Skip to content

Instantly share code, notes, and snippets.

View carljm's full-sized avatar

Carl Meyer carljm

View GitHub Profile
@carljm
carljm / staticmethod.py
Created June 27, 2012 14:55
pure Python implementation of the staticmethod decorator
class StaticMethod(object):
def __init__(self, func):
self.func = func
def __get__(self, obj, cls):
return self.func
def staticmethod(func):
@carljm
carljm / test_something.py
Created February 8, 2013 19:26
writing a py.test fixture that can take params from the test
@pytest.fixture
def template(request):
if 'param' in request.fixturenames:
param = request.getfuncargvalue('param')
else:
param = 'default'
# return something based on param
if 'raven.contrib.django' in settings.INSTALLED_APPS: # pragma: no cover
from raven.contrib.celery import register_signal
from raven.contrib.django.models import client
# automatic logging of task failures to Sentry
register_signal(client)
import unittest
from unittest import mock
class SomeClass:
def a_method(self):
return 2
class TestStub(unittest.TestCase):
It seems to me that there's a remarkable level of consensus developing here (though it may not look like it), and a small set of remaining open questions.
The consensus (as I see it):
- Migrate away from scraping external HTML pages, with package owners in control of the migration but a deadline for a forced switch, as outlined in Holger's PEP (with all appropriate caution and testing).
- In some way, migrate to a situation where the popular installer tools install only release files from PyPI by default, but are capable of installing from other locations if the user provides an option.
The open question is basically how to implement the latter portion. I see two options proposed:
It seems to me that there's a remarkable level of consensus developing
here (though it may not look like it), and a small set of remaining open
questions.
The consensus (as I see it):
- Migrate away from scraping external HTML pages, with package owners in
control of the migration but a deadline for a forced switch, as outlined
in Holger's PEP (with all appropriate caution and testing).
diff --git a/docs/ref/forms/models.txt b/docs/ref/forms/models.txt
index 46f7df1..dd0a422 100644
--- a/docs/ref/forms/models.txt
+++ b/docs/ref/forms/models.txt
@@ -33,8 +33,8 @@ Model Form Functions
``formfield_callback`` and ``widgets`` are all passed through to
:func:`~django.forms.models.modelform_factory`.
- Arguments ``formset``, ``extra``, ``max_num``, ``can_order``, and
- ``can_delete`` are passed through to
export GEM_HOME=$VIRTUAL_ENV/rubygems
export GEM_PATH=
export PATH=$VIRTUAL_ENV/rubygems/bin:$PATH
$ curl -s -XGET 'http://localhost:9200/_settings?pretty'
{
"jlor" : {
"settings" : {
"index.analysis.analyzer.default.filter.1" : "lowercase",
"index.analysis.analyzer.default.filter.0" : "standard",
"index.analysis.analyzer.default.tokenizer" : "standard",
"index.analysis.analyzer.default.type" : "custom",
"index.number_of_shards" : "5",
"index.number_of_replicas" : "1",

Keybase proof

I hereby claim:

  • I am carljm on github.
  • I am carljm (https://keybase.io/carljm) on keybase.
  • I have a public key whose fingerprint is 3C32 FA99 DC96 932C 2204 6A41 2D1F B791 6A52 E121

To claim this, I am signing this object: