]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Some docs cleanup
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 2 Aug 2021 09:59:50 +0000 (11:59 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 3 Aug 2021 10:57:53 +0000 (11:57 +0100)
docs/api/connections.rst
psycopg/psycopg/conninfo.py
psycopg/psycopg/pq/_enums.py
psycopg/psycopg/pq/pq_ctypes.py

index cb3db196db9dbf5954149ae4c5dfa4479b11bc1c..8bc980493357b717c64b056585673f37e2bf1c98 100644 (file)
@@ -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
index 9700c356fa50ccd9aed7b6f63ca108428ea78805..c442be79601d5b10380aaf31c1b15b1b548ea1ac 100644 (file)
@@ -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")
 
index 77b5c4a588b798a33d90ac82c6475891b0ebc50c..1ea4e7e01016bbb3f443b390b80aa4eafbcf57ff 100644 (file)
@@ -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"
index bf632d6fd3137c26768c2d7fcac2f91dba80ba86..c981380781c05dd831744d837a8fd2743a6c6a0b 100644 (file)
@@ -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: