summaryrefslogtreecommitdiff
path: root/docs/source/internal
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-02-03 23:11:45 -0600
committerIan Cordasco <graffatcolmingov@gmail.com>2016-02-03 23:11:45 -0600
commita4e051614f851cf4e642bf00991d5952af104723 (patch)
tree63e27b5afa3eb827488f745142618495b59a9d89 /docs/source/internal
parent253211f5ad09dbaef681f018860fe778026150b5 (diff)
downloadflake8-a4e051614f851cf4e642bf00991d5952af104723.tar.gz
Document flake8.utils
Diffstat (limited to 'docs/source/internal')
-rw-r--r--docs/source/internal/utils.rst47
1 files changed, 47 insertions, 0 deletions
diff --git a/docs/source/internal/utils.rst b/docs/source/internal/utils.rst
new file mode 100644
index 0000000..69dee45
--- /dev/null
+++ b/docs/source/internal/utils.rst
@@ -0,0 +1,47 @@
+===================
+ Utility Functions
+===================
+
+Flake8 has a few utility functions that it uses and provides to plugins.
+
+.. autofunction:: flake8.utils.parse_comma_separated_list
+
+:func:`~flake8.utils.parse_comma_separated_list` takes either a string like
+
+.. code-block:: python
+
+ "E121,W123,F904"
+ "E121,\nW123,\nF804"
+ "E121,\n\tW123,\n\tF804"
+
+Or it will take a list of strings (potentially with whitespace) such as
+
+.. code-block:: python
+
+ [" E121\n", "\t\nW123 ", "\n\tF904\n "]
+
+And converts it to a list that looks as follows
+
+.. code-block:: python
+
+ ["E121", "W123", "F904"]
+
+This function helps normalize any kind of comma-separated input you or Flake8
+might receive. This is most helpful when taking advantage of Flake8's
+additional parameters to :class:`~flake8.options.manager.Option`.
+
+.. autofunction:: flake8.utils.normalize_path
+
+This utility takes a string that represents a path and returns the absolute
+path if the string has a ``/`` in it. It also removes trailing ``/``\ s.
+
+.. autofunction:: flake8.utils.normalize_paths
+
+This function utilizes :func:`~flake8.utils.parse_comma_separated_list` and
+:func:`~flake8.utils.normalize_path` to normalize it's input to a list of
+strings that should be paths.
+
+.. autofunction:: flake8.utils.stdin_get_value
+
+This function retrieves and caches the value provided on ``sys.stdin``. This
+allows plugins to use this to retrieve ``stdin`` if necessary.