コード例 #1
0
ファイル: schedule.py プロジェクト: voigtjr/sfl
def validate(weeks):
    # each week: 6 games
    len_six = lambda (week, teams): len(teams) == 6

    bad_teams = funcy.remove(len_six, weeks.items())
    if bad_teams:
        print "have bad teams!!!"
        for week, teams in bad_teams:
            print week, ':', teams
        sys.exit(1)

    def tally(hg, game):
        hg[game[1]] += 1
        return hg

    all_games = funcy.cat(weeks.values())
    home_games = reduce(tally, all_games, collections.Counter())

    bad_homes = funcy.remove(lambda (x, y): y == 6, home_games.items())
    if bad_homes:
        print "have bad home game count!!!"
        for owner, homes in bad_homes:
            print owner, ':', homes
        sys.exit(1)

    return
コード例 #2
0
ファイル: condense.py プロジェクト: gartung/dxr
def c_type_sig(inputs, output, method=None):
    """Return FuncSig based on C style input, output, and method."""
    inputs = remove(lambda x: x == "void", inputs)  # Void Elimination

    inputs = map(lambda x: x.replace(' ', ''), inputs)  # Space Elimination
    output = output.replace(' ', '')

    if method is not None:  # Implicit first argument
        inputs = [method] + inputs

    if len(inputs) == 0:  # Expand no inputs to a single void input
        inputs = ["void"]

    return FuncSig(tuple(inputs), output)
コード例 #3
0
ファイル: __init__.py プロジェクト: jonyboy2000/redash
    'redash.query_runner.google_analytics',
    'redash.query_runner.axibase_tsd',
    'redash.query_runner.salesforce',
    'redash.query_runner.query_results',
    'redash.query_runner.prometheus',
    'redash.query_runner.qubole',
    'redash.query_runner.db2',
    'redash.query_runner.druid',
    'redash.query_runner.kylin'
]

enabled_query_runners = array_from_string(os.environ.get("REDASH_ENABLED_QUERY_RUNNERS", ",".join(default_query_runners)))
additional_query_runners = array_from_string(os.environ.get("REDASH_ADDITIONAL_QUERY_RUNNERS", ""))
disabled_query_runners = array_from_string(os.environ.get("REDASH_DISABLED_QUERY_RUNNERS", ""))

QUERY_RUNNERS = remove(set(disabled_query_runners), distinct(enabled_query_runners + additional_query_runners))
ADHOC_QUERY_TIME_LIMIT = int_or_none(os.environ.get('REDASH_ADHOC_QUERY_TIME_LIMIT', None))

# Destinations
default_destinations = [
    'redash.destinations.email',
    'redash.destinations.slack',
    'redash.destinations.webhook',
    'redash.destinations.hipchat',
    'redash.destinations.mattermost',
    'redash.destinations.chatwork',
    'redash.destinations.pagerduty',
]

enabled_destinations = array_from_string(os.environ.get("REDASH_ENABLED_DESTINATIONS", ",".join(default_destinations)))
additional_destinations = array_from_string(os.environ.get("REDASH_ADDITIONAL_DESTINATIONS", ""))
コード例 #4
0
ファイル: __init__.py プロジェクト: byte-power/redash
    "redash.query_runner.azure_kusto",
    "redash.query_runner.exasol",
    "redash.query_runner.cloudwatch",
    "redash.query_runner.cloudwatch_insights",
]

enabled_query_runners = array_from_string(
    os.environ.get("REDASH_ENABLED_QUERY_RUNNERS",
                   ",".join(default_query_runners)))
additional_query_runners = array_from_string(
    os.environ.get("REDASH_ADDITIONAL_QUERY_RUNNERS", ""))
disabled_query_runners = array_from_string(
    os.environ.get("REDASH_DISABLED_QUERY_RUNNERS", ""))

QUERY_RUNNERS = remove(
    set(disabled_query_runners),
    distinct(enabled_query_runners + additional_query_runners),
)

dynamic_settings = importlib.import_module(
    os.environ.get("REDASH_DYNAMIC_SETTINGS_MODULE",
                   "redash.settings.dynamic_settings"))

# Destinations
default_destinations = [
    "redash.destinations.email",
    "redash.destinations.slack",
    "redash.destinations.webhook",
    "redash.destinations.hipchat",
    "redash.destinations.mattermost",
    "redash.destinations.chatwork",
    "redash.destinations.pagerduty",
コード例 #5
0
def remove(f, *seq):
    return F.remove(f,*seq) if seq \
    else lambda *xs: F.remove(f,*xs)
コード例 #6
0
ファイル: scopes.py プロジェクト: ir4y/flaws
 def implicit_exports(self):
     assert self.is_module
     return remove(r'^_', self.names)