Skip to content

Commit 73786bb

Browse files
committed
Add mypy and fix related errors.
1 parent fb4058f commit 73786bb

File tree

12 files changed

+349
-221
lines changed

12 files changed

+349
-221
lines changed

doc/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ doc:
2020
sphinx-build source/ build/
2121

2222
clean:
23-
rm -r build/generated/
23+
rm -r build/
2424
rm -r source/generated/
25-
rm build/*.html
2625

2726
# Catch-all target: route all unknown targets to Sphinx using the new
2827
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

doc/source/conf.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,31 @@
3737
]
3838
napoleon_use_ivar = True
3939

40+
# Add any paths that contain custom static files (such as style sheets) here,
41+
# relative to this directory. They are copied after the builtin static files,
42+
# so a file named "default.css" will overwrite the builtin "default.css".
43+
html_static_path = ['static']
44+
html_css_files = ['functions.css']
45+
4046
# Add any paths that contain templates here, relative to this directory.
4147
templates_path = ['templates']
4248

4349
# List of patterns, relative to source directory, that match files and
4450
# directories to ignore when looking for source files.
4551
# This pattern also affects html_static_path and html_extra_path.
46-
exclude_patterns = ['templates']
52+
# exclude_patterns = ['templates']
4753

4854
autodoc_typehints = 'description'
4955
autodoc_typehints_description_target = 'documented'
5056
autodoc_default_options = {"members": True, "inherited-members": True}
51-
57+
autodoc_member_order = 'bysource'
5258

5359
# -- Options for HTML output -------------------------------------------------
5460

5561
# The theme to use for HTML and HTML Help pages. See the documentation for
5662
# a list of builtin themes.
5763
#
58-
# html_theme = 'alabaster'
59-
60-
# Add any paths that contain custom static files (such as style sheets) here,
61-
# relative to this directory. They are copied after the builtin static files,
62-
# so a file named "default.css" will overwrite the builtin "default.css".
63-
html_static_path = []
64+
html_theme = 'alabaster'
6465

6566

6667
# Changes autoclass "variables" to "attributes".

doc/source/reference.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ Reference Manual
1111
:toctree: generated/
1212
:template: class.rst
1313

14-
ggrecomb.ParentAlignment
14+
ParentAlignment
15+
PDBStructure

doc/source/static/functions.css

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.function {
2+
padding-bottom: 10pt;
3+
padding-top: 10pt;
4+
}
5+
6+
.method {
7+
border-top: 3px solid #d0d0d0;
8+
padding-bottom: 10pt;
9+
padding-top: 10pt;
10+
}

doc/source/templates/class.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.. currentmodule:: {{ module }}
55

66
.. autoclass:: {{ objname }}
7+
:no-undoc-members:
78

89
.. raw:: html
910

mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[mypy]
22

3-
[mypy-Bio.*]
3+
[mypy-Bio.*,matplotlib.*,scipy.*]
44
ignore_missing_imports = True

src/ggrecomb/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
from .parent_alignment.pdb_structure import PDBStructure
2-
3-
# Must come second because it imports PDBStructure.
42
from .parent_alignment.parent_alignment import ParentAlignment

src/ggrecomb/energy_functions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import numpy as np
44

5-
from ggrecomb.parent_alignment import ParentAlignment
5+
from ggrecomb import ParentAlignment
66

77

88
class EnergyFunction:
9-
pass
9+
# TODO: Implement general energy function.
10+
def __init__(self, pa: ParentAlignment):
11+
raise NotImplementedError
1012

1113

1214
class SCHEMA(EnergyFunction):

src/ggrecomb/library.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from functools import cached_property
1111
from itertools import combinations
1212

13-
from ggrecomb.parent_alignment import ParentAlignment
13+
from ggrecomb import ParentAlignment
1414

1515

1616
# @dataclass(repr=False)
@@ -21,7 +21,7 @@ def __init__(
2121
breakpoints: dict[int, list[tuple[int, str]]],
2222
parent_alignment: ParentAlignment,
2323
bp_to_group: dict[int, int] = None,
24-
group_bp_cache: dict[tuple[int], float] = None,
24+
group_bp_cache: dict[tuple[int, ...], float] = None,
2525
):
2626
self.energy = energy
2727
self.breakpoints = breakpoints

0 commit comments

Comments
 (0)