pixeltable 0.2.19__py3-none-any.whl → 0.2.21__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.

Files changed (88) hide show
  1. pixeltable/__init__.py +7 -19
  2. pixeltable/__version__.py +2 -2
  3. pixeltable/catalog/__init__.py +7 -7
  4. pixeltable/catalog/globals.py +3 -0
  5. pixeltable/catalog/insertable_table.py +9 -7
  6. pixeltable/catalog/table.py +220 -143
  7. pixeltable/catalog/table_version.py +36 -18
  8. pixeltable/catalog/table_version_path.py +0 -8
  9. pixeltable/catalog/view.py +3 -3
  10. pixeltable/dataframe.py +9 -24
  11. pixeltable/env.py +107 -36
  12. pixeltable/exceptions.py +7 -4
  13. pixeltable/exec/__init__.py +1 -1
  14. pixeltable/exec/aggregation_node.py +22 -15
  15. pixeltable/exec/component_iteration_node.py +62 -41
  16. pixeltable/exec/data_row_batch.py +7 -7
  17. pixeltable/exec/exec_node.py +35 -7
  18. pixeltable/exec/expr_eval_node.py +2 -1
  19. pixeltable/exec/in_memory_data_node.py +9 -9
  20. pixeltable/exec/sql_node.py +265 -136
  21. pixeltable/exprs/__init__.py +1 -0
  22. pixeltable/exprs/data_row.py +30 -19
  23. pixeltable/exprs/expr.py +15 -14
  24. pixeltable/exprs/expr_dict.py +55 -0
  25. pixeltable/exprs/expr_set.py +21 -15
  26. pixeltable/exprs/function_call.py +21 -8
  27. pixeltable/exprs/json_path.py +3 -6
  28. pixeltable/exprs/rowid_ref.py +2 -2
  29. pixeltable/exprs/sql_element_cache.py +5 -1
  30. pixeltable/ext/functions/whisperx.py +7 -2
  31. pixeltable/func/callable_function.py +2 -2
  32. pixeltable/func/function_registry.py +6 -7
  33. pixeltable/func/query_template_function.py +11 -12
  34. pixeltable/func/signature.py +17 -15
  35. pixeltable/func/udf.py +0 -4
  36. pixeltable/functions/__init__.py +1 -1
  37. pixeltable/functions/audio.py +4 -6
  38. pixeltable/functions/globals.py +86 -42
  39. pixeltable/functions/huggingface.py +12 -14
  40. pixeltable/functions/image.py +59 -45
  41. pixeltable/functions/json.py +0 -1
  42. pixeltable/functions/mistralai.py +2 -2
  43. pixeltable/functions/openai.py +22 -25
  44. pixeltable/functions/string.py +50 -50
  45. pixeltable/functions/timestamp.py +20 -20
  46. pixeltable/functions/together.py +26 -12
  47. pixeltable/functions/video.py +11 -20
  48. pixeltable/functions/whisper.py +2 -20
  49. pixeltable/globals.py +57 -56
  50. pixeltable/index/base.py +2 -2
  51. pixeltable/index/btree.py +7 -7
  52. pixeltable/index/embedding_index.py +8 -10
  53. pixeltable/io/external_store.py +11 -5
  54. pixeltable/io/globals.py +3 -1
  55. pixeltable/io/hf_datasets.py +4 -4
  56. pixeltable/io/label_studio.py +6 -6
  57. pixeltable/io/parquet.py +14 -13
  58. pixeltable/iterators/document.py +10 -8
  59. pixeltable/iterators/video.py +10 -1
  60. pixeltable/metadata/__init__.py +3 -2
  61. pixeltable/metadata/converters/convert_14.py +4 -2
  62. pixeltable/metadata/converters/convert_15.py +1 -1
  63. pixeltable/metadata/converters/convert_19.py +1 -0
  64. pixeltable/metadata/converters/convert_20.py +1 -1
  65. pixeltable/metadata/converters/util.py +9 -8
  66. pixeltable/metadata/schema.py +32 -21
  67. pixeltable/plan.py +136 -154
  68. pixeltable/store.py +51 -36
  69. pixeltable/tool/create_test_db_dump.py +7 -7
  70. pixeltable/tool/doc_plugins/griffe.py +3 -34
  71. pixeltable/tool/mypy_plugin.py +32 -0
  72. pixeltable/type_system.py +243 -60
  73. pixeltable/utils/arrow.py +10 -9
  74. pixeltable/utils/coco.py +4 -4
  75. pixeltable/utils/documents.py +1 -1
  76. pixeltable/utils/filecache.py +131 -84
  77. pixeltable/utils/formatter.py +1 -1
  78. pixeltable/utils/http_server.py +2 -5
  79. pixeltable/utils/media_store.py +6 -6
  80. pixeltable/utils/pytorch.py +10 -11
  81. pixeltable/utils/sql.py +2 -1
  82. {pixeltable-0.2.19.dist-info → pixeltable-0.2.21.dist-info}/METADATA +16 -7
  83. pixeltable-0.2.21.dist-info/RECORD +148 -0
  84. pixeltable/utils/help.py +0 -11
  85. pixeltable-0.2.19.dist-info/RECORD +0 -147
  86. {pixeltable-0.2.19.dist-info → pixeltable-0.2.21.dist-info}/LICENSE +0 -0
  87. {pixeltable-0.2.19.dist-info → pixeltable-0.2.21.dist-info}/WHEEL +0 -0
  88. {pixeltable-0.2.19.dist-info → pixeltable-0.2.21.dist-info}/entry_points.txt +0 -0
@@ -16,7 +16,6 @@ import PIL.Image
16
16
  import tenacity
17
17
 
18
18
  import pixeltable as pxt
19
- import pixeltable.type_system as ts
20
19
  from pixeltable import env
21
20
  from pixeltable.func import Batch
22
21
  from pixeltable.utils.code import local_public_names
@@ -51,10 +50,10 @@ def _retry(fn: Callable) -> Callable:
51
50
  # Audio Endpoints
52
51
 
53
52
 
54
- @pxt.udf(return_type=ts.AudioType())
53
+ @pxt.udf
55
54
  def speech(
56
55
  input: str, *, model: str, voice: str, response_format: Optional[str] = None, speed: Optional[float] = None
57
- ) -> str:
56
+ ) -> pxt.Audio:
58
57
  """
59
58
  Generates audio from the input text.
60
59
 
@@ -91,17 +90,9 @@ def speech(
91
90
  return output_filename
92
91
 
93
92
 
94
- @pxt.udf(
95
- param_types=[
96
- ts.AudioType(),
97
- ts.StringType(),
98
- ts.StringType(nullable=True),
99
- ts.StringType(nullable=True),
100
- ts.FloatType(nullable=True),
101
- ]
102
- )
93
+ @pxt.udf
103
94
  def transcriptions(
104
- audio: str,
95
+ audio: pxt.Audio,
105
96
  *,
106
97
  model: str,
107
98
  language: Optional[str] = None,
@@ -140,8 +131,14 @@ def transcriptions(
140
131
  return transcription.dict()
141
132
 
142
133
 
143
- @pxt.udf(param_types=[ts.AudioType(), ts.StringType(), ts.StringType(nullable=True), ts.FloatType(nullable=True)])
144
- def translations(audio: str, *, model: str, prompt: Optional[str] = None, temperature: Optional[float] = None) -> dict:
134
+ @pxt.udf
135
+ def translations(
136
+ audio: pxt.Audio,
137
+ *,
138
+ model: str,
139
+ prompt: Optional[str] = None,
140
+ temperature: Optional[float] = None
141
+ ) -> dict:
145
142
  """
146
143
  Translates audio into English.
147
144
 
@@ -304,10 +301,10 @@ _embedding_dimensions_cache: dict[str, int] = {
304
301
  }
305
302
 
306
303
 
307
- @pxt.udf(batch_size=32, return_type=ts.ArrayType((None,), dtype=ts.FloatType()))
304
+ @pxt.udf(batch_size=32)
308
305
  def embeddings(
309
306
  input: Batch[str], *, model: str, dimensions: Optional[int] = None, user: Optional[str] = None
310
- ) -> Batch[np.ndarray]:
307
+ ) -> Batch[pxt.Array[(None,), float]]:
311
308
  """
312
309
  Creates an embedding vector representing the input text.
313
310
 
@@ -342,13 +339,13 @@ def embeddings(
342
339
 
343
340
 
344
341
  @embeddings.conditional_return_type
345
- def _(model: str, dimensions: Optional[int] = None) -> ts.ArrayType:
342
+ def _(model: str, dimensions: Optional[int] = None) -> pxt.ArrayType:
346
343
  if dimensions is None:
347
344
  if model not in _embedding_dimensions_cache:
348
345
  # TODO: find some other way to retrieve a sample
349
- return ts.ArrayType((None,), dtype=ts.FloatType(), nullable=False)
346
+ return pxt.ArrayType((None,), dtype=pxt.FloatType(), nullable=False)
350
347
  dimensions = _embedding_dimensions_cache.get(model, None)
351
- return ts.ArrayType((dimensions,), dtype=ts.FloatType(), nullable=False)
348
+ return pxt.ArrayType((dimensions,), dtype=pxt.FloatType(), nullable=False)
352
349
 
353
350
 
354
351
  #####################################
@@ -408,17 +405,17 @@ def image_generations(
408
405
 
409
406
 
410
407
  @image_generations.conditional_return_type
411
- def _(size: Optional[str] = None) -> ts.ImageType:
408
+ def _(size: Optional[str] = None) -> pxt.ImageType:
412
409
  if size is None:
413
- return ts.ImageType(size=(1024, 1024))
410
+ return pxt.ImageType(size=(1024, 1024))
414
411
  x_pos = size.find('x')
415
412
  if x_pos == -1:
416
- return ts.ImageType()
413
+ return pxt.ImageType()
417
414
  try:
418
415
  width, height = int(size[:x_pos]), int(size[x_pos + 1 :])
419
416
  except ValueError:
420
- return ts.ImageType()
421
- return ts.ImageType(size=(width, height))
417
+ return pxt.ImageType()
418
+ return pxt.ImageType(size=(width, height))
422
419
 
423
420
 
424
421
  #####################################
@@ -14,12 +14,12 @@ t.select(pxt_str.capitalize(t.str_col)).collect()
14
14
 
15
15
  from typing import Any, Optional
16
16
 
17
+ import pixeltable as pxt
17
18
  import pixeltable.exceptions as excs
18
- import pixeltable.func as func
19
19
  from pixeltable.utils.code import local_public_names
20
20
 
21
21
 
22
- @func.udf(is_method=True)
22
+ @pxt.udf(is_method=True)
23
23
  def capitalize(self: str) -> str:
24
24
  """
25
25
  Return string with its first character capitalized and the rest lowercased.
@@ -28,7 +28,7 @@ def capitalize(self: str) -> str:
28
28
  """
29
29
  return self.capitalize()
30
30
 
31
- @func.udf(is_method=True)
31
+ @pxt.udf(is_method=True)
32
32
  def casefold(self: str) -> str:
33
33
  """
34
34
  Return a casefolded copy of string.
@@ -37,7 +37,7 @@ def casefold(self: str) -> str:
37
37
  """
38
38
  return self.casefold()
39
39
 
40
- @func.udf(is_method=True)
40
+ @pxt.udf(is_method=True)
41
41
  def center(self: str, width: int, fillchar: str = ' ') -> str:
42
42
  """
43
43
  Return a centered string of length `width`.
@@ -50,7 +50,7 @@ def center(self: str, width: int, fillchar: str = ' ') -> str:
50
50
  """
51
51
  return self.center(width, fillchar)
52
52
 
53
- @func.udf(is_method=True)
53
+ @pxt.udf(is_method=True)
54
54
  def contains(self: str, pattern: str, case: bool = True, flags: int = 0, regex: bool = True) -> bool:
55
55
  """
56
56
  Test if string contains pattern or regex.
@@ -72,7 +72,7 @@ def contains(self: str, pattern: str, case: bool = True, flags: int = 0, regex:
72
72
  else:
73
73
  return pattern.lower() in self.lower()
74
74
 
75
- @func.udf(is_method=True)
75
+ @pxt.udf(is_method=True)
76
76
  def count(self: str, pattern: str, flags: int = 0) -> int:
77
77
  """
78
78
  Count occurrences of pattern or regex.
@@ -85,7 +85,7 @@ def count(self: str, pattern: str, flags: int = 0) -> int:
85
85
  from builtins import len
86
86
  return len(re.findall(pattern, self, flags))
87
87
 
88
- @func.udf(is_method=True)
88
+ @pxt.udf(is_method=True)
89
89
  def endswith(self: str, pattern: str) -> bool:
90
90
  """
91
91
  Return `True` if the string ends with the specified suffix, otherwise return `False`.
@@ -97,7 +97,7 @@ def endswith(self: str, pattern: str) -> bool:
97
97
  """
98
98
  return self.endswith(pattern)
99
99
 
100
- @func.udf(is_method=True)
100
+ @pxt.udf(is_method=True)
101
101
  def fill(self: str, width: int, **kwargs: Any) -> str:
102
102
  """
103
103
  Wraps the single paragraph in string, and returns a single string containing the wrapped paragraph.
@@ -111,7 +111,7 @@ def fill(self: str, width: int, **kwargs: Any) -> str:
111
111
  import textwrap
112
112
  return textwrap.fill(self, width, **kwargs)
113
113
 
114
- @func.udf(is_method=True)
114
+ @pxt.udf(is_method=True)
115
115
  def find(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] = None) -> int:
116
116
  """
117
117
  Return the lowest index in string where `substr` is found within the slice `s[start:end]`.
@@ -125,7 +125,7 @@ def find(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] =
125
125
  """
126
126
  return self.find(substr, start, end)
127
127
 
128
- @func.udf(is_method=True)
128
+ @pxt.udf(is_method=True)
129
129
  def findall(self: str, pattern: str, flags: int = 0) -> list:
130
130
  """
131
131
  Find all occurrences of a regular expression pattern in string.
@@ -139,7 +139,7 @@ def findall(self: str, pattern: str, flags: int = 0) -> list:
139
139
  import re
140
140
  return re.findall(pattern, self, flags)
141
141
 
142
- @func.udf(is_method=True)
142
+ @pxt.udf(is_method=True)
143
143
  def format(self: str, *args: Any, **kwargs: Any) -> str:
144
144
  """
145
145
  Perform string formatting.
@@ -148,7 +148,7 @@ def format(self: str, *args: Any, **kwargs: Any) -> str:
148
148
  """
149
149
  return self.format(*args, **kwargs)
150
150
 
151
- @func.udf(is_method=True)
151
+ @pxt.udf(is_method=True)
152
152
  def fullmatch(self: str, pattern: str, case: bool = True, flags: int = 0) -> bool:
153
153
  """
154
154
  Determine if string fully matches a regular expression.
@@ -166,7 +166,7 @@ def fullmatch(self: str, pattern: str, case: bool = True, flags: int = 0) -> boo
166
166
  _ = bool(re.fullmatch(pattern, self, flags))
167
167
  return bool(re.fullmatch(pattern, self, flags))
168
168
 
169
- @func.udf(is_method=True)
169
+ @pxt.udf(is_method=True)
170
170
  def index(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] = None) -> int:
171
171
  """
172
172
  Return the lowest index in string where `substr` is found within the slice `[start:end]`.
@@ -181,7 +181,7 @@ def index(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] =
181
181
  """
182
182
  return self.index(substr, start, end)
183
183
 
184
- @func.udf(is_method=True)
184
+ @pxt.udf(is_method=True)
185
185
  def isalnum(self: str) -> bool:
186
186
  """
187
187
  Return `True` if all characters in the string are alphanumeric and there is at least one character, `False`
@@ -191,7 +191,7 @@ def isalnum(self: str) -> bool:
191
191
  """
192
192
  return self.isalnum()
193
193
 
194
- @func.udf(is_method=True)
194
+ @pxt.udf(is_method=True)
195
195
  def isalpha(self: str) -> bool:
196
196
  """
197
197
  Return `True` if all characters in the string are alphabetic and there is at least one character, `False` otherwise.
@@ -200,7 +200,7 @@ def isalpha(self: str) -> bool:
200
200
  """
201
201
  return self.isalpha()
202
202
 
203
- @func.udf(is_method=True)
203
+ @pxt.udf(is_method=True)
204
204
  def isascii(self: str) -> bool:
205
205
  """
206
206
  Return `True` if the string is empty or all characters in the string are ASCII, `False` otherwise.
@@ -209,7 +209,7 @@ def isascii(self: str) -> bool:
209
209
  """
210
210
  return self.isascii()
211
211
 
212
- @func.udf(is_method=True)
212
+ @pxt.udf(is_method=True)
213
213
  def isdecimal(self: str) -> bool:
214
214
  """
215
215
  Return `True` if all characters in the string are decimal characters and there is at least one character, `False`
@@ -219,7 +219,7 @@ def isdecimal(self: str) -> bool:
219
219
  """
220
220
  return self.isdecimal()
221
221
 
222
- @func.udf(is_method=True)
222
+ @pxt.udf(is_method=True)
223
223
  def isdigit(self: str) -> bool:
224
224
  """
225
225
  Return `True` if all characters in the string are digits and there is at least one character, `False` otherwise.
@@ -228,7 +228,7 @@ def isdigit(self: str) -> bool:
228
228
  """
229
229
  return self.isdigit()
230
230
 
231
- @func.udf(is_method=True)
231
+ @pxt.udf(is_method=True)
232
232
  def isidentifier(self: str) -> bool:
233
233
  """
234
234
  Return `True` if the string is a valid identifier according to the language definition, `False` otherwise.
@@ -238,7 +238,7 @@ def isidentifier(self: str) -> bool:
238
238
  return self.isidentifier()
239
239
 
240
240
 
241
- @func.udf(is_method=True)
241
+ @pxt.udf(is_method=True)
242
242
  def islower(self: str) -> bool:
243
243
  """
244
244
  Return `True` if all cased characters in the string are lowercase and there is at least one cased character, `False` otherwise.
@@ -247,7 +247,7 @@ def islower(self: str) -> bool:
247
247
  """
248
248
  return self.islower()
249
249
 
250
- @func.udf(is_method=True)
250
+ @pxt.udf(is_method=True)
251
251
  def isnumeric(self: str) -> bool:
252
252
  """
253
253
  Return `True` if all characters in the string are numeric characters, `False` otherwise.
@@ -256,7 +256,7 @@ def isnumeric(self: str) -> bool:
256
256
  """
257
257
  return self.isnumeric()
258
258
 
259
- @func.udf(is_method=True)
259
+ @pxt.udf(is_method=True)
260
260
  def isupper(self: str) -> bool:
261
261
  """
262
262
  Return `True` if all cased characters in the string are uppercase and there is at least one cased character, `False` otherwise.
@@ -265,7 +265,7 @@ def isupper(self: str) -> bool:
265
265
  """
266
266
  return self.isupper()
267
267
 
268
- @func.udf(is_method=True)
268
+ @pxt.udf(is_method=True)
269
269
  def istitle(self: str) -> bool:
270
270
  """
271
271
  Return `True` if the string is a titlecased string and there is at least one character, `False` otherwise.
@@ -274,7 +274,7 @@ def istitle(self: str) -> bool:
274
274
  """
275
275
  return self.istitle()
276
276
 
277
- @func.udf(is_method=True)
277
+ @pxt.udf(is_method=True)
278
278
  def isspace(self: str) -> bool:
279
279
  """
280
280
  Return `True` if there are only whitespace characters in the string and there is at least one character, `False` otherwise.
@@ -283,7 +283,7 @@ def isspace(self: str) -> bool:
283
283
  """
284
284
  return self.isspace()
285
285
 
286
- @func.udf(is_method=True)
286
+ @pxt.udf(is_method=True)
287
287
  def len(self: str) -> int:
288
288
  """
289
289
  Return the number of characters in the string.
@@ -292,7 +292,7 @@ def len(self: str) -> int:
292
292
  """
293
293
  return self.__len__()
294
294
 
295
- @func.udf(is_method=True)
295
+ @pxt.udf(is_method=True)
296
296
  def ljust(self: str, width: int, fillchar: str = ' ') -> str:
297
297
  """
298
298
  Return the string left-justified in a string of length `width`.
@@ -305,7 +305,7 @@ def ljust(self: str, width: int, fillchar: str = ' ') -> str:
305
305
  """
306
306
  return self.ljust(width, fillchar)
307
307
 
308
- @func.udf(is_method=True)
308
+ @pxt.udf(is_method=True)
309
309
  def lower(self: str) -> str:
310
310
  """
311
311
  Return a copy of the string with all the cased characters converted to lowercase.
@@ -314,7 +314,7 @@ def lower(self: str) -> str:
314
314
  """
315
315
  return self.lower()
316
316
 
317
- @func.udf(is_method=True)
317
+ @pxt.udf(is_method=True)
318
318
  def lstrip(self: str, chars: Optional[str] = None) -> str:
319
319
  """
320
320
  Return a copy of the string with leading characters removed. The `chars` argument is a string specifying the set of
@@ -327,7 +327,7 @@ def lstrip(self: str, chars: Optional[str] = None) -> str:
327
327
  """
328
328
  return self.lstrip(chars)
329
329
 
330
- @func.udf(is_method=True)
330
+ @pxt.udf(is_method=True)
331
331
  def match(self: str, pattern: str, case: bool = True, flags: int = 0) -> bool:
332
332
  """
333
333
  Determine if string starts with a match of a regular expression
@@ -342,7 +342,7 @@ def match(self: str, pattern: str, case: bool = True, flags: int = 0) -> bool:
342
342
  flags |= re.IGNORECASE
343
343
  return bool(re.match(pattern, self, flags))
344
344
 
345
- @func.udf(is_method=True)
345
+ @pxt.udf(is_method=True)
346
346
  def normalize(self: str, form: str) -> str:
347
347
  """
348
348
  Return the Unicode normal form.
@@ -355,7 +355,7 @@ def normalize(self: str, form: str) -> str:
355
355
  import unicodedata
356
356
  return unicodedata.normalize(form, self) # type: ignore[arg-type]
357
357
 
358
- @func.udf(is_method=True)
358
+ @pxt.udf(is_method=True)
359
359
  def pad(self: str, width: int, side: str = 'left', fillchar: str = ' ') -> str:
360
360
  """
361
361
  Pad string up to width
@@ -374,7 +374,7 @@ def pad(self: str, width: int, side: str = 'left', fillchar: str = ' ') -> str:
374
374
  else:
375
375
  raise ValueError(f"Invalid side: {side}")
376
376
 
377
- @func.udf(is_method=True)
377
+ @pxt.udf(is_method=True)
378
378
  def partition(self: str, sep: str = ' ') -> list:
379
379
  """
380
380
  Splits string at the first occurrence of `sep`, and returns 3 elements containing the part before the
@@ -387,7 +387,7 @@ def partition(self: str, sep: str = ' ') -> list:
387
387
  from builtins import len
388
388
  return [self[:idx], sep, self[idx + len(sep):]]
389
389
 
390
- @func.udf(is_method=True)
390
+ @pxt.udf(is_method=True)
391
391
  def removeprefix(self: str, prefix: str) -> str:
392
392
  """
393
393
  Remove prefix. If the prefix is not present, returns string.
@@ -398,7 +398,7 @@ def removeprefix(self: str, prefix: str) -> str:
398
398
  return self[len(prefix):]
399
399
  return self
400
400
 
401
- @func.udf(is_method=True)
401
+ @pxt.udf(is_method=True)
402
402
  def removesuffix(self: str, suffix: str) -> str:
403
403
  """
404
404
  Remove suffix. If the suffix is not present, returns string.
@@ -409,14 +409,14 @@ def removesuffix(self: str, suffix: str) -> str:
409
409
  return self[:-len(suffix)]
410
410
  return self
411
411
 
412
- @func.udf(is_method=True)
412
+ @pxt.udf(is_method=True)
413
413
  def repeat(self: str, n: int) -> str:
414
414
  """
415
415
  Repeat string `n` times.
416
416
  """
417
417
  return self * n
418
418
 
419
- @func.udf(is_method=True)
419
+ @pxt.udf(is_method=True)
420
420
  def replace(
421
421
  self: str, pattern: str, repl: str, n: int = -1, case: bool = True, flags: int = 0, regex: bool = False
422
422
  ) -> str:
@@ -442,7 +442,7 @@ def replace(
442
442
  else:
443
443
  return self.replace(pattern, repl, n)
444
444
 
445
- @func.udf(is_method=True)
445
+ @pxt.udf(is_method=True)
446
446
  def rfind(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] = None) -> int:
447
447
  """
448
448
  Return the highest index where `substr` is found, such that `substr` is contained within `[start:end]`.
@@ -456,7 +456,7 @@ def rfind(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] =
456
456
  """
457
457
  return self.rfind(substr, start, end)
458
458
 
459
- @func.udf(is_method=True)
459
+ @pxt.udf(is_method=True)
460
460
  def rindex(self: str, substr: str, start: Optional[int] = 0, end: Optional[int] = None) -> int:
461
461
  """
462
462
  Return the highest index where `substr` is found, such that `substr` is contained within `[start:end]`.
@@ -466,7 +466,7 @@ def rindex(self: str, substr: str, start: Optional[int] = 0, end: Optional[int]
466
466
  """
467
467
  return self.rindex(substr, start, end)
468
468
 
469
- @func.udf(is_method=True)
469
+ @pxt.udf(is_method=True)
470
470
  def rjust(self: str, width: int, fillchar: str = ' ') -> str:
471
471
  """
472
472
  Return the string right-justified in a string of length `width`.
@@ -479,7 +479,7 @@ def rjust(self: str, width: int, fillchar: str = ' ') -> str:
479
479
  """
480
480
  return self.rjust(width, fillchar)
481
481
 
482
- @func.udf(is_method=True)
482
+ @pxt.udf(is_method=True)
483
483
  def rpartition(self: str, sep: str = ' ') -> list:
484
484
  """
485
485
  This method splits string at the last occurrence of `sep`, and returns a list containing the part before the
@@ -491,7 +491,7 @@ def rpartition(self: str, sep: str = ' ') -> list:
491
491
  from builtins import len
492
492
  return [self[:idx], sep, self[idx + len(sep):]]
493
493
 
494
- @func.udf(is_method=True)
494
+ @pxt.udf(is_method=True)
495
495
  def rstrip(self: str, chars: Optional[str] = None) -> str:
496
496
  """
497
497
  Return a copy of string with trailing characters removed.
@@ -503,7 +503,7 @@ def rstrip(self: str, chars: Optional[str] = None) -> str:
503
503
  """
504
504
  return self.rstrip(chars)
505
505
 
506
- @func.udf(is_method=True)
506
+ @pxt.udf(is_method=True)
507
507
  def slice(self: str, start: Optional[int] = None, stop: Optional[int] = None, step: Optional[int] = None) -> str:
508
508
  """
509
509
  Return a slice.
@@ -515,7 +515,7 @@ def slice(self: str, start: Optional[int] = None, stop: Optional[int] = None, st
515
515
  """
516
516
  return self[start:stop:step]
517
517
 
518
- @func.udf(is_method=True)
518
+ @pxt.udf(is_method=True)
519
519
  def slice_replace(self: str, start: Optional[int] = None, stop: Optional[int] = None, repl: Optional[str] = None) -> str:
520
520
  """
521
521
  Replace a positional slice with another value.
@@ -527,7 +527,7 @@ def slice_replace(self: str, start: Optional[int] = None, stop: Optional[int] =
527
527
  """
528
528
  return self[:start] + repl + self[stop:]
529
529
 
530
- @func.udf(is_method=True)
530
+ @pxt.udf(is_method=True)
531
531
  def startswith(self: str, pattern: str) -> int:
532
532
  """
533
533
  Return `True` if string starts with `pattern`, otherwise return `False`.
@@ -539,7 +539,7 @@ def startswith(self: str, pattern: str) -> int:
539
539
  """
540
540
  return self.startswith(pattern)
541
541
 
542
- @func.udf(is_method=True)
542
+ @pxt.udf(is_method=True)
543
543
  def strip(self: str, chars: Optional[str] = None) -> str:
544
544
  """
545
545
  Return a copy of string with leading and trailing characters removed.
@@ -551,7 +551,7 @@ def strip(self: str, chars: Optional[str] = None) -> str:
551
551
  """
552
552
  return self.strip(chars)
553
553
 
554
- @func.udf(is_method=True)
554
+ @pxt.udf(is_method=True)
555
555
  def swapcase(self: str) -> str:
556
556
  """
557
557
  Return a copy of string with uppercase characters converted to lowercase and vice versa.
@@ -560,7 +560,7 @@ def swapcase(self: str) -> str:
560
560
  """
561
561
  return self.swapcase()
562
562
 
563
- @func.udf(is_method=True)
563
+ @pxt.udf(is_method=True)
564
564
  def title(self: str) -> str:
565
565
  """
566
566
  Return a titlecased version of string, i.e. words start with uppercase characters, all remaining cased characters
@@ -570,7 +570,7 @@ def title(self: str) -> str:
570
570
  """
571
571
  return self.title()
572
572
 
573
- @func.udf(is_method=True)
573
+ @pxt.udf(is_method=True)
574
574
  def upper(self: str) -> str:
575
575
  """
576
576
  Return a copy of string converted to uppercase.
@@ -579,7 +579,7 @@ def upper(self: str) -> str:
579
579
  """
580
580
  return self.upper()
581
581
 
582
- @func.udf(is_method=True)
582
+ @pxt.udf(is_method=True)
583
583
  def wrap(self: str, width: int, **kwargs: Any) -> list[str]:
584
584
  """
585
585
  Wraps the single paragraph in string so every line is at most `width` characters long.
@@ -594,7 +594,7 @@ def wrap(self: str, width: int, **kwargs: Any) -> list[str]:
594
594
  import textwrap
595
595
  return textwrap.wrap(self, width, **kwargs)
596
596
 
597
- @func.udf(is_method=True)
597
+ @pxt.udf(is_method=True)
598
598
  def zfill(self: str, width: int) -> str:
599
599
  """
600
600
  Pad a numeric string with ASCII `0` on the left to a total length of `width`.