Skip to content

Commit

Permalink
Refactor/docs (#15)
Browse files Browse the repository at this point in the history
* Update docs

* Fix templates

* Fix path

* .

* Add static and templates

* Add structure

* .
  • Loading branch information
ngc436 authored Jul 5, 2023
1 parent eaa541c commit 7d618a6
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 15 deletions.
10 changes: 9 additions & 1 deletion autotm/algorithms_for_tuning/genetic_algorithm/crossover.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ def crossover_blend(parent_1, parent_2, **kwargs):
return child


def crossover(crossover_type="crossover_one_point"):
def crossover(crossover_type: str = "crossover_one_point"):
"""
Crossover function
Parameters
----------
crossover_type : str, default="crossover_one_point"
Crossover to be used in the genetic algorithm
"""
if crossover_type == "crossover_pmx":
return crossover_pmx
if crossover_type == "crossover_one_point":
Expand Down
13 changes: 13 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.wy-nav-content {
max-width: none;
}

.rst-content code.xref {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
color: #E74C3C
}

html.writer-html4 .rst-content dl:not(.docutils) dl:not(.field-list)>dt, html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dl:not(.field-list)>dt {
border-left-color: rgb(9, 183, 14)
}
14 changes: 14 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}


{{ name | underline}}

.. autoclass:: {{ name }}
:members:


..
autogenerated from source/_templates/autosummary/class.rst
note it does not have :inherited-members:
48 changes: 48 additions & 0 deletions docs/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. role:: hidden
:class: hidden-section

{{ name | underline }}

.. automodule:: {{ fullname }}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree: generated
:nosignatures:
:template: functiontemplate.rst
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}


{% block modules %}
{% if modules %}
.. rubric:: {{ _('Modules') }}

.. autosummary::
:toctree:
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
14 changes: 14 additions & 0 deletions docs/_templates/classtemplate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}


{{ name | underline }}

.. autoclass:: {{ name }}
:members:


..
autogenerated from source/_templates/classtemplate.rst
note it does not have :inherited-members:
11 changes: 11 additions & 0 deletions docs/_templates/functiontemplate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}

{{ name | underline }}

.. autofunction:: {{ fullname }}

..
autogenerated from source/_templates/functiontemplate.rst
note it does not have :inherited-members:
18 changes: 13 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import sys


LIB_PATH = os.path.abspath(os.path.dirname(__file__))
CURR_PATH = os.path.abspath(os.path.dirname(__file__))
LIB_PATH = os.path.join(CURR_PATH, os.path.pardir)
print(LIB_PATH)
sys.path.insert(0, LIB_PATH)

project = "AutoTM"
Expand All @@ -21,7 +23,7 @@
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx.ext.autosummary"]
extensions = ["sphinx.ext.napoleon", "sphinx.ext.autosummary"]

# Delete external references
autosummary_mock_imports = [
Expand All @@ -36,15 +38,21 @@
"sklearn",
"spacy",
"pymystem3",
# "nltk"
"tqdm",
"nltk"
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]

html_static_path = ['_static']

# Autosummary true if you want to generate it from very beginning
# autosummary_generate = True

# set_type_checking_flag = True
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Welcome to AutoTM's documentation!
:maxdepth: 1
:caption: Contents:

algorithms_for_tuning
fitness
preprocessing
visualization
pages/algorithms_for_tuning
pages/fitness
pages/preprocessing
pages/visualization


Indices and tables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Algorithms for tuning.
.. autosummary::
:toctree: ./generated
:nosignatures:
:template: classtemplate.rst
:template: autosummary/class.rst

crossover.crossover_pmx
crossover.crossover_one_point
Expand Down
2 changes: 1 addition & 1 deletion docs/fitness.rst → docs/pages/fitness.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Fitness.
.. autosummary::
:toctree: ./generated
:nosignatures:
:template: classtemplate.rst
:template: autosummary/class.rst

Dataset
TopicModelFactory
Expand Down
2 changes: 0 additions & 2 deletions docs/preprocessing.rst → docs/pages/preprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ Preprocessing.
.. autosummary::
:toctree: ./generated
:nosignatures:
:template: functiontemplate.rst

dictionaries_preparation.get_words_dict
text_preprocessing.new_html
2 changes: 1 addition & 1 deletion docs/visualization.rst → docs/pages/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Visualization.
.. autosummary::
:toctree: ./generated
:nosignatures:
:template: classtemplate.rst
:template: autosummary/class.rst

MetricsCollector

0 comments on commit 7d618a6

Please sign in to comment.