docs: Import 'yamllint.config' rather than 'yamllint'

Since yamllint version 0.5.2 (in 2016, just after yamllint was created)
this example in documentation doesn't work. Indeed, commit dbbecb5
(which aimed to solve another problem) removed the ability to import
yamllint submodules directly.

This commit makes it clearer inside documentation.

Fixes https://github.com/adrienverge/yamllint/issues/698
This commit is contained in:
Adrien Vergé
2024-11-16 17:55:08 +01:00
parent 95e17b33dc
commit 8513d9b97d

View File

@@ -8,7 +8,8 @@ Basic example of running the linter from Python:
.. code-block:: python
import yamllint
import yamllint.config
import yamllint.linter
yaml_config = yamllint.config.YamlLintConfig("extends: default")
for p in yamllint.linter.run(open("example.yaml", "r"), yaml_config):