From: H Date: Wed, 19 Jan 2022 20:57:35 +0000 (+0000) Subject: Fix spelling errors found by codespell X-Git-Tag: pool-3.1~7^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bce7ccb1268e3235bd6734634737bdad69c80324;p=thirdparty%2Fpsycopg.git Fix spelling errors found by codespell --- diff --git a/docs/api/cursors.rst b/docs/api/cursors.rst index 947e4f6df..74d9a1634 100644 --- a/docs/api/cursors.rst +++ b/docs/api/cursors.rst @@ -257,12 +257,12 @@ The `!ServerCursor` class .. autoattribute:: name .. autoattribute:: scrollable - .. seealso:: The PostgreSQL DECLARE_ statement documetation + .. seealso:: The PostgreSQL DECLARE_ statement documentation for the description of :sql:`[NO] SCROLL`. .. autoattribute:: withhold - .. seealso:: The PostgreSQL DECLARE_ statement documetation + .. seealso:: The PostgreSQL DECLARE_ statement documentation for the description of :sql:`{WITH|WITHOUT} HOLD`. .. _DECLARE: https://www.postgresql.org/docs/current/sql-declare.html diff --git a/docs/api/dns.rst b/docs/api/dns.rst index af09a344b..84e07b926 100644 --- a/docs/api/dns.rst +++ b/docs/api/dns.rst @@ -3,7 +3,7 @@ .. module:: psycopg._dns -This module contains a few experimental utilities to interact wit the DNS +This module contains a few experimental utilities to interact with the DNS server before performing a connection. .. warning:: diff --git a/docs/api/pool.rst b/docs/api/pool.rst index c6234cf00..45b6cf07e 100644 --- a/docs/api/pool.rst +++ b/docs/api/pool.rst @@ -102,7 +102,7 @@ The `!ConnectionPool` class ``pool-2``, etc. :type name: `!str` - :param timeout: The default maximum time in seconts that a client can wait + :param timeout: The default maximum time in seconds that a client can wait to receive a connection from the pool (using `connection()` or `getconn()`). Note that these methods allow to override the *timeout* default. @@ -154,7 +154,7 @@ The `!ConnectionPool` class Added *open* parameter to init method. - .. note:: In a future version, the deafult value for the *open* parameter + .. note:: In a future version, the default value for the *open* parameter might be changed to `!False`. If you rely on this behaviour (e.g. if you don't use the pool as a context manager) you might want to specify this parameter explicitly. diff --git a/psycopg/psycopg/__init__.py b/psycopg/psycopg/__init__.py index 7314692ba..6f4068a0b 100644 --- a/psycopg/psycopg/__init__.py +++ b/psycopg/psycopg/__init__.py @@ -36,7 +36,7 @@ logger = logging.getLogger("psycopg") if logger.level == logging.NOTSET: logger.setLevel(logging.WARNING) -# DBAPI compliancy +# DBAPI compliance connect = Connection.connect apilevel = "2.0" threadsafety = 2 diff --git a/psycopg/psycopg/_column.py b/psycopg/psycopg/_column.py index 30ac104b7..ab30b4d4f 100644 --- a/psycopg/psycopg/_column.py +++ b/psycopg/psycopg/_column.py @@ -105,7 +105,7 @@ class Column(Sequence[Any]): @property def internal_size(self) -> Optional[int]: - """The interal field size for fixed-size types, None otherwise.""" + """The internal field size for fixed-size types, None otherwise.""" fsize = self._data.fsize return fsize if fsize >= 0 else None diff --git a/psycopg/psycopg/_dns.py b/psycopg/psycopg/_dns.py index 58e644206..0e83d29e2 100644 --- a/psycopg/psycopg/_dns.py +++ b/psycopg/psycopg/_dns.py @@ -117,7 +117,7 @@ async def resolve_hostaddr_async(params: Dict[str, Any]) -> Dict[str, Any]: ans = await async_resolver.resolve(host) except DNSException as ex: # Special case localhost: on MacOS it doesn't get resolved. - # I assue it is just resolved by /etc/hosts, which is not handled + # I assume it is just resolved by /etc/hosts, which is not handled # by dnspython. if host == "localhost": hosts_out.append(host) diff --git a/psycopg/psycopg/_preparing.py b/psycopg/psycopg/_preparing.py index a9f048f0e..d7d71d1c0 100644 --- a/psycopg/psycopg/_preparing.py +++ b/psycopg/psycopg/_preparing.py @@ -163,7 +163,7 @@ class PrepareManager: ) -> None: """Validate cached entry with 'key' by checking query 'results'. - Possibly return a command to perform maintainance on database side. + Possibly return a command to perform maintenance on database side. Note: this method is only called in pipeline mode. """ diff --git a/psycopg/psycopg/abc.py b/psycopg/psycopg/abc.py index 9fb100cec..c9904600f 100644 --- a/psycopg/psycopg/abc.py +++ b/psycopg/psycopg/abc.py @@ -140,7 +140,7 @@ class Dumper(Protocol): size of int?...) In these cases, a dumper can implement `!get_key()` and return a new - class, or sequence of classes, that can be used to indentify the same + class, or sequence of classes, that can be used to identify the same dumper again. If the mechanism is not needed, the method should return the same *cls* object passed in the constructor. diff --git a/psycopg/psycopg/connection.py b/psycopg/psycopg/connection.py index fce72516a..3a739e946 100644 --- a/psycopg/psycopg/connection.py +++ b/psycopg/psycopg/connection.py @@ -384,7 +384,7 @@ class BaseConnection(Generic[Row]): # to the connections subclass, which might wait either in blocking mode # or through asyncio. # - # All these generators assume exclusive acces to the connection: subclasses + # All these generators assume exclusive access to the connection: subclasses # should have a lock and hold it before calling and consuming them. @classmethod diff --git a/psycopg/psycopg/cursor.py b/psycopg/psycopg/cursor.py index ada4e8510..423f15732 100644 --- a/psycopg/psycopg/cursor.py +++ b/psycopg/psycopg/cursor.py @@ -437,7 +437,7 @@ class BaseCursor(Generic[ConnectionType, Row]): self._iresult = i res = self.pgresult = self._results[i] - # Note: the only reason to override format is to correclty set + # Note: the only reason to override format is to correctly set # binary loaders on server-side cursors, because send_describe_portal # only returns a text result. self._tx.set_pgresult(res, format=format) diff --git a/psycopg/psycopg/pq/__init__.py b/psycopg/psycopg/pq/__init__.py index 2339eca3f..3cf58cef1 100644 --- a/psycopg/psycopg/pq/__init__.py +++ b/psycopg/psycopg/pq/__init__.py @@ -100,7 +100,7 @@ def import_from_libpq() -> None: PGcancel = module.PGcancel __build_version__ = getattr(module, "__build_version__", None) elif impl: - raise ImportError(f"requested psycopg impementation '{impl}' unknown") + raise ImportError(f"requested psycopg implementation '{impl}' unknown") else: sattempts = "\n".join(f"- {attempt}" for attempt in attempts) raise ImportError( diff --git a/psycopg/psycopg/rows.py b/psycopg/psycopg/rows.py index 55574d839..8032fb2d5 100644 --- a/psycopg/psycopg/rows.py +++ b/psycopg/psycopg/rows.py @@ -96,7 +96,7 @@ def tuple_row(cursor: "BaseCursor[Any, TupleRow]") -> "RowMaker[TupleRow]": r"""Row factory to represent rows as simple tuples. This is the default factory, used when `~psycopg.Connection.connect()` or - `~psycopg.Connection.cursor()` are called withouth a `!row_factory` + `~psycopg.Connection.cursor()` are called without a `!row_factory` parameter. """ diff --git a/psycopg/psycopg/sql.py b/psycopg/psycopg/sql.py index 520a71d72..2f1a02ac4 100644 --- a/psycopg/psycopg/sql.py +++ b/psycopg/psycopg/sql.py @@ -21,7 +21,7 @@ def quote(obj: Any, context: Optional[AdaptContext] = None) -> str: Use this function only if you absolutely want to convert a Python string to an SQL quoted literal to use e.g. to generate batch SQL and you won't have - a connection avaliable when you will need to use it. + a connection available when you will need to use it. This function is relatively inefficient, because it doesn't cache the adaptation rules. If you pass a *context* you can adapt the adaptation diff --git a/psycopg/psycopg/types/range.py b/psycopg/psycopg/types/range.py index e636862a7..e1e2c73b3 100644 --- a/psycopg/psycopg/types/range.py +++ b/psycopg/psycopg/types/range.py @@ -470,12 +470,12 @@ _re_range = re.compile( (?: # lower bound: " ( (?: [^"] | "")* ) " # - a quoted string | ( [^",]+ ) # - or an unquoted string - )? # - or empty (not catched) + )? # - or empty (not caught) , (?: # upper bound: " ( (?: [^"] | "")* ) " # - a quoted string | ( [^"\)\]]+ ) # - or an unquoted string - )? # - or empty (not catched) + )? # - or empty (not caught) ( \)|\] ) # upper bound flag """, re.VERBOSE, diff --git a/psycopg/psycopg/types/string.py b/psycopg/psycopg/types/string.py index 2bf5cfe8f..f389e43c0 100644 --- a/psycopg/psycopg/types/string.py +++ b/psycopg/psycopg/types/string.py @@ -55,7 +55,7 @@ class StrDumper(_StrDumper): """ Dumper for strings in text format to the text oid. - Note that this dumper is not used by deafult because the type is too strict + Note that this dumper is not used by default because the type is too strict and PostgreSQL would require an explicit casts to everything that is not a text field. However it is useful where the unknown oid is ambiguous and the text oid is required, for instance with variadic functions. diff --git a/psycopg_c/psycopg_c/_psycopg/adapt.pyx b/psycopg_c/psycopg_c/_psycopg/adapt.pyx index 0ab9b0a02..5676fef25 100644 --- a/psycopg_c/psycopg_c/_psycopg/adapt.pyx +++ b/psycopg_c/psycopg_c/_psycopg/adapt.pyx @@ -55,7 +55,7 @@ cdef class CDumper: The function interface allows C code to use this method automatically to create larger buffers, e.g. for copy, composite objects, etc. - Implementation note: as you will alway need to make sure that rv + Implementation note: as you will always need to make sure that rv has enough space to include what you want to dump, `ensure_size()` might probably come handy. """ diff --git a/psycopg_c/psycopg_c/pq/pgconn.pyx b/psycopg_c/psycopg_c/pq/pgconn.pyx index 3921f20ff..c96dd3b26 100644 --- a/psycopg_c/psycopg_c/pq/pgconn.pyx +++ b/psycopg_c/psycopg_c/pq/pgconn.pyx @@ -672,7 +672,7 @@ cdef (Py_ssize_t, libpq.Oid *, char * const*, int *, int *) _query_params_args( ) except *: cdef int i - # the PostgresQuery convers the param_types to tuple, so this operation + # the PostgresQuery converts the param_types to tuple, so this operation # is most often no-op cdef tuple tparam_types if param_types is not None and not isinstance(param_types, tuple): diff --git a/psycopg_c/psycopg_c/types/string.pyx b/psycopg_c/psycopg_c/types/string.pyx index cff136bb4..53fd30b1b 100644 --- a/psycopg_c/psycopg_c/types/string.pyx +++ b/psycopg_c/psycopg_c/types/string.pyx @@ -157,7 +157,7 @@ cdef class BytesDumper(CDumper): format = PQ_TEXT oid = oids.BYTEA_OID - # 0: not set, 1: just single "'" quote, 3: " E'" qoute + # 0: not set, 1: just single "'" quote, 3: " E'" quote cdef int _qplen def __cinit__(self): diff --git a/psycopg_pool/psycopg_pool/null_pool.py b/psycopg_pool/psycopg_pool/null_pool.py index 62e1b3f85..436485d7e 100644 --- a/psycopg_pool/psycopg_pool/null_pool.py +++ b/psycopg_pool/psycopg_pool/null_pool.py @@ -96,7 +96,7 @@ class NullConnectionPool(_BaseNullConnectionPool, ConnectionPool): elif self.max_waiting and len(self._waiting) >= self.max_waiting: self._stats[self._REQUESTS_ERRORS] += 1 raise TooManyRequests( - f"the pool {self.name!r} has aleady" + f"the pool {self.name!r} has already" f" {len(self._waiting)} requests waiting" ) return conn @@ -158,6 +158,6 @@ class NullConnectionPool(_BaseNullConnectionPool, ConnectionPool): if self._pool_full_event: self._pool_full_event.set() else: - # The connection created by wait shoudn't decrease the + # The connection created by wait shouldn't decrease the # count of the number of connection used. self._nconns -= 1 diff --git a/psycopg_pool/psycopg_pool/null_pool_async.py b/psycopg_pool/psycopg_pool/null_pool_async.py index 694e8f091..3fa8a1462 100644 --- a/psycopg_pool/psycopg_pool/null_pool_async.py +++ b/psycopg_pool/psycopg_pool/null_pool_async.py @@ -57,7 +57,7 @@ class AsyncNullConnectionPool(_BaseNullConnectionPool, AsyncConnectionPool): elif self.max_waiting and len(self._waiting) >= self.max_waiting: self._stats[self._REQUESTS_ERRORS] += 1 raise TooManyRequests( - f"the pool {self.name!r} has aleady" + f"the pool {self.name!r} has already" f" {len(self._waiting)} requests waiting" ) return conn @@ -121,6 +121,6 @@ class AsyncNullConnectionPool(_BaseNullConnectionPool, AsyncConnectionPool): if self._pool_full_event: self._pool_full_event.set() else: - # The connection created by wait shoudn't decrease the + # The connection created by wait shouldn't decrease the # count of the number of connection used. self._nconns -= 1 diff --git a/psycopg_pool/psycopg_pool/pool.py b/psycopg_pool/psycopg_pool/pool.py index c9f7c0c7a..664ca123f 100644 --- a/psycopg_pool/psycopg_pool/pool.py +++ b/psycopg_pool/psycopg_pool/pool.py @@ -128,7 +128,7 @@ class ConnectionPool(BasePool[Connection[Any]]): def getconn(self, timeout: Optional[float] = None) -> Connection[Any]: """Obtain a connection from the pool. - You should preferrably use `connection()`. Use this function only if + You should preferably use `connection()`. Use this function only if it is not possible to use the connection as context manager. After using this function you *must* call a corresponding `putconn()`: @@ -187,7 +187,7 @@ class ConnectionPool(BasePool[Connection[Any]]): elif self.max_waiting and len(self._waiting) >= self.max_waiting: self._stats[self._REQUESTS_ERRORS] += 1 raise TooManyRequests( - f"the pool {self.name!r} has aleady" + f"the pool {self.name!r} has already" f" {len(self._waiting)} requests waiting" ) return conn @@ -447,7 +447,7 @@ class ConnectionPool(BasePool[Connection[Any]]): # Don't make all the workers time out at the same moment timeout = cls._jitter(cls._WORKER_TIMEOUT, -0.1, 0.1) while True: - # Use a timeout to make the wait interruptable + # Use a timeout to make the wait interruptible try: task = q.get(timeout=timeout) except Empty: diff --git a/psycopg_pool/psycopg_pool/pool_async.py b/psycopg_pool/psycopg_pool/pool_async.py index e9bb2adc4..bb7be930a 100644 --- a/psycopg_pool/psycopg_pool/pool_async.py +++ b/psycopg_pool/psycopg_pool/pool_async.py @@ -153,7 +153,7 @@ class AsyncConnectionPool(BasePool[AsyncConnection[Any]]): elif self.max_waiting and len(self._waiting) >= self.max_waiting: self._stats[self._REQUESTS_ERRORS] += 1 raise TooManyRequests( - f"the pool {self.name!r} has aleady" + f"the pool {self.name!r} has already" f" {len(self._waiting)} requests waiting" ) return conn diff --git a/tests/fix_faker.py b/tests/fix_faker.py index db26d4de5..aebd553e5 100644 --- a/tests/fix_faker.py +++ b/tests/fix_faker.py @@ -143,7 +143,7 @@ class Faker: @contextmanager def find_insert_problem(self, conn): - """Context manager to help finding a problematic vaule.""" + """Context manager to help finding a problematic value.""" try: yield except psycopg.DatabaseError: diff --git a/tests/test_transaction.py b/tests/test_transaction.py index b2b5e0fb9..7db3b1dba 100644 --- a/tests/test_transaction.py +++ b/tests/test_transaction.py @@ -409,7 +409,7 @@ def test_named_savepoints_successful_exit(conn, commands): ...and exiting the context successfully will "commit" the same. """ # Case 1 - # Using Transaction explicitly becase conn.transaction() enters the contetx + # Using Transaction explicitly because conn.transaction() enters the contetx assert not commands with conn.transaction() as tx: assert commands.popall() == ["BEGIN"] diff --git a/tests/test_transaction_async.py b/tests/test_transaction_async.py index 4335eb837..51bc023dd 100644 --- a/tests/test_transaction_async.py +++ b/tests/test_transaction_async.py @@ -362,7 +362,7 @@ async def test_named_savepoints_successful_exit(aconn, acommands): commands = acommands # Case 1 - # Using Transaction explicitly becase conn.transaction() enters the contetx + # Using Transaction explicitly because conn.transaction() enters the contetx async with aconn.transaction() as tx: assert commands.popall() == ["BEGIN"] assert not tx.savepoint_name