pylegend 0.7.0__py3-none-any.whl → 0.8.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.
@@ -108,7 +108,7 @@ class PyLegendIntegerLiteralExpression(PyLegendExpressionIntegerReturn):
108
108
  return IntegerLiteral(value=self.__value)
109
109
 
110
110
  def to_pure_expression(self, config: FrameToPureConfig) -> str:
111
- return str(self.__value)
111
+ return f"minus({abs(self.__value)})" if self.__value < 0 else str(self.__value)
112
112
 
113
113
  def is_non_nullable(self) -> bool:
114
114
  return True
@@ -128,7 +128,7 @@ class PyLegendFloatLiteralExpression(PyLegendExpressionFloatReturn):
128
128
  return DoubleLiteral(value=self.__value)
129
129
 
130
130
  def to_pure_expression(self, config: FrameToPureConfig) -> str:
131
- return str(self.__value)
131
+ return f"minus({abs(self.__value)})" if self.__value < 0 else str(self.__value)
132
132
 
133
133
  def is_non_nullable(self) -> bool:
134
134
  return True
@@ -0,0 +1,56 @@
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.
14
+
15
+ from datetime import datetime, date
16
+ from pylegend._typing import (
17
+ PyLegendSequence,
18
+ PyLegendUnion,
19
+ )
20
+ from pylegend.core.language import (
21
+ convert_literal_to_literal_expression,
22
+ PyLegendBooleanLiteralExpression,
23
+ PyLegendStringLiteralExpression,
24
+ PyLegendIntegerLiteralExpression,
25
+ PyLegendFloatLiteralExpression,
26
+ PyLegendStrictDateLiteralExpression,
27
+ PyLegendDateTimeLiteralExpression,
28
+ PyLegendFloat,
29
+ PyLegendDateTime,
30
+ PyLegendStrictDate,
31
+ PyLegendString,
32
+ PyLegendInteger,
33
+ PyLegendBoolean,
34
+ PyLegendPrimitive
35
+ )
36
+
37
+ __all__: PyLegendSequence[str] = [
38
+ "c",
39
+ ]
40
+
41
+
42
+ def c(constant: PyLegendUnion[int, float, bool, str, datetime, date]) -> PyLegendPrimitive:
43
+ expr = convert_literal_to_literal_expression(constant)
44
+ if isinstance(expr, PyLegendBooleanLiteralExpression):
45
+ return PyLegendBoolean(expr)
46
+ if isinstance(expr, PyLegendStringLiteralExpression):
47
+ return PyLegendString(expr)
48
+ if isinstance(expr, PyLegendIntegerLiteralExpression):
49
+ return PyLegendInteger(expr)
50
+ if isinstance(expr, PyLegendFloatLiteralExpression):
51
+ return PyLegendFloat(expr)
52
+ if isinstance(expr, PyLegendDateTimeLiteralExpression):
53
+ return PyLegendDateTime(expr)
54
+ if isinstance(expr, PyLegendStrictDateLiteralExpression):
55
+ return PyLegendStrictDate(expr)
56
+ raise RuntimeError(f"Unsupported constant type: {type(constant)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pylegend
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: Python language binding for Legend data management platform
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ pylegend/core/language/shared/column_expressions.py,sha256=qWHVvwPGwKroQX94a_ovU
18
18
  pylegend/core/language/shared/expression.py,sha256=-XDJ3JfkyQ2FunACUEGI4CeTgqCvBexp55_YCaZUD1k,2446
19
19
  pylegend/core/language/shared/functions.py,sha256=G94EiFdZV4jorJTX23ErxKP1GusKl61G3qQN1e26Zws,1495
20
20
  pylegend/core/language/shared/helpers.py,sha256=E7IKZwb__qj4_JpoBT2cra_umvfKP58c5U5bygMqh_o,2379
21
- pylegend/core/language/shared/literal_expressions.py,sha256=bU9pO-H9DxNyDlWVMiJC__YPzHQLo_v9aedllozBzVo,6185
21
+ pylegend/core/language/shared/literal_expressions.py,sha256=YfLdbhkN5RZm_NRaseWngoZ7iSEbe42FuF2criZVYD8,6295
22
22
  pylegend/core/language/shared/operations/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
23
23
  pylegend/core/language/shared/operations/binary_expression.py,sha256=I3CIWwbKlKq1R8ekUXY8QKyHro8b7fIgeM8hTPwN5jA,4006
24
24
  pylegend/core/language/shared/operations/boolean_operation_expressions.py,sha256=6NYAilcC6QEn4J_mWTZdDCJhbPMam36Xl6Ai9N1kJsQ,4630
@@ -31,6 +31,7 @@ pylegend/core/language/shared/operations/number_operation_expressions.py,sha256=
31
31
  pylegend/core/language/shared/operations/primitive_operation_expressions.py,sha256=UsNe3RN_HuxIfQwcWI6l2xtTgrLIbrJd2nRPJYCTsXA,5297
32
32
  pylegend/core/language/shared/operations/string_operation_expressions.py,sha256=90T02mRtJ2lHSPauD-HXeKyNEVFaJB-Cg4HVQbPGAMk,20886
33
33
  pylegend/core/language/shared/operations/unary_expression.py,sha256=1VWE43rN4x4NLc6aL3xRzleK9c_UfrLawlyYgX3SG48,3132
34
+ pylegend/core/language/shared/pct_helpers.py,sha256=tQo0BkaPro8Tqc3Tt2hmMrQOLsf4Ra0ENgDRQOhZe1I,1998
34
35
  pylegend/core/language/shared/primitive_collection.py,sha256=ShUtgdZkZ8cKdQJLP5iU_zYDK7piMzWlimvjhnyfnGk,13098
35
36
  pylegend/core/language/shared/primitives/__init__.py,sha256=9p7VVRhzeRQwTkxXQBBZuJY6P9V-yX0Q_elviaYIgPg,1649
36
37
  pylegend/core/language/shared/primitives/boolean.py,sha256=x0JgS8E9AXv0fkExuCCyD9Paim2xwfU9cn-1Jh3bqtI,4058
@@ -149,9 +150,9 @@ pylegend/legacy_api_tds_client.py,sha256=IXfo2pdBFV3M3S4RYKJcvudMc_OGdR0yvJhTV-o
149
150
  pylegend/legendql_api_tds_client.py,sha256=oS6NET5pAA-hfVhVvwG6sRF7omyBs_gEYSAgA8Tky8U,2357
150
151
  pylegend/utils/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
151
152
  pylegend/utils/class_utils.py,sha256=t4PpF3jAXS_D6p9TqlSppryNYNOuy5C-kbKn2Kgb4QU,973
152
- pylegend-0.7.0.dist-info/METADATA,sha256=UnFFbTxMJAH41GLOlNVtSgmA3YnDqqJRxDTT5gTmAzk,4280
153
- pylegend-0.7.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
154
- pylegend-0.7.0.dist-info/licenses/LICENSE,sha256=AGR96_qQPZO66Gjqq4G6r_g670K35VtW-IobTAkmZJM,11343
155
- pylegend-0.7.0.dist-info/licenses/LICENSE.spdx,sha256=i7TsBclLotUvMjx9vZ_6S8Pp0r4uknWGw1RwiKBBvQ4,207
156
- pylegend-0.7.0.dist-info/licenses/NOTICE,sha256=2Lr4FqiscyRI7-vyn7c2z-zqUw2p6x7upJyBvFKkHjk,167
157
- pylegend-0.7.0.dist-info/RECORD,,
153
+ pylegend-0.8.0.dist-info/METADATA,sha256=58OpiXGHs4FMBUhK_qqWkEeTX_Vca6SYoBTphzMJBbg,4280
154
+ pylegend-0.8.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
155
+ pylegend-0.8.0.dist-info/licenses/LICENSE,sha256=AGR96_qQPZO66Gjqq4G6r_g670K35VtW-IobTAkmZJM,11343
156
+ pylegend-0.8.0.dist-info/licenses/LICENSE.spdx,sha256=i7TsBclLotUvMjx9vZ_6S8Pp0r4uknWGw1RwiKBBvQ4,207
157
+ pylegend-0.8.0.dist-info/licenses/NOTICE,sha256=2Lr4FqiscyRI7-vyn7c2z-zqUw2p6x7upJyBvFKkHjk,167
158
+ pylegend-0.8.0.dist-info/RECORD,,