i want to be able to do this:
# grocery list * apples * bananas * strawberries
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 |
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 | |
# Obtain pure-Ruby lib | |
require 'grok-pure' | |
# Create grok instance | |
grok = Grok.new | |
# Map some regex patterns to pattern names; this sets up %{FOO} | |
grok.add_pattern("FOO", "[abc]") | |
# And/or load from file -- highly useful is the patterns/grok-patterns file that ships with Logstash source |
i want to be able to do this:
# grocery list * apples * bananas * strawberries
>>> def init(headers={}): | |
... print "headers before: %r" % headers | |
... headers['foo'] = 'bar' | |
... print "headers after: %r" % headers | |
... | |
... | |
>>> init() | |
headers before: {} | |
headers after: {'foo': 'bar'} | |
>>> init() |