diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/expression.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/expression.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/expression.py b/lib/sqlalchemy/dialects/mysql/expression.py index 7a66e9b14..77b985b6a 100644 --- a/lib/sqlalchemy/dialects/mysql/expression.py +++ b/lib/sqlalchemy/dialects/mysql/expression.py @@ -1,3 +1,11 @@ +# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors +# <see AUTHORS file> +# +# This module is part of SQLAlchemy and is released under +# the MIT License: https://www.opensource.org/licenses/mit-license.php + +import typing + from ... import exc from ... import util from ...sql import coercions @@ -8,6 +16,9 @@ from ...sql.base import _generative from ...sql.base import Generative +Selfmatch = typing.TypeVar("Selfmatch", bound="match") + + class match(Generative, elements.BinaryExpression): """Produce a ``MATCH (X, Y) AGAINST ('TEXT')`` clause. @@ -99,7 +110,7 @@ class match(Generative, elements.BinaryExpression): ) @_generative - def in_boolean_mode(self): + def in_boolean_mode(self: Selfmatch) -> Selfmatch: """Apply the "IN BOOLEAN MODE" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications @@ -107,9 +118,10 @@ class match(Generative, elements.BinaryExpression): """ self.modifiers = self.modifiers.union({"mysql_boolean_mode": True}) + return self @_generative - def in_natural_language_mode(self): + def in_natural_language_mode(self: Selfmatch) -> Selfmatch: """Apply the "IN NATURAL LANGUAGE MODE" modifier to the MATCH expression. @@ -118,9 +130,10 @@ class match(Generative, elements.BinaryExpression): """ self.modifiers = self.modifiers.union({"mysql_natural_language": True}) + return self @_generative - def with_query_expansion(self): + def with_query_expansion(self: Selfmatch) -> Selfmatch: """Apply the "WITH QUERY EXPANSION" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications @@ -128,3 +141,4 @@ class match(Generative, elements.BinaryExpression): """ self.modifiers = self.modifiers.union({"mysql_query_expansion": True}) + return self |