This file contains 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 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})" |
This file contains 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 | |
"""Custom reST_ directive for ditaa_ integration. | |
.. _reST: http://docutils.sourceforge.net/rst.html | |
.. _ditaa: http://ditaa.sourceforge.net/ | |
""" | |
import os | |
import tempfile | |
from zlib import adler32 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 | |
"""An example of cursor dealing with prepared statements. | |
A cursor can be used as a regular one, but has also a prepare() statement. If | |
prepare() is called, execute() and executemany() can be used without query: in | |
this case the parameters are passed to the prepared statement. The functions | |
also execute the prepared statement if the query is the same prepared before. | |
Prepared statements aren't automatically deallocated when the cursor is | |
deleted, but are when the cursor is closed. For long-running sessions creating |
This file contains 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 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 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'] ] |
This file contains 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
""" | |
A quick test to try and run psycopg3 with anyio | |
""" | |
import anyio | |
from psycopg3 import exceptions as exc | |
from psycopg3.waiting import Wait, Ready | |
from psycopg3.connection import AsyncConnection | |
import logging |
This file contains 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 | |
# A backup solution based on rsync with hard links and no deletion of old images | |
# Deletion would be delegated to a script such as weeder | |
# https://pypi.org/project/weeder/ | |
set -euo pipefail | |
set -x | |
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
NewerOlder