Skip to content

Commit 49edc74

Browse files
committed
Made ietf/utils pyflakes-clean.
- Legacy-Id: 7496
1 parent 02031a0 commit 49edc74

4 files changed

Lines changed: 25 additions & 29 deletions

File tree

ietf/utils/draft.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,12 @@ def _stripheaders(self):
191191
pages = []
192192
page = []
193193
line = ""
194-
debug = False
195194
newpage = False
196195
sentence = False
197196
blankcount = 0
198197
linecount = 0
199198
# two functions with side effects
200199
def striplines(p):
201-
r = []
202200
beg = end = 0
203201
for i in range(len(p)):
204202
l = p[i]
@@ -522,7 +520,6 @@ def dotexp(s):
522520

523521
authors = []
524522
companies = []
525-
author_info = []
526523
companies_seen = []
527524
self._docheader = ""
528525

@@ -533,7 +530,7 @@ def dotexp(s):
533530
for line in self.lines[:30]:
534531
self._docheader += line+"\n"
535532
author_on_line = False
536-
company_on_line = False
533+
537534
_debug( "**" + line)
538535
leading_space = len(re.findall("^ *", line)[0])
539536
line_len = len(line.rstrip())
@@ -609,7 +606,6 @@ def dotexp(s):
609606
company = match.group(1)
610607
authors += [ "" ]
611608
companies += [ company ]
612-
company_on_line = True
613609
#_debug("\nLine: " + line)
614610
#_debug("Format: " + authformat)
615611
_debug("Company: '%s'" % company)
@@ -772,7 +768,7 @@ def dotexp(s):
772768
authors[i] = (fullname, first, middle, surname, suffix)
773769
companies[i] = None
774770
break
775-
except AssertionError, e:
771+
except AssertionError:
776772
sys.stderr.write("filename: "+self.filename+"\n")
777773
sys.stderr.write("authpat: "+authpat+"\n")
778774
raise
@@ -788,9 +784,7 @@ def dotexp(s):
788784
_debug("2: authors[%s]: %s" % (i, authors[i]))
789785
if start and col != None:
790786
_debug("\n * %s" % (authors[i], ))
791-
done = False
792787
nonblank_count = 0
793-
keyword = False
794788
blanklines = 0
795789
email = None
796790
for line in self.lines[start+1:]:
@@ -1101,6 +1095,7 @@ def getmeta(fn):
11011095

11021096
# ----------------------------------------------------------------------
11031097
def _output(docname, fields, outfile=sys.stdout):
1098+
global company_domain
11041099
if opt_getauthors:
11051100
# Output an (incomplete!) getauthors-compatible format. Country
11061101
# information is always UNKNOWN, and information about security and
@@ -1165,6 +1160,7 @@ def _printmeta(fn, outfile=sys.stdout):
11651160
# Main
11661161
# ----------------------------------------------------------------------
11671162

1163+
company_domain = {}
11681164
def _main(outfile=sys.stdout):
11691165
global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, opt_getauthors, files, company_domain, opt_attributes
11701166
# set default values, if any
@@ -1234,6 +1230,7 @@ def _main(outfile=sys.stdout):
12341230
if file == "-":
12351231
file = sys.stdin
12361232
elif file.endswith(".gz"):
1233+
import gzip
12371234
file = gzip.open(file)
12381235
else:
12391236
file = open(file)

ietf/utils/mail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def smtp_error_logging(thing):
325325
""") % e.original_msg.as_string()
326326
try:
327327
send_mail_preformatted(request=None, preformatted=msg)
328-
except smtplib.SMTPException as ticket_mail_error:
328+
except smtplib.SMTPException:
329329
log("Exception encountered while sending a ticket to the secretariat")
330330
(extype,value) = sys.exc_info()[:2]
331331
log("SMTP Exception: %s : %s" % (extype,value))

ietf/utils/test_data.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
import datetime
2+
13
from django.conf import settings
24
from django.contrib.auth.models import User
35

4-
from ietf.iesg.models import TelechatDate
6+
import debug # pyflakes:ignore
7+
8+
from ietf.doc.models import Document, DocAlias, State, DocumentAuthor, BallotType, DocEvent, BallotDocEvent
9+
from ietf.group.models import Group, GroupHistory, Role, RoleHistory
510
from ietf.ipr.models import IprDetail, IprDocAlias
611
from ietf.meeting.models import Meeting
7-
from ietf.doc.models import *
8-
from ietf.doc.utils import *
9-
from ietf.name.models import *
10-
from ietf.group.models import *
11-
from ietf.person.models import *
12-
13-
import debug # pyflakes:ignore
12+
from ietf.name.models import StreamName
13+
from ietf.person.models import Person, Alias, Email
1414

1515
def create_person(group, role_name, name=None, username=None, email_address=None):
1616
"""Add person/user/email and role."""
@@ -36,12 +36,12 @@ def make_immutable_base_data():
3636
all tests in a run."""
3737

3838
# telechat dates
39-
t = datetime.date.today()
40-
old = TelechatDate.objects.create(date=t - datetime.timedelta(days=14)).date
41-
date1 = TelechatDate.objects.create(date=t).date
42-
date2 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14)).date
43-
date3 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 2)).date
44-
date4 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 3)).date
39+
#t = datetime.date.today()
40+
#old = TelechatDate.objects.create(date=t - datetime.timedelta(days=14)).date
41+
#date1 = TelechatDate.objects.create(date=t).date
42+
#date2 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14)).date
43+
#date3 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 2)).date
44+
#date4 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 3)).date
4545

4646
# system
4747
system_person = Person.objects.create(name="(System)", ascii="(System)", address="")
@@ -77,9 +77,9 @@ def make_immutable_base_data():
7777
rfc_editor = create_group(name="RFC Editor", acronym="rfceditor", type_id="rfcedtyp")
7878
create_person(rfc_editor, "auth", name="Rfc Editor", username="rfc", email_address="rfc@edit.or")
7979

80-
iesg = create_group(name="Internet Engineering Steering Group", acronym="iesg", type_id="ietf", parent=ietf)
80+
iesg = create_group(name="Internet Engineering Steering Group", acronym="iesg", type_id="ietf", parent=ietf) # pyflakes:ignore
8181

82-
individ = create_group(name="Individual submissions", acronym="none", type_id="individ")
82+
individ = create_group(name="Individual submissions", acronym="none", type_id="individ") # pyflakes:ignore
8383

8484
# one area
8585
area = create_group(name="Far Future", acronym="farfut", type_id="area", parent=ietf)
@@ -165,7 +165,7 @@ def make_test_data():
165165
# plain IETF'er
166166
u = User.objects.create(username="plain")
167167
plainman = Person.objects.create(name="Plain Man", ascii="Plain Man", user=u)
168-
email = Email.objects.create(address="plain@example.com", person=plainman)
168+
email = Email.objects.create(address="plain@example.com", person=plainman) # pyflakes:ignore
169169

170170
# group personnel
171171
create_person(mars_wg, "chair", name="WG Chair Man", username="marschairman")
@@ -294,7 +294,7 @@ def rfc_for_status_change_test_factory(name,rfc_num,std_level_id):
294294
target_rfc.set_state(State.objects.get(slug='rfc',type__slug='draft'))
295295
target_rfc.save()
296296
docalias = DocAlias.objects.create(name=name,document=target_rfc)
297-
docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc)
297+
docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc) # pyflakes:ignore
298298
return target_rfc
299299
rfc_for_status_change_test_factory('draft-ietf-random-thing',9999,'ps')
300300
rfc_for_status_change_test_factory('draft-ietf-random-otherthing',9998,'inf')

ietf/utils/test_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@
4040
from difflib import unified_diff
4141

4242
import django.test
43-
from django.db import connection, connections, transaction, DEFAULT_DB_ALIAS
43+
from django.db import connection, connections, DEFAULT_DB_ALIAS
4444
from django.test.testcases import connections_support_transactions
45-
from django.test.testcases import disable_transaction_methods
4645
from django.test.client import Client
4746
from django.conf import settings
4847
from django.core.management import call_command

0 commit comments

Comments
 (0)