Skip to content

Commit

Permalink
merge conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksMat committed Aug 6, 2018
2 parents 9e2eae6 + 762762e commit fa764e1
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 19 deletions.
3 changes: 3 additions & 0 deletions docs/source/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.wy-nav-content {
max-width: 1200px !important;
}
4 changes: 4 additions & 0 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% extends "!layout.html" %}
{% block extrahead %}
<link href="{{ pathto("_static/style.css", True) }}" rel="stylesheet" type="text/css">
{% endblock %}
68 changes: 49 additions & 19 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.autosummary',
'nbsphinx',
'IPython.sphinxext.ipython_console_highlighting'
]

# Both the class’ and the __init__ method’s docstring are concatenated and inserted.
autoclass_content = 'both'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down Expand Up @@ -101,7 +105,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down Expand Up @@ -205,32 +209,58 @@

# Create a list of all EOTasks

def get_subclasses(cls):
direct_subclasses = cls.__subclasses__()
nested_subclasses = [ s for c in direct_subclasses
for s in get_subclasses(c) ]

return list(set(direct_subclasses).union(nested_subclasses))


def get_eotasks():
import eolearn.core
import eolearn.coregistration
import eolearn.features
# import eolearn.geometry
# import eolearn.io
# import eolearn.mask
import eolearn.geometry
import eolearn.io
import eolearn.mask
import eolearn.ml_tools

return eolearn.core.EOTask.__subclasses__()
return get_subclasses(eolearn.core.EOTask)

with open('eotasks.rst', 'w') as f:
f.write('********\n')
f.write('EO Tasks\n')
f.write('********\n')
f.write('\n')

eopackage_tasks = {}

for eotask_cls in get_eotasks():
eopackage = eotask_cls.__module__.split('.')[1]
eotask = eotask_cls.__module__ + '.' + eotask_cls.__name__

if eopackage not in eopackage_tasks:
eopackage_tasks[eopackage] = []

eopackage_tasks[eopackage].append(eotask)

for eopackage in sorted(eopackage_tasks.keys()):
f.write(eopackage + '\n')
f.write('-' * len(eopackage) + '\n')
f.write('\n')

f.write('.. currentmodule:: eolearn.' + eopackage + '\n')
f.write('.. autosummary::\n')
f.write('\t:nosignatures:\n')
f.write('\n')

eotasks_str = " ".join([
eotask.__module__ + "." + eotask.__name__
for eotask in get_eotasks()
])
eotasks = eopackage_tasks[eopackage]
eotasks.sort()

eotasks_file_content = '''
********
EO Tasks
********
for eotask in eotasks:
# tilde is used to show only the class name without the module
f.write('\t~' + eotask + '\n')

.. inheritance-diagram:: %s
:top-classes: eolearn.core.EOTask
:parts: 3
'''
f.write('\n')

with open("eotasks.rst", "w") as f:
f.write(eotasks_file_content % eotasks_str)
12 changes: 12 additions & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Sphinx==1.7.5
sphinx-rtd-theme==0.4.0
nbsphinx==0.3.3
ipython==6.4.0

./core
./coregistration
./features
./geometry
./io
./mask
./ml_tools

0 comments on commit fa764e1

Please sign in to comment.