pyopsin 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ include pyopsin/opsin_cli.jar
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyopsin
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A simple python wrapper for OPSIN: Open Parser for Systematic IUPAC nomenclature.
5
5
  Home-page: https://github.com/Dingyun-Huang/pyopsin
6
6
  Author: Dingyun Huang
Binary file
@@ -12,6 +12,7 @@ class PyOpsin:
12
12
  """
13
13
 
14
14
  def __init__(self, path: str = None,
15
+ exit_on_error: bool = True,
15
16
  allowUninterpretableStereo: bool = False,
16
17
  allowRadicals: bool = False,
17
18
  wildcardRadicals: bool = False,
@@ -28,6 +29,8 @@ class PyOpsin:
28
29
  Raises:
29
30
  FileNotFoundError: No opsin cli .jar file was found.
30
31
  """
32
+
33
+ self.exit_on_error = exit_on_error
31
34
 
32
35
  if not path:
33
36
  path = resource_filename(__name__, "opsin_cli.jar")
@@ -77,7 +80,6 @@ class PyOpsin:
77
80
  raise ValueError(
78
81
  "Input name must be a string or a list of strings.")
79
82
 
80
-
81
83
  def to_smiles_single(self, name: str) -> str:
82
84
  """compute a single SMILES of a molecule for its IUPAC name
83
85
 
@@ -87,8 +89,14 @@ class PyOpsin:
87
89
  Returns:
88
90
  str: SMILES of the molecule
89
91
  """
90
-
91
- results = self.nts.parseChemicalName(name, self.config)
92
+ try:
93
+ results = self.nts.parseChemicalName(name, self.config)
94
+ except Exception as e:
95
+ if self.exit_on_error:
96
+ raise ValueError(f"Failed to parse the name: {name} due to exception {e}") from e
97
+ else:
98
+ print(f"Failed to parse the name: {name} due to exception {e}")
99
+ return None
92
100
  return str(results.getSmiles())
93
101
 
94
102
  def to_cml(self, name: str) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyopsin
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A simple python wrapper for OPSIN: Open Parser for Systematic IUPAC nomenclature.
5
5
  Home-page: https://github.com/Dingyun-Huang/pyopsin
6
6
  Author: Dingyun Huang
@@ -1,7 +1,9 @@
1
1
  LICENSE
2
+ MANIFEST.in
2
3
  README.md
3
4
  setup.py
4
5
  pyopsin/__init__.py
6
+ pyopsin/opsin_cli.jar
5
7
  pyopsin/pyopsin.py
6
8
  pyopsin.egg-info/PKG-INFO
7
9
  pyopsin.egg-info/SOURCES.txt
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name='pyopsin',
9
- version='0.2.2',
9
+ version='0.2.3',
10
10
  author='Dingyun Huang',
11
11
  author_email='dh582@cam.ac.uk',
12
12
  description='A simple python wrapper for OPSIN: Open Parser for Systematic IUPAC nomenclature.',
@@ -14,6 +14,7 @@ setup(
14
14
  long_description_content_type="text/markdown",
15
15
  url="https://github.com/Dingyun-Huang/pyopsin",
16
16
  packages=setuptools.find_packages(),
17
+ include_package_data=True,
17
18
  python_requires='>=3.9',
18
19
  install_requires=[
19
20
  'jpype1>=1.2.0',
File without changes
File without changes
File without changes
File without changes