Skip to content

Commit

Permalink
documentation fixed.
Browse files Browse the repository at this point in the history
typing added
  • Loading branch information
stsouko committed Dec 16, 2020
1 parent 3365cbb commit df048ef
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 16 deletions.
16 changes: 14 additions & 2 deletions CGRtools/algorithms/aromatics.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@
#
from CachedMethods import cached_property
from collections import defaultdict, deque
from typing import List, Optional, Tuple
from typing import List, Optional, Tuple, TYPE_CHECKING, TypeVar, Type
from .._functions import lazy_product
from ..containers import query # cyclic imports resolve
from ..exceptions import InvalidAromaticRing


class Aromatize:
if TYPE_CHECKING:
from CGRtools import MoleculeContainer
else:
MoleculeContainer = object

T = TypeVar('T')


def typehint(baseclass: Type[T]) -> Type[T]:
return object


class Aromatize(typehint(MoleculeContainer)):
__slots__ = ()

def thiele(self, *, fix_tautomers=True) -> bool:
Expand Down
12 changes: 10 additions & 2 deletions CGRtools/algorithms/tautomers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,25 @@
from CachedMethods import class_cached_property, cached_property
from collections import deque
from itertools import product, chain, repeat
from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING, Iterator, Type, TypeVar
from ..containers import query # cyclic imports resolve
from ..containers.bonds import Bond
from ..periodictable import ListElement


if TYPE_CHECKING:
from CGRtools import MoleculeContainer
else:
MoleculeContainer = object

T = TypeVar('T')

class Tautomers:

def typehint(baseclass: Type[T]) -> Type[T]:
return object


class Tautomers(typehint(MoleculeContainer)):
__slots__ = ()

def tautomerize(self, *, prepare_molecules=True) -> bool:
Expand Down
3 changes: 0 additions & 3 deletions CGRtools/containers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ class Graph(GraphComponents, Morgan, SSSR, Isomorphism, MCS, ABC):
'__dict__', '__weakref__')

def __init__(self):
"""
Empty data object initialization or conversion from another object type
"""
self._atoms: Dict[int, AnyAtom] = {}
self._charges: Dict[int, int] = {}
self._radicals: Dict[int, bool] = {}
Expand Down
3 changes: 2 additions & 1 deletion CGRtools/periodictable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
modules = {v.__name__: v for k, v in globals().items() if k.startswith('group') and k != 'groups'}
elements = {k: v for k, v in globals().items() if isinstance(v, ABCMeta) and k != 'Element' and issubclass(v, Element)}

__all__ = ['Element', 'DynamicElement', 'QueryElement', 'DynamicQueryElement', 'AnyElement', 'DynamicAnyElement']
__all__ = ['Element', 'DynamicElement', 'QueryElement', 'DynamicQueryElement', 'AnyElement', 'DynamicAnyElement',
'ListElement', 'AnyAtom']
__all__.extend(k for k in globals() if k.startswith('Group'))
__all__.extend(k for k in globals() if k.startswith('Period'))
__all__.extend(elements)
Expand Down
3 changes: 1 addition & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
parent = abspath('..')
if parent not in path:
path.insert(0, parent)
from CGRtools.files._CGRrw import elements_set
from CGRtools.periodictable import C, DynamicC, QueryC, DynamicQueryC
from CGRtools.periodictable import C, DynamicC, QueryC, DynamicQueryC, ListElement, AnyElement, DynamicAnyElement

author = 'Dr. Ramil Nugmanov'
copyright = '2014-2020, Dr. Ramil Nugmanov <nougmanoff@protonmail.com>'
Expand Down
1 change: 0 additions & 1 deletion doc/containers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ Data classes.
.. automodule:: CGRtools.containers
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
2 changes: 0 additions & 2 deletions doc/files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ Available file parsers and writers:
.. automodule:: CGRtools.files
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
23 changes: 22 additions & 1 deletion doc/periodictable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CGRtools\.periodictable package

Contains classes of all elements used in containers: common for `MoleculeContainer`, `Dynamic` for `CGRContainer`,
`Query` and `DynamicQuery` for `QueryContainer` and `QueryCGRContainer` respectively.
Also available two special query atom types: `AnyElement` and `DynamicAnyElement`
Also available 3 special query atom types: `AnyElement`, `DynamicAnyElement` and `ListElement`

Below only carbon atom classes shown.

Expand Down Expand Up @@ -34,3 +34,24 @@ Below only carbon atom classes shown.
:show-inheritance:
:inherited-members:
:special-members: __hash__, __eq__, __int__

.. autoclass:: CGRtools.periodictable.AnyElement
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
:special-members: __hash__, __eq__, __int__

.. autoclass:: CGRtools.periodictable.DynamicAnyElement
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
:special-members: __hash__, __eq__, __int__

.. autoclass:: CGRtools.periodictable.ListElement
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
:special-members: __hash__, __eq__, __int__
1 change: 0 additions & 1 deletion doc/reactor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ CGRtools\.reactor package
.. automodule:: CGRtools.reactor
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
1 change: 0 additions & 1 deletion doc/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ Utils for data transformation.
.. automodule:: CGRtools.utils
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

0 comments on commit df048ef

Please sign in to comment.