diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-05-13 21:20:51 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-05-16 11:11:10 +0200 |
commit | 71cb17c81d358646f8dfeac14e9662ce42bb94df (patch) | |
tree | 8ea3a686ffd0b9fea4fa7f91acfd8987d9369d9a /lib/sqlalchemy/engine/url.py | |
parent | 0d5508d77653b37368ff9de22307c154cc90cf71 (diff) | |
download | sqlalchemy-71cb17c81d358646f8dfeac14e9662ce42bb94df.tar.gz |
Remove pep484 type comments from the code
Current effort is around the stub package, and having typing in
two places makes thing worse, since the types here are usually
outdated compared to the version in the stubs.
Once v2 gets under way we can start consolidating the types
here.
Fixes: #6461
Change-Id: I7132a444bd7138123074bf5bc664b4bb119a85ce
Diffstat (limited to 'lib/sqlalchemy/engine/url.py')
-rw-r--r-- | lib/sqlalchemy/engine/url.py | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py index 7db524b9f..7898f9121 100644 --- a/lib/sqlalchemy/engine/url.py +++ b/lib/sqlalchemy/engine/url.py @@ -25,14 +25,6 @@ from ..util import collections_abc from ..util import compat -if compat.TYPE_CHECKING: - from typing import Mapping - from typing import Optional - from typing import Sequence - from typing import Tuple - from typing import Union - - class URL( util.namedtuple( "URL", @@ -102,15 +94,14 @@ class URL( @classmethod def create( cls, - drivername, # type: str - username=None, # type: Optional[str] - password=None, # type: Optional[Union[str, object]] - host=None, # type: Optional[str] - port=None, # type: Optional[int] - database=None, # type: Optional[str] - query=util.EMPTY_DICT, # type: Mapping[str, Union[str, Sequence[str]]] + drivername, + username=None, + password=None, + host=None, + port=None, + database=None, + query=util.EMPTY_DICT, ): - # type: (...) -> URL """Create a new :class:`_engine.URL` object. :param drivername: the name of the database backend. This name will @@ -214,15 +205,14 @@ class URL( def set( self, - drivername=None, # type: Optional[str] - username=None, # type: Optional[str] - password=None, # type: Optional[Union[str, object]] - host=None, # type: Optional[str] - port=None, # type: Optional[int] - database=None, # type: Optional[str] - query=None, # type: Optional[Mapping[str, Union[str, Sequence[str]]]] + drivername=None, + username=None, + password=None, + host=None, + port=None, + database=None, + query=None, ): - # type: (...) -> URL """return a new :class:`_engine.URL` object with modifications. Values are used if they are non-None. To set a value to ``None`` @@ -267,7 +257,6 @@ class URL( return self._replace(**kw) def _replace(self, **kw): - # type: (**object) -> URL """Override ``namedtuple._replace()`` to provide argument checking.""" if "drivername" in kw: @@ -283,7 +272,6 @@ class URL( return super(URL, self)._replace(**kw) def update_query_string(self, query_string, append=False): - # type: (str, bool) -> URL """Return a new :class:`_engine.URL` object with the :attr:`_engine.URL.query` parameter dictionary updated by the given query string. @@ -317,7 +305,6 @@ class URL( ) def update_query_pairs(self, key_value_pairs, append=False): - # type: (Sequence[Tuple[str, str]], bool) -> URL """Return a new :class:`_engine.URL` object with the :attr:`_engine.URL.query` parameter dictionary updated by the given sequence of key/value pairs @@ -382,7 +369,6 @@ class URL( return self.set(query=new_query) def update_query_dict(self, query_parameters, append=False): - # type: (Mapping[str, Union[str, Sequence[str]]], bool) -> URL """Return a new :class:`_engine.URL` object with the :attr:`_engine.URL.query` parameter dictionary updated by the given dictionary. @@ -428,7 +414,6 @@ class URL( return self.update_query_pairs(query_parameters.items(), append=append) def difference_update_query(self, names): - # type: (Sequence[str]) -> URL """ Remove the given names from the :attr:`_engine.URL.query` dictionary, returning the new :class:`_engine.URL`. @@ -513,7 +498,6 @@ class URL( ":meth:`_engine.URL.render_as_string` method.", ) def __to_string__(self, hide_password=True): - # type: (bool) -> str """Render this :class:`_engine.URL` object as a string. :param hide_password: Defaults to True. The password is not shown @@ -523,7 +507,6 @@ class URL( return self.render_as_string(hide_password=hide_password) def render_as_string(self, hide_password=True): - # type: (bool) -> str """Render this :class:`_engine.URL` object as a string. This method is used when the ``__str__()`` or ``__repr__()`` |