From: Daniele Varrazzo Date: Mon, 2 Aug 2021 09:59:50 +0000 (+0200) Subject: Some docs cleanup X-Git-Tag: 3.0.dev2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70e2a6e10755749936f62995a85eefcb777f62be;p=thirdparty%2Fpsycopg.git Some docs cleanup --- diff --git a/docs/api/connections.rst b/docs/api/connections.rst index cb3db196d..8bc980493 100644 --- a/docs/api/connections.rst +++ b/docs/api/connections.rst @@ -382,12 +382,22 @@ Connection support objects is bad. `!ACTIVE` is reported only when a query has been sent to the server and not yet completed. - .. autoattribute:: server_version .. autoattribute:: backend_pid + .. autoattribute:: server_version .. autoattribute:: error_message .. automethod:: get_parameters + + .. note:: The `dsn` attribute returns the same information in the form + as a string. + .. autoattribute:: timezone + + .. code:: pycon + + >>> conn.info.timezone + zoneinfo.ZoneInfo(key='Europe/Rome') + .. autoattribute:: host This can be a host name, an IP address, or a directory path if the diff --git a/psycopg/psycopg/conninfo.py b/psycopg/psycopg/conninfo.py index 9700c356f..c442be796 100644 --- a/psycopg/psycopg/conninfo.py +++ b/psycopg/psycopg/conninfo.py @@ -121,32 +121,32 @@ class ConnectionInfo: @property def host(self) -> str: - """The server host name of the active connection. See :pq:`PQhost`.""" + """The server host name of the active connection. See :pq:`PQhost()`.""" return self._get_pgconn_attr("host") @property def hostaddr(self) -> str: - """The server IP address of the connection. See :pq:`PQhostaddr`.""" + """The server IP address of the connection. See :pq:`PQhostaddr()`.""" return self._get_pgconn_attr("hostaddr") @property def port(self) -> int: - """The port of the active connection. See :pq:`PQport`.""" + """The port of the active connection. See :pq:`PQport()`.""" return int(self._get_pgconn_attr("port")) @property def dbname(self) -> str: - """The database name of the connection. See :pq:`PQdb`.""" + """The database name of the connection. See :pq:`PQdb()`.""" return self._get_pgconn_attr("db") @property def user(self) -> str: - """The user name of the connection. See :pq:`PQuser`.""" + """The user name of the connection. See :pq:`PQuser()`.""" return self._get_pgconn_attr("user") @property def password(self) -> str: - """The password of the connection. See :pq:`PQpass`.""" + """The password of the connection. See :pq:`PQpass()`.""" return self._get_pgconn_attr("password") @property @@ -199,14 +199,14 @@ class ConnectionInfo: @property def status(self) -> pq.ConnStatus: - """The status of the connection. See :pq:`PQstatus`.""" + """The status of the connection. See :pq:`PQstatus()`.""" return pq.ConnStatus(self.pgconn.status) @property def transaction_status(self) -> pq.TransactionStatus: """ The current in-transaction status of the server. - See :pq:`PQtransactionStatus`. + See :pq:`PQtransactionStatus()`. """ return pq.TransactionStatus(self.pgconn.transaction_status) @@ -227,7 +227,7 @@ class ConnectionInfo: The number is formed by converting the major, minor, and revision numbers into two-decimal-digit numbers and appending them together. After PostgreSQL 10 the minor version was dropped, so the second group - of digits is always 00. For example, version 9.3.5 will be returned as + of digits is always 00. For example, version 9.3.5 is returned as 90305, version 10.2 as 100002. """ return self.pgconn.server_version @@ -236,14 +236,14 @@ class ConnectionInfo: def backend_pid(self) -> int: """ The process ID (PID) of the backend process handling this connection. - See :pq:`PQbackendPID`. + See :pq:`PQbackendPID()`. """ return self.pgconn.backend_pid @property def protocol_version(self) -> int: """ - The frontend/backend protocol currently used. See :pq:`PQprotocolVersion`. + The frontend/backend protocol currently used. See :pq:`PQprotocolVersion()`. """ return self.pgconn.protocol_version @@ -251,7 +251,7 @@ class ConnectionInfo: def error_message(self) -> str: """ The error message most recently generated by an operation on the connection. - See :pq:`PQerrorMessage`. + See :pq:`PQerrorMessage()`. """ return self._get_pgconn_attr("error_message") diff --git a/psycopg/psycopg/pq/_enums.py b/psycopg/psycopg/pq/_enums.py index 77b5c4a58..1ea4e7e01 100644 --- a/psycopg/psycopg/pq/_enums.py +++ b/psycopg/psycopg/pq/_enums.py @@ -185,7 +185,7 @@ class Format(IntEnum): Enum representing the format of a query argument or return value. These values are only the ones managed by the libpq. `~psycopg` may also - support automatically-chosen values: see `psycopg.adapt.Format`. + support automatically-chosen values: see `psycopg.adapt.PyFormat`. """ __module__ = "psycopg.pq" diff --git a/psycopg/psycopg/pq/pq_ctypes.py b/psycopg/psycopg/pq/pq_ctypes.py index bf632d6fd..c98138078 100644 --- a/psycopg/psycopg/pq/pq_ctypes.py +++ b/psycopg/psycopg/pq/pq_ctypes.py @@ -670,7 +670,7 @@ class PGresult: def pgresult_ptr(self) -> Optional[int]: """The pointer to the underlying ``PGresult`` structure, as integer. - `!None` if the result waas cleared. + `!None` if the result was cleared. The value can be used to pass the structure to libpq functions which psycopg doesn't (currently) wrap, either in C or in Python using FFI @@ -789,11 +789,11 @@ class PGcancel: def free(self) -> None: """ - Free the data structure created by PQgetCancel. + Free the data structure created by :pq:`PQgetCancel()`. Automatically invoked by `!__del__()`. - See :pq:`PQfreeCancel` for details. + See :pq:`PQfreeCancel()` for details. """ self.pgcancel_ptr, p = None, self.pgcancel_ptr if p: