Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite99558c

Browse files
committed
gh-101100: Remove roles of sample classes inhowto/*
Removed sphinx roles of some classes and methods,as the classes are defined in the sample codes, not in Python.Fixed warnings:```howto/descriptor.rst:45: WARNING: py:class reference target not found: Ten [ref.class]howto/descriptor.rst:218: WARNING: py:class reference target not found: Person [ref.class]howto/descriptor.rst:218: WARNING: py:class reference target not found: Person [ref.class]howto/descriptor.rst:256: WARNING: py:class reference target not found: Person [ref.class]howto/descriptor.rst:340: WARNING: py:class reference target not found: Validator [ref.class]howto/descriptor.rst:363: WARNING: py:class reference target not found: Validator [ref.class]howto/descriptor.rst:363: WARNING: py:meth reference target not found: validate [ref.meth]howto/descriptor.rst:372: WARNING: py:class reference target not found: OneOf [ref.class]howto/descriptor.rst:374: WARNING: py:class reference target not found: Number [ref.class]howto/descriptor.rst:378: WARNING: py:class reference target not found: String [ref.class]howto/descriptor.rst:876: WARNING: py:class reference target not found: Field [ref.class]howto/descriptor.rst:1143: WARNING: py:func reference target not found: Property [ref.func]howto/enum.rst:78: WARNING: py:class reference target not found: Weekday [ref.class]howto/enum.rst:90: WARNING: py:class reference target not found: Weekday [ref.class]howto/enum.rst:113: WARNING: py:class reference target not found: Weekday [ref.class]howto/enum.rst:131: WARNING: py:class reference target not found: Weekday [ref.class]howto/enum.rst:576: WARNING: py:class reference target not found: Animal [ref.class]howto/enum.rst:893: WARNING: py:class reference target not found: FloatEnum [ref.class]```
1 parentc9b399f commite99558c

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

‎Doc/howto/descriptor.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ add new capabilities one by one.
4242
Simple example: A descriptor that returns a constant
4343
----------------------------------------------------
4444

45-
The:class:`Ten` class is a descriptor whose:meth:`__get__` method always
45+
The``Ten`` class is a descriptor whose:meth:`__get__` method always
4646
returns the constant ``10``:
4747

4848
..testcode::
@@ -215,8 +215,8 @@ Customized names
215215
When a class uses descriptors, it can inform each descriptor about which
216216
variable name was used.
217217

218-
In this example, the:class:`Person` class has two descriptor instances,
219-
*name* and *age*. When the:class:`Person` class is defined, it makes a
218+
In this example, the``Person`` class has two descriptor instances,
219+
*name* and *age*. When the``Person`` class is defined, it makes a
220220
callback to:meth:`__set_name__` in *LoggedAccess* so that the field names can
221221
be recorded, giving each descriptor its own *public_name* and *private_name*:
222222

@@ -253,7 +253,7 @@ be recorded, giving each descriptor its own *public_name* and *private_name*:
253253
def birthday(self):
254254
self.age += 1
255255

256-
An interactive session shows that the:class:`Person` class has called
256+
An interactive session shows that the``Person`` class has called
257257
:meth:`__set_name__` so that the field names would be recorded. Here
258258
we call:func:`vars` to look up the descriptor without triggering it:
259259

@@ -337,7 +337,7 @@ any data, it verifies that the new value meets various type and range
337337
restrictions. If those restrictions aren't met, it raises an exception to
338338
prevent data corruption at its source.
339339

340-
This:class:`Validator` class is both an:term:`abstract base class` and a
340+
This``Validator`` class is both an:term:`abstract base class` and a
341341
managed attribute descriptor:
342342

343343
..testcode::
@@ -360,22 +360,22 @@ managed attribute descriptor:
360360
def validate(self, value):
361361
pass
362362

363-
Custom validators need to inherit from:class:`Validator` and must supply a
364-
:meth:`validate` method to test various restrictions as needed.
363+
Custom validators need to inherit from``Validator`` and must supply a
364+
``validate`` method to test various restrictions as needed.
365365

366366

367367
Custom validators
368368
-----------------
369369

370370
Here are three practical data validation utilities:
371371

372-
1):class:`OneOf` verifies that a value is one of a restricted set of options.
372+
1)``OneOf`` verifies that a value is one of a restricted set of options.
373373

374-
2):class:`Number` verifies that a value is either an:class:`int` or
374+
2)``Number`` verifies that a value is either an:class:`int` or
375375
:class:`float`. Optionally, it verifies that a value is between a given
376376
minimum or maximum.
377377

378-
3):class:`String` verifies that a value is a:class:`str`. Optionally, it
378+
3)``String`` verifies that a value is a:class:`str`. Optionally, it
379379
validates a given minimum or maximum length. It can validate a
380380
user-defined `predicate
381381
<https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)>`_ as well.
@@ -873,7 +873,7 @@ care of lookups or updates:
873873
conn.execute(self.store, [value, obj.key])
874874
conn.commit()
875875

876-
We can use the:class:`Field` class to define `models
876+
We can use the``Field`` class to define `models
877877
<https://en.wikipedia.org/wiki/Database_model>`_ that describe the schema for
878878
each table in a database:
879879

@@ -1140,7 +1140,7 @@ to wrap access to the value attribute in a property data descriptor:
11401140
self.recalc()
11411141
return self._value
11421142

1143-
Either the built-in:func:`property` or our:func:`Property` equivalent would
1143+
Either the built-in:func:`property` or our``Property`` equivalent would
11441144
work in this example.
11451145

11461146

‎Doc/howto/enum.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ Unlike many languages that treat enumerations solely as name/value pairs,
7979
Python Enums can have behavior added. For example,:class:`datetime.date`
8080
has two methods for returning the weekday::meth:`weekday` and:meth:`isoweekday`.
8181
The difference is that one of them counts from 0-6 and the other from 1-7.
82-
Rather than keep track of that ourselves we can add a method to the:class:`Weekday`
82+
Rather than keep track of that ourselves we can add a method to the``Weekday``
8383
enum to extract the day from the:class:`date` instance and return the matching
8484
enum member::
8585

8686
@classmethod
8787
def from_date(cls, date):
8888
return cls(date.isoweekday())
8989

90-
The complete:class:`Weekday` enum now looks like this::
90+
The complete``Weekday`` enum now looks like this::
9191

9292
>>> class Weekday(Enum):
9393
... MONDAY = 1
@@ -110,7 +110,7 @@ Now we can find out what today is! Observe::
110110

111111
Of course, if you're reading this on some other day, you'll see that day instead.
112112

113-
This:class:`Weekday` enum is great if our variable only needs one day, but
113+
This``Weekday`` enum is great if our variable only needs one day, but
114114
what if we need several? Maybe we're writing a function to plot chores during
115115
a week, and don't want to use a:class:`list` -- we could use a different type
116116
of:class:`Enum`::
@@ -128,7 +128,7 @@ of :class:`Enum`::
128128
We've changed two things: we're inherited from:class:`Flag`, and the values are
129129
all powers of 2.
130130

131-
Just like the original:class:`Weekday` enum above, we can have a single selection::
131+
Just like the original``Weekday`` enum above, we can have a single selection::
132132

133133
>>> first_week_day = Weekday.MONDAY
134134
>>> first_week_day
@@ -580,7 +580,7 @@ values. The last two options enable assigning arbitrary values to
580580
enumerations; the others auto-assign increasing integers starting with 1 (use
581581
the ``start`` parameter to specify a different starting value). A
582582
new class derived from:class:`Enum` is returned. In other words, the above
583-
assignment to:class:`Animal` is equivalent to::
583+
assignment to``Animal`` is equivalent to::
584584

585585
>>> class Animal(Enum):
586586
... ANT = 1
@@ -891,7 +891,7 @@ simple to implement independently::
891891
pass
892892

893893
This demonstrates how similar derived enumerations can be defined; for example
894-
a:class:`FloatEnum` that mixes in:class:`float` instead of:class:`int`.
894+
a``FloatEnum`` that mixes in:class:`float` instead of:class:`int`.
895895

896896
Some rules:
897897

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp