thesketh / pygen-structures

3D molecular structure generation for MD simulation
https://pygen-structures.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Change `typing` types to the more specific types from `pygen_structures._typing` #4

Open thesketh opened 4 years ago

thesketh commented 4 years ago

Currently, most of the library is typed fairly effectively, but much of the usage is messy due to long strings like the following:

Dict[Tuple[int, str], Tuple[Tuple[int, str], ...]]

Additionally, many class __init__ signatures contain types such as:

(None, List[Tuple[int, ...]])

It would be better to convert these types to those specified in _typing, to reduce clutter. This would enable the first example to read Dict[AtomID, Connection], and the second Optional[List[IndexConnection]].

This could also increase specificity by emphasising the semantic difference between types with the same signature. For example, this allows differentiation of an atom reference (where the 'residue index' refers to the order of the residues supplied to CHARMMPatchResidue.apply) and an atom ID (where the 'residue index' refers to the order of the residue in the molecule).