Loglan-Core 0.4.2__tar.gz → 0.4.4__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.2 → loglan_core-0.4.4/Loglan_Core.egg-info}/PKG-INFO +2 -2
- {loglan_core-0.4.2/Loglan_Core.egg-info → loglan_core-0.4.4}/PKG-INFO +2 -2
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/__init__.py +11 -2
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/base_selector.py +20 -2
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/definition.py +5 -6
- {loglan_core-0.4.2 → loglan_core-0.4.4}/setup.py +1 -1
- {loglan_core-0.4.2 → loglan_core-0.4.4}/LICENSE +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/Loglan_Core.egg-info/SOURCES.txt +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/Loglan_Core.egg-info/dependency_links.txt +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/Loglan_Core.egg-info/requires.txt +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/Loglan_Core.egg-info/top_level.txt +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/README.md +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/__init__.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/definition_selector.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/export_word_converter.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/exporter.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/key_selector.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/utils.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/word_linker.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/word_selector.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/addons/word_sourcer.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/author.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/base.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/connect_tables.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/event.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/key.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/setting.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/syllable.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/table_names.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/type.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/word.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/loglan_core/word_spell.py +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/pyproject.toml +0 -0
- {loglan_core-0.4.2 → loglan_core-0.4.4}/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.4
|
|
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.4.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.4
|
|
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.4.tar.gz
|
|
7
7
|
Author: torrua
|
|
8
8
|
Author-email: torrua@gmail.com
|
|
9
9
|
License: MIT
|
|
@@ -8,12 +8,15 @@ __author__ = "torrua"
|
|
|
8
8
|
__copyright__ = "Copyright 2024, loglan_core project"
|
|
9
9
|
__email__ = "torrua@gmail.com"
|
|
10
10
|
|
|
11
|
-
from loglan_core.author import BaseAuthor as Author
|
|
12
11
|
from loglan_core.connect_tables import (
|
|
13
12
|
t_connect_authors,
|
|
14
13
|
t_connect_words,
|
|
15
14
|
t_connect_keys,
|
|
16
15
|
)
|
|
16
|
+
|
|
17
|
+
from loglan_core.base import BaseModel as Base
|
|
18
|
+
|
|
19
|
+
from loglan_core.author import BaseAuthor as Author
|
|
17
20
|
from loglan_core.definition import BaseDefinition as Definition
|
|
18
21
|
from loglan_core.event import BaseEvent as Event
|
|
19
22
|
from loglan_core.key import BaseKey as Key
|
|
@@ -23,5 +26,11 @@ from loglan_core.type import BaseType as Type
|
|
|
23
26
|
from loglan_core.word import BaseWord as Word
|
|
24
27
|
from loglan_core.word_spell import BaseWordSpell as WordSpell
|
|
25
28
|
|
|
26
|
-
from loglan_core.
|
|
29
|
+
from loglan_core.addons.base_selector import BaseSelector
|
|
30
|
+
from loglan_core.addons.definition_selector import DefinitionSelector
|
|
31
|
+
from loglan_core.addons.key_selector import KeySelector
|
|
27
32
|
from loglan_core.addons.word_selector import WordSelector
|
|
33
|
+
|
|
34
|
+
from loglan_core.addons.export_word_converter import ExportWordConverter
|
|
35
|
+
from loglan_core.addons.exporter import Exporter
|
|
36
|
+
from loglan_core.addons.word_linker import WordLinker
|
|
@@ -7,7 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
from typing import Type, Iterable, Any
|
|
8
8
|
|
|
9
9
|
from sqlalchemy import select, Select
|
|
10
|
-
from sqlalchemy.orm import Session,
|
|
10
|
+
from sqlalchemy.orm import Session, InstrumentedAttribute, joinedload
|
|
11
11
|
from typing_extensions import Self
|
|
12
12
|
|
|
13
13
|
from loglan_core.base import BaseModel
|
|
@@ -204,6 +204,24 @@ class BaseSelector: # pylint: disable=too-many-ancestors
|
|
|
204
204
|
self._statement = self._statement.where(*args)
|
|
205
205
|
return self
|
|
206
206
|
|
|
207
|
+
def where_like(self, **kwargs) -> Self:
|
|
208
|
+
"""Filter results based on arbitrary keyword arguments.
|
|
209
|
+
Use internal method `_generate_column_condition` to generate
|
|
210
|
+
the condition based on settings provided by Selector instance
|
|
211
|
+
like (is_sqlite, case_sensitive).
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
**kwargs: Column-value pairs to filter by.
|
|
215
|
+
|
|
216
|
+
Returns:
|
|
217
|
+
Self: The current instance for method chaining.
|
|
218
|
+
"""
|
|
219
|
+
for key, value in kwargs.items():
|
|
220
|
+
self._statement = self._statement.where(
|
|
221
|
+
self._generate_column_condition(key, value)
|
|
222
|
+
)
|
|
223
|
+
return self
|
|
224
|
+
|
|
207
225
|
def _generate_column_condition(self, key: str | InstrumentedAttribute, value: Any):
|
|
208
226
|
column = getattr(self.model, key, None) if isinstance(key, str) else key
|
|
209
227
|
if column is None:
|
|
@@ -260,7 +278,7 @@ class BaseSelector: # pylint: disable=too-many-ancestors
|
|
|
260
278
|
attr: getattr(self.model, attr) for attr in self.model.relationships()
|
|
261
279
|
}
|
|
262
280
|
relationships = {
|
|
263
|
-
|
|
281
|
+
joinedload(v)
|
|
264
282
|
for k, v in available_relationships.items()
|
|
265
283
|
if not selected or k in selected
|
|
266
284
|
}
|
|
@@ -112,12 +112,11 @@ class BaseDefinition(BaseModel):
|
|
|
112
112
|
@property
|
|
113
113
|
def grammar(self) -> str:
|
|
114
114
|
"""
|
|
115
|
-
Combine definition's 'slots' and 'grammar_code' attributes
|
|
115
|
+
Combine definition's 'slots' and 'grammar_code' attributes.
|
|
116
116
|
|
|
117
117
|
Returns:
|
|
118
|
-
String with grammar data like (3v) or (2n)
|
|
118
|
+
String with grammar data like (3v) or (2n), or an empty string if both are None.
|
|
119
119
|
"""
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
)
|
|
120
|
+
sl_str = self.slots or ""
|
|
121
|
+
gr_str = self.grammar_code or ""
|
|
122
|
+
return f"({sl_str}{gr_str})" if sl_str or gr_str else ""
|
|
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
|