TypeDAL 3.3.1__py3-none-any.whl → 3.4.0__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 TypeDAL might be problematic. Click here for more details.

typedal/__about__.py CHANGED
@@ -5,4 +5,4 @@ This file contains the Version info for this package.
5
5
  # SPDX-FileCopyrightText: 2023-present Robin van der Noord <robinvandernoord@gmail.com>
6
6
  #
7
7
  # SPDX-License-Identifier: MIT
8
- __version__ = "3.3.1"
8
+ __version__ = "3.4.0"
typedal/core.py CHANGED
@@ -1841,15 +1841,6 @@ class TypedRows(typing.Collection[T_MetaInstance], Rows):
1841
1841
  result = super().group_by_value(*fields, **kwargs)
1842
1842
  return typing.cast(dict[T, list[T_MetaInstance]], result)
1843
1843
 
1844
- def column(self, column: str = None) -> list[Any]:
1845
- """
1846
- Get a list of all values in a specific column.
1847
-
1848
- Example:
1849
- rows.column('name') -> ['Name 1', 'Name 2', ...]
1850
- """
1851
- return typing.cast(list[Any], super().column(column))
1852
-
1853
1844
  def as_csv(self) -> str:
1854
1845
  """
1855
1846
  Dump the data to csv.
@@ -2426,6 +2417,26 @@ class QueryBuilder(typing.Generic[T_MetaInstance]):
2426
2417
  # only saves if requested in metadata:
2427
2418
  return save_to_cache(typed_rows, rows)
2428
2419
 
2420
+ @typing.overload
2421
+ def column(self, field: TypedField[T]) -> list[T]:
2422
+ """
2423
+ If a typedfield is passed, the output type can be safely determined.
2424
+ """
2425
+
2426
+ @typing.overload
2427
+ def column(self, field: T) -> list[T]:
2428
+ """
2429
+ Otherwise, the output type is loosely determined (assumes `field: type` or Any).
2430
+ """
2431
+
2432
+ def column(self, field: TypedField[T] | T) -> list[T]:
2433
+ """
2434
+ Get all values in a specific column.
2435
+
2436
+ Shortcut for `.select(field).execute().column(field)`.
2437
+ """
2438
+ return self.select(field).execute().column(field)
2439
+
2429
2440
  def _handle_relationships_pre_select(
2430
2441
  self,
2431
2442
  query: Query,
typedal/types.py CHANGED
@@ -79,6 +79,15 @@ class Rows(_Rows): # type: ignore
79
79
  Make mypy happy.
80
80
  """
81
81
 
82
+ def column(self, column: typing.Any = None) -> list[typing.Any]:
83
+ """
84
+ Get a list of all values in a specific column.
85
+
86
+ Example:
87
+ rows.column('name') -> ['Name 1', 'Name 2', ...]
88
+ """
89
+ return [r[str(column) if column else self.colnames[0]] for r in self]
90
+
82
91
 
83
92
  class Validator(_Validator): # type: ignore
84
93
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TypeDAL
3
- Version: 3.3.1
3
+ Version: 3.4.0
4
4
  Summary: Typing support for PyDAL
5
5
  Project-URL: Documentation, https://typedal.readthedocs.io/
6
6
  Project-URL: Issues, https://github.com/trialandsuccess/TypeDAL/issues
@@ -1,19 +1,19 @@
1
- typedal/__about__.py,sha256=Wu5Lv4Jglqs8h2_AjyrHv-m67Gz9cmuGT7s5MPNnAFs,206
1
+ typedal/__about__.py,sha256=4H4aYxAonMoSZ4TwJQKsDojr3VmwSW8DHN3jahxVVsA,206
2
2
  typedal/__init__.py,sha256=QQpLiVl9w9hm2LBxey49Y_tCF_VB2bScVaS_mCjYy54,366
3
3
  typedal/caching.py,sha256=SMcJsahLlZ79yykWCveERFx1ZJUNEKhA9SPmCTIuLp8,11798
4
4
  typedal/cli.py,sha256=BXXu1w9WRRK9GA82xh_JLvvfpNDFWICXKCAWNg4a3-Y,18180
5
5
  typedal/config.py,sha256=0qy1zrTUdtmXPM9jHzFnSR1DJsqGJqcdG6pvhzKQHe0,11625
6
- typedal/core.py,sha256=ScUZkDzHGULNTcrW9Jq4Anf4axUfha-CXWmm7SWrn90,95991
6
+ typedal/core.py,sha256=b8pFiaORXEC0PWaBSmPkQuPtJfk0mwqUiAqxSmX4ZtM,96318
7
7
  typedal/fields.py,sha256=z2PD9vLWqBR_zXtiY0DthqTG4AeF3yxKoeuVfGXnSdg,5197
8
8
  typedal/for_py4web.py,sha256=d07b8hL_PvNDUS26Z5fDH2OxWb-IETBuAFPSzrRwm04,1285
9
9
  typedal/for_web2py.py,sha256=4RHgzGXgKIO_BYB-7adC5e35u52rX-p1t4tPEz-NK24,1867
10
10
  typedal/helpers.py,sha256=KbgP4ZRW7KCroyHwTwdErPqylOX4dsqVnKJeZ5TtTFY,7363
11
11
  typedal/mixins.py,sha256=OHhVYLBGTzPSJKgp1uovBs1Y6NJa0d-DxHTOk9LyOXA,5414
12
12
  typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- typedal/types.py,sha256=AsUHrAXk058zmdqDbZlpf6sE85ID1Q2vofsGgCXni1s,4851
13
+ typedal/types.py,sha256=fyTOAhORFufZsAKnf1dMcWJxLK-UMX6UFl-JbiqFmSk,5161
14
14
  typedal/web2py_py4web_shared.py,sha256=VK9T8P5UwVLvfNBsY4q79ANcABv-jX76YKADt1Zz_co,1539
15
15
  typedal/serializers/as_json.py,sha256=ffo152W-sARYXym4BzwX709rrO2-QwKk2KunWY8RNl4,2229
16
- typedal-3.3.1.dist-info/METADATA,sha256=8sBC0FTFEy7qE17mgnL5sj06hkl3LQc_tRP8_j2-kbU,9462
17
- typedal-3.3.1.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
18
- typedal-3.3.1.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
19
- typedal-3.3.1.dist-info/RECORD,,
16
+ typedal-3.4.0.dist-info/METADATA,sha256=onWL5IwfJALWrdfIPUQNYrmFdIcMNZqRAlGixK88Tv0,9462
17
+ typedal-3.4.0.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
18
+ typedal-3.4.0.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
19
+ typedal-3.4.0.dist-info/RECORD,,