Skip to content

Commit d79c9c6

Browse files
authored
Adjust string literals to pep8 standard. (#896)
1 parent 39421da commit d79c9c6

File tree

139 files changed

+2129
-2113
lines changed

Some content is hidden

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

139 files changed

+2129
-2113
lines changed

doc/api/doxygen/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def which(program):
3131
return None
3232

3333

34-
if which('doxygen') is not None:
34+
if which("doxygen") is not None:
3535
print("Building Doxygen API Documentation")
3636
os.system("doxygen .doxygen") # nosec
37-
if os.path.exists('../../../build'):
37+
if os.path.exists("../../../build"):
3838
shutil.move("html", "../../../build/doxygen")
3939
else:
4040
print("Doxygen not available...not building")

doc/api/epydoc/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
print("Building Epydoc API Documentation")
3333
cli()
3434

35-
if os.path.exists('../../../build'):
35+
if os.path.exists("../../../build"):
3636
shutil.move("html", "../../../build/epydoc")
3737
except Exception: # pylint: disable=broad-except
3838
traceback.print_exc(file=sys.stdout)

doc/api/pydoc/build.py

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ def classify_class_attrs(cls):
2626
0. The name (a string).
2727
2828
1. The kind of attribute this is, one of these strings:
29-
'class method' created via classmethod()
30-
'static method' created via staticmethod()
31-
'property' created via property()
32-
'method' any other flavor of method
33-
'data' not a method
29+
"class method" created via classmethod()
30+
"static method" created via staticmethod()
31+
"property" created via property()
32+
"method" any other flavor of method
33+
"data" not a method
3434
3535
2. The class which defined this attribute (a class).
3636
37-
3. The object as obtained directly from the defining class's
37+
3. The object as obtained directly from the defining class"s
3838
__dict__, not via getattr. This is especially important for
3939
data attributes: C.data is just a data object, but
40-
C.__dict__['data'] may be a data descriptor with additional
40+
C.__dict__["data"] may be a data descriptor with additional
4141
info, like a __doc__ string.
4242
4343
Note: This version is patched to work with Zope Interface-bearing objects
@@ -101,72 +101,72 @@ class DefaultFormatter(pydoc.HTMLDoc):
101101
def docmodule(self, object, name=None, mod=None, packageContext=None, *ignored): # noqa: C901
102102
"""Produce HTML documentation for a module object."""
103103
my_name = object.__name__ # ignore the passed-in name
104-
parts = split(my_name, '.')
104+
parts = split(my_name, ".")
105105
links = []
106106
for i in range(len(parts) - 1):
107107
links.append(
108-
'<a href="%s.html"><font color="#ffffff">%s</font></a>' %
109-
(join(parts[:i + 1], '.'), parts[i]))
110-
linkedname = join(links + parts[-1:], '.')
111-
head = '<big><big><strong>%s</strong></big></big>' % linkedname
108+
"<a href=\"%s.html\"><font color=\"#ffffff\">%s</font></a>" %
109+
(join(parts[:i + 1], "."), parts[i]))
110+
linkedname = join(links + parts[-1:], ".")
111+
head = "<big><big><strong>%s</strong></big></big>" % linkedname
112112
try:
113113
path = inspect.getabsfile(object)
114114
url = path
115-
if sys.platform == 'win32':
115+
if sys.platform == "win32":
116116
import nturl2path
117117
url = nturl2path.pathname2url(path)
118-
filelink = '<a href="file:%s">%s</a>' % (url, path)
118+
filelink = "<a href=\"file:%s\">%s</a>" % (url, path)
119119
except TypeError:
120-
filelink = '(built-in)'
120+
filelink = "(built-in)"
121121
info = []
122-
if hasattr(object, '__version__'):
122+
if hasattr(object, "__version__"):
123123
version = str(object.__version__)
124-
if version[:11] == '$' + 'Revision: ' and version[-1:] == '$':
124+
if version[:11] == "$" + "Revision: " and version[-1:] == "$":
125125
version = strip(version[11:-1])
126-
info.append('version %s' % self.escape(version))
127-
if hasattr(object, '__date__'):
126+
info.append("version %s" % self.escape(version))
127+
if hasattr(object, "__date__"):
128128
info.append(self.escape(str(object.__date__)))
129129
if info:
130-
head = head + ' (%s)' % join(info, ', ')
130+
head = head + " (%s)" % join(info, ", ")
131131
result = self.heading(
132-
head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
132+
head, "#ffffff", "#7799ee", "<a href=\".\">index</a><br>" + filelink)
133133

134134
modules = inspect.getmembers(object, inspect.ismodule)
135135

136136
classes, cdict = [], {}
137137
for key, value in inspect.getmembers(object, inspect.isclass):
138138
if (inspect.getmodule(value) or object) is object:
139139
classes.append((key, value))
140-
cdict[key] = cdict[value] = '#' + key
140+
cdict[key] = cdict[value] = "#" + key
141141
for key, value in classes:
142142
for base in value.__bases__:
143143
key, modname = base.__name__, base.__module__
144144
module = sys.modules.get(modname)
145145
if modname != my_name and module and hasattr(module, key):
146146
if getattr(module, key) is base:
147147
if key not in cdict:
148-
cdict[key] = cdict[base] = modname + '.html#' + key
148+
cdict[key] = cdict[base] = modname + ".html#" + key
149149
funcs, fdict = [], {}
150150
for key, value in inspect.getmembers(object, inspect.isroutine):
151151
if inspect.isbuiltin(value) or inspect.getmodule(value) is object:
152152
funcs.append((key, value))
153-
fdict[key] = '#-' + key
153+
fdict[key] = "#-" + key
154154
if inspect.isfunction(value):
155155
fdict[value] = fdict[key]
156156
data = []
157157
for key, value in inspect.getmembers(object, pydoc.isdata):
158-
if key not in ['__builtins__', '__doc__']:
158+
if key not in ["__builtins__", "__doc__"]:
159159
data.append((key, value))
160160

161161
doc = self.markup(pydoc.getdoc(object), self.preformat, fdict, cdict)
162-
doc = doc and '<tt>%s</tt>' % doc
163-
result = result + '<p>%s</p>\n' % doc
162+
doc = doc and "<tt>%s</tt>" % doc
163+
result = result + "<p>%s</p>\n" % doc
164164

165165
packageContext.clean(classes, object)
166166
packageContext.clean(funcs, object)
167167
packageContext.clean(data, object)
168168

169-
if hasattr(object, '__path__'):
169+
if hasattr(object, "__path__"):
170170
modpkgs = []
171171
modnames = []
172172
for file in os.listdir(object.__path__[0]):
@@ -180,13 +180,13 @@ def docmodule(self, object, name=None, mod=None, packageContext=None, *ignored):
180180
modpkgs.sort()
181181
contents = self.multicolumn(modpkgs, self.modpkglink)
182182
# # result = result + self.bigsection(
183-
# # 'Package Contents', '#ffffff', '#aa55cc', contents)
183+
# # "Package Contents", "#ffffff", "#aa55cc", contents)
184184
result = result + self.moduleSection(object, packageContext)
185185
elif modules:
186186
# FIX contents = self.multicolumn(
187187
# FIX modules, lambda (key, value), s=self: s.modulelink(value))
188188
result = result + self.bigsection(
189-
'Modules', '#fffff', '#aa55cc', contents)
189+
"Modules", "#fffff", "#aa55cc", contents)
190190

191191
if classes:
192192
# FIX classlist = map(lambda (key, value): value, classes)
@@ -195,13 +195,13 @@ def docmodule(self, object, name=None, mod=None, packageContext=None, *ignored):
195195
for key, value in classes:
196196
contents.append(self.document(value, key, my_name, fdict, cdict))
197197
result = result + self.bigsection(
198-
'Classes', '#ffffff', '#ee77aa', join(contents))
198+
"Classes", "#ffffff", "#ee77aa", join(contents))
199199
if funcs:
200200
contents = []
201201
for key, value in funcs:
202202
contents.append(self.document(value, key, my_name, fdict, cdict))
203203
result = result + self.bigsection(
204-
'Functions', '#ffffff', '#eeaa77', join(contents))
204+
"Functions", "#ffffff", "#eeaa77", join(contents))
205205
if data:
206206
contents = []
207207
for key, value in data:
@@ -210,23 +210,23 @@ def docmodule(self, object, name=None, mod=None, packageContext=None, *ignored):
210210
except Exception: # nosec
211211
pass
212212
result = result + self.bigsection(
213-
'Data', '#ffffff', '#55aa55', join(contents, '<br>\n'))
214-
if hasattr(object, '__author__'):
213+
"Data", "#ffffff", "#55aa55", join(contents, "<br>\n"))
214+
if hasattr(object, "__author__"):
215215
contents = self.markup(str(object.__author__), self.preformat)
216216
result = result + self.bigsection(
217-
'Author', '#ffffff', '#7799ee', contents)
218-
if hasattr(object, '__credits__'):
217+
"Author", "#ffffff", "#7799ee", contents)
218+
if hasattr(object, "__credits__"):
219219
contents = self.markup(str(object.__credits__), self.preformat)
220220
result = result + self.bigsection(
221-
'Credits', '#ffffff', '#7799ee', contents)
221+
"Credits", "#ffffff", "#7799ee", contents)
222222

223223
return result
224224

225225
def classlink(self, object, modname):
226226
"""Make a link for a class."""
227227
name, module = object.__name__, sys.modules.get(object.__module__)
228228
if hasattr(module, name) and getattr(module, name) is object:
229-
return '<a href="%s.html#%s">%s</a>' % (
229+
return "<a href=\"%s.html#%s\">%s</a>" % (
230230
module.__name__, name, name
231231
)
232232
return pydoc.classname(object, modname)
@@ -237,7 +237,7 @@ def moduleSection(self, object, packageContext):
237237
packageContext.clean(modules, object)
238238
packageContext.recurseScan(modules)
239239

240-
if hasattr(object, '__path__'):
240+
if hasattr(object, "__path__"):
241241
modpkgs = []
242242
modnames = []
243243
for file in os.listdir(object.__path__[0]):
@@ -251,7 +251,7 @@ def moduleSection(self, object, packageContext):
251251
modpkgs.sort()
252252
# do more recursion here...
253253
for (modname, name, ya, yo) in modpkgs:
254-
packageContext.addInteresting(join((object.__name__, modname), '.'))
254+
packageContext.addInteresting(join((object.__name__, modname), "."))
255255
items = []
256256
for (modname, name, ispackage, isshadowed) in modpkgs:
257257
try:
@@ -268,12 +268,12 @@ def moduleSection(self, object, packageContext):
268268
items.append(
269269
self.modpkglink((modname, name, ispackage, isshadowed))
270270
)
271-
contents = string.join(items, '<br>')
271+
contents = string.join(items, "<br>")
272272
result = self.bigsection(
273-
'Package Contents', '#ffffff', '#aa55cc', contents)
273+
"Package Contents", "#ffffff", "#aa55cc", contents)
274274
elif modules:
275275
result = self.bigsection(
276-
'Modules', '#fffff', '#aa55cc', contents)
276+
"Modules", "#fffff", "#aa55cc", contents)
277277
else:
278278
result = ""
279279
return result
@@ -288,7 +288,7 @@ class AlreadyDone(Exception):
288288
class PackageDocumentationGenerator:
289289
"""A package document generator creates documentation.
290290
291-
for an entire package using pydoc's machinery.
291+
for an entire package using pydoc"s machinery.
292292
293293
baseModules -- modules which will be included
294294
and whose included and children modules will be
@@ -419,7 +419,7 @@ def process(self):
419419
self.destinationDirectory,
420420
self.pending[0] + ".html",
421421
),
422-
'w',
422+
"w",
423423
)
424424
file.write(page)
425425
file.close()
@@ -441,7 +441,7 @@ def clean(self, objectList, object):
441441
if hasattr(excludeObject, key) and excludeObject is not object:
442442
if (
443443
getattr(excludeObject, key) is value or # noqa: W504
444-
(hasattr(excludeObject, '__name__') and # noqa: W504
444+
(hasattr(excludeObject, "__name__") and # noqa: W504
445445
excludeObject.__name__ == "Numeric"
446446
)
447447
):
@@ -466,11 +466,11 @@ def recurseScan(self, objectList):
466466

467467
print("Building Pydoc API Documentation")
468468
PackageDocumentationGenerator(
469-
baseModules=['pymodbus', '__builtin__'],
469+
baseModules=["pymodbus", "__builtin__"],
470470
destinationDirectory="./html/",
471-
exclusions=['math', 'string', 'twisted'],
471+
exclusions=["math", "string", "twisted"],
472472
recursionStops=[],
473473
).process()
474474

475-
if os.path.exists('../../../build'):
475+
if os.path.exists("../../../build"):
476476
shutil.move("html", "../../../build/pydoc")

doc/api/pydoctor/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
print("Building Pydoctor API Documentation")
2323
main(sys.argv[1:])
2424

25-
if os.path.exists('../../../build'):
25+
if os.path.exists("../../../build"):
2626
shutil.move("html", "../../../build/pydoctor")
2727
except: # noqa: E722 NOSONAR pylint: disable=bare-except
2828
print("Pydoctor unavailable...not building")

0 commit comments

Comments
 (0)