"pydoc" — Générateur de documentation et système d’aide en ligne
****************************************************************

**Code source :** Lib/pydoc.py

======================================================================

The "pydoc" module automatically generates documentation from Python
modules.  The documentation can be presented as pages of text on the
console, served to a web browser, or saved to HTML files.

For modules, classes, functions and methods, the displayed
documentation is derived from the docstring (i.e. the "__doc__"
attribute) of the object, and recursively of its documentable members.
If there is no docstring, "pydoc" tries to obtain a description from
the block of comment lines just above the definition of the class,
function or method in the source file, or at the top of the module
(see "inspect.getcomments()").

The built-in function "help()" invokes the online help system in the
interactive interpreter, which uses "pydoc" to generate its
documentation as text on the console.  The same text documentation can
also be viewed from outside the Python interpreter by running
**pydoc** as a script at the operating system's command prompt. For
example, running

   python -m pydoc sys

dans un terminal, cela affiche la documentation du module "sys" dans
un style similaire à la commande Unix **man**. On peut passer comme
argument à **pydoc** le nom d’une fonction, d’un module, d’un paquet,
ou une référence pointant vers une classe, une méthode, ou une
fonction dans un module ou dans un paquet. Si l’argument passé à
**pydoc** est un chemin (c.-à-d. qu’il contient des séparateurs de
chemin tels que la barre oblique "/" dans Unix), et fait référence à
un fichier source Python existant, alors la documentation est générée
pour ce fichier.

Note:

  In order to find objects and their documentation, "pydoc" imports
  the module(s) to be documented.  Therefore, any code on module level
  will be executed on that occasion.  Use an "if __name__ ==
  '__main__':" guard to only execute code when a file is invoked as a
  script and not just imported.

Lorsque l’on affiche une sortie sur la console, **pydoc** essaye de
créer une pagination pour faciliter la lecture. Si la variable
d’environnement "PAGER" est configurée, **pydoc** utilise sa valeur
comme programme de pagination.

Ajouter une option "-w" avant l’argument entraine l’enregistrement de
la documentation HTML générée dans un fichier du répertoire courant au
lieu de l’afficher dans la console.

Ajouter une option "-w" avant l’argument cherche les lignes de résumé
de tous les modules disponibles pour le mot clé donné comme argument,
ceci à la manière de la commande Unix **man**. Les lignes de résumé
d’un module sont les premières lignes de sa *docstring*.

You can also use **pydoc** to start an HTTP server on the local
machine that will serve documentation to visiting web browsers.
**python -m pydoc -p 1234** will start a HTTP server on port 1234,
allowing you to browse the documentation at "http://localhost:1234/"
in your preferred web browser. Specifying "0" as the port number will
select an arbitrary unused port.

**python -m pydoc -n <hostname>** will start the server listening at
the given hostname.  By default the hostname is 'localhost' but if you
want the server to be reached from other machines, you may want to
change the host name that the server responds to.  During development
this is especially useful if you want to run pydoc from within a
container.

**python -m pydoc -b** will start the server and additionally open a
web browser to a module index page.  Each served page has a navigation
bar at the top where you can *Get* help on an individual item,
*Search* all modules with a keyword in their synopsis line, and go to
the *Module index*, *Topics* and *Keywords* pages.

Quand **pydoc** génère de la documentation, il utilise l’environnement
et le chemin courant pour localiser les modules. Ainsi, en invoquant
les documents **pydoc spam** en précisant la version du module, vous
obtenez le même résultat qu’en lançant l’interpréteur Python et en
tapant la commande "import spam".

Module docs for core modules are assumed to reside in
"https://docs.python.org/X.Y/library/" where "X" and "Y" are the major
and minor version numbers of the Python interpreter.  This can be
overridden by setting the "PYTHONDOCS" environment variable to a
different URL or to a local directory containing the Library Reference
Manual pages.

Modifié dans la version 3.2: Ajout de l’option "-b".

Modifié dans la version 3.3: Suppression de l’option "-g".

Modifié dans la version 3.4: "pydoc" now uses "inspect.signature()"
rather than "inspect.getfullargspec()" to extract signature
information from callables.

Modifié dans la version 3.7: Ajout de l’option "-n".
