Skip to content

Instantly share code, notes, and snippets.

View bitprophet's full-sized avatar
🎯
Focusing

Jeff Forcier bitprophet

🎯
Focusing
View GitHub Profile
diff --git a/fabric/main.py b/fabric/main.py
index 33f2f47..89a1cec 100644
--- a/fabric/main.py
+++ b/fabric/main.py
@@ -167,7 +167,7 @@ def is_task_module(a):
Determine if the provided value is a task module
"""
return (type(a) is types.ModuleType and
- getattr(a, "FABRIC_TASK_MODULE", False))
+ any(map(is_task_object, vars(a).values())))
diff --git a/fabric/main.py b/fabric/main.py
index 33f2f47..89a1cec 100644
--- a/fabric/main.py
+++ b/fabric/main.py
@@ -167,7 +167,7 @@ def is_task_module(a):
Determine if the provided value is a task module
"""
return (type(a) is types.ModuleType and
- getattr(a, "FABRIC_TASK_MODULE", False))
+ any(map(is_task_object, vars(a).values())))
## Normal/flat -- this is still the default output of fab --list:
Available commands:
build_docs
deploy
db.migrate
system.install_package
system.debian.update_apt
@bitprophet
bitprophet / gist:1189894
Created September 2, 2011 20:56
Partial Cony settings file
def github(query, url):
url = "https://github.com/%s/issues" % url
# Direct to issue number
try:
redirect("%s/%s" % (url, int(query)))
except ValueError:
# New ticket
if query == "new":
redirect("%s/new" % url)
# Issue list
# Output of https://github.com/bitprophet/seven/blob/master/2-io/day1/answers.io
# at 6a42e4c454eb6eb6499bc1264efa34fc22d3fa15
-- Type strength --
Strongly typed
Still strongly typed
-- Truthiness --
0 is true
empty string is true
import csv
import json
import sys
from collections import defaultdict
from dateutil.parser import parse as dateparse
count = int(sys.argv[2]) if len(sys.argv) > 2 else None
seconds = defaultdict(int)
import csv
import json
import os
import sys
from collections import defaultdict
from dateutil.parser import parse as dateparse
import requests
@bitprophet
bitprophet / gist:1503116
Created December 20, 2011 20:25 — forked from blech75/gist:1503089
markdown and lists

i want to be able to do this:


# grocery list

* apples
* bananas
* strawberries
@bitprophet
bitprophet / bad.py
Created April 17, 2012 05:26 — forked from idan/gist:2403662
Parameter Usage Style
>>> def init(headers={}):
... print "headers before: %r" % headers
... headers['foo'] = 'bar'
... print "headers after: %r" % headers
...
...
>>> init()
headers before: {}
headers after: {'foo': 'bar'}
>>> init()
# Bad
foo \
bar
# Good
foo \
bar