Skip to content

Commit ff0dbe0

Browse files
committed
Merged in source:personal/henrik/r7446-pyflakes@7463, which adds pyflakes tests to the test suite, and makes the code pyflakes-clean.
- Legacy-Id: 7521
2 parents 6f4a5bd + 5955902 commit ff0dbe0

291 files changed

Lines changed: 1053 additions & 307704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1+
ietfdb (5.2.0) ietf; urgency=low
2+
3+
This is a code cleanup release. It adds a test and a managemement command
4+
to run pyflakes (pyflakes is a bit like 'lint' for Python) over the
5+
datatracker code, and cleans up the code so that it tests clean. The number
6+
of lines changed is large, but the changes to what the code actually does is
7+
limited to fixing bugs discovered by pyflakes during the cleanup. There
8+
were around 10 such cases.
9+
10+
Most of the changes are related to import statements, as the code otherwise
11+
was pretty clean already. In almost all places, bulk imports using '*' has been
12+
replaced by explicit imports, for these reasons:
13+
14+
* It makes it clear from where an imported name has come, so that a
15+
human reader can look for an identifier in the import statements, and
16+
see from where it comes, and where he should go to inspect the related
17+
code.
18+
19+
* It makes it clear to the interpreter exactly which symbol is intended,
20+
in cases where the same symbol is defined in multiple modules imported
21+
using '*' import. This is not a common case, but it actually turned up
22+
a couple of times during the cleanup. If the '*' imports in question
23+
hadn't been turned into explicit imports, only the (somewhat arbitrary)
24+
order of the import statements would have determine which instance of a
25+
function or class would actually be visible to the following code. This
26+
situation can make the code do something different from what was intended,
27+
in a quite devious way.
28+
29+
* It avoids unintended import of generically named variables from other
30+
modules. Altough having such variables as module globals is a bad
31+
practice, it happens, and sometimes unintentionally importing them
32+
through a '*' import will make it appear to the interpreter that a
33+
statement intended to use an (by mistake undefined) identically named
34+
local variable is in fact a valid statement which uses the imported
35+
symbol instead. Without the '*' import, the situation would be
36+
correctly flagged by the interpreter.
37+
38+
* Finally, importing all symbols explicitly makes it possible for pyflakes
39+
to do a better job in identifying unused and undefined symbols -- in the
40+
presence of '*' imports, this capability becomes much more limited.
41+
Several cases of bad code (use of undefined variables) was discovered
42+
during the cleanup only after the '*' imports were replaced by explicit
43+
imports.
44+
45+
In many places, the import statements have been reordered to consistently
46+
list the generic python library imports first, followed by django imports,
47+
then local module imports (these typically live on the same level as ietf/
48+
and django/), finally followed by datatracker-specific imports. Some people
49+
find that this kind of consistency in importing, both in keeping a consistent
50+
order, and in importing in a sequence from the more general down to the more
51+
specific, aids in the readability of the code.
52+
53+
-- Henrik Levkowetz <henrik@levkowetz.com> 16 Mar 2014 20:52:05 +0100
54+
55+
156
ietfdb (5.1.1) ietf; urgency=medium
257

358
This is a minor bugfix release, in preparation for merging the pyflakes test
@@ -20,6 +75,7 @@ ietfdb (5.1.1) ietf; urgency=medium
2075

2176
-- Henrik Levkowetz <henrik@levkowetz.com> 18 Mar 2014 22:49:58 +0100
2277

78+
2379
ietfdb (5.1.0) ietf; urgency=high
2480

2581
This release contains the datatracker bugfixes and enhancements from the

ietf/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8-no-bom -*-
21
# Copyright The IETF Trust 2007, All Rights Reserved
32

43
__version__ = "5.1.2-dev"

ietf/community/display.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import datetime
22

3-
from django.db.models import Q
43
from django.core.urlresolvers import reverse as urlreverse
54

6-
from ietf.doc.models import DocAlias, DocEvent
5+
from ietf.doc.models import DocAlias
76

87

98
class DisplayField(object):

ietf/community/management/commands/update_doc_change_dates.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22

33
from django.core.management.base import BaseCommand
4-
from django.db.models import Q
54

65
from ietf.community.constants import SIGNIFICANT_STATES
76
from ietf.community.models import DocumentChangeDates

ietf/community/migrations/0001_initial_migration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
from south.db import db
33
from django.db import models
4-
from ietf.community.models import *
4+
#from ietf.community.models import *
55

66
class Migration:
77

ietf/community/migrations/0002_add_display_config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
21
from south.db import db
3-
from django.db import models
4-
from ietf.community.models import *
52

63
class Migration:
74

ietf/community/migrations/0003_add_notifications.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
21
from south.db import db
3-
from django.db import models
4-
from ietf.community.models import *
52

63
class Migration:
74

ietf/community/migrations/0004_refactor_notifications_with_docevent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
21
from south.db import db
3-
from django.db import models
4-
from ietf.community.models import *
52

63
class Migration:
74

ietf/community/migrations/0005_auto__add_field_communitylist_secret.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
21
from south.db import db
3-
from django.db import models
4-
from ietf.community.models import *
52

63
class Migration:
74

ietf/community/migrations/0006_auto__add_field_communitylist_cached.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
21
from south.db import db
3-
from django.db import models
4-
from ietf.community.models import *
52

63
class Migration:
74

0 commit comments

Comments
 (0)