diff options
author | Federico Caselli <cfederico87@gmail.com> | 2023-02-28 22:44:27 +0100 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-03 10:40:17 -0500 |
commit | c39dc697c1598c4a6a934dc0b5a60a0eaae6555d (patch) | |
tree | 919992761ed4cc8c926da23617d3671b536022f5 /lib/sqlalchemy/sql/functions.py | |
parent | da70478eb2eafe9c76b836217371e029c3c820e3 (diff) | |
download | sqlalchemy-c39dc697c1598c4a6a934dc0b5a60a0eaae6555d.tar.gz |
Add missing overload to Numeric
Added missing init overload to :class:`_sql.Numeric` to allow
type checkers to properly resolve the type var given the
``asdecimal`` parameter.
this fortunately fixes a glitch in the generate_sql_functions script
also
Fixes: #9391
Change-Id: I9cecc40c52711489e9dbe663f110c3b81c7285e4
Diffstat (limited to 'lib/sqlalchemy/sql/functions.py')
-rw-r--r-- | lib/sqlalchemy/sql/functions.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 6054be98a..5f2e67288 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -13,6 +13,7 @@ from __future__ import annotations import datetime +import decimal from typing import Any from typing import cast from typing import Dict @@ -54,7 +55,6 @@ from .elements import WithinGroup from .selectable import FromClause from .selectable import Select from .selectable import TableValuedAlias -from .sqltypes import _N from .sqltypes import TableValueType from .type_api import TypeEngine from .visitors import InternalTraversal @@ -950,7 +950,7 @@ class _FunctionGenerator: ... @property - def cume_dist(self) -> Type[cume_dist[Any]]: + def cume_dist(self) -> Type[cume_dist]: ... @property @@ -1014,7 +1014,7 @@ class _FunctionGenerator: ... @property - def percent_rank(self) -> Type[percent_rank[Any]]: + def percent_rank(self) -> Type[percent_rank]: ... @property @@ -1703,7 +1703,7 @@ class dense_rank(GenericFunction[int]): inherit_cache = True -class percent_rank(GenericFunction[_N]): +class percent_rank(GenericFunction[decimal.Decimal]): """Implement the ``percent_rank`` hypothetical-set aggregate function. This function must be used with the :meth:`.FunctionElement.within_group` @@ -1715,11 +1715,11 @@ class percent_rank(GenericFunction[_N]): """ - type: sqltypes.Numeric[_N] = sqltypes.Numeric() + type: sqltypes.Numeric[decimal.Decimal] = sqltypes.Numeric() inherit_cache = True -class cume_dist(GenericFunction[_N]): +class cume_dist(GenericFunction[decimal.Decimal]): """Implement the ``cume_dist`` hypothetical-set aggregate function. This function must be used with the :meth:`.FunctionElement.within_group` @@ -1731,7 +1731,7 @@ class cume_dist(GenericFunction[_N]): """ - type: sqltypes.Numeric[_N] = sqltypes.Numeric() + type: sqltypes.Numeric[decimal.Decimal] = sqltypes.Numeric() inherit_cache = True |