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
# -*- coding: utf-8 -*- | |
# $Id: offline_bootstrap.py 73407 2011-08-21 20:35:04Z glenfant $ | |
"""Offline buildout bootstraping for use on installation targets with no | |
Internet access. | |
See http://glenfant.wordpress.com/2011/07/31/bootstrap-and-install-a-buildout-based-project-without-internet-connection/ | |
We assume that the directory that contains this file has the following | |
structure: |
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
""" | |
============== | |
marshmallow_fr | |
============== | |
Les fields de marshmallow dont les messages d'erreur sont traduits en Français. | |
Ces messages d'erreur sont basés sur marshmallow 2.15.1 et il sera peut-être nécessaire de le mettre à jour | |
au fil des évolutions de marshmallow. | |
Parametrized marshmallow fields with error messages translated into French. |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# | |
# Docker playground for MacOS and Windows | |
# ======================================= | |
# | |
# - Installs the latest Docker + Docker-compose | |
# - Uses faster NFS files sync on Mac OS | |
# - Uses faster SMB files share on Windows | |
# |
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
""" | |
================ | |
euscans.settings | |
================ | |
Provides settings customization and public configuration object | |
[DEPRECATED] I released the ``pyflexconfig`` package on PyPI that rationalizes and improves this boilerplate. | |
https://pypi.org/project/pyflexconfig/ |
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
# Running a blocking callable inside a coroutine | |
# ============================================== | |
import asyncio | |
import concurrent.futures | |
import functools | |
from typing import Callable, Tuple, Dict, Any | |
# Use the better suited pool (see doc of ``concurrent.future```) |
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
# -*- coding: utf-8 -*- | |
# If you need to test a REST client, this is a Python 2 recipe that runs a | |
# simple WSGI app for your tests. Any improvement suggestion is welcome. | |
# Run this with "python -m unittest testingwsgi" | |
# Put this in a testing resources module, say tests/resources.py | |
import os |
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
# -*- coding: utf-8 | |
"""\ | |
A simple demo of logging configuration with YAML (Python 2.7) | |
============================================================= | |
Requires PyYAML -> "easy_install PyYAML" | |
See the recipes for configuring logging with dicts and YAML | |
- http://docs.python.org/2.7/howto/logging-cookbook.html | |
- http://stackoverflow.com/questions/10519392/python2-7-logging-configuration-with-yaml |
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
import contextlib | |
import time | |
@contextlib.contextmanager | |
def mock_time(timestamp): | |
"""A simple context manager for mocking time.time() useful for traveling | |
immediately in the future or in the past in unit tests. | |
>>> t0 = time.time() | |
>>> with mock_time(t0 + 5.0): |
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
# -*- coding: utf-8 -*- | |
"""Python enumeration""" | |
import itertools | |
def enumeration(name, *auto, **named): | |
"""Pythonic enumeration type | |
>>> Colors = enumeration('Colors', 'GREEN', 'RED', 'YELLOW') |
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
# -*- coding: utf-8 -*- | |
"""Mock datetime.datetime.now()""" | |
import contextlib | |
import datetime | |
@contextlib.contextmanager | |
def mock_datetime_now(*args, **kwargs): | |
"""Context manager for mocking out datetime.datetime.now() in unit tests. |