---------------------------------------------------------------------- This is the API documentation for the gdtest_complete_docstrings library. ---------------------------------------------------------------------- ## Classes Main classes provided by the package Connection(backend: Literal['postgresql', 'mysql', 'sqlite'], connection_id: str) -> None A managed database connection drawn from the pool. Connections track their own state (idle, active, closed) and expose that state through read-only properties. Use `get_connection()` to obtain one; call `close()` when finished. Parameters ---------- backend Which database backend this connection targets. connection_id The pool-assigned unique identifier. %seealso get_connection, reinitialize ## Functions Utility functions get_connection(backend: Literal['postgresql', 'mysql', 'sqlite'] = 'postgresql', host: str = 'localhost', port: int = 5432) -> gdtest_complete_docstrings.Connection Obtain a connection from the pool. If a pool for the given `(backend, host, port)` triple already exists, a connection is drawn from it. Otherwise a new pool is created with `MIN_CONNECTIONS` warm connections. Parameters ---------- backend Which database backend to connect to. host The server hostname or IP address. port The server port number. Returns ------- Connection A ready-to-use connection. Raises ------ ConnectionPoolExhausted If the pool has reached `MAX_CONNECTIONS`. TimeoutError If a connection cannot be established within `timeout` seconds. %seealso Connection, MAX_CONNECTIONS, timeout reinitialize() -> None Reset the global connection pool. Call this after `os.fork()` to avoid sharing file descriptors between parent and child processes. All existing connections are closed and new ones are established. Notes ----- This is a no-op if the pool has not been initialized yet. %seealso get_connection, MIN_CONNECTIONS ## Constants Module-level constants and data Literal(*args, **kwargs) str str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'. Handler Type variable. The preferred way to construct a type variable is via the dedicated syntax for generic functions, classes, and type aliases:: class Sequence[T]: # T is a TypeVar ... This syntax can also be used to create bound and constrained type variables:: # S is a TypeVar bound to str class StrSequence[S: str]: ... # A is a TypeVar constrained to str or bytes class StrOrBytesSequence[A: (str, bytes)]: ... Type variables can also have defaults: class IntDefault[T = int]: ... However, if desired, reusable type variables can also be constructed manually, like so:: T = TypeVar('T') # Can be anything S = TypeVar('S', bound=str) # Can be any subtype of str A = TypeVar('A', str, bytes) # Must be exactly str or bytes D = TypeVar('D', default=int) # Defaults to int Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function and type alias definitions. The variance of type variables is inferred by type checkers when they are created through the type parameter syntax and when ``infer_variance=True`` is passed. Manually created type variables may be explicitly marked covariant or contravariant by passing ``covariant=True`` or ``contravariant=True``. By default, manually created type variables are invariant. See PEP 484 and PEP 695 for more details. MAX_CONNECTIONS int([x]) -> integer int(x, base=10) -> integer Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero. If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer iteral. >>> int('0b100', base=0) 4 MIN_CONNECTIONS int([x]) -> integer int(x, base=10) -> integer Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero. If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer iteral. >>> int('0b100', base=0) 4 tuple(iterable=(), /) Built-in immutable sequence. If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items. If the argument is a tuple, the return value is the same object. SUPPORTED_BACKENDS Built-in immutable sequence. If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items. If the argument is a tuple, the return value is the same object. Sortable Type variable. The preferred way to construct a type variable is via the dedicated syntax for generic functions, classes, and type aliases:: class Sequence[T]: # T is a TypeVar ... This syntax can also be used to create bound and constrained type variables:: # S is a TypeVar bound to str class StrSequence[S: str]: ... # A is a TypeVar constrained to str or bytes class StrOrBytesSequence[A: (str, bytes)]: ... Type variables can also have defaults: class IntDefault[T = int]: ... However, if desired, reusable type variables can also be constructed manually, like so:: T = TypeVar('T') # Can be anything S = TypeVar('S', bound=str) # Can be any subtype of str A = TypeVar('A', str, bytes) # Must be exactly str or bytes D = TypeVar('D', default=int) # Defaults to int Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function and type alias definitions. The variance of type variables is inferred by type checkers when they are created through the type parameter syntax and when ``infer_variance=True`` is passed. Manually created type variables may be explicitly marked covariant or contravariant by passing ``covariant=True`` or ``contravariant=True``. By default, manually created type variables are invariant. See PEP 484 and PEP 695 for more details. retry_delay Convert a string or number to a floating-point number, if possible. timeout int([x]) -> integer int(x, base=10) -> integer Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero. If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer iteral. >>> int('0b100', base=0) 4