Skip to content

Commit b199a29

Browse files
authored
Many PEPs: Resolve reference warnings (#3214)
This commit resolves all outstanding duplicate label and duplicate citation warnings. I have not yet addressed unreferenced footnote warnings. I took the general strategy of replacing a target above a section heading with references directly to that section heading, or where impractical, disambiguting the target with ``PEP NNN``. I also converted all the citations in PEP 482 to links, as they were causing duplicate citation warnings.
1 parent 16e35f5 commit b199a29

29 files changed

+155
-386
lines changed

pep-0394.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ administrators with the freedom to configure their systems based on
183183
the needs of their particular environment.
184184

185185

186-
.. _rationale:
187-
188186
Current Rationale
189187
=================
190188

pep-0400.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ StreamReader and StreamWriter issues
8484
supports UNIX newlines ('\\n').
8585
* StreamReader and StreamWriter are stateful codecs but don't expose
8686
functions to control their state (getstate() or setstate()). Each
87-
codec has to handle corner cases, see `Appendix A`_.
87+
codec has to handle corner cases, see `Appendix A <PEP 400 Appendix A_>`_.
8888
* StreamReader and StreamWriter are very similar to IncrementalReader
8989
and IncrementalEncoder, some code is duplicated for stateful codecs
9090
(e.g. UTF-16).
@@ -207,7 +207,7 @@ Python 3.3. Defining a subclass doesn't emit a DeprecationWarning.
207207
codecs.open() will be changed to reuse the builtin open() function
208208
(TextIOWrapper) to read-write text files.
209209

210-
.. _Appendix A:
210+
.. _PEP 400 Appendix A:
211211

212212
Alternative Approach
213213
====================

pep-0482.txt

Lines changed: 31 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -26,48 +26,61 @@ Existing Approaches for Python
2626
mypy
2727
----
2828

29-
(This section is a stub, since mypy [mypy]_ is essentially what we're
29+
(This section is a stub, since `mypy`__ is essentially what we're
3030
proposing.)
3131

32+
__ https://mypy-lang.org
33+
3234

3335
Reticulated Python
3436
------------------
3537

36-
Reticulated Python [reticulated]_ by Michael Vitousek is an example of
38+
`Reticulated Python`__ by Michael Vitousek is an example of
3739
a slightly different approach to gradual typing for Python. It is
38-
described in an actual academic paper [reticulated-paper]_ written by
40+
described in an actual `academic paper`__ written by
3941
Vitousek with Jeremy Siek and Jim Baker (the latter of Jython fame).
4042

43+
__ https://github.com/mvitousek/reticulated
44+
__ http://wphomes.soic.indiana.edu/jsiek/files/2014/03/retic-python.pdf
4145

4246
PyCharm
4347
-------
4448

4549
PyCharm by JetBrains has been providing a way to specify and check
46-
types for about four years. The type system suggested by PyCharm
47-
[pycharm]_ grew from simple class types to tuple types, generic types,
50+
types for about four years. The type system suggested by PyCharm__
51+
grew from simple class types to tuple types, generic types,
4852
function types, etc. based on feedback of many users who shared their
4953
experience of using type hints in their code.
5054

55+
__ https://github.com/JetBrains/python-skeletons#types
5156

5257
Others
5358
------
5459

55-
TBD: Add sections on pyflakes [pyflakes]_, pylint [pylint]_, numpy
56-
[numpy]_, Argument Clinic [argumentclinic]_, pytypedecl [pytypedecl]_,
57-
numba [numba]_, obiwan [obiwan]_.
60+
TBD: Add sections on pyflakes__, pylint__, numpy__,
61+
`Argument Clinic`__, pytypedecl__, numba__, obiwan__.
5862

63+
__ https://github.com/pyflakes/pyflakes/
64+
__ https://www.pylint.org
65+
__ https://www.numpy.org
66+
__ https://docs.python.org/3/howto/clinic.html
67+
__ https://github.com/google/pytypedecl
68+
__ https://numba.pydata.org
69+
__ https://pypi.org/project/obiwan
5970

6071
Existing Approaches in Other Languages
6172
======================================
6273

6374
ActionScript
6475
------------
6576

66-
ActionScript [actionscript]_ is a class-based, single inheritance,
77+
ActionScript__ is a class-based, single inheritance,
6778
object-oriented superset of ECMAScript. It supports inferfaces and
6879
strong runtime-checked static typing. Compilation supports a “strict
6980
dialect” where type mismatches are reported at compile-time.
7081

82+
__ https://livedocs.adobe.com/specs/actionscript/3/
83+
7184
Example code with types::
7285

7386
package {
@@ -95,10 +108,12 @@ Example code with types::
95108
Dart
96109
----
97110

98-
Dart [dart]_ is a class-based, single inheritance, object-oriented
111+
Dart__ is a class-based, single inheritance, object-oriented
99112
language with C-style syntax. It supports interfaces, abstract classes,
100113
reified generics, and optional typing.
101114

115+
__ https://www.dartlang.org
116+
102117
Types are inferred when possible. The runtime differentiates between two
103118
modes of execution: *checked mode* aimed for development (catching type
104119
errors at runtime) and *production mode* recommended for speed execution
@@ -121,10 +136,12 @@ Example code with types::
121136
Hack
122137
----
123138

124-
Hack [hack]_ is a programming language that interoperates seamlessly
139+
Hack__ is a programming language that interoperates seamlessly
125140
with PHP. It provides opt-in static type checking, type aliasing,
126141
generics, nullable types, and lambdas.
127142

143+
__ https://hacklang.org
144+
128145
Example code with types::
129146

130147
<?hh
@@ -148,9 +165,11 @@ Example code with types::
148165
TypeScript
149166
----------
150167

151-
TypeScript [typescript]_ is a typed superset of JavaScript that adds
168+
TypeScript__ is a typed superset of JavaScript that adds
152169
interfaces, classes, mixins and modules to the language.
153170

171+
__ http://www.typescriptlang.org
172+
154173
Type checks are duck typed. Multiple valid function signatures are
155174
specified by supplying overloaded function declarations. Functions and
156175
classes can use generics as type parameterization. Interfaces can have
@@ -195,67 +214,7 @@ Example code with types::
195214
}
196215

197216

198-
References
199-
==========
200-
201-
.. [mypy]
202-
http://mypy-lang.org
203-
204-
.. [reticulated]
205-
https://github.com/mvitousek/reticulated
206-
207-
.. [reticulated-paper]
208-
http://wphomes.soic.indiana.edu/jsiek/files/2014/03/retic-python.pdf
209-
210-
.. [pycharm]
211-
https://github.com/JetBrains/python-skeletons#types
212-
213-
.. [obiwan]
214-
http://pypi.python.org/pypi/obiwan
215-
216-
.. [numba]
217-
http://numba.pydata.org
218-
219-
.. [pytypedecl]
220-
https://github.com/google/pytypedecl
221-
222-
.. [argumentclinic]
223-
https://docs.python.org/3/howto/clinic.html
224-
225-
.. [numpy]
226-
http://www.numpy.org
227-
228-
.. [typescript]
229-
http://www.typescriptlang.org
230-
231-
.. [hack]
232-
http://hacklang.org
233-
234-
.. [dart]
235-
https://www.dartlang.org
236-
237-
.. [actionscript]
238-
http://livedocs.adobe.com/specs/actionscript/3/
239-
240-
.. [pyflakes]
241-
https://github.com/pyflakes/pyflakes/
242-
243-
.. [pylint]
244-
http://www.pylint.org
245-
246-
247217
Copyright
248218
=========
249219

250220
This document has been placed in the public domain.
251-
252-
253-
254-
..
255-
Local Variables:
256-
mode: indented-text
257-
indent-tabs-mode: nil
258-
sentence-end-double-space: t
259-
fill-column: 70
260-
coding: utf-8
261-
End:

pep-0526.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ There was preliminary discussion on python-ideas and at
3131
https://github.com/python/typing/issues/258.
3232

3333
Before you bring up an objection in a public forum please at least
34-
read the summary of `rejected`_ ideas listed at the end of this PEP.
34+
read the summary of `rejected ideas <PEP 526 rejected_>`_ listed at the end of this PEP.
3535

3636

3737
Abstract
@@ -395,8 +395,8 @@ Changes to Standard Library and Documentation
395395
instances. This restriction is ensured by static checkers,
396396
but not at runtime. See the
397397
`classvar`_ section for examples and explanations for the usage of
398-
``ClassVar``, and see the `rejected`_ section for more information on
399-
the reasoning behind ``ClassVar``.
398+
``ClassVar``, and see the `rejected <PEP 526 rejected_>`_ section
399+
for more information on the reasoning behind ``ClassVar``.
400400

401401
- Function ``get_type_hints`` in the ``typing`` module will be extended,
402402
so that one can retrieve type annotations at runtime from modules
@@ -511,7 +511,7 @@ These stored annotations might be used for other purposes,
511511
but with this PEP we explicitly recommend type hinting as the
512512
preferred use of annotations.
513513

514-
.. _rejected:
514+
.. _PEP 526 rejected:
515515

516516
Rejected/Postponed Proposals
517517
============================

pep-0544.txt

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static and runtime semantics of protocol classes that will provide a support
2424
for *structural* subtyping (static duck typing).
2525

2626

27-
.. _rationale:
27+
.. _PEP 544 rationale:
2828

2929
Rationale and Goals
3030
===================
@@ -86,8 +86,8 @@ subtyping have their strengths and weaknesses. Therefore, in this PEP we
8686
*do not propose* to replace the nominal subtyping described by :pep:`484` with
8787
structural subtyping completely. Instead, protocol classes as specified in
8888
this PEP complement normal classes, and users are free to choose
89-
where to apply a particular solution. See section on `rejected`_ ideas at the
90-
end of this PEP for additional motivation.
89+
where to apply a particular solution. See section on `rejected
90+
<PEP 544 rejected_>`_ ideas at the end of this PEP for additional motivation.
9191

9292

9393
Non-goals
@@ -181,8 +181,9 @@ approaches related to structural subtyping in Python and other languages:
181181
assert issubclass(tuple, MyTuple)
182182
assert isinstance((), MyTuple)
183183

184-
As mentioned in the `rationale`_, we want to avoid such necessity, especially
185-
in static context. However, in a runtime context, ABCs are good candidates for
184+
As mentioned in the `rationale <PEP 544 rationale_>`_,
185+
we want to avoid such necessity, especially in static context.
186+
However, in a runtime context, ABCs are good candidates for
186187
protocol classes and they are already used extensively in
187188
the ``typing`` module.
188189

@@ -200,8 +201,9 @@ approaches related to structural subtyping in Python and other languages:
200201
assert isinstance(MyIterable(), Iterable)
201202

202203
Such behavior seems to be a perfect fit for both runtime and static behavior
203-
of protocols. As discussed in `rationale`_, we propose to add static support
204-
for such behavior. In addition, to allow users to achieve such runtime
204+
of protocols. As discussed in `rationale <PEP 544 rationale_>`_,
205+
we propose to add static support for such behavior.
206+
In addition, to allow users to achieve such runtime
205207
behavior for *user-defined* protocols a special ``@runtime_checkable`` decorator
206208
will be provided, see detailed `discussion`_ below.
207209

@@ -225,9 +227,9 @@ approaches related to structural subtyping in Python and other languages:
225227
prohibits redundant members in implementations. While the idea of
226228
optional members looks interesting, it would complicate this proposal and
227229
it is not clear how useful it will be. Therefore, it is proposed to postpone
228-
this; see `rejected`_ ideas. In general, the idea of static protocol
229-
checking without runtime implications looks reasonable, and basically
230-
this proposal follows the same line.
230+
this; see `rejected <PEP 544 rejected_>`_ ideas. In general, the idea of
231+
static protocol checking without runtime implications looks reasonable,
232+
and basically this proposal follows the same line.
231233

232234
* Go [golang]_ uses a more radical approach and makes interfaces the primary
233235
way to provide type information. Also, assignments are used to explicitly
@@ -242,11 +244,9 @@ approaches related to structural subtyping in Python and other languages:
242244
}
243245

244246
Both these ideas are questionable in the context of this proposal. See
245-
the section on `rejected`_ ideas.
247+
the section on `rejected <PEP 544 rejected_>`_ ideas.
246248

247249

248-
.. _specification:
249-
250250
Specification
251251
=============
252252

@@ -496,8 +496,9 @@ considering subtyping, since structural compatibility is
496496
the criterion, not the MRO.
497497

498498
If ``Protocol`` is included in the base class list, all the other base classes
499-
must be protocols. A protocol can't extend a regular class, see `rejected`_
500-
ideas for rationale. Note that rules around explicit subclassing are different
499+
must be protocols. A protocol can't extend a regular class, see `rejected
500+
<PEP 544 rejected_>`_ ideas for rationale.
501+
Note that rules around explicit subclassing are different
501502
from regular ABCs, where abstractness is simply defined by having at least one
502503
abstract method being unimplemented. Protocol classes must be marked
503504
*explicitly*.
@@ -551,7 +552,7 @@ the declared variance. Examples::
551552

552553
Note that unlike nominal classes, de facto covariant protocols cannot be
553554
declared as invariant, since this can break transitivity of subtyping
554-
(see `rejected`_ ideas for details). For example::
555+
(see `rejected <PEP 544 rejected_>`_ ideas for details). For example::
555556

556557
T = TypeVar('T')
557558

@@ -732,7 +733,7 @@ Example::
732733

733734
If this will prove to be a widely used scenario, then a special
734735
intersection type construct could be added in future as specified by :pep:`483`,
735-
see `rejected`_ ideas for more details.
736+
see `rejected <PEP 544 rejected_>`_ ideas for more details.
736737

737738

738739
``Type[]`` and class objects vs protocols
@@ -888,7 +889,8 @@ that provides the same semantics for class and instance checks as for
888889
assert isinstance(open('some/file'), SupportsClose)
889890

890891
Note that instance checks are not 100% reliable statically, this is why
891-
this behavior is opt-in, see section on `rejected`_ ideas for examples.
892+
this behavior is opt-in, see section on `rejected <PEP 544 rejected_>`_
893+
ideas for examples.
892894
The most type checkers can do is to treat ``isinstance(obj, Iterator)``
893895
roughly as a simpler way to write
894896
``hasattr(x, '__iter__') and hasattr(x, '__next__')``. To minimize
@@ -1027,7 +1029,7 @@ at runtime in this case). But together with other introspection tools this
10271029
give a reasonable perspective for runtime type checking tools.
10281030

10291031

1030-
.. _rejected:
1032+
.. _PEP 544 rejected:
10311033

10321034
Rejected/Postponed Ideas
10331035
========================
@@ -1498,14 +1500,3 @@ Copyright
14981500
=========
14991501

15001502
This document has been placed in the public domain.
1501-
1502-
1503-
1504-
..
1505-
Local Variables:
1506-
mode: indented-text
1507-
indent-tabs-mode: nil
1508-
sentence-end-double-space: t
1509-
fill-column: 70
1510-
coding: utf-8
1511-
End:

0 commit comments

Comments
 (0)