Skip to content

Commit fb9a7e7

Browse files
committed
Revert "ran 2to3.py on everything"
This reverts commit f525ed9.
1 parent f525ed9 commit fb9a7e7

22 files changed

+324
-325
lines changed

src/epydoc/apidoc.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import types, re, os.path, pickle
4242
from epydoc import log
4343
import epydoc
44-
import builtins
44+
import __builtin__
4545
from epydoc.compat import * # Backwards compatibility
4646
from epydoc.util import decode_with_backslashreplace, py_src_filename
4747
import epydoc.markup.pyval_repr
@@ -111,7 +111,7 @@ def __init__(self, *pieces, **options):
111111
for piece in pieces:
112112
if isinstance(piece, DottedName):
113113
self._identifiers += piece._identifiers
114-
elif isinstance(piece, str):
114+
elif isinstance(piece, basestring):
115115
for subpiece in piece.split('.'):
116116
if piece not in self._ok_identifiers:
117117
if not self._IDENTIFIER_RE.match(subpiece):
@@ -129,7 +129,7 @@ def __init__(self, *pieces, **options):
129129
self._identifiers = tuple(self._identifiers)
130130

131131
def __repr__(self):
132-
idents = [repr(ident) for ident in self._identifiers]
132+
idents = [`ident` for ident in self._identifiers]
133133
return 'DottedName(' + ', '.join(idents) + ')'
134134

135135
def __str__(self):
@@ -147,7 +147,7 @@ def __add__(self, other):
147147
Return a new C{DottedName} whose identifier sequence is formed
148148
by adding C{other}'s identifier sequence to C{self}'s.
149149
"""
150-
if isinstance(other, (str, DottedName)):
150+
if isinstance(other, (basestring, DottedName)):
151151
return DottedName(self, other)
152152
else:
153153
return DottedName(self, *other)
@@ -157,7 +157,7 @@ def __radd__(self, other):
157157
Return a new C{DottedName} whose identifier sequence is formed
158158
by adding C{self}'s identifier sequence to C{other}'s.
159159
"""
160-
if isinstance(other, (str, DottedName)):
160+
if isinstance(other, (basestring, DottedName)):
161161
return DottedName(other, self)
162162
else:
163163
return DottedName(*(list(other)+[self]))
@@ -169,7 +169,7 @@ def __getitem__(self, i):
169169
identifiers selected by the slice. If C{i} is an empty slice,
170170
return an empty list (since empty C{DottedName}s are not valid).
171171
"""
172-
if isinstance(i, slice):
172+
if isinstance(i, types.SliceType):
173173
pieces = self._identifiers[i.start:i.stop]
174174
if pieces: return DottedName(pieces)
175175
else: return []
@@ -277,7 +277,7 @@ def __init__(self, name):
277277
self.name = name
278278
def __repr__(self):
279279
return '<%s>' % self.name
280-
def __bool__(self):
280+
def __nonzero__(self):
281281
raise ValueError('Sentinel value <%s> can not be used as a boolean' %
282282
self.name)
283283

@@ -974,17 +974,17 @@ def apidoc_links(self, **filters):
974974
imports = filters.get('imports', True)
975975
private = filters.get('private', True)
976976
if variables and imports and private:
977-
return list(self.variables.values()) # list the common case first.
977+
return self.variables.values() # list the common case first.
978978
elif not variables:
979979
return []
980980
elif not imports and not private:
981-
return [v for v in list(self.variables.values()) if
981+
return [v for v in self.variables.values() if
982982
v.is_imported != True and v.is_public != False]
983983
elif not private:
984-
return [v for v in list(self.variables.values()) if
984+
return [v for v in self.variables.values() if
985985
v.is_public != False]
986986
elif not imports:
987-
return [v for v in list(self.variables.values()) if
987+
return [v for v in self.variables.values() if
988988
v.is_imported != True]
989989
assert 0, 'this line should be unreachable'
990990

@@ -1008,7 +1008,7 @@ def init_sorted_variables(self):
10081008
elif '*' in ident:
10091009
regexp = re.compile('^%s$' % ident.replace('*', '(.*)'))
10101010
# sort within matching group?
1011-
for name, var_doc in list(unsorted.items()):
1011+
for name, var_doc in unsorted.items():
10121012
if regexp.match(name):
10131013
self.sorted_variables.append(unsorted.pop(name))
10141014
unused_idents.discard(ident)
@@ -1019,7 +1019,7 @@ def init_sorted_variables(self):
10191019

10201020

10211021
# Add any remaining variables in alphabetical order.
1022-
var_docs = list(unsorted.items())
1022+
var_docs = unsorted.items()
10231023
var_docs.sort()
10241024
for name, var_doc in var_docs:
10251025
self.sorted_variables.append(var_doc)
@@ -1096,7 +1096,7 @@ def report_unused_groups(self):
10961096
Issue a warning for any @group items that were not used by
10971097
L{_init_grouping()}.
10981098
"""
1099-
for (group, unused_idents) in list(self._unused_groups.items()):
1099+
for (group, unused_idents) in self._unused_groups.items():
11001100
for ident in unused_idents:
11011101
log.warning("@group %s: %s.%s not found" %
11021102
(group, self.canonical_name, ident))
@@ -1299,7 +1299,7 @@ def mro(self, warn_about_bad_bases=False):
12991299
if self.is_newstyle_class():
13001300
try:
13011301
return self._c3_mro(warn_about_bad_bases)
1302-
except ValueError as e: # (inconsistent hierarchy)
1302+
except ValueError, e: # (inconsistent hierarchy)
13031303
log.error('Error finding mro for %s: %s' %
13041304
(self.canonical_name, e))
13051305
# Better than nothing:
@@ -1331,7 +1331,7 @@ def _c3_mro(self, warn_about_bad_bases):
13311331
base.proxy_for is not None):
13321332
self._report_bad_base(base)
13331333
w = [warn_about_bad_bases]*len(bases)
1334-
return self._c3_merge([[self]] + list(map(ClassDoc._c3_mro, bases, w)) +
1334+
return self._c3_merge([[self]] + map(ClassDoc._c3_mro, bases, w) +
13351335
[list(bases)])
13361336

13371337
def _report_bad_base(self, base):
@@ -1879,7 +1879,7 @@ def find(self, name, context, not_found_exception=False):
18791879
if the name is not found anywhere (including builtins,
18801880
function parameters, etc.)
18811881
"""
1882-
if isinstance(name, str):
1882+
if isinstance(name, basestring):
18831883
name = re.sub(r'\(.*\)$', '', name.strip())
18841884
if re.match('^([a-zA-Z_]\w*)(\.[a-zA-Z_]\w*)*$', name):
18851885
name = DottedName(name)
@@ -1959,7 +1959,7 @@ def _get_module_classes(self, docs):
19591959
if not isinstance(doc, ModuleDoc):
19601960
continue
19611961

1962-
for var in list(doc.variables.values()):
1962+
for var in doc.variables.values():
19631963
if not isinstance(var.value, ClassDoc):
19641964
continue
19651965

@@ -2043,7 +2043,7 @@ def read_profiling_info(self, profile_stats):
20432043
# from these `funcid`s to `RoutineDoc`s.
20442044
self._update_funcid_to_doc(profile_stats)
20452045

2046-
for callee, (cc, nc, tt, ct, callers) in list(profile_stats.stats.items()):
2046+
for callee, (cc, nc, tt, ct, callers) in profile_stats.stats.items():
20472047
callee = self._funcid_to_doc.get(callee)
20482048
if callee is None: continue
20492049
for caller in callers:
@@ -2123,15 +2123,15 @@ def pp_apidoc(api_doc, doublespace=0, depth=5, exclude=(), include=(),
21232123
s = '%s [%s]' % (name, backpointers[pyid])
21242124

21252125
# Only print non-empty fields:
2126-
fields = [field for field in list(api_doc.__dict__.keys())
2126+
fields = [field for field in api_doc.__dict__.keys()
21272127
if (field in include or
21282128
(getattr(api_doc, field) is not UNKNOWN
21292129
and field not in exclude))]
21302130
if include:
21312131
fields = [field for field in dir(api_doc)
21322132
if field in include]
21332133
else:
2134-
fields = [field for field in list(api_doc.__dict__.keys())
2134+
fields = [field for field in api_doc.__dict__.keys()
21352135
if (getattr(api_doc, field) is not UNKNOWN
21362136
and field not in exclude)]
21372137
fields.sort()
@@ -2141,15 +2141,15 @@ def pp_apidoc(api_doc, doublespace=0, depth=5, exclude=(), include=(),
21412141
if doublespace: s += '\n |'
21422142
s += '\n +- %s' % field
21432143

2144-
if (isinstance(fieldval, list) and
2144+
if (isinstance(fieldval, types.ListType) and
21452145
len(fieldval)>0 and
21462146
isinstance(fieldval[0], APIDoc)):
21472147
s += _pp_list(api_doc, fieldval, doublespace, depth,
21482148
exclude, include, backpointers,
21492149
(field is fields[-1]))
2150-
elif (isinstance(fieldval, dict) and
2150+
elif (isinstance(fieldval, types.DictType) and
21512151
len(fieldval)>0 and
2152-
isinstance(list(fieldval.values())[0], APIDoc)):
2152+
isinstance(fieldval.values()[0], APIDoc)):
21532153
s += _pp_dict(api_doc, fieldval, doublespace,
21542154
depth, exclude, include, backpointers,
21552155
(field is fields[-1]))
@@ -2179,7 +2179,7 @@ def _pp_list(api_doc, items, doublespace, depth, exclude, include,
21792179

21802180
def _pp_dict(api_doc, dict, doublespace, depth, exclude, include,
21812181
backpointers, is_last):
2182-
items = list(dict.items())
2182+
items = dict.items()
21832183
items.sort()
21842184
line1 = (is_last and ' ') or '|'
21852185
s = ''
@@ -2210,7 +2210,7 @@ def _pp_val(api_doc, val, doublespace, depth, exclude, include, backpointers):
22102210
return pp_apidoc(val, doublespace, depth-1, exclude,
22112211
include, backpointers)
22122212
elif isinstance(val, markup.ParsedDocstring):
2213-
valrepr = repr(val.to_plaintext(None))
2213+
valrepr = `val.to_plaintext(None)`
22142214
if len(valrepr) < 40: return valrepr
22152215
else: return valrepr[:37]+'...'
22162216
else:

0 commit comments

Comments
 (0)