Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_uuid_instance(self):
from dallinger.experiment import Experiment
exp = Experiment()
exp_uuid = exp.make_uuid()
assert isinstance(UUID(exp_uuid, version=4), UUID)
def klass(self):
from dallinger.experiment import Experiment
return Experiment
def exp(self):
from dallinger.experiment import Experiment
return Experiment()
def uuid():
"""Print a new UUID"""
from dallinger.experiment import Experiment
click.echo(Experiment.make_uuid())
"""The game Concentration."""
from dallinger.config import get_config
from dallinger.experiment import Experiment
from dallinger.networks import Empty
def extra_parameters():
config = get_config()
config.register("num_participants", int)
class ConcentrationGame(Experiment):
"""Define the structure of the experiment."""
def __init__(self, session=None):
"""Initialize the experiment."""
super(ConcentrationGame, self).__init__(session)
self.experiment_repeats = 1
if session:
self.setup()
def configure(self):
config = get_config()
self.initial_recruitment_size = config["num_participants"]
def create_network(self):
"""Return a new network."""
return Empty(max_size=self.initial_recruitment_size)
Bot = Bot # Make name "Bot" importable without triggering style warnings
except ImportError:
pass
logger = logging.getLogger(__file__)
def extra_parameters():
config = get_config()
config.register("network", unicode)
config.register("repeats", int)
config.register("n", int)
class CoordinationChatroom(Experiment):
"""Define the structure of the experiment."""
def __init__(self, session=None):
"""Initialize the experiment."""
super(CoordinationChatroom, self).__init__(session)
if session:
self.setup()
def configure(self):
config = get_config()
self.experiment_repeats = repeats = config.get("repeats")
self.network_class = config.get("network")
self.quorum = config.get("n")
# Recruit for all networks at once
self.initial_recruitment_size = repeats * self.quorum
import time
from operator import attrgetter
from flask import Blueprint, Response
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from dallinger.bots import BotBase
from dallinger.experiment import Experiment
from dallinger import db
from dallinger.networks import Chain
class MCMCP(Experiment):
"""Define the structure of the experiment."""
def __init__(self, session=None):
"""Call the same function in the super (see experiments.py in dallinger).
The models module is imported here because it must be imported at
runtime.
A few properties are then overwritten.
Finally, setup() is called.
"""
super(MCMCP, self).__init__(session)
from . import models
self.models = models
from dallinger.compat import unicode
from dallinger.config import get_config
from dallinger.experiments import Experiment
config = get_config()
logger = logging.getLogger(__file__)
def extra_parameters():
config.register('network', unicode)
config.register('repeats', int)
config.register('n', int)
class CoordinationChatroom(dlgr.experiment.Experiment):
"""Define the structure of the experiment."""
def __init__(self, session=None):
"""Initialize the experiment."""
super(CoordinationChatroom, self).__init__(session)
self.experiment_repeats = repeats = config.get('repeats')
self.quorum = config.get('n')
# Recruit for all networks at once
self.initial_recruitment_size = repeats * self.quorum
self.config = config
if not self.config.ready:
self.config.load()
if session:
self.setup()
def create_network(self):
from dallinger.bots import BotBase
from dallinger.config import get_config
from dallinger.networks import Chain
from dallinger.experiment import Experiment
logger = logging.getLogger(__file__)
def extra_parameters():
config = get_config()
config.register("num_participants", int)
class Bartlett1932(Experiment):
"""Define the structure of the experiment."""
def __init__(self, session=None):
"""Call the same function in the super (see experiments.py in dallinger).
A few properties are then overwritten.
Finally, setup() is called.
"""
super(Bartlett1932, self).__init__(session)
from . import models # Import at runtime to avoid SQLAlchemy warnings
self.models = models
self.experiment_repeats = 1
self.initial_recruitment_size = 1
if session:
"""Bartlett's trasmission chain experiment from Remembering (1932)."""
from dallinger.networks import Chain
from dallinger.experiment import Experiment
class IteratedDrawing(Experiment):
"""Define the structure of the experiment."""
def __init__(self, session=None):
"""Call the same function in the super (see experiments.py in dallinger).
The models module is imported here because it must be imported at
runtime.
A few properties are then overwritten.
Finally, setup() is called.
"""
super(IteratedDrawing, self).__init__(session)
from . import models
self.models = models