Loglan-Core 0.4.1__tar.gz → 0.4.2__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.
- {loglan_core-0.4.1 → loglan_core-0.4.2/Loglan_Core.egg-info}/PKG-INFO +2 -2
- {loglan_core-0.4.1/Loglan_Core.egg-info → loglan_core-0.4.2}/PKG-INFO +2 -2
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/base_selector.py +31 -6
- {loglan_core-0.4.1 → loglan_core-0.4.2}/setup.py +1 -1
- {loglan_core-0.4.1 → loglan_core-0.4.2}/LICENSE +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/Loglan_Core.egg-info/SOURCES.txt +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/Loglan_Core.egg-info/dependency_links.txt +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/Loglan_Core.egg-info/requires.txt +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/Loglan_Core.egg-info/top_level.txt +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/README.md +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/__init__.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/__init__.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/definition_selector.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/export_word_converter.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/exporter.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/key_selector.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/utils.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/word_linker.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/word_selector.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/addons/word_sourcer.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/author.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/base.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/connect_tables.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/definition.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/event.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/key.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/setting.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/syllable.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/table_names.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/type.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/word.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/loglan_core/word_spell.py +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/pyproject.toml +0 -0
- {loglan_core-0.4.1 → loglan_core-0.4.2}/setup.cfg +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Loglan-Core
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Loglan Dictionary Database Model for SQLAlchemy
|
|
5
5
|
Home-page: https://github.com/torrua/loglan_core
|
|
6
|
-
Download-URL: https://github.com/torrua/loglan_core/archive/0.4.
|
|
6
|
+
Download-URL: https://github.com/torrua/loglan_core/archive/0.4.2.tar.gz
|
|
7
7
|
Author: torrua
|
|
8
8
|
Author-email: torrua@gmail.com
|
|
9
9
|
License: MIT
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Loglan-Core
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Loglan Dictionary Database Model for SQLAlchemy
|
|
5
5
|
Home-page: https://github.com/torrua/loglan_core
|
|
6
|
-
Download-URL: https://github.com/torrua/loglan_core/archive/0.4.
|
|
6
|
+
Download-URL: https://github.com/torrua/loglan_core/archive/0.4.2.tar.gz
|
|
7
7
|
Author: torrua
|
|
8
8
|
Author-email: torrua@gmail.com
|
|
9
9
|
License: MIT
|
|
@@ -6,7 +6,7 @@ from __future__ import annotations
|
|
|
6
6
|
|
|
7
7
|
from typing import Type, Iterable, Any
|
|
8
8
|
|
|
9
|
-
from sqlalchemy import
|
|
9
|
+
from sqlalchemy import select, Select
|
|
10
10
|
from sqlalchemy.orm import Session, selectinload, InstrumentedAttribute
|
|
11
11
|
from typing_extensions import Self
|
|
12
12
|
|
|
@@ -164,25 +164,50 @@ class BaseSelector: # pylint: disable=too-many-ancestors
|
|
|
164
164
|
self._statement = self._statement.order_by(*columns)
|
|
165
165
|
return self
|
|
166
166
|
|
|
167
|
+
def filter(self, *args) -> Self:
|
|
168
|
+
"""Filter results based on arbitrary keyword arguments.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
*args: Column-value pairs to filter by.
|
|
172
|
+
|
|
173
|
+
Returns:
|
|
174
|
+
Self: The current instance for method chaining.
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
self._statement = self._statement.filter(*args)
|
|
178
|
+
|
|
179
|
+
return self
|
|
180
|
+
|
|
167
181
|
def filter_by(self, **kwargs) -> Self:
|
|
168
182
|
"""Filter results based on arbitrary keyword arguments.
|
|
169
183
|
|
|
170
184
|
Args:
|
|
171
|
-
|
|
185
|
+
*kwargs: Column-value pairs to filter by.
|
|
172
186
|
|
|
173
187
|
Returns:
|
|
174
188
|
Self: The current instance for method chaining.
|
|
175
189
|
"""
|
|
176
|
-
for key, value in kwargs.items():
|
|
177
|
-
condition = self._generate_column_condition(key, value)
|
|
178
|
-
self._statement = self._statement.where(condition)
|
|
179
190
|
|
|
191
|
+
self._statement = self._statement.filter_by(**kwargs)
|
|
192
|
+
|
|
193
|
+
return self
|
|
194
|
+
|
|
195
|
+
def where(self, *args) -> Self:
|
|
196
|
+
"""Filter results based on arbitrary keyword arguments.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
*args: Column-value pairs to filter by.
|
|
200
|
+
|
|
201
|
+
Returns:
|
|
202
|
+
Self: The current instance for method chaining.
|
|
203
|
+
"""
|
|
204
|
+
self._statement = self._statement.where(*args)
|
|
180
205
|
return self
|
|
181
206
|
|
|
182
207
|
def _generate_column_condition(self, key: str | InstrumentedAttribute, value: Any):
|
|
183
208
|
column = getattr(self.model, key, None) if isinstance(key, str) else key
|
|
184
209
|
if column is None:
|
|
185
|
-
|
|
210
|
+
raise AttributeError(f"Model {self.model} has no attribute {key}")
|
|
186
211
|
|
|
187
212
|
value = str(value).replace("*", "%")
|
|
188
213
|
if self.case_sensitive:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|