pixeltable 0.2.13__py3-none-any.whl → 0.2.14__py3-none-any.whl
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.
Potentially problematic release.
This version of pixeltable might be problematic. Click here for more details.
- pixeltable/__init__.py +1 -1
- pixeltable/__version__.py +2 -2
- pixeltable/catalog/column.py +5 -0
- pixeltable/catalog/globals.py +8 -0
- pixeltable/catalog/table.py +22 -4
- pixeltable/catalog/table_version.py +30 -55
- pixeltable/catalog/view.py +1 -1
- pixeltable/exec/__init__.py +2 -1
- pixeltable/exec/row_update_node.py +61 -0
- pixeltable/exec/{sql_scan_node.py → sql_node.py} +120 -56
- pixeltable/exprs/__init__.py +1 -1
- pixeltable/exprs/expr.py +35 -22
- pixeltable/exprs/function_call.py +60 -29
- pixeltable/exprs/globals.py +2 -0
- pixeltable/exprs/inline_array.py +18 -11
- pixeltable/exprs/method_ref.py +63 -0
- pixeltable/ext/__init__.py +9 -0
- pixeltable/ext/functions/__init__.py +8 -0
- pixeltable/ext/functions/whisperx.py +45 -5
- pixeltable/ext/functions/yolox.py +60 -14
- pixeltable/func/callable_function.py +12 -4
- pixeltable/func/expr_template_function.py +1 -1
- pixeltable/func/function.py +12 -2
- pixeltable/func/function_registry.py +24 -9
- pixeltable/func/udf.py +32 -4
- pixeltable/functions/__init__.py +1 -1
- pixeltable/functions/fireworks.py +33 -0
- pixeltable/functions/huggingface.py +96 -6
- pixeltable/functions/image.py +226 -41
- pixeltable/functions/openai.py +214 -0
- pixeltable/functions/string.py +195 -218
- pixeltable/functions/timestamp.py +210 -0
- pixeltable/functions/together.py +106 -0
- pixeltable/functions/video.py +2 -2
- pixeltable/functions/whisper.py +32 -0
- pixeltable/io/__init__.py +1 -1
- pixeltable/io/globals.py +133 -1
- pixeltable/io/pandas.py +52 -27
- pixeltable/metadata/__init__.py +1 -1
- pixeltable/metadata/converters/convert_18.py +39 -0
- pixeltable/metadata/notes.py +10 -0
- pixeltable/plan.py +76 -1
- pixeltable/tool/create_test_db_dump.py +3 -4
- pixeltable/tool/doc_plugins/griffe.py +4 -0
- pixeltable/type_system.py +15 -14
- {pixeltable-0.2.13.dist-info → pixeltable-0.2.14.dist-info}/METADATA +1 -1
- {pixeltable-0.2.13.dist-info → pixeltable-0.2.14.dist-info}/RECORD +50 -45
- pixeltable/exprs/image_member_access.py +0 -96
- {pixeltable-0.2.13.dist-info → pixeltable-0.2.14.dist-info}/LICENSE +0 -0
- {pixeltable-0.2.13.dist-info → pixeltable-0.2.14.dist-info}/WHEEL +0 -0
- {pixeltable-0.2.13.dist-info → pixeltable-0.2.14.dist-info}/entry_points.txt +0 -0
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Optional, List, Any, Dict, Tuple
|
|
4
|
-
|
|
5
|
-
import PIL
|
|
6
|
-
import sqlalchemy as sql
|
|
7
|
-
|
|
8
|
-
import pixeltable.exceptions as excs
|
|
9
|
-
import pixeltable.func as func
|
|
10
|
-
import pixeltable.type_system as ts
|
|
11
|
-
from .data_row import DataRow
|
|
12
|
-
from .expr import Expr
|
|
13
|
-
from .function_call import FunctionCall
|
|
14
|
-
from .row_builder import RowBuilder
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# TODO: this doesn't dig up all attrs for actual jpeg images
|
|
18
|
-
def _create_pil_attr_info() -> Dict[str, ts.ColumnType]:
|
|
19
|
-
# create random Image to inspect for attrs
|
|
20
|
-
img = PIL.Image.new('RGB', (100, 100))
|
|
21
|
-
# we're only interested in public attrs (including properties)
|
|
22
|
-
result: Dict[str, ts.ColumnType] = {}
|
|
23
|
-
for name in [name for name in dir(img) if not callable(getattr(img, name)) and not name.startswith('_')]:
|
|
24
|
-
if getattr(img, name) is None:
|
|
25
|
-
continue
|
|
26
|
-
if isinstance(getattr(img, name), str):
|
|
27
|
-
result[name] = ts.StringType()
|
|
28
|
-
if isinstance(getattr(img, name), int):
|
|
29
|
-
result[name] = ts.IntType()
|
|
30
|
-
if getattr(img, name) is dict:
|
|
31
|
-
result[name] = ts.JsonType()
|
|
32
|
-
return result
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class ImageMemberAccess(Expr):
|
|
36
|
-
"""
|
|
37
|
-
Access of either an attribute or function member of PIL.Image.Image.
|
|
38
|
-
Ex.: tbl.img_col_ref.rotate(90), tbl.img_col_ref.width
|
|
39
|
-
TODO: remove this class and use FunctionCall instead (attributes to be replaced by functions)
|
|
40
|
-
"""
|
|
41
|
-
attr_info = _create_pil_attr_info()
|
|
42
|
-
|
|
43
|
-
def __init__(self, member_name: str, caller: Expr):
|
|
44
|
-
if member_name in self.attr_info:
|
|
45
|
-
super().__init__(self.attr_info[member_name])
|
|
46
|
-
else:
|
|
47
|
-
candidates = func.FunctionRegistry.get().get_type_methods(member_name, ts.ColumnType.Type.IMAGE)
|
|
48
|
-
if len(candidates) == 0:
|
|
49
|
-
raise excs.Error(f'Unknown Image member: {member_name}')
|
|
50
|
-
if len(candidates) > 1:
|
|
51
|
-
raise excs.Error(f'Ambiguous Image method: {member_name}')
|
|
52
|
-
self.img_method = candidates[0]
|
|
53
|
-
super().__init__(ts.InvalidType()) # requires FunctionCall to return value
|
|
54
|
-
self.member_name = member_name
|
|
55
|
-
self.components = [caller]
|
|
56
|
-
self.id = self._create_id()
|
|
57
|
-
|
|
58
|
-
def default_column_name(self) -> Optional[str]:
|
|
59
|
-
return self.member_name.replace('.', '_')
|
|
60
|
-
|
|
61
|
-
@property
|
|
62
|
-
def _caller(self) -> Expr:
|
|
63
|
-
return self.components[0]
|
|
64
|
-
|
|
65
|
-
def __str__(self) -> str:
|
|
66
|
-
return f'{self._caller}.{self.member_name}'
|
|
67
|
-
|
|
68
|
-
def _as_dict(self) -> Dict:
|
|
69
|
-
return {'member_name': self.member_name, **super()._as_dict()}
|
|
70
|
-
|
|
71
|
-
@classmethod
|
|
72
|
-
def _from_dict(cls, d: Dict, components: List[Expr]) -> Expr:
|
|
73
|
-
assert 'member_name' in d
|
|
74
|
-
assert len(components) == 1
|
|
75
|
-
return cls(d['member_name'], components[0])
|
|
76
|
-
|
|
77
|
-
def __call__(self, *args, **kwargs) -> FunctionCall:
|
|
78
|
-
result = self.img_method(*[self._caller, *args], **kwargs)
|
|
79
|
-
result.is_method_call = True
|
|
80
|
-
return result
|
|
81
|
-
|
|
82
|
-
def _equals(self, other: ImageMemberAccess) -> bool:
|
|
83
|
-
return self.member_name == other.member_name
|
|
84
|
-
|
|
85
|
-
def _id_attrs(self) -> List[Tuple[str, Any]]:
|
|
86
|
-
return super()._id_attrs() + [('member_name', self.member_name)]
|
|
87
|
-
|
|
88
|
-
def sql_expr(self) -> Optional[sql.ClauseElement]:
|
|
89
|
-
return None
|
|
90
|
-
|
|
91
|
-
def eval(self, data_row: DataRow, row_builder: RowBuilder) -> None:
|
|
92
|
-
caller_val = data_row[self._caller.slot_idx]
|
|
93
|
-
try:
|
|
94
|
-
data_row[self.slot_idx] = getattr(caller_val, self.member_name)
|
|
95
|
-
except AttributeError:
|
|
96
|
-
data_row[self.slot_idx] = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|