Author: mthuurne Reviewer: adiroiban Fixes: ticket:10080
Fix or work around stricter pydoctor warnings about all and doc
10 | 10 | from twisted.internet import testing |
|
11 | 11 | ||
12 | 12 | ||
13 | - | __all__ = testing.__all__ |
|
13 | + | __all__ = [ |
|
14 | + | "AccumulatingProtocol", |
|
15 | + | "LineSendingProtocol", |
|
16 | + | "FakeDatagramTransport", |
|
17 | + | "StringTransport", |
|
18 | + | "StringTransportWithDisconnection", |
|
19 | + | "StringIOWithoutClosing", |
|
20 | + | "_FakeConnector", |
|
21 | + | "_FakePort", |
|
22 | + | "MemoryReactor", |
|
23 | + | "MemoryReactorClock", |
|
24 | + | "RaisingMemoryReactor", |
|
25 | + | "NonStreamingProducer", |
|
26 | + | "waitUntilAllDisconnected", |
|
27 | + | "EventLoggingObserver", |
|
28 | + | ] |
|
14 | 29 | ||
15 | 30 | ||
16 | 31 | AccumulatingProtocol = testing.AccumulatingProtocol |
37 | 37 | openFile = open |
|
38 | 38 | ||
39 | 39 | ||
40 | + | def _update_doc(opt: Callable[["TwistOptions", str], None], **kwargs: str) -> None: |
|
41 | + | """ |
|
42 | + | Update the docstring of a method that implements an option. |
|
43 | + | The string is dedented and the given keyword arguments are substituted. |
|
44 | + | """ |
|
45 | + | opt.__doc__ = dedent(opt.__doc__ or "").format(**kwargs) |
|
46 | + | ||
47 | + | ||
40 | 48 | class TwistOptions(Options): |
|
41 | 49 | """ |
|
42 | 50 | Command line options for C{twist}. |
76 | 84 | else: |
|
77 | 85 | self["reactorName"] = name |
|
78 | 86 | ||
79 | - | opt_reactor.__doc__ = dedent(opt_reactor.__doc__ or "").format( |
|
87 | + | _update_doc( |
|
88 | + | opt_reactor, |
|
80 | 89 | options=", ".join('"{}"'.format(rt.shortName) for rt in getReactorTypes()), |
|
81 | 90 | ) |
|
82 | 91 |
101 | 110 | except InvalidLogLevelError: |
|
102 | 111 | raise UsageError("Invalid log level: {}".format(levelName)) |
|
103 | 112 | ||
104 | - | opt_log_level.__doc__ = dedent(opt_log_level.__doc__ or "").format( |
|
113 | + | _update_doc( |
|
114 | + | opt_log_level, |
|
105 | 115 | options=", ".join( |
|
106 | 116 | '"{}"'.format(constant.name) for constant in LogLevel.iterconstants() |
|
107 | 117 | ), |
144 | 154 | raise UsageError("Invalid log format: {}".format(format)) |
|
145 | 155 | self["logFormat"] = format |
|
146 | 156 | ||
147 | - | opt_log_format.__doc__ = dedent(opt_log_format.__doc__ or "") |
|
157 | + | _update_doc(opt_log_format) |
|
148 | 158 | ||
149 | 159 | def selectDefaultLogObserver(self) -> None: |
|
150 | 160 | """ |
Files | Coverage |
---|---|
src/twisted | 88.17% |
Project Totals (829 files) | 88.17% |
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push
TOXENV=alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push