Skip to content

Instantly share code, notes, and snippets.

brian wickman wickman

  • twitter
Block or report user

Report or block wickman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wickman
wickman / rformat.py
Created Nov 20, 2015
recursive version of python str.format
View rformat.py
from string import Formatter
class RecursiveFormatter(Formatter):
def _contains_underformatted_field_names(self, format_tuple):
literal_text, field_name, format_spec, conversion = format_tuple
if field_name is not None:
return any(component[1] is not None for component in self.parse(field_name))
return False
@wickman
wickman / coverage.patch
Created Sep 12, 2014
custom pants pytest runner
View coverage.patch
diff --git a/src/python/twitter/pants/BUILD b/src/python/twitter/pants/BUILD
index c4cfaac..656392d 100644
--- a/src/python/twitter/pants/BUILD
+++ b/src/python/twitter/pants/BUILD
@@ -27,13 +27,13 @@ python_library(
name='pants-deps',
dependencies=[
pants('3rdparty/python:ansicolors'),
+ pants('3rdparty/python:coverage'),
pants('3rdparty/python:elementtree'),
@wickman
wickman / thread_registry.py
Created Aug 27, 2014
healthy thread registry
View thread_registry.py
import threading
from twitter.common import log
from twitter.common.exceptions import ExceptionalThread
class ThreadRegistry(ExceptionalThread):
DEFAULT_WAIT_INTERVAL_SECS = 1.0
def __init__(self, wait_interval=DEFAULT_WAIT_INTERVAL_SECS):
@wickman
wickman / requests.diff
Created Jun 11, 2014
requests patch to twitter.common.http
View requests.diff
diff --git a/src/python/twitter/common/python/http/http.py b/src/python/twitter/common/python/http/h
index 51d0543..db5ab05 100644
--- a/src/python/twitter/common/python/http/http.py
+++ b/src/python/twitter/common/python/http/http.py
@@ -6,7 +6,7 @@ import struct
import time
from ..common import safe_delete, safe_mkdir, safe_mkdtemp
-from ..compatibility import PY2, PY3
+from ..compatibility import PY2, PY3, StringIO
@wickman
wickman / setup.py
Created May 14, 2014
example autogenerated setup.py
View setup.py
# DO NOT EDIT THIS FILE -- AUTOGENERATED BY PANTS
# Target: PythonLibrary(src/main/python/apache/thermos/observer/BUILD:observer)
from setuptools import setup
setup(**
{ 'description': 'The Thermos observer web interface.',
'entry_points': { 'console_scripts': [ 'thermos_observer = apache.thermos.observer.bin.thermos_observer:proxy_main']},
'install_requires': [ 'apache.thermos.monitoring==0.5.0-DEV1399063100',
'mako==0.4.0',
@wickman
wickman / pygoal.diff
Created May 13, 2014
python goal backend diff
View pygoal.diff
diff --git a/3rdparty/python/BUILD b/3rdparty/python/BUILD
index 1188c3f..7427891 100644
--- a/3rdparty/python/BUILD
+++ b/3rdparty/python/BUILD
@@ -14,14 +14,14 @@
# limitations under the License.
# ==================================================================================================
-def make_dep(name, dependency_name=None):
+def make_dep(name, dependency_name=None, **kw):
@wickman
wickman / pystachio1_designdoc.txt
Created Feb 19, 2014
pystachio 1.0 designdoc
View pystachio1_designdoc.txt
Pystachio 1.0 redesign
1. Documents:
Essentially a set of hierarchical key/value pairs a la a JSON document.
Documents may contain:
1. Leaves (string or numeric [integer, long, float, etc])
View break_pypy
------- code/__main__.py -------
import os
import pkgutil
from pprint import pprint
import sys
from zipimport import zipimporter
sys.path.insert(0, os.path.join(sys.argv[0], 'deps'))
import twitter
@wickman
wickman / README.md
Created Jan 3, 2014
pex.pex README
View README.md

Pex.pex: Usage

PEX files are single-file lightweight virtual Python environments.

pex.pex is a utility that:

  • creates PEX files
  • provides a single use run-environment

Installation

@wickman
wickman / gist:6587345
Created Sep 16, 2013
holy shit, open source aurora client
View gist:6587345
mba=science=; PANTS_VERBOSE=1 ./pants src/python/twitter/aurora/client/bin:aurora_client
Build operating on targets: OrderedSet([PythonBinary(src/python/twitter/aurora/client/bin/BUILD:aurora_client)])
Building PythonBinary PythonBinary(src/python/twitter/aurora/client/bin/BUILD:aurora_client):
Building PythonBinary PythonBinary(src/python/twitter/aurora/client/bin/BUILD:aurora_client):
Dumping library: PythonLibrary(src/python/twitter/aurora/client/bin/BUILD:aurora_client_source)
Dumping library: PythonLibrary(src/python/twitter/common/app/BUILD:app)
Dumping library: PythonLibrary(src/python/twitter/common/BUILD:common)
Dumping library: PythonLibrary(src/python/twitter/common/collections/BUILD:collections)
Dumping library: PythonLibrary(src/python/twitter/common/config/BUILD:config)
Dumping library: PythonLibrary(src/python/twitter/common/lang/BUILD:lang)
You can’t perform that action at this time.