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
$ git checkout --detach HEAD | |
... | |
$ git branch | |
* (detached from HEAD) | |
master | |
$ git branch -m master master-dirty | |
$ git branch | |
* (detached from HEAD) | |
master-dirty | |
$ git branch master origin/master |
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
$ tox | |
GLOB sdist-make: /Users/dhermes/google_contracting/gcloud-python/setup.py | |
py26 inst-nodeps: /Users/dhermes/google_contracting/gcloud-python/.tox/dist/gcloud-0.02.2.zip | |
py26 runtests: PYTHONHASHSEED='189486614' | |
py26 runtests: commands[0] | nosetests | |
............ | |
---------------------------------------------------------------------- | |
Ran 12 tests in 1.541s | |
OK |
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 __builtin__ | |
import ast | |
import collections | |
import shutil | |
import sys | |
import tempfile | |
TRIPLE_QUOTES = ('"""', '\'\'\'') | |
# Also see: http://stackoverflow.com/a/17478618/1068170 |
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 itertools | |
>>> for pair in itertools.product((0, 1), repeat=2): | |
... print pair | |
... | |
(0, 0) | |
(0, 1) | |
(1, 0) | |
(1, 1) |
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
>>> len(list(itertools.product((0, 1), repeat=5))) | |
32 |
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
def fits_criterion(digit_list): | |
for i in xrange(10): | |
if digit_list.count(i) != digit_list[i]: | |
return False | |
return True |
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
for first5 in xrange(10**4, 10**5): | |
first5_list = map(int, str(first5)) | |
for last5 in itertools.product((0, 1), repeat=5): | |
digit_list = first5_list + list(last5) # last5 is a tuple | |
if fits_criterion(digit_list): | |
print digit_list |
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
[6, 2, 1, 0, 0, 0, 1, 0, 0, 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
"""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. | |
""" |
OlderNewer