Skip to content

Commit e370ac3

Browse files
authored
09/12/2024 Update.
* Corrected some type hints according to `mypy` package. * Corrected a typo in help messages.
1 parent a68e025 commit e370ac3

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

mol2chemfigPy3/chemfig_mappings.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
the TeX syntax defined by the chemfig package.
77
"""
88
import textwrap
9-
from typing import Union, Optional, List, Tuple, Dict
9+
from typing import Union, Optional, List, Tuple, Dict, Any
1010

1111
BOND_CODE_WIDTH = 50 # space for bonds - generous upfront, will be trimmed at the end
1212
TERSE_LINE_WIDTH = 75 # in terse code format, force linebreaks
@@ -158,7 +158,7 @@ def format_angle(
158158
return prefix + str(angle % 360)
159159

160160

161-
def specifier_default(val: any, default: any) -> str:
161+
def specifier_default(val: Any, default: Any) -> str:
162162
"""
163163
set bond specifier default values to ""
164164
@@ -539,3 +539,7 @@ def format_output(options: Dict, output_list: List[str]) -> str:
539539
joiner = "\n"
540540

541541
return joiner.join(output_list)
542+
543+
544+
if __name__ == "__main__":
545+
...

mol2chemfigPy3/common.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"""
33
common settings and a bit of infrastructure
44
"""
5+
from typing import Any
56
from .options import getParser
67

7-
program_version = "1.5.10"
8+
program_version = "1.5.11"
89

910
# pubchem url for retrieving sdf for numerical IDs
1011
pubchem_url = (
@@ -78,7 +79,7 @@ class MCFError(Exception):
7879
this flags an anticipated error due to faulty user input.
7980
"""
8081

81-
def __init__(self, text: any):
82+
def __init__(self, text: Any):
8283
self.text = str(text)
8384

8485
def __str__(self):
@@ -100,7 +101,7 @@ def __init__(self, lst: list):
100101

101102
self._d[val] += 1
102103

103-
def most_common(self) -> any:
104+
def most_common(self) -> Any:
104105
"""
105106
return the most common object
106107

mol2chemfigPy3/optionparser.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353

5454
self.help_text = help_text
5555

56-
def _default(self) -> None:
56+
def _default(self) -> Any:
5757
"""
5858
give the default value, i.e., None
5959
@@ -361,7 +361,7 @@ def __init__(self) -> None:
361361
self._options_by_name = {}
362362
self._options_by_key = {}
363363

364-
def append(self, option: any) -> None:
364+
def append(self, option: Any) -> None:
365365
"""
366366
add option
367367
@@ -400,7 +400,7 @@ def option_values(self) -> Dict:
400400

401401
return option_dict
402402

403-
def process_form_fields(self, fields: any) -> Tuple[Dict, List]:
403+
def process_form_fields(self, fields: Any) -> Tuple[Dict, List]:
404404
"""
405405
process options received through the web form.
406406
we don't look at the cargo data here at all.
@@ -500,3 +500,7 @@ def form_tags(self) -> List:
500500
:return: [tag_1, tag_2,...]
501501
"""
502502
return [opt.format_tag() for opt in self._options]
503+
504+
505+
if __name__ == "__main__":
506+
...

mol2chemfigPy3/options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def getParser() -> OptionParser:
300300
Specify bonds that should be drawn on top of others they cross over.
301301
Give the start and the end atoms.
302302
Example for one bond: --cross-bond=5-6
303-
Example for two bonds: --crossbond=4-8,12-13
303+
Example for two bonds: --cross-bond=4-8,12-13
304304
""",
305305
)
306306
)

0 commit comments

Comments
 (0)