This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """The wait_async() implementation before the #1331 optimisation. | |
| Copied verbatim from `git show ebf8d9d4:psycopg/psycopg/waiting.py`, which is | |
| the merge of #1411, right after the `timeout` parameter refactoring: the first | |
| commit whose signature matches what `AsyncConnection.wait()` passes today, so | |
| no adaptation was needed. Only the function name differs. | |
| It is NOT the 3.3.5 code: that one has no `timeout` parameter at all and would | |
| raise a TypeError when called by the current connection classes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| PostgreSQL Logical Replication for psycopg3 | |
| A production-ready implementation of PostgreSQL logical replication using psycopg3. | |
| Works around psycopg3's missing replication support by using a raw socket bridge. | |
| Author: Richard Brandes | |
| Date: October 2025 | |
| License: MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import statistics as st | |
| from time import sleep, monotonic | |
| from argparse import ArgumentParser, Namespace | |
| import psycopg | |
| import psycopg2 | |
| from psycopg import sql | |
| DSN = "dbname=psycopg3_test host=localhost sslmode=disable" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """Convert a codebase to using the walrus operator. | |
| Hint: in order to explore the AST of a module you can run: | |
| python -m ast path/to/module.py | |
| """ | |
| from __future__ import annotations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DictTuple(tuple): | |
| """Tuple class with added item getting by name. | |
| """ | |
| def __new__(cls, d): | |
| rv = super().__new__(cls, d.values()) | |
| rv._map = d | |
| return rv | |
| def __repr__(self): | |
| return f"{type(self).__qualname__}({self._map!r})" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| tests-python: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Return the ip address for a container in docker-compose | |
| set -euo pipefail | |
| # set -x | |
| if [[ "${1:-}" == "" ]]; then | |
| echo "usage: $0 container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Apply database patches. | |
| Applied patches are recorded in the schema_patch table of the database. | |
| The dsn to connect to defaults to a local one (empty connection string). It can | |
| be chosen using the command line or an environment variable. Patches | |
| application is interactive by default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| r"""Implementation of a `stan`_\ -like XML description language. | |
| .. _stan: http://www.kieranholland.com/code/documentation/nevow-stan/ | |
| An example XHTML page can be generated by: | |
| .. python:: | |
| def items(): | |
| return [ T.li['foo'], T.li['bar'], T.li['baz'] ] |
NewerOlder