This file contains hidden or 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
| from functools import wraps | |
| def replace_if_condition_met(condition, replacement): | |
| def innerfunc(func): | |
| @wraps(func) | |
| def wrap(*args): | |
| val = func(*args) | |
| if condition(val): | |
| return replacement | |
| return val |
This file contains hidden or 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 simple_partial(func, *args): | |
| original_args = args + () | |
| def inner(*new_args): | |
| args = original_args + new_args | |
| return func(*args) | |
| return inner | |
| def divisible(divider, value, number): | |
| if number % divider == 0 : | |
| return value |
This file contains hidden or 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
| #!/bin/bash -ex | |
| cd $WORKSPACE | |
| #regular virtualenv stuff | |
| virtualenv -q --no-site-packages ve | |
| source ./ve/bin/activate | |
| pip install -r subdirectory/requirements-test.pip | |
| cd subdirectory | |
| #nose.cfg should hav with-coverage=1 and with-xunit=1 | |
| #or you can pass them onc ommand line here |
This file contains hidden or 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 org.apache.hadoop.fs.Path; | |
| import org.apache.hadoop.conf.*; | |
| import org.apache.hadoop.io.*; | |
| import org.apache.hadoop.util.GenericOptionsParser; | |
| /*Everything in mapred is deprecated, don't use unless must*/ | |
| //import org.apache.hadoop.mapred.*; | |
| import org.apache.hadoop.util.*; | |
| import org.apache.hadoop.mapreduce.*; | |
| import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ A Mapred from helmet library data to other data | |
| """ | |
| from mrjob.job import MRJob | |
| from mrjob.protocol import JSONValueProtocol | |
| import json |