pythonQEPest 2.0.0a4__tar.gz → 2.0.0a5__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.
Files changed (65) hide show
  1. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/PKG-INFO +2 -1
  2. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pyproject.toml +14 -8
  3. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/cli/cli.py +1 -1
  4. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/config/qepest_config.py +1 -3
  5. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/core/qepest.py +3 -4
  6. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/QEPestFile.py +4 -5
  7. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/QEPestInput.py +1 -2
  8. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/QEPestOutput.py +1 -3
  9. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/coefficients/QEPestCoefficientList.py +2 -4
  10. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/normalisation/Normaliser.py +2 -5
  11. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/pest_type/PestTypeCoefficient.py +1 -1
  12. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/actions/actions_other.py +1 -1
  13. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/utility/DataManager.py +1 -1
  14. pythonqepest-2.0.0a5/pythonQEPest/helpers/get_values_from_line.py +2 -0
  15. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/helpers/norm.py +4 -7
  16. pythonqepest-2.0.0a5/pythonQEPest/helpers/round_to_4digs.py +2 -0
  17. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/services/QEPestFileService.py +2 -3
  18. pythonqepest-2.0.0a4/pythonQEPest/helpers/get_values_from_line.py +0 -5
  19. pythonqepest-2.0.0a4/pythonQEPest/helpers/round_to_4digs.py +0 -2
  20. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/LICENSE +0 -0
  21. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/README.md +0 -0
  22. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/.env.example +0 -0
  23. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/__init__.py +0 -0
  24. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/cli/__init__.py +0 -0
  25. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/config/__init__.py +0 -0
  26. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/config/config_provider.py +0 -0
  27. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/config/normalise.py +0 -0
  28. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/config/qepest_default.py +0 -0
  29. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/core/__init__.py +0 -0
  30. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/core/qepest_meta.py +0 -0
  31. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/data.txt +0 -0
  32. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/data.txt.out +0 -0
  33. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/QEPestData.py +0 -0
  34. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/__init__.py +0 -0
  35. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/coefficients/QEPestCoefficient.py +0 -0
  36. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/coefficients/QEPestCoefficientNumerics.py +0 -0
  37. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/coefficients/__init__.py +0 -0
  38. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/normalisation/__init__.py +0 -0
  39. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/pest_type/PestTypeConfig.py +0 -0
  40. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/dto/pest_type/__init__.py +0 -0
  41. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/__init__.py +0 -0
  42. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/actions/__init__.py +0 -0
  43. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/actions/action_clicks.py +0 -0
  44. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/actions/actions_crud.py +0 -0
  45. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/ButtonsFrame.py +0 -0
  46. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/DataTree.py +0 -0
  47. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/EditWindow.py +0 -0
  48. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/Menu.py +0 -0
  49. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/ResultTree.py +0 -0
  50. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/SaveButton.py +0 -0
  51. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/elements/__init__.py +0 -0
  52. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/gui.py +0 -0
  53. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/gui_meta.py +0 -0
  54. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/utility/DataManagerMeta.py +0 -0
  55. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/gui/utility/__init__.py +0 -0
  56. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/helpers/__init__.py +0 -0
  57. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/helpers/check_nan.py +0 -0
  58. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/helpers/compute_df.py +0 -0
  59. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/helpers/get_num_of_cols.py +0 -0
  60. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/logger.py +0 -0
  61. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/main.py +0 -0
  62. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/providers/__init__.py +0 -0
  63. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/providers/default_provider.py +0 -0
  64. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/providers/json_provider.py +0 -0
  65. {pythonqepest-2.0.0a4 → pythonqepest-2.0.0a5}/pythonQEPest/services/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonQEPest
3
- Version: 2.0.0a4
3
+ Version: 2.0.0a5
4
4
  Summary: Java QEPest but written in Python
5
5
  License-File: LICENSE
6
6
  Author: Lina
@@ -16,6 +16,7 @@ Requires-Dist: pydantic (==2.12.5)
16
16
  Requires-Dist: pyperclip (>=1.11.0,<2.0.0) ; extra == "gui"
17
17
  Requires-Dist: python-dotenv (>=1.2.1,<2.0.0)
18
18
  Requires-Dist: rdkit (>=2024.3.1,<2026.0.0) ; extra == "rdkit"
19
+ Requires-Dist: ruff (>=0.15.13,<0.16.0)
19
20
  Description-Content-Type: text/markdown
20
21
 
21
22
  # pythonQEPest
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "pythonQEPest"
3
- version = "2.0.0a4"
3
+ version = "2.0.0a5"
4
4
  description = "Java QEPest but written in Python"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12,<3.15"
7
7
  authors = [{ name = "Lina", email = "knocker767@gmail.com" }]
8
- dependencies = ["pydantic==2.12.5", "python-dotenv>=1.2.1,<2.0.0"]
8
+ dependencies = ["pydantic==2.12.5", "python-dotenv>=1.2.1,<2.0.0", "ruff (>=0.15.13,<0.16.0)"]
9
9
 
10
10
  [project.optional-dependencies]
11
11
  gui = ["pyperclip>=1.11.0,<2.0.0"]
@@ -22,10 +22,10 @@ packages = [{ include = "pythonQEPest" }]
22
22
 
23
23
  [dependency-groups]
24
24
  dev = [
25
- "pytest (>=9.0.0)",
26
- "pre-commit (>=4.3.0,<5.0.0)",
25
+ "pytest (>=9.0.3)",
26
+ "pre-commit (>=4.6.0,<5.0.0)",
27
27
  "pyinstaller (>=6.18.0,<7.0.0)",
28
- "poethepoet[poetry_plugin] (>=0.39.0)",
28
+ "poethepoet[poetry_plugin] (>=0.46.0)",
29
29
  "pytest-cov (>=7.0.0,<8.0.0)",
30
30
  "twine (>=6.2.0,<7.0.0)",
31
31
  ]
@@ -34,11 +34,17 @@ dev = [
34
34
  requires = ["poetry-core>=1.0.0", "setuptools>=40.8.0"]
35
35
  build-backend = "poetry.core.masonry.api"
36
36
 
37
- [tool.flake8]
38
- max-line-length = 88
39
- extend-ignore = ["E203", "W503"]
37
+ [tool.ruff]
38
+ line-length = 88
40
39
  exclude = [".venv", ".git", "__pycache__", "build", "dist"]
41
40
 
41
+ [tool.ruff.lint]
42
+ select = ["E", "F", "W", "B", "C4", "UP"]
43
+ ignore = ["E203"]
44
+
45
+ [tool.ruff.format]
46
+ quote-style = "double"
47
+
42
48
  [tool.poe.tasks]
43
49
  test = "pytest"
44
50
  build-simple = "pyinstaller --onefile pythonQEPest/main.py"
@@ -4,7 +4,7 @@ import argparse
4
4
  import logging
5
5
  from importlib.metadata import PackageNotFoundError, version
6
6
  from pathlib import Path
7
- from typing import Sequence
7
+ from collections.abc import Sequence
8
8
 
9
9
  from pythonQEPest.dto import QEPestFile
10
10
  from pythonQEPest.services.QEPestFileService import QEPestFileService
@@ -1,12 +1,10 @@
1
- from typing import Optional
2
-
3
1
  from pydantic import BaseModel
4
2
 
5
3
  from pythonQEPest.dto.pest_type.PestTypeConfig import PestTypeConfig
6
4
 
7
5
 
8
6
  class QEPestConfig(BaseModel):
9
- name: Optional[str] = "HerbInsectFung"
7
+ name: str | None = "HerbInsectFung"
10
8
  pest_types: list[PestTypeConfig]
11
9
 
12
10
  def get_pest_names(self) -> list[str]:
@@ -1,6 +1,5 @@
1
1
  import logging
2
2
  import math
3
- from typing import Optional
4
3
 
5
4
  from pythonQEPest.config import ConfigProvider
6
5
  from pythonQEPest.core.qepest_meta import QEPestMeta
@@ -20,7 +19,7 @@ logger = logging.getLogger(__name__)
20
19
 
21
20
 
22
21
  class QEPest(QEPestMeta):
23
- def __init__(self, provider: Optional[ConfigProvider] = None, *args, **kwargs):
22
+ def __init__(self, provider: ConfigProvider | None = None, *args, **kwargs):
24
23
  super().__init__(*args, **kwargs)
25
24
 
26
25
  self.config: QEPestConfig
@@ -33,7 +32,7 @@ class QEPest(QEPestMeta):
33
32
 
34
33
  logger.debug("QEPest initialization successful")
35
34
 
36
- def initialise_config(self, provider: Optional[ConfigProvider] = None):
35
+ def initialise_config(self, provider: ConfigProvider | None = None):
37
36
  logger.debug("Config initialisation")
38
37
  if provider is None:
39
38
  logger.debug("Config is empty. Loading default one.")
@@ -65,7 +64,7 @@ class QEPest(QEPestMeta):
65
64
 
66
65
  if len(names) == 0:
67
66
  raise ValueError(
68
- "No pest types configured. " "Please provide a valid configuration."
67
+ "No pest types configured. Please provide a valid configuration."
69
68
  )
70
69
 
71
70
  qe_values = dict.fromkeys(names, 0.0)
@@ -1,5 +1,4 @@
1
1
  from enum import Enum
2
- from typing import Optional
3
2
 
4
3
  from pydantic import BaseModel, model_validator
5
4
 
@@ -10,10 +9,10 @@ class QEPestFormat(Enum):
10
9
 
11
10
 
12
11
  class QEPestFile(BaseModel):
13
- input_file: Optional[str] = None
14
- output_file: Optional[str] = None
15
- format: Optional[QEPestFormat] = QEPestFormat.TXT
16
- smiles: Optional[bool] = False
12
+ input_file: str | None = None
13
+ output_file: str | None = None
14
+ format: QEPestFormat | None = QEPestFormat.TXT
15
+ smiles: bool | None = False
17
16
 
18
17
  model_config = {"arbitrary_types_allowed": True}
19
18
 
@@ -1,5 +1,4 @@
1
1
  import logging
2
- from typing import Union
3
2
 
4
3
  from pydantic import BaseModel
5
4
 
@@ -19,7 +18,7 @@ class QEPestInput(BaseModel):
19
18
  aromatic_rings: int = 0
20
19
 
21
20
  @classmethod
22
- def from_array(cls, data: Union[list, tuple, set]):
21
+ def from_array(cls, data: list | tuple | set):
23
22
  if len(data) != 7:
24
23
  raise ValueError(f"Expected 7 elements, got {len(data)}")
25
24
  return cls(
@@ -1,12 +1,10 @@
1
- from typing import Optional
2
-
3
1
  from pydantic import BaseModel
4
2
  from pythonQEPest.dto.QEPestData import QEPestData
5
3
 
6
4
 
7
5
  class QEPestOutput(BaseModel):
8
6
  data: QEPestData
9
- name: Optional[str] = ""
7
+ name: str | None = ""
10
8
 
11
9
  def to_array(self) -> list:
12
10
  values = list(self.data.root.values())
@@ -1,13 +1,11 @@
1
- from typing import Optional, List
2
-
3
1
  from pydantic import BaseModel
4
2
 
5
3
  from pythonQEPest.dto.coefficients import QEPestCoefficient
6
4
 
7
5
 
8
6
  class QEPestCoefficientList(BaseModel):
9
- name: Optional[str]
10
- named_coefficients: List[QEPestCoefficient]
7
+ name: str | None
8
+ named_coefficients: list[QEPestCoefficient]
11
9
 
12
10
  # TODO: Done all the cases and make some sort of docs here, pls
13
11
  def __init__(self, *args, **kwargs):
@@ -1,14 +1,11 @@
1
- from typing import Union
2
-
3
-
4
1
  class Normaliser:
5
- def __init__(self, arr: Union[tuple, list]):
2
+ def __init__(self, arr: tuple | list):
6
3
  # if len(arr) != 6:
7
4
  # raise ValueError(f"Array must be exact length of 6. Given: {len(arr)}")
8
5
 
9
6
  self.arr = arr
10
7
 
11
- def norm(self, d: Union[int, float], descr: int) -> float:
8
+ def norm(self, d: int | float, descr: int) -> float:
12
9
  if descr > len(self.arr):
13
10
  raise KeyError(f"Out of array. {descr} > {len(self.arr)}")
14
11
 
@@ -22,7 +22,7 @@ class PestTypeCoefficient(BaseModel):
22
22
  raise ValueError("Expected 6 items: mwH, logpH, hbaH, hbdH, rbH, arRCH")
23
23
 
24
24
  keys = ("mwH", "logpH", "hbaH", "hbdH", "rbH", "arRCH")
25
- return dict(zip(keys, data))
25
+ return dict(zip(keys, data, strict=True))
26
26
 
27
27
  raise TypeError("Expected a dict or a 6-item tuple/list")
28
28
 
@@ -22,7 +22,7 @@ class GUIActionsOther:
22
22
  return
23
23
 
24
24
  try:
25
- with open(file_path, "r", encoding="utf-8") as file:
25
+ with open(file_path, encoding="utf-8") as file:
26
26
  self.data_manager.clear_file()
27
27
  self.data_tree.delete(*self.data_tree.get_children())
28
28
 
@@ -26,7 +26,7 @@ class DataManager(metaclass=DataManagerMeta):
26
26
  return self
27
27
 
28
28
  def add(self, lst, entry):
29
- if not entry in lst:
29
+ if entry not in lst:
30
30
  lst.append(entry)
31
31
  return self
32
32
 
@@ -0,0 +1,2 @@
1
+ def get_values_from_line(lst: list | tuple | set) -> list[float]:
2
+ return [float(x) for x in lst[1:]]
@@ -1,7 +1,4 @@
1
- from typing import Union
2
-
3
-
4
- def norm(arr: Union[list, tuple], d: Union[int, float], descr: int) -> float:
1
+ def norm(arr: list | tuple, d: int | float, descr: int) -> float:
5
2
  if descr > len(arr):
6
3
  raise KeyError(f"Out of array. {descr} > {len(arr)}")
7
4
 
@@ -9,7 +6,7 @@ def norm(arr: Union[list, tuple], d: Union[int, float], descr: int) -> float:
9
6
  return d / max_val if max_val != 0 else 0.0
10
7
 
11
8
 
12
- def norm_h(d: Union[int, float], descr: int) -> float:
9
+ def norm_h(d: int | float, descr: int) -> float:
13
10
  return norm(
14
11
  (69.5849922, 94.4228257, 120.4572352, 228.1589796, 89.7012502, 276.9634213),
15
12
  d,
@@ -17,7 +14,7 @@ def norm_h(d: Union[int, float], descr: int) -> float:
17
14
  )
18
15
 
19
16
 
20
- def norm_i(d: Union[int, float], descr: int) -> float:
17
+ def norm_i(d: int | float, descr: int) -> float:
21
18
  return norm(
22
19
  (78.2919965, 71.2829691, 133.9224801, 331.170104, 70.5540709, 193.0023343),
23
20
  d,
@@ -25,7 +22,7 @@ def norm_i(d: Union[int, float], descr: int) -> float:
25
22
  )
26
23
 
27
24
 
28
- def norm_f(d: Union[int, float], descr: int) -> float:
25
+ def norm_f(d: int | float, descr: int) -> float:
29
26
  return norm(
30
27
  (53.3719946, 52.773116, 73.7976536, 144.9887053, 41.4385926, 102.3024319),
31
28
  d,
@@ -0,0 +1,2 @@
1
+ def round_to_4digs(q) -> float:
2
+ return float(f"{q:.4f}")
@@ -11,7 +11,6 @@ logger = logging.getLogger(__name__)
11
11
 
12
12
 
13
13
  class QEPestFileService:
14
-
15
14
  def __init__(self, qepest: QEPestMeta, qepest_file: QEPestFile):
16
15
  self.qepest = qepest
17
16
  self.qepest_file = qepest_file
@@ -59,7 +58,7 @@ class QEPestFileService:
59
58
 
60
59
  def _read_smiles_file(self) -> None:
61
60
  try:
62
- with open(self.qepest_file.input_file, "r") as f:
61
+ with open(self.qepest_file.input_file) as f:
63
62
  lines = f.readlines()
64
63
 
65
64
  with open(self.qepest_file.output_file, "w") as wr:
@@ -91,7 +90,7 @@ class QEPestFileService:
91
90
 
92
91
  def _read_descriptor_file(self) -> None:
93
92
  try:
94
- with open(self.qepest_file.input_file, "r") as f:
93
+ with open(self.qepest_file.input_file) as f:
95
94
  lines = f.readlines()
96
95
 
97
96
  with open(self.qepest_file.output_file, "w") as wr:
@@ -1,5 +0,0 @@
1
- from typing import Union
2
-
3
-
4
- def get_values_from_line(lst: Union[list, tuple, set]) -> list[float]:
5
- return [float(x) for x in lst[1:]]
@@ -1,2 +0,0 @@
1
- def round_to_4digs(q) -> float:
2
- return float("{:.4f}".format(q))
File without changes
File without changes