Loglan-Core 0.4.7__tar.gz → 0.4.9__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 (35) hide show
  1. {loglan_core-0.4.7 → loglan_core-0.4.9/Loglan_Core.egg-info}/PKG-INFO +2 -2
  2. {loglan_core-0.4.7 → loglan_core-0.4.9}/Loglan_Core.egg-info/SOURCES.txt +0 -2
  3. {loglan_core-0.4.7/Loglan_Core.egg-info → loglan_core-0.4.9}/PKG-INFO +2 -2
  4. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/base_selector.py +29 -24
  5. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/utils.py +0 -2
  6. {loglan_core-0.4.7 → loglan_core-0.4.9}/pyproject.toml +2 -2
  7. loglan_core-0.4.9/setup.cfg +4 -0
  8. loglan_core-0.4.7/setup.cfg +0 -7
  9. loglan_core-0.4.7/setup.py +0 -9
  10. {loglan_core-0.4.7 → loglan_core-0.4.9}/LICENSE +0 -0
  11. {loglan_core-0.4.7 → loglan_core-0.4.9}/Loglan_Core.egg-info/dependency_links.txt +0 -0
  12. {loglan_core-0.4.7 → loglan_core-0.4.9}/Loglan_Core.egg-info/requires.txt +0 -0
  13. {loglan_core-0.4.7 → loglan_core-0.4.9}/Loglan_Core.egg-info/top_level.txt +0 -0
  14. {loglan_core-0.4.7 → loglan_core-0.4.9}/README.md +0 -0
  15. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/__init__.py +0 -0
  16. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/__init__.py +0 -0
  17. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/definition_selector.py +0 -0
  18. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/export_word_converter.py +0 -0
  19. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/exporter.py +0 -0
  20. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/key_selector.py +0 -0
  21. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/word_linker.py +0 -0
  22. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/word_selector.py +0 -0
  23. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/addons/word_sourcer.py +0 -0
  24. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/author.py +0 -0
  25. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/base.py +0 -0
  26. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/connect_tables.py +0 -0
  27. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/definition.py +0 -0
  28. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/event.py +0 -0
  29. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/key.py +0 -0
  30. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/setting.py +0 -0
  31. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/syllable.py +0 -0
  32. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/table_names.py +0 -0
  33. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/type.py +0 -0
  34. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/word.py +0 -0
  35. {loglan_core-0.4.7 → loglan_core-0.4.9}/loglan_core/word_spell.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Loglan-Core
3
- Version: 0.4.7
3
+ Version: 0.4.9
4
4
  Summary: Loglan Dictionary Database Model for SQLAlchemy
5
5
  Author-email: torrua <torrua@gmail.com>
6
6
  License: MIT
7
- Project-URL: Download, https://github.com/torrua/loglan_core/archive/0.4.7.tar.gz
7
+ Project-URL: Download, https://github.com/torrua/loglan_core/archive/0.4.9.tar.gz
8
8
  Project-URL: Homepage, https://github.com/torrua/loglan_core
9
9
  Project-URL: Repository, https://github.com/torrua/loglan_core
10
10
  Keywords: Loglan,Dictionary,Database,Model,LOD
@@ -1,8 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- setup.cfg
5
- setup.py
6
4
  Loglan_Core.egg-info/PKG-INFO
7
5
  Loglan_Core.egg-info/SOURCES.txt
8
6
  Loglan_Core.egg-info/dependency_links.txt
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Loglan-Core
3
- Version: 0.4.7
3
+ Version: 0.4.9
4
4
  Summary: Loglan Dictionary Database Model for SQLAlchemy
5
5
  Author-email: torrua <torrua@gmail.com>
6
6
  License: MIT
7
- Project-URL: Download, https://github.com/torrua/loglan_core/archive/0.4.7.tar.gz
7
+ Project-URL: Download, https://github.com/torrua/loglan_core/archive/0.4.9.tar.gz
8
8
  Project-URL: Homepage, https://github.com/torrua/loglan_core
9
9
  Project-URL: Repository, https://github.com/torrua/loglan_core
10
10
  Keywords: Loglan,Dictionary,Database,Model,LOD
@@ -2,8 +2,6 @@
2
2
  This module provides a base selector for SQLAlchemy
3
3
  """
4
4
 
5
- from __future__ import annotations
6
-
7
5
  from typing import Type, Iterable, Any
8
6
 
9
7
  from sqlalchemy import select, Select
@@ -46,7 +44,7 @@ class BaseSelector: # pylint: disable=too-many-ancestors
46
44
  """Initializes the Selector.
47
45
 
48
46
  Args:
49
- model (Type): The SQLAlchemy model class to query.
47
+ model (Type): The SQLAlchemy model class to select from.
50
48
  is_sqlite (bool): Flag indicating if the database is SQLite.
51
49
  case_sensitive (bool): Flag indicating if the queries should be case-sensitive.
52
50
  disable_model_check (bool): Flag indicating if the model check should be disabled.
@@ -62,27 +60,30 @@ class BaseSelector: # pylint: disable=too-many-ancestors
62
60
  self.is_sqlite = is_sqlite
63
61
  self.case_sensitive = case_sensitive
64
62
 
65
- def execute(self, session: Session):
63
+ def execute(self, session: Session, unique: bool = False) -> Any:
66
64
  """Executes the given session and returns the result.
67
65
 
68
66
  Args:
69
67
  session (Session): SQLAlchemy Session object.
70
-
68
+ unique (bool, optional): Flag indicating if the result should be unique.
69
+ Defaults to False.
71
70
  Returns:
72
71
  ResultProxy: The result of the executed session.
73
72
  """
74
- return session.execute(self._statement)
73
+ result = session.execute(self._statement)
74
+ return result.unique() if unique else result
75
75
 
76
- def all(self, session: Session):
76
+ def all(self, session: Session, unique: bool = False):
77
77
  """Executes the given session and returns all the results as a list.
78
78
 
79
79
  Args:
80
80
  session (Session): SQLAlchemy Session object.
81
-
81
+ unique (bool, optional): Flag indicating if the result should contain unique items.
82
+ Defaults to False.
82
83
  Returns:
83
84
  List[ResultRow]: All the results of the executed session.
84
85
  """
85
- return session.execute(self._statement).scalars().all()
86
+ return self.execute(session, unique).scalars().all()
86
87
 
87
88
  def scalar(self, session: Session):
88
89
  """Executes the given session and returns a scalar result.
@@ -93,19 +94,34 @@ class BaseSelector: # pylint: disable=too-many-ancestors
93
94
  Returns:
94
95
  Any: The scalar result of the executed session.
95
96
  """
96
- return session.execute(self._statement).scalar()
97
+ return self.execute(session).scalar()
97
98
 
98
- def fetchmany(self, session: Session, size: int | None = None):
99
+ def fetchmany(
100
+ self, session: Session, size: int | None = None, unique: bool = False
101
+ ):
99
102
  """Executes the given session and fetches a specified number of results.
100
103
 
101
104
  Args:
102
105
  session (Session): SQLAlchemy Session object.
103
106
  size (int, optional): Number of results to fetch. If None, fetches all results.
104
-
107
+ unique (bool, optional): Flag indicating if the result should contain unique items.
108
+ Defaults to False.
105
109
  Returns:
106
110
  List[ResultRow]: The fetched results.
107
111
  """
108
- return session.execute(self._statement).scalars().fetchmany(size)
112
+ return self.execute(session, unique).scalars().fetchmany(size)
113
+
114
+ def __call__(self, session: Session, unique: bool = False) -> list:
115
+ """Execute the current _statement and return the results.
116
+
117
+ Args:
118
+ session (Session): The SQLAlchemy session to use for executing the query.
119
+ unique (bool, optional): Flag indicating if the result should contain unique items.
120
+ Defaults to False.
121
+ Returns:
122
+ list: The results of the query.
123
+ """
124
+ return self.all(session, unique)
109
125
 
110
126
  def select_columns(self, *columns: type[BaseModel]) -> Self:
111
127
  """Specify which columns to select without resetting the filters.
@@ -254,17 +270,6 @@ class BaseSelector: # pylint: disable=too-many-ancestors
254
270
  """
255
271
  return self._statement
256
272
 
257
- def __call__(self, session: Session):
258
- """Execute the current _statement and return the results.
259
-
260
- Args:
261
- session (Session): The SQLAlchemy session to use for executing the query.
262
-
263
- Returns:
264
- list: The results of the query.
265
- """
266
- return self.all(session)
267
-
268
273
  def with_relationships(self, selected: Iterable[str] | None = None) -> Self:
269
274
  """Adds relationships to the query.
270
275
 
@@ -2,8 +2,6 @@
2
2
  This module provides utility functions for the loglan_core package.
3
3
  """
4
4
 
5
- from __future__ import annotations
6
-
7
5
  from sqlalchemy import select, true, func
8
6
  from sqlalchemy.sql.elements import BinaryExpression
9
7
  from sqlalchemy.sql.elements import BooleanClauseList
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [project]
6
6
  name = "Loglan-Core"
7
- version = "0.4.7" # Placeholder, will be replaced by the script
7
+ version = "0.4.9"
8
8
  description = "Loglan Dictionary Database Model for SQLAlchemy"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -29,7 +29,7 @@ dependencies = [
29
29
  ]
30
30
 
31
31
  [project.urls]
32
- "Download" = "https://github.com/torrua/loglan_core/archive/0.4.7.tar.gz" # Placeholder, will be replaced by the script
32
+ "Download" = "https://github.com/torrua/loglan_core/archive/0.4.9.tar.gz"
33
33
  "Homepage" = "https://github.com/torrua/loglan_core"
34
34
  "Repository" = "https://github.com/torrua/loglan_core"
35
35
 
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,7 +0,0 @@
1
- [metadata]
2
- description_file = README.md
3
-
4
- [egg_info]
5
- tag_build =
6
- tag_date = 0
7
-
@@ -1,9 +0,0 @@
1
- from setuptools import setup
2
-
3
-
4
- setup(
5
- package_data={
6
- "loglan_core": ["*"],
7
- },
8
- include_package_data=True,
9
- )
File without changes
File without changes