From ca8c461a7908c0acb2d8c67cab8544b4c3b7832f Mon Sep 17 00:00:00 2001 From: Casper Weiss Bang Date: Sun, 30 May 2021 10:01:24 +0200 Subject: [PATCH] updated documentation --- docs/reference/filters.rst | 51 ++++----------------- src/codoc/service/filters/children_based.py | 8 ++-- src/codoc/service/filters/regex_based.py | 12 +++-- 3 files changed, 21 insertions(+), 50 deletions(-) diff --git a/docs/reference/filters.rst b/docs/reference/filters.rst index 644f57d..4521ff5 100644 --- a/docs/reference/filters.rst +++ b/docs/reference/filters.rst @@ -7,82 +7,49 @@ Filters ================ +list of all filters +-------------------- + .. automodule:: codoc.service.filters .. _type_ex_filter: -Type based ----------------------- -.. automodule:: codoc.service.filters.type_exclusion_filter - - .. _class_ex_filter: -Exclude classes -````````````````` - .. autofunction:: exclude_classes .. _function_ex_filter: -Exclude functions -````````````````` - .. autofunction:: exclude_functions - .. _module_ex_filter: -Exclude modules -````````````````` - .. autofunction:: exclude_modules -Exclude exceptions -```````````````````` - .. autofunction:: exclude_exceptions -Only classes -````````````````` - .. autofunction:: include_only_classes -Only functions -````````````````` - .. autofunction:: include_only_functions - -Only modules -````````````````` - .. autofunction:: include_only_modules -Only exceptions -```````````````````` - .. autofunction:: include_only_exceptions .. _child_filter: -Child Based ----------------------- - -.. autofunction:: codoc.service.filters.get_children_of +.. autofunction:: content_of -Depth based ----------------------- - -.. autofunction:: codoc.service.filters.get_depth_based_filter +.. autofunction:: get_depth_based_filter .. _class_diagram: -Class Diagram filter ----------------------- +.. autofunction:: class_diagram_filter + -.. autofunction:: codoc.service.filters.class_diagram_filter +.. autofunction:: filter_by_regex +.. autofunction:: exclude_by_regex Customization diff --git a/src/codoc/service/filters/children_based.py b/src/codoc/service/filters/children_based.py index 740ebfa..f7786d5 100644 --- a/src/codoc/service/filters/children_based.py +++ b/src/codoc/service/filters/children_based.py @@ -32,14 +32,12 @@ def get_children_of( the current node. I.e if a class, Foo, defined in FooModule, then FooModule is the parent of Foo. - Example - + Example that returns all modules/classes/exceptions/functions defined + inside `myproject.subproject`. .. code-block:: python - # returns all modules/classes/exceptions/functions - # defined inside `myporject.subproject`. - filter_function = filters.get_children_of(myproject.subproject) + filter_function = filters.content_of(myproject.subproject) filtered_graph = filter_function(graph) diff --git a/src/codoc/service/filters/regex_based.py b/src/codoc/service/filters/regex_based.py index 5348b01..dfd4915 100644 --- a/src/codoc/service/filters/regex_based.py +++ b/src/codoc/service/filters/regex_based.py @@ -13,8 +13,11 @@ def filter_by_regex(pattern: str, flags=0) -> FilterType: The regex is done solely on the `name` attribute. - The following example removes all instances of "test". + The following example removes all instances that don't include "test". Example: + + .. code-block:: python + graph = filters.filter_by_regex("test", flags=re.IGNORECASE)(graph) To understand how to use regex, please consult the python documentation: @@ -34,9 +37,12 @@ def exclude_by_regex(pattern: str, flags=0) -> FilterType: The regex is done solely on the `name` attribute. - The following example removes all instances of "test". + The following example removes all instances with a name that contains "test". Example: - graph = filters.filter_by_regex("test", flags=re.IGNORECASE)(graph) + + .. code-block:: python + + graph = filters.exclude_by_regex("test", flags=re.IGNORECASE)(graph) To understand how to use regex, please consult the python documentation: