diff options
author | Federico Caselli <cfederico87@gmail.com> | 2022-11-03 20:52:21 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2022-11-16 23:03:04 +0100 |
commit | 4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66 (patch) | |
tree | 4970cff3f78489a4a0066cd27fd4bae682402957 /lib/sqlalchemy/exc.py | |
parent | 3fc6c40ea77c971d3067dab0fdf57a5b5313b69b (diff) | |
download | sqlalchemy-4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66.tar.gz |
Try running pyupgrade on the code
command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>"
pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not
exists in sqlalchemy fixtures
Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r-- | lib/sqlalchemy/exc.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index 88edba328..fa46a46c4 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -49,7 +49,7 @@ class HasDescriptionCode: code = kw.pop("code", None) if code is not None: self.code = code - super(HasDescriptionCode, self).__init__(*arg, **kw) + super().__init__(*arg, **kw) def _code_str(self) -> str: if not self.code: @@ -65,7 +65,7 @@ class HasDescriptionCode: ) def __str__(self) -> str: - message = super(HasDescriptionCode, self).__str__() + message = super().__str__() if self.code: message = "%s %s" % (message, self._code_str()) return message @@ -134,9 +134,7 @@ class ObjectNotExecutableError(ArgumentError): """ def __init__(self, target: Any): - super(ObjectNotExecutableError, self).__init__( - "Not an executable object: %r" % target - ) + super().__init__("Not an executable object: %r" % target) self.target = target def __reduce__(self) -> Union[str, Tuple[Any, ...]]: @@ -223,7 +221,7 @@ class UnsupportedCompilationError(CompileError): element_type: Type[ClauseElement], message: Optional[str] = None, ): - super(UnsupportedCompilationError, self).__init__( + super().__init__( "Compiler %r can't render element of type %s%s" % (compiler, element_type, ": %s" % message if message else "") ) @@ -557,7 +555,7 @@ class DBAPIError(StatementError): dbapi_base_err: Type[Exception], hide_parameters: bool = False, connection_invalidated: bool = False, - dialect: Optional["Dialect"] = None, + dialect: Optional[Dialect] = None, ismulti: Optional[bool] = None, ) -> StatementError: ... @@ -572,7 +570,7 @@ class DBAPIError(StatementError): dbapi_base_err: Type[Exception], hide_parameters: bool = False, connection_invalidated: bool = False, - dialect: Optional["Dialect"] = None, + dialect: Optional[Dialect] = None, ismulti: Optional[bool] = None, ) -> DontWrapMixin: ... @@ -587,7 +585,7 @@ class DBAPIError(StatementError): dbapi_base_err: Type[Exception], hide_parameters: bool = False, connection_invalidated: bool = False, - dialect: Optional["Dialect"] = None, + dialect: Optional[Dialect] = None, ismulti: Optional[bool] = None, ) -> BaseException: ... @@ -601,7 +599,7 @@ class DBAPIError(StatementError): dbapi_base_err: Type[Exception], hide_parameters: bool = False, connection_invalidated: bool = False, - dialect: Optional["Dialect"] = None, + dialect: Optional[Dialect] = None, ismulti: Optional[bool] = None, ) -> Union[BaseException, DontWrapMixin]: # Don't ever wrap these, just return them directly as if @@ -792,7 +790,7 @@ class Base20DeprecationWarning(SADeprecationWarning): def __str__(self) -> str: return ( - super(Base20DeprecationWarning, self).__str__() + super().__str__() + " (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)" ) |