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 sys | |
import argparse | |
from itertools import ifilter | |
from fuzzywuzzy import fuzz | |
MATCH_THRESHOLD = 90 | |
def parse_file(filename, predicate=None): | |
with open(filename) as f: | |
return aggregate_errors(f, predicate) |
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
<?php | |
class KeyError extends Exception {}; | |
function filter_tree($tree, $fields) { | |
if (empty($fields)) | |
{ | |
return $tree; | |
} | |
$result = array(); |
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 cached(key_formatstr): | |
def decorator(fn): | |
def wrapped(self, *args, **kwargs): | |
cache_key = key_formatstr.format(*args, **kwargs) | |
log.debug('Fetching cached value for {0}'.format(cache_key)) | |
value = self.mc_get(cache_key) | |
if not value: | |
value = fn(self, *args, **kwargs) | |
log.debug('Storing cached value for {0}'.format(cache_key)) | |
self.mc_set(cache_key, value) |
NewerOlder