pylegend 0.3.0__py3-none-any.whl → 0.5.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.
Files changed (124) hide show
  1. pylegend/__init__.py +16 -6
  2. pylegend/core/{databse → database}/sql_to_string/__init__.py +3 -3
  3. pylegend/core/{databse → database}/sql_to_string/db_extension.py +14 -5
  4. pylegend/core/{databse → database}/sql_to_string/generator.py +2 -2
  5. pylegend/core/language/__init__.py +12 -10
  6. pylegend/core/language/legacy_api/__init__.py +13 -0
  7. pylegend/core/language/{aggregate_specification.py → legacy_api/aggregate_specification.py} +10 -10
  8. pylegend/core/language/legacy_api/legacy_api_tds_row.py +32 -0
  9. pylegend/core/language/legendql_api/__init__.py +13 -0
  10. pylegend/core/language/legendql_api/legendql_api_custom_expressions.py +541 -0
  11. pylegend/core/language/legendql_api/legendql_api_tds_row.py +292 -0
  12. pylegend/core/language/shared/__init__.py +13 -0
  13. pylegend/core/language/{column_expressions.py → shared/column_expressions.py} +32 -31
  14. pylegend/core/language/{expression.py → shared/expression.py} +8 -0
  15. pylegend/core/language/{functions.py → shared/functions.py} +12 -3
  16. pylegend/core/language/shared/helpers.py +75 -0
  17. pylegend/core/language/{literal_expressions.py → shared/literal_expressions.py} +39 -1
  18. pylegend/core/language/{operations → shared/operations}/binary_expression.py +34 -2
  19. pylegend/core/language/{operations → shared/operations}/boolean_operation_expressions.py +34 -6
  20. pylegend/core/language/{operations → shared/operations}/collection_operation_expressions.py +146 -26
  21. pylegend/core/language/{operations → shared/operations}/date_operation_expressions.py +288 -24
  22. pylegend/core/language/{operations → shared/operations}/float_operation_expressions.py +53 -8
  23. pylegend/core/language/{operations → shared/operations}/integer_operation_expressions.py +62 -9
  24. pylegend/core/language/{operations → shared/operations}/nullary_expression.py +9 -2
  25. pylegend/core/language/{operations → shared/operations}/number_operation_expressions.py +211 -30
  26. pylegend/core/language/shared/operations/primitive_operation_expressions.py +155 -0
  27. pylegend/core/language/{operations → shared/operations}/string_operation_expressions.py +194 -21
  28. pylegend/core/language/{operations → shared/operations}/unary_expression.py +10 -2
  29. pylegend/core/language/{primitive_collection.py → shared/primitive_collection.py} +2 -2
  30. pylegend/core/language/{primitives → shared/primitives}/__init__.py +9 -9
  31. pylegend/core/language/{primitives → shared/primitives}/boolean.py +9 -5
  32. pylegend/core/language/{primitives → shared/primitives}/date.py +60 -15
  33. pylegend/core/language/{primitives → shared/primitives}/datetime.py +4 -5
  34. pylegend/core/language/{primitives → shared/primitives}/float.py +6 -6
  35. pylegend/core/language/{primitives → shared/primitives}/integer.py +6 -6
  36. pylegend/core/language/{primitives → shared/primitives}/number.py +16 -13
  37. pylegend/core/language/{primitives → shared/primitives}/primitive.py +41 -5
  38. pylegend/core/language/{primitives → shared/primitives}/strictdate.py +4 -5
  39. pylegend/core/language/{primitives → shared/primitives}/string.py +18 -19
  40. pylegend/core/language/{tds_row.py → shared/tds_row.py} +46 -16
  41. pylegend/core/request/__init__.py +7 -1
  42. pylegend/core/request/auth.py +55 -1
  43. pylegend/core/request/legend_client.py +32 -0
  44. pylegend/core/sql/metamodel_extension.py +28 -0
  45. pylegend/core/tds/abstract/__init__.py +13 -0
  46. pylegend/core/tds/abstract/frames/__init__.py +13 -0
  47. pylegend/core/tds/{legend_api/frames/legend_api_applied_function_tds_frame.py → abstract/frames/applied_function_tds_frame.py} +19 -13
  48. pylegend/core/tds/abstract/frames/base_tds_frame.py +125 -0
  49. pylegend/core/tds/{legend_api/frames/legend_api_input_tds_frame.py → abstract/frames/input_tds_frame.py} +9 -12
  50. pylegend/core/tds/{legend_api/frames/functions → abstract}/function_helpers.py +1 -1
  51. pylegend/core/tds/{legend_api/frames/functions/concatenate_function.py → legacy_api/frames/functions/legacy_api_concatenate_function.py} +25 -13
  52. pylegend/core/tds/{legend_api/frames/functions/distinct_function.py → legacy_api/frames/functions/legacy_api_distinct_function.py} +13 -8
  53. pylegend/core/tds/{legend_api/frames/functions/drop_function.py → legacy_api/frames/functions/legacy_api_drop_function.py} +13 -8
  54. pylegend/core/tds/{legend_api/frames/functions/extend_function.py → legacy_api/frames/functions/legacy_api_extend_function.py} +36 -16
  55. pylegend/core/tds/{legend_api/frames/functions/filter_function.py → legacy_api/frames/functions/legacy_api_filter_function.py} +25 -13
  56. pylegend/core/tds/{legend_api/frames/functions/group_by_function.py → legacy_api/frames/functions/legacy_api_group_by_function.py} +44 -17
  57. pylegend/core/tds/{legend_api/frames/functions/head_function.py → legacy_api/frames/functions/legacy_api_head_function.py} +13 -8
  58. pylegend/core/tds/{legend_api/frames/functions/join_by_columns_function.py → legacy_api/frames/functions/legacy_api_join_by_columns_function.py} +40 -13
  59. pylegend/core/tds/{legend_api/frames/functions/join_function.py → legacy_api/frames/functions/legacy_api_join_function.py} +44 -20
  60. pylegend/core/tds/{legend_api/frames/functions/rename_columns_function.py → legacy_api/frames/functions/legacy_api_rename_columns_function.py} +20 -8
  61. pylegend/core/tds/{legend_api/frames/functions/restrict_function.py → legacy_api/frames/functions/legacy_api_restrict_function.py} +17 -8
  62. pylegend/core/tds/{legend_api/frames/functions/slice_function.py → legacy_api/frames/functions/legacy_api_slice_function.py} +13 -8
  63. pylegend/core/tds/{legend_api/frames/functions/sort_function.py → legacy_api/frames/functions/legacy_api_sort_function.py} +19 -8
  64. pylegend/core/tds/legacy_api/frames/legacy_api_applied_function_tds_frame.py +37 -0
  65. pylegend/core/tds/legacy_api/frames/legacy_api_base_tds_frame.py +204 -0
  66. pylegend/core/tds/legacy_api/frames/legacy_api_input_tds_frame.py +51 -0
  67. pylegend/core/tds/{legend_api/frames/legend_api_tds_frame.py → legacy_api/frames/legacy_api_tds_frame.py} +28 -28
  68. pylegend/core/tds/legendql_api/__init__.py +13 -0
  69. pylegend/core/tds/legendql_api/frames/__init__.py +13 -0
  70. pylegend/core/tds/legendql_api/frames/functions/__init__.py +13 -0
  71. pylegend/core/tds/legendql_api/frames/functions/legendql_api_asofjoin_function.py +156 -0
  72. pylegend/core/tds/legendql_api/frames/functions/legendql_api_concatenate_function.py +139 -0
  73. pylegend/core/tds/legendql_api/frames/functions/legendql_api_distinct_function.py +69 -0
  74. pylegend/core/tds/legendql_api/frames/functions/legendql_api_drop_function.py +74 -0
  75. pylegend/core/tds/legendql_api/frames/functions/legendql_api_extend_function.py +256 -0
  76. pylegend/core/tds/legendql_api/frames/functions/legendql_api_filter_function.py +121 -0
  77. pylegend/core/tds/legendql_api/frames/functions/legendql_api_function_helpers.py +137 -0
  78. pylegend/core/tds/legendql_api/frames/functions/legendql_api_groupby_function.py +256 -0
  79. pylegend/core/tds/legendql_api/frames/functions/legendql_api_head_function.py +74 -0
  80. pylegend/core/tds/legendql_api/frames/functions/legendql_api_join_function.py +214 -0
  81. pylegend/core/tds/legendql_api/frames/functions/legendql_api_project_function.py +169 -0
  82. pylegend/core/tds/legendql_api/frames/functions/legendql_api_rename_function.py +189 -0
  83. pylegend/core/tds/legendql_api/frames/functions/legendql_api_select_function.py +131 -0
  84. pylegend/core/tds/legendql_api/frames/functions/legendql_api_slice_function.py +82 -0
  85. pylegend/core/tds/legendql_api/frames/functions/legendql_api_sort_function.py +93 -0
  86. pylegend/core/tds/legendql_api/frames/functions/legendql_api_window_extend_function.py +283 -0
  87. pylegend/core/tds/legendql_api/frames/legendql_api_applied_function_tds_frame.py +37 -0
  88. pylegend/core/tds/legendql_api/frames/legendql_api_base_tds_frame.py +419 -0
  89. pylegend/core/tds/legendql_api/frames/legendql_api_input_tds_frame.py +50 -0
  90. pylegend/core/tds/legendql_api/frames/legendql_api_tds_frame.py +327 -0
  91. pylegend/core/tds/pandas_api/frames/functions/assign_function.py +6 -6
  92. pylegend/core/tds/pandas_api/frames/pandas_api_applied_function_tds_frame.py +4 -0
  93. pylegend/core/tds/pandas_api/frames/pandas_api_base_tds_frame.py +11 -3
  94. pylegend/core/tds/pandas_api/frames/pandas_api_tds_frame.py +2 -2
  95. pylegend/core/tds/tds_frame.py +32 -2
  96. pylegend/extensions/database/vendors/postgres/postgres_sql_to_string.py +1 -1
  97. pylegend/extensions/tds/abstract/legend_function_input_frame.py +4 -0
  98. pylegend/extensions/tds/abstract/legend_service_input_frame.py +4 -0
  99. pylegend/extensions/tds/abstract/table_spec_input_frame.py +4 -0
  100. pylegend/extensions/tds/{legend_api/frames/legend_api_legend_function_input_frame.py → legacy_api/frames/legacy_api_legend_function_input_frame.py} +5 -5
  101. pylegend/extensions/tds/{legend_api/frames/legend_api_legend_service_input_frame.py → legacy_api/frames/legacy_api_legend_service_input_frame.py} +6 -6
  102. pylegend/extensions/tds/{legend_api/frames/legend_api_table_spec_input_frame.py → legacy_api/frames/legacy_api_table_spec_input_frame.py} +5 -5
  103. pylegend/extensions/tds/legendql_api/__init__.py +13 -0
  104. pylegend/extensions/tds/legendql_api/frames/__init__.py +13 -0
  105. pylegend/extensions/tds/legendql_api/frames/legendql_api_legend_service_input_frame.py +46 -0
  106. pylegend/extensions/tds/legendql_api/frames/legendql_api_table_spec_input_frame.py +36 -0
  107. pylegend/{legend_api_tds_client.py → legacy_api_tds_client.py} +15 -15
  108. {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/METADATA +7 -8
  109. pylegend-0.5.0.dist-info/NOTICE +5 -0
  110. pylegend-0.5.0.dist-info/RECORD +155 -0
  111. {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/WHEEL +1 -1
  112. pylegend/core/language/operations/primitive_operation_expressions.py +0 -56
  113. pylegend/core/tds/legend_api/frames/legend_api_base_tds_frame.py +0 -294
  114. pylegend-0.3.0.dist-info/RECORD +0 -115
  115. /pylegend/core/{databse → database}/__init__.py +0 -0
  116. /pylegend/core/{databse → database}/sql_to_string/config.py +0 -0
  117. /pylegend/core/language/{operations → shared/operations}/__init__.py +0 -0
  118. /pylegend/core/tds/{legend_api → legacy_api}/__init__.py +0 -0
  119. /pylegend/core/tds/{legend_api → legacy_api}/frames/__init__.py +0 -0
  120. /pylegend/core/tds/{legend_api → legacy_api}/frames/functions/__init__.py +0 -0
  121. /pylegend/extensions/tds/{legend_api → legacy_api}/__init__.py +0 -0
  122. /pylegend/extensions/tds/{legend_api → legacy_api}/frames/__init__.py +0 -0
  123. {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/LICENSE +0 -0
  124. {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/LICENSE.spdx +0 -0
pylegend/__init__.py CHANGED
@@ -15,15 +15,16 @@
15
15
  from pylegend._typing import (
16
16
  PyLegendSequence,
17
17
  )
18
- from pylegend.legend_api_tds_client import (
19
- LegendApiTdsClient,
20
- legend_api_tds_client,
18
+ from pylegend.legacy_api_tds_client import (
19
+ LegacyApiTdsClient,
20
+ legacy_api_tds_client,
21
21
  )
22
22
  from pylegend.core.request import (
23
23
  LegendClient,
24
24
  AuthScheme,
25
25
  LocalhostEmptyAuthScheme,
26
26
  HeaderTokenAuthScheme,
27
+ CookieAuthScheme,
27
28
  ResponseReader,
28
29
  )
29
30
  from pylegend.core.project_cooridnates import (
@@ -31,19 +32,25 @@ from pylegend.core.project_cooridnates import (
31
32
  PersonalWorkspaceProjectCoordinates,
32
33
  GroupWorkspaceProjectCoordinates,
33
34
  )
34
- from pylegend.core.language import agg
35
+ from pylegend.core.language import (
36
+ agg,
37
+ now,
38
+ today,
39
+ current_user,
40
+ )
35
41
 
36
42
 
37
43
  __all__: PyLegendSequence[str] = [
38
44
  "__version__",
39
45
 
40
- "LegendApiTdsClient",
41
- "legend_api_tds_client",
46
+ "LegacyApiTdsClient",
47
+ "legacy_api_tds_client",
42
48
 
43
49
  "LegendClient",
44
50
  "AuthScheme",
45
51
  "LocalhostEmptyAuthScheme",
46
52
  "HeaderTokenAuthScheme",
53
+ "CookieAuthScheme",
47
54
  "ResponseReader",
48
55
 
49
56
  "VersionedProjectCoordinates",
@@ -51,6 +58,9 @@ __all__: PyLegendSequence[str] = [
51
58
  "GroupWorkspaceProjectCoordinates",
52
59
 
53
60
  "agg",
61
+ "now",
62
+ "today",
63
+ "current_user",
54
64
  ]
55
65
 
56
66
 
@@ -13,9 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from pylegend._typing import PyLegendSequence
16
- from pylegend.core.databse.sql_to_string.generator import SqlToStringGenerator
17
- from pylegend.core.databse.sql_to_string.config import SqlToStringConfig, SqlToStringFormat
18
- from pylegend.core.databse.sql_to_string.db_extension import SqlToStringDbExtension
16
+ from pylegend.core.database.sql_to_string.generator import SqlToStringGenerator
17
+ from pylegend.core.database.sql_to_string.config import SqlToStringConfig, SqlToStringFormat
18
+ from pylegend.core.database.sql_to_string.db_extension import SqlToStringDbExtension
19
19
 
20
20
  __all__: PyLegendSequence[str] = [
21
21
  "SqlToStringGenerator",
@@ -18,7 +18,7 @@ from pylegend._typing import (
18
18
  PyLegendList,
19
19
  PyLegendSequence
20
20
  )
21
- from pylegend.core.databse.sql_to_string.config import SqlToStringConfig
21
+ from pylegend.core.database.sql_to_string.config import SqlToStringConfig
22
22
  from pylegend.core.sql.metamodel import (
23
23
  QuerySpecification,
24
24
  Select,
@@ -130,6 +130,8 @@ from pylegend.core.sql.metamodel_extension import (
130
130
  MinuteExpression,
131
131
  SecondExpression,
132
132
  EpochExpression,
133
+ WindowExpression,
134
+ ConstantExpression,
133
135
  )
134
136
 
135
137
 
@@ -448,6 +450,10 @@ def expression_processor(
448
450
  return extension.process_second_expression(expression, config)
449
451
  elif isinstance(expression, EpochExpression):
450
452
  return extension.process_epoch_expression(expression, config)
453
+ elif isinstance(expression, WindowExpression):
454
+ return extension.process_window_expression(expression, config)
455
+ elif isinstance(expression, ConstantExpression):
456
+ return expression.name
451
457
 
452
458
  else:
453
459
  raise ValueError("Unsupported expression type: " + str(type(expression))) # pragma: no cover
@@ -674,7 +680,7 @@ def function_call_processor(
674
680
 
675
681
  window = ""
676
682
  if function_call.window:
677
- window = " OVER" + extension.process_window(function_call.window, config)
683
+ window = " " + extension.process_window(function_call.window, config)
678
684
 
679
685
  first_sep = config.format.separator(1) if function_call.arguments else ""
680
686
  sep0 = config.format.separator(0) if function_call.arguments else ""
@@ -838,14 +844,14 @@ def window_processor(
838
844
  if window.windowRef:
839
845
  return window.windowRef
840
846
 
841
- partitions = " PARTITION BY " + (", ".join([extension.process_expression(e, config) for e in window.partitions])) \
847
+ partitions = "PARTITION BY " + (", ".join([extension.process_expression(e, config) for e in window.partitions])) \
842
848
  if window.partitions else ""
843
849
 
844
- order_by = " ORDER BY " + (", ".join([extension.process_sort_item(o, config) for o in window.orderBy])) \
850
+ order_by = "ORDER BY " + (", ".join([extension.process_sort_item(o, config) for o in window.orderBy])) \
845
851
  if window.orderBy else ""
846
852
 
847
853
  # TODO: Handle window frame
848
- return f"{partitions}{order_by}{''}"
854
+ return f"OVER ({partitions}{' ' if (partitions != '') and (order_by != '') else ''}{order_by}){''}"
849
855
 
850
856
 
851
857
  def table_function_processor(
@@ -1162,6 +1168,9 @@ class SqlToStringDbExtension:
1162
1168
  def process_epoch_expression(self, expr: EpochExpression, config: SqlToStringConfig) -> str:
1163
1169
  return f"DATE_PART('epoch', {self.process_expression(expr.value, config)})"
1164
1170
 
1171
+ def process_window_expression(self, expr: WindowExpression, config: SqlToStringConfig) -> str:
1172
+ return f"{self.process_expression(expr.nested, config)} {self.process_window(expr.window, config)}"
1173
+
1165
1174
  def process_qualified_name(self, qualified_name: QualifiedName, config: SqlToStringConfig) -> str:
1166
1175
  return qualified_name_processor(qualified_name, self, config)
1167
1176
 
@@ -18,8 +18,8 @@ from pylegend._typing import (
18
18
  PyLegendDict
19
19
  )
20
20
  from pylegend.utils.class_utils import find_sub_classes
21
- from pylegend.core.databse.sql_to_string.config import SqlToStringConfig
22
- from pylegend.core.databse.sql_to_string.db_extension import SqlToStringDbExtension
21
+ from pylegend.core.database.sql_to_string.config import SqlToStringConfig
22
+ from pylegend.core.database.sql_to_string.db_extension import SqlToStringDbExtension
23
23
  from pylegend.core.sql.metamodel import QuerySpecification
24
24
 
25
25
  __all__: PyLegendSequence[str] = [
@@ -15,7 +15,7 @@
15
15
  from pylegend._typing import (
16
16
  PyLegendSequence,
17
17
  )
18
- from pylegend.core.language.primitives import (
18
+ from pylegend.core.language.shared.primitives import (
19
19
  PyLegendPrimitive,
20
20
  PyLegendPrimitiveOrPythonPrimitive,
21
21
  PyLegendBoolean,
@@ -27,7 +27,7 @@ from pylegend.core.language.primitives import (
27
27
  PyLegendDateTime,
28
28
  PyLegendStrictDate,
29
29
  )
30
- from pylegend.core.language.expression import (
30
+ from pylegend.core.language.shared.expression import (
31
31
  PyLegendExpressionBooleanReturn,
32
32
  PyLegendExpressionStringReturn,
33
33
  PyLegendExpressionNumberReturn,
@@ -37,7 +37,7 @@ from pylegend.core.language.expression import (
37
37
  PyLegendExpressionDateTimeReturn,
38
38
  PyLegendExpressionStrictDateReturn,
39
39
  )
40
- from pylegend.core.language.literal_expressions import (
40
+ from pylegend.core.language.shared.literal_expressions import (
41
41
  PyLegendBooleanLiteralExpression,
42
42
  PyLegendStringLiteralExpression,
43
43
  PyLegendIntegerLiteralExpression,
@@ -46,7 +46,7 @@ from pylegend.core.language.literal_expressions import (
46
46
  PyLegendStrictDateLiteralExpression,
47
47
  convert_literal_to_literal_expression,
48
48
  )
49
- from pylegend.core.language.column_expressions import (
49
+ from pylegend.core.language.shared.column_expressions import (
50
50
  PyLegendColumnExpression,
51
51
  PyLegendBooleanColumnExpression,
52
52
  PyLegendStringColumnExpression,
@@ -57,9 +57,9 @@ from pylegend.core.language.column_expressions import (
57
57
  PyLegendDateTimeColumnExpression,
58
58
  PyLegendStrictDateColumnExpression,
59
59
  )
60
- from pylegend.core.language.tds_row import TdsRow
61
- from pylegend.core.language.aggregate_specification import AggregateSpecification, agg
62
- from pylegend.core.language.primitive_collection import (
60
+ from pylegend.core.language.legacy_api.legacy_api_tds_row import LegacyApiTdsRow
61
+ from pylegend.core.language.legacy_api.aggregate_specification import LegacyApiAggregateSpecification, agg
62
+ from pylegend.core.language.shared.primitive_collection import (
63
63
  PyLegendPrimitiveCollection,
64
64
  PyLegendIntegerCollection,
65
65
  PyLegendFloatCollection,
@@ -71,9 +71,10 @@ from pylegend.core.language.primitive_collection import (
71
71
  PyLegendStrictDateCollection,
72
72
  create_primitive_collection,
73
73
  )
74
- from pylegend.core.language.functions import (
74
+ from pylegend.core.language.shared.functions import (
75
75
  today,
76
76
  now,
77
+ current_user,
77
78
  )
78
79
 
79
80
  __all__: PyLegendSequence[str] = [
@@ -115,8 +116,8 @@ __all__: PyLegendSequence[str] = [
115
116
  "PyLegendStrictDateLiteralExpression",
116
117
  "convert_literal_to_literal_expression",
117
118
 
118
- "TdsRow",
119
- "AggregateSpecification",
119
+ "LegacyApiTdsRow",
120
+ "LegacyApiAggregateSpecification",
120
121
  "agg",
121
122
 
122
123
  "PyLegendPrimitiveCollection",
@@ -132,4 +133,5 @@ __all__: PyLegendSequence[str] = [
132
133
 
133
134
  "today",
134
135
  "now",
136
+ "current_user",
135
137
  ]
@@ -0,0 +1,13 @@
1
+ # Copyright 2025 Goldman Sachs
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -16,27 +16,27 @@ from pylegend._typing import (
16
16
  PyLegendSequence,
17
17
  PyLegendCallable
18
18
  )
19
- from pylegend.core.language.primitive_collection import PyLegendPrimitiveCollection
19
+ from pylegend.core.language.shared.primitive_collection import PyLegendPrimitiveCollection
20
20
  from pylegend.core.language import (
21
- TdsRow,
21
+ LegacyApiTdsRow,
22
22
  PyLegendPrimitive,
23
23
  PyLegendPrimitiveOrPythonPrimitive,
24
24
  )
25
25
 
26
26
  __all__: PyLegendSequence[str] = [
27
- "AggregateSpecification",
27
+ "LegacyApiAggregateSpecification",
28
28
  "agg",
29
29
  ]
30
30
 
31
31
 
32
- class AggregateSpecification:
33
- __map_fn: PyLegendCallable[[TdsRow], PyLegendPrimitiveOrPythonPrimitive]
32
+ class LegacyApiAggregateSpecification:
33
+ __map_fn: PyLegendCallable[[LegacyApiTdsRow], PyLegendPrimitiveOrPythonPrimitive]
34
34
  __aggregate_fn: PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
35
35
  __name: str
36
36
 
37
37
  def __init__(
38
38
  self,
39
- map_fn: PyLegendCallable[[TdsRow], PyLegendPrimitiveOrPythonPrimitive],
39
+ map_fn: PyLegendCallable[[LegacyApiTdsRow], PyLegendPrimitiveOrPythonPrimitive],
40
40
  aggregate_fn: PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive],
41
41
  name: str
42
42
  ) -> None:
@@ -47,7 +47,7 @@ class AggregateSpecification:
47
47
  def get_name(self) -> str:
48
48
  return self.__name
49
49
 
50
- def get_map_fn(self) -> PyLegendCallable[[TdsRow], PyLegendPrimitiveOrPythonPrimitive]:
50
+ def get_map_fn(self) -> PyLegendCallable[[LegacyApiTdsRow], PyLegendPrimitiveOrPythonPrimitive]:
51
51
  return self.__map_fn
52
52
 
53
53
  def get_aggregate_fn(self) -> PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]:
@@ -55,8 +55,8 @@ class AggregateSpecification:
55
55
 
56
56
 
57
57
  def agg(
58
- map_fn: PyLegendCallable[[TdsRow], PyLegendPrimitiveOrPythonPrimitive],
58
+ map_fn: PyLegendCallable[[LegacyApiTdsRow], PyLegendPrimitiveOrPythonPrimitive],
59
59
  aggregate_fn: PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive],
60
60
  name: str
61
- ) -> AggregateSpecification:
62
- return AggregateSpecification(map_fn=map_fn, aggregate_fn=aggregate_fn, name=name)
61
+ ) -> LegacyApiAggregateSpecification:
62
+ return LegacyApiAggregateSpecification(map_fn=map_fn, aggregate_fn=aggregate_fn, name=name)
@@ -0,0 +1,32 @@
1
+ # Copyright 2023 Goldman Sachs
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from pylegend._typing import (
16
+ PyLegendSequence,
17
+ )
18
+ from pylegend.core.language.shared.tds_row import AbstractTdsRow
19
+ from pylegend.core.tds.tds_frame import PyLegendTdsFrame
20
+
21
+ __all__: PyLegendSequence[str] = [
22
+ "LegacyApiTdsRow",
23
+ ]
24
+
25
+
26
+ class LegacyApiTdsRow(AbstractTdsRow):
27
+ def __init__(self, frame_name: str, frame: PyLegendTdsFrame) -> None:
28
+ super().__init__(frame_name, frame)
29
+
30
+ @staticmethod
31
+ def from_tds_frame(frame_name: str, frame: PyLegendTdsFrame) -> "LegacyApiTdsRow":
32
+ return LegacyApiTdsRow(frame_name=frame_name, frame=frame)
@@ -0,0 +1,13 @@
1
+ # Copyright 2025 Goldman Sachs
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.