Skip to content

Instantly share code, notes, and snippets.

View dhermes's full-sized avatar

Danny Hermes dhermes

View GitHub Profile
"""Plugin for pylint to suppress warnings on tests.
Turns off the following pylint errors/warnings:
- Docstring checks in test modules.
- Too few public methods on test classes.
- Too many public methods on subclasses of unittest.TestCase.
- Invalid names on all functions/methods.
- Private attribute mangling outside __init__ method.
- Invalid variable name assignment.
"""
"""Plugin for pylint to allow gcloud type inference.
Supports:
- Specifying the return type of an instance methods in the case
that no arguments are passed in.
"""
import importlib
import astroid
@dhermes
dhermes / truthiness.pyout
Created October 10, 2014 17:56
NumPy array truthiness
>>> import numpy as np
>>> bool(np.array([]))
False
>>> bool(np.array([1]))
True
>>> bool(np.array([0]))
False
>>> bool(np.array([0,0]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
$ git grep "Needs docstring"
gcloud/connection.py: """Needs docstring."""
gcloud/datastore/connection.py: """Needs docstring."""
gcloud/datastore/connection.py: """Needs docstring."""
gcloud/datastore/connection.py: """Needs docstring."""
gcloud/datastore/connection.py: """Needs docstring."""
gcloud/datastore/connection.py: """Needs docstring."""
gcloud/datastore/dataset.py: """Needs docstring."""
gcloud/datastore/dataset.py: """Needs docstring."""
gcloud/datastore/dataset.py: """Needs docstring."""
$ git grep "Class data attribute docstring"
gcloud/storage/_helpers.py: """Class data attribute docstring."""
gcloud/storage/_helpers.py: """Class data attribute docstring."""
gcloud/storage/_helpers.py: """Class data attribute docstring."""
gcloud/storage/bucket.py: """Class data attribute docstring."""
gcloud/storage/bucket.py: """Class data attribute docstring."""
gcloud/storage/bucket.py: """Class data attribute docstring."""
gcloud/storage/key.py: """Class data attribute docstring."""
gcloud/storage/key.py: """Class data attribute docstring."""
gcloud/storage/key.py: """Class data attribute docstring."""
"""Simple utility to check config consistency.
Parses the production and test lint config files and makes
sure the test config inherits from the production config.
"""
import ConfigParser
PRODUCTION_RC = 'pylintrc_default'
@dhermes
dhermes / travis-output.shell
Last active August 29, 2015 14:08
Travis Run Regression Tests
$ travis login --github-token=`cat travis.token`
$ if [ "`git rev-parse --show-toplevel`" == "`pwd`" ]; then echo "at top level"; fi
at top level
$ travis env list --repo dhermes/gcloud-python
# environment variables for dhermes/gcloud-python
$ travis encrypt-file regression/djh_key.p12 \
> --repo dhermes/gcloud-python
... encrypted_d4f2fba7a94f_key ...
$ mv djh_key.p12.enc regression/
$ travis env list --repo dhermes/gcloud-python
@dhermes
dhermes / gist:5088b5520bba841a3d0e
Created October 23, 2014 20:14
Travis BUILD Speed-up Test
https://travis-ci.org/dhermes/gcloud-python/builds/38858843
INSTALL:
--------
pip install coveralls - 10.44s
pip install pep8 - 0.54s
pip install pylint - 3.36s
pip install unittest2 - 1.26s
pip install nose - 0.33s
pip install coverage - 0.33s
https://travis-ci.org/dhermes/gcloud-python/builds/38970047
------------------------------------------------------------ ------
export WHEELHOUSE="`pwd`/travis-wheels/wheelhouse/" 0.01s
pip install --no-index --find-links=${WHEELHOUSE} ./ 3.47s
pip install --no-index --find-links=${WHEELHOUSE} coverage 0.48s
pip install --no-index --find-links=${WHEELHOUSE} nose 0.35s
pip install --no-index --find-links=${WHEELHOUSE} nosexcover 0.39s
pip install --no-index --find-links=${WHEELHOUSE} pep8 0.49s
pip install --no-index --find-links=${WHEELHOUSE} pylint 2.12s