Module Expr Str ImportFrom alias alias alias alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias Import alias Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore ListLoad Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num FunctionDef arguments args defaults vararg body Expr Str Assign NameStore Lambda arguments args NameParam NameParam defaults BinOpDiv Call NameLoad BinOpPow BinOpSub NameLoad NameLoad Num Call NameLoad NameLoad Num Assign NameStore BinOpDiv Call NameLoad Call NameLoad ListComp AttributeLoad NameLoad attr comprehension NameStore NameLoad Call NameLoad Call NameLoad ListComp AttributeLoad NameLoad attr comprehension NameStore NameLoad Num Assign NameStore BinOpSub Num NameLoad Return Call NameLoad ListComp BinOpAdd Call NameLoad BinOpMult NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad BinOpMult NameLoad AttributeLoad NameLoad attr BinOpSub AttributeLoad NameLoad attr AttributeLoad NameLoad attr comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return CompareGtE NameLoad SubscriptLoad NameLoad Index BinOpSub NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return IfExp CompareNotEq NameLoad NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults NameLoad body Expr Str Return Call NameLoad GeneratorExp TupleLoad AttributeLoad NameLoad attr NameLoad comprehension NameStore Call NameLoad NameLoad keyword NameLoad decorator_list Assign NameStore Call NameLoad Assign NameStore Call NameLoad keyword NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore BinOpBitAnd BinOpSub NameLoad NameLoad Call NameLoad Call AttributeLoad NameLoad attr For NameStore NameLoad body Expr Call NameLoad BinOpMod Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore Call NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr For NameStore BinOpSub NameLoad NameLoad body Expr Call NameLoad BinOpMod Str NameLoad Assign NameStore Call NameLoad NameLoad NameLoad For NameStore SubscriptLoad NameLoad Index NameLoad body Expr Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad For NameStore BinOpSub NameLoad NameLoad body Expr Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr For NameStore BinOpBitAnd NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr For NameStore BinOpSub NameLoad NameLoad body Expr Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad For NameStore BinOpSub NameLoad NameLoad body Expr Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr If CompareEq SubscriptLoad NameLoad Index Num NameLoad body Raise Call NameLoad AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr IfExp CompareNotEq SubscriptLoad NameLoad Index Num NameLoad Call NameLoad SubscriptLoad NameLoad Index Num ListLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareEq AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr ListComp Call NameLoad NameLoad NameLoad comprehension NameStore AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If CompareGtE Call NameLoad NameLoad Num body Assign NameStore Call NameLoad NameLoad Assign NameStore IfExp CompareLtE Call NameLoad NameLoad Num Call NameLoad NameLoad Call NameLoad NameLoad NameLoad orelse Assign NameStore NameLoad Assign NameStore NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad If CompareIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod NameLoad AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod NameLoad AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If CompareEq Call NameLoad NameLoad Num body Return NameLoad Assign NameStore Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod NameLoad AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore BinOpMod NameLoad AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr Call NameLoad BoolOpOr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad BinOpMod Str AttributeLoad NameLoad attr Num Assign AttributeStore NameLoad attr Call NameLoad BoolOpOr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad BinOpMod Str AttributeLoad NameLoad attr Num Assign AttributeStore NameLoad attr BinOpDiv Call NameLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Num decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad NameLoad Str If Call AttributeLoad NameLoad attr BinOpMod NameLoad NameLoad body Raise Call NameLoad NameLoad Str Assign NameStore Call NameLoad keyword Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad NameLoad Str Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore IfExp NameLoad NameLoad NameLoad Return ListComp Call NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad comprehension NameStore Call AttributeLoad NameLoad attr NameLoad decorator_list
N/A N/A Bandit testing plugin __future__ absolute_import division print_function with_statement unicode_literals tornado escape util actions * middleware * tests * N/A re N/A ACTIVE_EXPERIMENTS_REDIS_KEY bandit:listing:active:v2 N/A ARCHIVED_EXPERIMENTS_REDIS_KEY bandit:listing:archived:v2 N/A EXPERIMENT_REDIS_KEY_TEMPLATE bandit:experiment:%s:v2 N/A ALLOWED_NAMES N/A N/A re compile ^[A-Za-z0-9-_]+$ N/A CHI_SQUARE_DISTRIBUTION N/A 3.84 5.99 7.81 9.49 11.07 12.59 14.07 15.51 16.92 18.31 19.68 21.03 22.36 23.68 25.0 26.3 27.59 28.87 30.14 31.41 chi_squared N/A N/A N/A choices N/A N/A Calculates the chi squared N/A term N/A N/A N/A expected observed N/A N/A N/A float N/A N/A expected observed 2 N/A max expected 1 N/A mean_success_rate N/A N/A float N/A sum N/A N/A c rewards N/A c choices N/A max N/A sum N/A N/A c plays N/A c choices 1 N/A mean_failure_rate N/A 1 mean_success_rate N/A N/A sum N/A N/A N/A term N/A mean_success_rate N/A c plays N/A c rewards N/A term N/A mean_failure_rate N/A c plays N/A N/A c plays N/A c rewards N/A c choices N/A is_confident N/A N/A csq num_choices N/A N/A N/A 
    Returns whether an experiment is statistically significant with 95%%
    confidence
     N/A N/A csq N/A CHI_SQUARE_DISTRIBUTION N/A N/A num_choices 2 N/A parse_json N/A N/A raw N/A N/A N/A Parses raw bytes to a JSON object with unicode strings N/A N/A N/A raw None N/A N/A escape recursive_unicode N/A N/A escape json_decode raw None N/A sync_from_spec N/A N/A redis schema N/A N/A N/A 
    Takes an input experiment spec and creates/modifies/archives the existing
    experiments to match the spec.

    If there's an experiment in the spec that currently doesn't exist, it will
    be created along with the associated choices.

    If there's an experiment in the spec that currently exists, and the set of
    choices are different, that experiment's choices will be modified to match
    the spec.

    If there's an experiment not in the spec that currently exists, it will be
    archived.

    A spec looks like this:

    {
       "experiment 1": ["choice 1", "choice 2", "choice 3"],
       "experiment 2": ["choice 1", "choice 2"]
    }
     get_experiments_dict N/A N/A active N/A True N/A N/A Returns a dictionary of experiment names -> experiment objects N/A N/A dict N/A N/A N/A experiment name experiment N/A experiment N/A get_experiments redis active active N/A N/A active_experiments N/A get_experiments_dict N/A archived_experiments N/A get_experiments_dict active False N/A new_experiment_names N/A set N/A N/A schema keys N/A active_experiment_names N/A set N/A N/A active_experiments keys N/A unarchivable_experiment_names N/A N/A new_experiment_names active_experiment_names N/A set N/A N/A archived_experiments keys N/A unarchivable_experiment_name unarchivable_experiment_names N/A N/A N/A print N/A - De-archiving %s unarchivable_experiment_name N/A pipe N/A N/A redis pipeline transaction True N/A N/A N/A pipe sadd ACTIVE_EXPERIMENTS_REDIS_KEY unarchivable_experiment_name N/A N/A N/A pipe srem ARCHIVED_EXPERIMENTS_REDIS_KEY unarchivable_experiment_name N/A N/A N/A pipe execute N/A unarchivable_experiment_names N/A N/A active_experiments N/A get_experiments_dict N/A active_experiment_names N/A set N/A N/A active_experiments keys N/A new_experiment_name N/A new_experiment_names active_experiment_names N/A N/A N/A print N/A - Creating experiment %s new_experiment_name N/A experiment N/A add_experiment redis new_experiment_name N/A choice N/A schema N/A new_experiment_name N/A N/A N/A print N/A   - Adding choice %s choice N/A N/A N/A experiment add_choice choice N/A archivable_experiment_name N/A active_experiment_names new_experiment_names N/A N/A N/A print N/A - Archiving %s archivable_experiment_name N/A N/A N/A N/A active_experiments N/A archivable_experiment_name archive N/A experiment_name N/A new_experiment_names active_experiment_names N/A N/A experiment N/A active_experiments N/A experiment_name N/A new_choice_names N/A set N/A schema N/A experiment_name N/A old_choice_names N/A set N/A experiment choice_names N/A new_choice_name N/A new_choice_names old_choice_names N/A N/A N/A print N/A - Adding choice %s to existing experiment %s N/A new_choice_name experiment_name N/A N/A N/A experiment add_choice new_choice_name N/A removable_choice_name N/A old_choice_names new_choice_names N/A N/A N/A print N/A - Removing choice %s from existing experiment %s N/A removable_choice_name experiment_name N/A N/A N/A experiment remove_choice removable_choice_name N/A ExperimentException N/A Exception N/A N/A 
    An exception for issues related to experiments. This way applications can
    catch the exception and respond accordingly.
     __init__ N/A N/A self experiment_name message N/A N/A N/A N/A N/A N/A super ExperimentException self __init__ N/A Experiment %s: %s N/A experiment_name message N/A N/A self experiment_name experiment_name N/A N/A Experiment N/A object N/A N/A Specification for a bandit experiment __init__ N/A N/A self redis name N/A N/A N/A N/A self redis redis N/A N/A self name name N/A N/A N/A self refresh N/A refresh N/A N/A self N/A N/A N/A Re-pulls the data from redis N/A pipe N/A N/A N/A self redis pipeline N/A N/A N/A pipe hget N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name metadata N/A N/A N/A pipe hget N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name choices N/A N/A N/A pipe hget N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name default-choice N/A results N/A N/A pipe execute N/A N/A N/A results N/A 0 None N/A N/A N/A ExperimentException N/A self name Does not exist N/A N/A self metadata N/A parse_json N/A results N/A 0 N/A N/A self choice_names N/A N/A N/A results N/A 1 None N/A parse_json N/A results N/A 1 N/A N/A N/A self default_choice N/A N/A escape to_unicode N/A results N/A 2 N/A N/A self _choices None N/A choices N/A N/A self N/A N/A N/A Gets the experiment choices N/A N/A N/A self _choices None N/A N/A N/A self _choices N/A N/A ExperimentChoice self choice_name N/A choice_name N/A self choice_names N/A N/A self _choices N/A property confidence N/A N/A self N/A N/A N/A 
        Returns a tuple (chi squared, confident) of the experiment. Confident
        is simply a boolean specifying whether we're > 95%% sure that the
        results are statistically significant.
         N/A choices N/A self choices N/A N/A N/A len choices 2 N/A N/A csq N/A chi_squared choices N/A confident N/A N/A N/A len choices 10 N/A is_confident csq N/A len choices None N/A N/A csq None N/A confident False N/A N/A csq confident N/A archive N/A N/A self N/A N/A N/A Archives an experiment N/A pipe N/A N/A N/A self redis pipeline transaction True N/A N/A N/A pipe srem ACTIVE_EXPERIMENTS_REDIS_KEY N/A self name N/A N/A N/A pipe sadd ARCHIVED_EXPERIMENTS_REDIS_KEY N/A self name N/A N/A N/A pipe execute N/A add_choice N/A N/A self choice_name N/A N/A N/A Adds a choice for the experiment N/A N/A N/A N/A ALLOWED_NAMES match choice_name N/A N/A N/A ExperimentException N/A self name N/A Illegal choice name: %s choice_name N/A N/A choice_name N/A self choice_names N/A N/A N/A ExperimentException N/A self name N/A Choice already exists: %s choice_name N/A N/A N/A N/A self choice_names append choice_name N/A N/A N/A N/A self redis hset N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name choices N/A N/A escape json_encode N/A self choice_names N/A N/A N/A self refresh N/A remove_choice N/A N/A self choice_name N/A N/A N/A Adds a choice for the experiment N/A N/A N/A N/A self choice_names remove choice_name N/A N/A N/A N/A self redis hset N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name choices N/A N/A escape json_encode N/A self choice_names N/A N/A N/A self refresh N/A add_play N/A N/A self choice count N/A 1 N/A N/A Increments the play count for a given experiment choice N/A N/A N/A N/A self redis hincrby N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name N/A %s:plays choice count N/A N/A self _choices None N/A add_reward N/A N/A self choice count N/A 1 N/A N/A Increments the reward count for a given experiment choice N/A N/A N/A N/A self redis hincrby N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name N/A %s:rewards choice count N/A N/A self _choices None N/A compute_default_choice N/A N/A self N/A N/A N/A Computes and sets the default choice N/A choices N/A self choices N/A N/A N/A len choices 0 N/A N/A None N/A high_choice N/A max choices key N/A N/A N/A choice N/A N/A choice performance N/A N/A N/A N/A self redis hset N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A self name default-choice N/A high_choice name N/A N/A N/A self refresh N/A high_choice N/A N/A ExperimentChoice N/A object N/A N/A Represents an experiment choice __init__ N/A N/A self experiment name N/A N/A N/A N/A self experiment experiment N/A N/A self name name N/A N/A N/A self refresh N/A refresh N/A N/A self N/A N/A N/A Re-pulls the data from redis N/A redis_key N/A EXPERIMENT_REDIS_KEY_TEMPLATE N/A N/A self experiment name N/A N/A self plays N/A int N/A N/A N/A N/A N/A self experiment redis hget redis_key N/A %s:plays N/A self name 0 N/A N/A self rewards N/A int N/A N/A N/A N/A N/A self experiment redis hget redis_key N/A %s:rewards N/A self name 0 N/A N/A self performance N/A N/A float N/A self rewards N/A max N/A self plays 1 N/A N/A add_experiment N/A N/A redis name N/A N/A N/A Adds a new experiment N/A N/A N/A N/A ALLOWED_NAMES match name N/A N/A N/A ExperimentException name Illegal name N/A N/A N/A redis exists N/A EXPERIMENT_REDIS_KEY_TEMPLATE name N/A N/A N/A ExperimentException name Already exists N/A json N/A dict creation_date N/A N/A util unicode_type N/A N/A N/A datetime datetime now N/A pipe N/A N/A redis pipeline transaction True N/A N/A N/A pipe sadd ACTIVE_EXPERIMENTS_REDIS_KEY name N/A N/A N/A pipe hset N/A EXPERIMENT_REDIS_KEY_TEMPLATE name metadata N/A N/A escape json_encode json N/A N/A N/A pipe execute N/A N/A Experiment redis name N/A get_experiments N/A N/A redis active N/A True N/A N/A Gets the full list of experiments N/A key N/A active ACTIVE_EXPERIMENTS_REDIS_KEY ARCHIVED_EXPERIMENTS_REDIS_KEY N/A N/A N/A Experiment redis N/A N/A escape to_unicode name N/A name N/A N/A redis smembers key N/A