query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
get the first arangosync master of this starter | def get_sync_master(self):
servers = self.get_sync_masters()
assert servers, "starter: don't have instances!"
return servers[0] | [
"def master_id(self):\n\n try:\n return self.release.data['master_id']\n except KeyError:\n return None",
"def FindMasterUsingChubby(ver):\n return core_utils.GetGSAMaster(ver, install_utilities.is_test(ver))",
"def master_id(self):\r\n return self._arm.master_id",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the essentials of all instances controlled by this starter | def get_instance_essentials(self):
ret = []
for instance in self.all_instances:
ret.append(instance.get_essentials())
return ret | [
"def getEssentialList(self):\n return self.essentials",
"def show_all_instances(self):\n if not self.all_instances:\n logging.error(\"%s: no instances detected\", self.name)\n return\n instances = \"\"\n for instance in self.all_instances:\n instances +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print all instances of this starter to the user | def show_all_instances(self):
if not self.all_instances:
logging.error("%s: no instances detected", self.name)
return
instances = ""
for instance in self.all_instances:
instances += " - {0.name} (pid: {0.pid})".format(instance)
logging.info("arangod in... | [
"def display_instances(self):\n pass",
"def print_students(self):\n for student in self.student_list:\n print(student)",
"def print_results(self):\n pass",
"def printResults(self):\n for tweet in self.tweets:\n print(tweet)\n print(\"---------------... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieve token from the JWT secret file which is cached for the future use | def get_jwt_token_from_secret_file(self, filename):
# pylint: disable=consider-iterating-dictionary
if filename in self.jwt_tokens.keys():
# token for that file was checked already.
return self.jwt_tokens[filename]
cmd = [
self.cfg.bin_dir / "arangodb",
... | [
"def read_jwt_token():\n return config.get('JWT')",
"def peek_app_token():\n if not os.path.exists(_token_storage_path):\n return None\n\n try:\n with open(_token_storage_path) as secret_file:\n return json.loads(secret_file.read())\n\n except Exception as exc:\n log.er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return jwt header from current installation | def get_jwt_header(self):
if self.jwt_header:
return self.jwt_header
self.jwt_header = self.get_jwt_token_from_secret_file(str(self.jwtfile))
return self.jwt_header | [
"def get_jwt_header() -> dict:\n decoded_header = g.get(\"_jwt_extended_jwt_header\", None)\n if decoded_header is None:\n raise RuntimeError(\n \"You must call `@jwt_required()` or `verify_jwt_in_request()` \"\n \"before using this method\"\n )\n return decoded_header",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the passvoid to the managed instance | def set_passvoid(self, passvoid, write_to_server=True):
if write_to_server:
print("Provisioning passvoid " + passvoid)
self.arangosh.js_set_passvoid("root", passvoid)
self.passvoidfile.write_text(passvoid, encoding="utf-8")
self.passvoid = passvoid
for i in se... | [
"def _set(cls, context):\n cls._local._context_instance = context",
"def set_instance(self, instance):\n self.instance = instance",
"def set_passage(self,pass_bool):\n self.bill_pass=pass_bool",
"def _attach_to_instance(self, instance):\n self._instance = instance",
"def target_insta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the passvoid to the managed instance | def get_passvoid(self):
return self.passvoid | [
"def _get_permit(self):\n return self.__permit",
"def getInstanciable(self):\n\t\treturn self.getOpArgument(0)",
"def _get_instance(self):",
"def vault(self):",
"def get(self):\n return self.args, self.kwargs",
"def GetObject(self) -> SculptObject:\n ...",
"def _vm_get_password(self, vm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make all managed instances plus the starter itself crash. | def crash_instances(self):
try:
if self.instance.status() == psutil.STATUS_RUNNING or self.instance.status() == psutil.STATUS_SLEEPING:
print("generating coredump for " + str(self.instance))
gcore = psutil.Popen(["gcore", str(self.instance.pid)], cwd=self.basedir)
... | [
"def main():\n cause_a_bunch_of_exceptions_to_happen()",
"def detect_fatal_errors(self):\n for instance in self.all_instances:\n instance.detect_fatal_errors()",
"def cold_start(self):\n if not self._configdone:\n return\n # jagonzal (CAS-4292): Stop the cluster via... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wait for our instance to create a logfile | def wait_for_logfile(self):
counter = 0
keep_going = True
logging.info("Looking for log file.\n")
while keep_going:
self.check_that_instance_is_alive()
if counter == 20:
raise Exception("logfile did not appear: " + str(self.log_file))
c... | [
"def logging_func():\n while not self.stopped:\n self.write_to_file()\n time.sleep(self.TIMESTAMP_INTERVAL)",
"async def test_log_to_file(self):\n curr_dir = get_curr_dir(__file__)\n async with self.test_lock:\n with patch.object(pyinsteon.tools, \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wait for our instance to bind its TCPports | def wait_for_port_bind(self):
if self.starter_port is not None:
count = 0
while count < 10:
for socket in self.instance.connections():
if socket.status == "LISTEN" and socket.laddr.port == self.starter_port:
print("socket found!... | [
"def wait_for_port(self, hostname=None, tcp_port=8096):\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n while True:\n try:\n s.connect((hostname, tcp_port))\n s.close()\n break\n except socket.error as _:\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
kill the instance of this starter (it won't kill its managed services) | def kill_instance(self):
logging.info("StarterManager: Killing: %s", str(self.default_starter_args + self.arguments))
self.instance.kill()
try:
logging.info(str(self.instance.wait(timeout=45)))
self.add_logfile_to_report()
except Exception as ex:
raise... | [
"def kill(self):\n if self.process:\n logs.log('Stopping emulator.')\n self.process.kill()\n self.process = None",
"def kill_vrouter_instance(self):\n # Stop vrouter\n if (self.vr_args['vtest_only']):\n self.logger.info(\"Stopping vrouter pid=\" + str(self.pid))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
replace the parts of the installation with information after an upgrade kill the starter processes of the old version revalidate that the old arangods are still running and alive replace the starter binary with a new one. this has not yet spawned any children | def replace_binary_for_upgrade(self, new_install_cfg, relaunch=True):
# On windows the install prefix may change,
# since we can't overwrite open files:
old_version = self.cfg.version
self.default_starter_args = new_install_cfg.default_starter_args.copy()
self.enterprise = new_in... | [
"def main():\n install_dir = Path(get_home()).joinpath(\"agents\")\n if not install_dir.exists():\n print(\"No historians to upgrade\")\n return\n fail_if_instance_running()\n aip = get_aip()\n move_historian_cache_files(aip)\n print(\"\")\n print(\"Moving historian backup files c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
kill specific instances of this starter (it won't kill starter itself) | def kill_specific_instance(self, which_instances):
for instance_type in which_instances:
for instance in self.all_instances:
if instance.instance_type == instance_type:
instance.terminate_instance() | [
"def kill_instance(self):\n logging.info(\"StarterManager: Killing: %s\", str(self.default_starter_args + self.arguments))\n self.instance.kill()\n try:\n logging.info(str(self.instance.wait(timeout=45)))\n self.add_logfile_to_report()\n except Exception as ex:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wait for the upgrade commanding starter to finish | def wait_for_upgrade(self, timeout=60):
ret = None
try:
ret = self.upgradeprocess.wait(timeout=timeout)
except psutil.TimeoutExpired as timeout_ex:
msg = "StarterManager: Upgrade command [%s] didn't finish in time: %d" % (
str(self.basedir),
... | [
"def test_wait_for_upgrade(self):\n self.run_test_suites(self.wait_for_upgrade_test_suite_list)",
"def _ask_for_upgrade(self):",
"def test_do_upgrade(self):\n with self.with_config_update():\n result = self.runner.invoke(\n cli,\n [\n \"u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tries to wait for the server to restart after the 'restore' command | def wait_for_restore(self):
for node in self.all_instances:
if node.instance_type in [
InstanceType.RESILIENT_SINGLE,
InstanceType.SINGLE,
InstanceType.DBSERVER,
]:
node.detect_restore_restart() | [
"def continue_server():\n update_server_status({'ready': True})",
"async def async_restore(self):\n await self._client.restore()\n self.async_write_ha_state()",
"def test_server_reboot(self):\n self.wait_for_status(\"ACTIVE\")\n # reboot\n raw_output = self.openstack('serve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use arangosh to run a command on the frontend arangod | def execute_frontend(self, cmd, verbose=True):
return self.arangosh.run_command(cmd, verbose) | [
"def run_command(\n self,\n cmd,\n verbose=True,\n use_default_auth=True,\n progressive_timeout=300,\n deadline=300,\n expect_to_fail=False,\n result_line_handler=default_line_result,\n ):\n title = f\"run a command in arangosh: {cmd[0]}\"\n w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the port of a syncmaster arangosync | def get_sync_master_port(self):
self.sync_master_port = None
pos = None
sm_port_text = "Starting syncmaster on port"
sw_text = "syncworker up and running"
worker_count = 0
logging.info("detecting sync master port")
while worker_count < 3 and self.is_instance_runni... | [
"def masterPort(self):\r\n return self._masterPort",
"def get_slave_port():\n return 9901",
"def Port(self) -> int:",
"def port(self):\n return self[1]",
"def auto_get_port(self):\n return self._auto_get_port",
"def _get_nport(self):\n return self.__nport",
"def get_port(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the logfile of the dbserver instance | def read_db_logfile(self):
server = self.get_dbserver()
assert server.logfile.exists(), "don't have logfile?"
return server.logfile.read_text(errors="backslashreplace") | [
"def log_db():\n return pymongo.MongoClient(SCITRAN_PERSISTENT_DB_LOG_URI).get_database()",
"def get_log_file(self):\n return(self.__log_file)",
"def logfile(self):\n return os.path.join(self.workdir, 'phaser_PDB_{}_out.log')",
"def getLogger(self):\n return self.server.logger",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the agent logfile of this instance | def read_agent_logfile(self):
server = self.get_agent()
assert server.logfile.exists(), "don't have logfile?"
return server.logfile.read_text(errors="backslashreplace") | [
"def get_agent_stdout_log() -> Path:\n return get_agent_log_dir() / \"com.alienwallpaper.alienwallpaper.out.log\"",
"def get_log_file(self):\n return(self.__log_file)",
"def get_agent_stderr_log() -> Path:\n return get_agent_log_dir() / \"com.alienwallpaper.alienwallpaper.err.log\"",
"def logger(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detect the arangod instance PIDs | def detect_instance_pids(self):
for instance in self.all_instances:
instance.detect_pid(
ppid=self.instance.pid,
full_binary_path=self.cfg.real_sbin_dir,
offset=0,
)
self.show_all_instances()
self.detect_arangosh_instances(... | [
"def _get_instance_ids(instances):\n instance_ids = []\n for instance in instances:\n instance_ids.append(instance.id)\n return instance_ids",
"def pids(node, java_class):\n cmd = \"ps -C java -wwo pid,args | grep '%s' | awk -F' ' '{print $1}'\" % java_class\n\n return [int(pid) for pid in nod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scan all instances for `FATAL` statements | def detect_fatal_errors(self):
for instance in self.all_instances:
instance.detect_fatal_errors() | [
"def errors_fatal(self) -> List[Error]:",
"def getFatalErrors(self):\n global hadFatalErrors\n if hadFatalErrors:\n text = '\\n'.join(hadFatalErrors)\n hadFatalErrors = []\n return text",
"def fatal_errors(self):\n return self.get('__meta_metadata__.__errors... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
launch an arangobench instance to the frontend of this starter | def launch_arangobench(self, testacse_no, moreopts=None):
arangobench = ArangoBenchManager(self.cfg, self.get_frontend())
arangobench.launch(testacse_no, moreopts)
return arangobench | [
"def main():\n tng.api.runner()",
"def run_experiment(self):",
"def main(unused_argv):\n launch_experiment()",
"def start(self):\n self.validate()\n if self.experimental_mode:\n self.experiment()\n else:\n self.initialise()\n self.run()\n se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in active failover detect whether we run the leader | def detect_leader(self):
# Should this be moved to the AF script?
lfs = self.read_db_logfile()
became_leader = lfs.find("Became leader in") >= 0
took_over = lfs.find("Successful leadership takeover:" + " All your base are belong to us") >= 0
self.is_leader = became_leader or too... | [
"def isLeader(self):\r\n if self.getName() == 'Main' and core.FW_conf['settings'].TestRun.ExecutionMode == 'Leader':\r\n return True\r\n else:\r\n return False",
"def isLeader():\n print(\"IsLeader()\")\n if status == 0:\n return True\n else:\n return Fal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
talk to the frontends to find out whether its a leader or not. | def probe_leader(self):
# Should this be moved to the AF script?
self.is_leader = False
for instance in self.get_frontends():
if instance.probe_if_is_leader():
self.is_leader = True
return self.is_leader | [
"def isLeader():\n print(\"IsLeader()\")\n if status == 0:\n return True\n else:\n return False",
"def detect_leader(self):\n # Should this be moved to the AF script?\n lfs = self.read_db_logfile()\n\n became_leader = lfs.find(\"Became leader in\") >= 0\n took_ov... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detect hosts for the active failover | def active_failover_detect_hosts(self):
self.check_that_instance_is_alive()
# this is the way to detect the master starter...
lfs = self.get_log_file()
if lfs.find("Just became master") >= 0:
self.is_master = True
else:
self.is_master = False
regx ... | [
"def getAffectedHosts(vulnName):",
"def _wait_hostname_resolution():\n for host in _env.TrainingEnv().hosts:\n _dns_lookup(host)",
"def get_hosts(self, target, listener_type):",
"def select_active_hosts():\n return IMPL.select_active_hosts()",
"def get_hosts_retry(self, target, listener_type):"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detect whether we successfully respawned the instance, and it became a follower | def active_failover_detect_host_now_follower(self):
self.check_that_instance_is_alive()
lfs = self.get_log_file()
if lfs.find("resilientsingle up and running as follower") >= 0:
self.is_master = False
return True
return False | [
"def isPawnStarted(self):\n self._started = True",
"def respawn_player(self):\n assert self.is_player_dead()\n self.game.respawn_player()\n# self.log('Respawn player')\n self.initialize_game()",
"def _onTacticalRespawnEndInternal(self):\n pass",
"def isFollower(self):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add starter log to allure report | def add_logfile_to_report(self):
logfile = str(self.log_file)
attach.file(logfile, "Starter log file", AttachmentType.TEXT) | [
"def log_app_start():\n\n LOGGER.info(\"\")\n LOGGER.info(\"#######################################\")\n LOGGER.info(\"# #\")\n LOGGER.info(\"# Tableau Extract Refresher #\")\n LOGGER.info(\"# #\")\n LOGGER.info(\"##... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get HTTP protocol for this starter(http/https) | def get_http_protocol(self):
if self.cfg.ssl:
return "https"
else:
return "http" | [
"def get_protocol():\n if https():\n protocol = 'https'\n else:\n protocol = 'http'\n return protocol",
"def protocol(self):\n if self.scheme in (\"bolt\", \"bolt+s\", \"bolt+ssc\"):\n return \"bolt\"\n elif self.scheme in (\"http\", \"https\", \"http+s\", \"http+ss... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that starter instance is alive | def check_that_instance_is_alive(self):
if not self.instance.is_running():
raise Exception(f"Starter instance is not running. Base directory: {str(self.basedir)}")
if self.instance.status() == psutil.STATUS_ZOMBIE:
raise Exception(f"Starter instance is a zombie. Base directory: {... | [
"def is_alive(self):\n pass",
"def healthy(self):\n return True",
"def is_alive(self):\n if self.status == 1:\n return True\n else:\n return False",
"def __some_alive(self):\n for service in self.__services.values():\n if service.is_alive():\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check whether substring is present in the starter log | def check_that_starter_log_contains(self, substring: str):
if self.count_occurances_in_starter_log(substring) > 0:
return
else:
raise Exception(
f"Expected to find the following string: {substring}\n in this log file:\n{str(self.log_file)}"
) | [
"def log_contains(self, s: str) -> bool:\n return len(list(filter(lambda str: s in str, self.logs))) > 0",
"def hasSubstring(self, s):\n node, off = self.followPath(s)\n return node is not None",
"def _is_substring(s1, s2):\n\treturn s1.find(s2) != -1",
"def issubstring(substring, string)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count occurrences of a substring in the starter log | def count_occurances_in_starter_log(self, substring: str):
number_of_occurances = self.get_log_file().count(substring)
return number_of_occurances | [
"def strCount(s: str, sub: str) -> int:\n pass",
"def count_occurrences(lines, substrings):\n for substring in substrings:\n pattern = get_pattern(substring)\n count = sum(len(pattern.findall(line)) for line in lines)\n print(count)",
"def overcount(string, sub):\n count, start = 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fake run starter method | def run_starter(self, expect_to_fail=False): | [
"def start_test_run(self):",
"def test_demo_runs(self):\n self.star.run_demo()",
"def test_get_run(self):\n pass",
"def before_tester_run(self) -> None:",
"def run_experiment(self):",
"def test_run_started(self):",
"def run_test(self, *args):\n pass",
"def test_main(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
création des annexes de facture | def annexes(sommes, clients, edition, livraisons, acces, machines, reservations, prestations, comptes,
dossier_annexe, plateforme, coefprests, coefmachines, generaux, nom_dossier='deprecated'):
# dossier_annexe = Outils.chemin_dossier([nom_dossier, "annexes"], plateforme, generaux)
prefi... | [
"def imprime(nota_fiscal):\n\n print(\"Imprimindo nota fiscal %s\" % nota_fiscal.cnpj)",
"def reu_docencia(self):\n self.exigencia_act = 7 + uniform(1, 5) / float(self.contenidos[self.semanas].dificultad)\n self.exigencia_cont = 7 + uniform(1, 5) / float(self.contenidos[self.semanas].dificultad)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
création des annexes techniques | def annexes_techniques(sommes, clients, edition, livraisons, acces, machines, reservations, prestations, comptes,
dossier_annexe, plateforme, coefprests, coefmachines, generaux):
prefixe = "annexeT_"
garde = r'''Annexes techniques \newline Technical Appendices'''
Anne... | [
"def annexes_techniques(sommes, clients, edition, livraisons, acces, machines, reservations, comptes, dossier_annexe,\n plateforme, generaux, users, couts):\n prefixe = \"annexeT_\"\n garde = r'''Annexes techniques \\newline Technical Appendices'''\n\n Annexes.creation... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for basketballteams_get | def test_basketballteams_get(self):
pass | [
"def test_teams_get(self):\n pass",
"def test_basketballteams_id_get(self):\n pass",
"def test_get_teams(self):\n pass",
"def test_get_team(self):\n pass",
"def test_teams_get_teams_v2(self):\n pass",
"def test_retrieve_team(self):\n pass",
"def test_teams_id_te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for basketballteams_id_get | def test_basketballteams_id_get(self):
pass | [
"def test_teams_id_get(self):\n pass",
"def test_teams_id_exists_get(self):\n pass",
"def test_baseballteams_id_get(self):\n headers = { \n 'Accept': 'application/json',\n }\n response = self.client.open(\n '/v0.0.1/baseballteams/{id}'.format(id='id_examp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state. | def update(self, key):
return self.state | [
"def __getitem__(self, frame):\n if not self.dynamic == 'open' and isinstance(frame, int) and frame > len(self):\n self.warning(\"Showing last frame available: %d\" % len(self))\n if not self.drawn: self.handles['fig'] = self.initialize_plot()\n if not self.dynamic == 'open' and not ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the state of the Plot for a given frame number. | def __getitem__(self, frame):
if not self.dynamic == 'open' and isinstance(frame, int) and frame > len(self):
self.warning("Showing last frame available: %d" % len(self))
if not self.drawn: self.handles['fig'] = self.initialize_plot()
if not self.dynamic == 'open' and not isinstance(... | [
"def getFrame(self, number):\n if self._frames is None:\n self.load()\n return self._frames[number]",
"def get_plot_state(self_or_cls, obj, renderer=None, **kwargs):\n if not isinstance(obj, Plot):\n obj = self_or_cls.get_plot(obj=obj, renderer=renderer, **kwargs)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class. | def traverse(self, fn=None, specs=None, full_breadth=True):
accumulator = []
matches = specs is None
if not matches:
for spec in specs:
matches = self.matches(spec)
if matches: break
if matches:
accumulator.append(fn(self) if fn els... | [
"def get_all_kb2d_plots(self, *kind):\n d = {\"graphs\" : \"gr_dpTOverpT_vs_qd0\",\n \"dpT/pT hists\" : \"h_dpTOverpT\",\n \"qd0 hists\" : \"h_qd0\",}\n all_plots = []\n if len(kind) > 0:\n # User requests specific plots. Grab them.\n for k in kind:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an object, a specific key and the normalization options this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each gr... | def compute_ranges(self, obj, key, ranges):
all_table = all(isinstance(el, Table) for el in obj.traverse(lambda x: x, [Element]))
if obj is None or not self.normalize or all_table:
return OrderedDict()
# Get inherited ranges
ranges = self.ranges if ranges is None else dict(ra... | [
"def _get_norm_opts(self, obj):\n norm_opts = {}\n\n # Get all elements' type.group.label specs and ids\n type_val_fn = lambda x: (x.id, (type(x).__name__, util.group_sanitizer(x.group, escape=False),\n util.label_sanitizer(x.label, escape=False))) \\\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the normalization options for a LabelledData object by traversing the object for to find elements and their ids. The id is then used to select the appropriate OptionsTree, accumulating the normalization options into a dictionary. Returns a dictionary of normalization options for each element in the tree. | def _get_norm_opts(self, obj):
norm_opts = {}
# Get all elements' type.group.label specs and ids
type_val_fn = lambda x: (x.id, (type(x).__name__, util.group_sanitizer(x.group, escape=False),
util.label_sanitizer(x.label, escape=False))) \
if ... | [
"def collect_children_by_id(self):\n self.children_by_id = {}\n self.root_by_id = {}\n self.ns_for_root_id = {}\n\n def recursive_fill_root_id(entry):\n root_id = self.root_by_id.get(entry.mount_id)\n if root_id is not None:\n return root_id\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Traverses the supplied object getting all options in opts for the specified opt_type and specs. Also takes into account the plotting class defaults for plot options. If a keyfn is supplied the returned options will be grouped by the returned keys. | def _traverse_options(cls, obj, opt_type, opts, specs=None, keyfn=None, defaults=True):
def lookup(x):
"""
Looks up options for object, including plot defaults,
keyfn determines returned key otherwise None key is used.
"""
options = cls.lookup_options(... | [
"def _all_opt_infos(self):\n for info in self._opts.values():\n yield info, None\n for group in self._groups.values():\n for info in group._opts.values():\n yield info, group",
"def get_plot_kwargs(cfg, option, key=None):\n plot_kwargs = cfg.get(option, {}).ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Looks up options for object, including plot defaults, keyfn determines returned key otherwise None key is used. | def lookup(x):
options = cls.lookup_options(x, opt_type)
selected = {o: options.options[o]
for o in opts if o in options.options}
if opt_type == 'plot' and defaults:
plot = Store.registry[cls.backend].get(type(x))
selected['defa... | [
"def _traverse_options(cls, obj, opt_type, opts, specs=None, keyfn=None, defaults=True):\n def lookup(x):\n \"\"\"\n Looks up options for object, including plot defaults,\n keyfn determines returned key otherwise None key is used.\n \"\"\"\n options = cl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses traversal to find the appropriate projection for a nested object. Respects projections set on Overlays before considering Element based settings, before finally looking up the default projection on the plot type. If more than one nonNone projection type is found an exception is raised. | def _get_projection(cls, obj):
isoverlay = lambda x: isinstance(x, CompositeOverlay)
opts = cls._traverse_options(obj, 'plot', ['projection'],
[CompositeOverlay, Element],
keyfn=isoverlay)
from_overlay = not all(p is None ... | [
"async def test_entity_nested_projection(self):\n test_name = 'test_entity_nested_projection'\n entity_name = 'TestEntityNestedProjection'\n\n corpus = TestHelper.get_local_corpus(self.tests_subpath, test_name)\n expected_output_path = TestHelper.get_expected_output_folder_path(self.test... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the zorder of element in the NdOverlay taking into account possible batching of elements. | def get_zorder(self, overlay, key, el):
spec = util.get_overlay_spec(overlay, key, el)
try:
return self.ordering.index(spec)
except ValueError:
self.ordering = sorted(self.ordering+[spec])
return self.ordering.index(spec) | [
"def compute_overlayable_zorders(obj, path=[]):\n path = path+[obj]\n zorder_map = defaultdict(list)\n\n # Process non-dynamic layers\n if not isinstance(obj, DynamicMap):\n if isinstance(obj, CompositeOverlay):\n for z, o in enumerate(obj):\n zorder_map[z] = [o, obj]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the extents for the axes from the current View. The globally computed ranges can optionally override the extents. | def get_extents(self, view, ranges):
ndims = len(view.dimensions())
num = 6 if self.projection == '3d' else 4
if self.apply_ranges:
if ranges:
dims = view.dimensions()
x0, x1 = ranges[dims[0].name]
if ndims > 1:
y0, ... | [
"def extents(self):\n if self.direction == 'horizontal':\n vmin = self._selection_artist.get_x()\n vmax = vmin + self._selection_artist.get_width()\n else:\n vmin = self._selection_artist.get_y()\n vmax = vmin + self._selection_artist.get_height()\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a HoloMap compute the appropriate (mapwise or framewise) ranges in order to apply the Compositor collapse operations in display mode (data collapse should already have happened). | def _apply_compositor(self, holomap, ranges=None, keys=None, dimensions=None):
# Compute framewise normalization
defaultdim = holomap.ndims == 1 and holomap.kdims[0].name != 'Frame'
if keys and ranges and dimensions and not defaultdim:
dim_inds = [dimensions.index(d) for d in holoma... | [
"def _collapse(clutter_levels: List) -> np.ndarray:\n # kernel approximation for the five - tap 1D Gaussian filter used in pyramid methods for image processing\n kernel_1d: np.ndarray = np.array([[0.05, 0.25, 0.4, 0.25, 0.05]])\n kernel_2d: np.ndarray = conv2(kernel_1d, kernel_1d.T)\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This Function is used to control the Movement of the Snake | def Movement():
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT] and not snake.ang==90:
snake.x_change = -snake.vel
snake.y_change = 0
snake.left = True
snake.right = False
snake.up = False
snake.down = False
snake.ang = -90
elif... | [
"def move(self):\n new_pos = self.snake_parts[-1][:]\n if self.direction == 'up':\n new_pos[1] -= 1\n elif self.direction == 'down':\n new_pos[1] += 1\n elif self.direction == 'left':\n new_pos[0] -= 1\n else:\n new_pos[0] += 1\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This Function Calculates distance between Food and Snake | def Distance(foodx,foody):
di = ((snake.x - foodx)**2) + ((snake.y - foody)**2)
d = int(math.sqrt(di))
return d | [
"def rel_food_dist(self):\n i0, j0 = self._snake_pos[0]\n i1, j1 = self._food_pos\n return i0 - i1, j0 - j1",
"def abs_food_dist(self):\n d = self.rel_food_dist()\n return abs(d[0]) + abs(d[1])",
"def calculate_distance(asteroid_1: Asteroid, asteroid_2: Asteroid) -> float:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the value of a leaf node and all the sums above it. Idx expected in the [0, capacity] range. | def update(self, idx, value):
idx = self.__capacity - 1 + idx
self.__tree[idx] = value
self.__update(idx) | [
"def update(self, idx, p):\n if idx < 0 or idx > self.capacity - 1:\n raise ValueError('idx must be a positive integer small than capacity')\n tree_idx = idx + self.capacity - 1\n\n change = p - self.tree[tree_idx]\n self.tree[tree_idx] = p\n\n self._propagate(tree_idx,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receives the idx of a leaf node and updates the sums on all the nodes above it based on its current value. | def __update(self, idx):
parent = (idx - 1) // 2
while parent >= 0:
left, right = 2 * parent + 1, 2 * parent + 2
self.__tree[parent] = self.__tree[left] + self.__tree[right]
parent = (parent - 1) // 2 | [
"def sum(self, idx):\n idx += 1\n r = 0\n while idx > 0:\n r += self.tree[idx]\n idx -= (idx & (-idx))\n return r",
"def incr(self, idx, val):\n idx += 1\n while idx < len(self.tree):\n self.tree[idx] += val\n idx += (idx & (-i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an arbitrary number of functions we create a pipeline where the output is piped between functions. you can also specify a tuple of arguments that should be passed to functions in the pipeline. The first arg is always the output of the previous function. | def PipeLine(*funcs, **kwargs):
def wrapper(*data):
if len(funcs) == 1:
combinedArgs = data + kwargs.get(funcs[-1].__name__, tuple())
return funcs[-1](combinedArgs)
else:
combinedArgs = kwargs.get(funcs[-1].__name__, tuple())
if combinedArgs != ():
... | [
"def make_pipeline(steps):\n def compose2(f, g):\n return lambda x: g(f(x))\n return functools.reduce(compose2, steps)",
"def pipeline(*fns: Callable[[Any], Option[Any]]) -> Callable[[Any], Option[Any]]: # type: ignore\n\n def reducer(acc: Callable[[Any], Option[Any]], fn: Callable[[Any], Option[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an arbitrary number of functions we create a pipeline where the output is piped between functions. You can also specify a tuple of arguments that should be passed to the functions in the pipeline. The first argument is always the output of the previous function. This version uses the reduce builtin instead of usi... | def ReducePipeline(*funcs, **kwargs):
def accum(val, func):
funcArgs = kwargs.get(func.__name__, tuple())
if hasattr(val, "__call__"):
return func(val(), *funcArgs)
else:
return func(val, *funcArgs)
def wrapper(*data):
newFuncs = (partial(funcs[0], *data)... | [
"def pipeline(*fns: Callable[[Any], Option[Any]]) -> Callable[[Any], Option[Any]]: # type: ignore\n\n def reducer(acc: Callable[[Any], Option[Any]], fn: Callable[[Any], Option[Any]]) -> Callable[[Any], Option[Any]]:\n def gn(x: Any) -> Option[Any]:\n return acc(x).bind(fn)\n\n return gn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check move possibility using observation window | def is_move_possible(obs_window, displacement):
pos_row = obs_window.shape[0] // 2
pos_col = obs_window.shape[1] // 2
new_pos_row = pos_row + displacement[0]
new_pos_col = pos_col + displacement[1]
is_traversable = obs_window[new_pos_row, new_pos_col] == 0
is_shortcut = obs_window[new_pos_row,... | [
"def _ismoving(self):\n return self.dp.state()==PyTango.DevState.MOVING",
"def ismoving(self):\n return not self.get_par(\"done_moving\")",
"def is_moving(self):\n is_moving = self.get_raw_status() & self.STATUS_MOVING\n return bool(is_moving)",
"def o_win(self):\r\n if (self.x_can_move... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the CPModule from within the loaded Python module m an imported module returns the CPModule class | def find_cpmodule(m):
for v, val in list(m.__dict__.items()):
if isinstance(val, type) and issubclass(val, cellprofiler_core.module.Module):
return val
raise ValueError(
"Could not find cellprofiler_core.module.Module class in %s" % m.__file__
) | [
"def _module(self):\n if self._module_cache is None:\n self._module_cache = load_module(self._name, self._path)\n return self._module_cache",
"def get_module(self):\n return self.module",
"def get_module_class(module):\n try:\n for name, obj in inspect.getmember... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CPU mnist test for TF Training Instance Type c5.4xlarge Given above parameters, registers a task with family named after this test, runs the task, and waits for the task to be stopped before doing teardown operations of instance and cluster. | def test_ecs_tensorflow_training_mnist_cpu(cpu_only, ecs_container_instance, tensorflow_training, training_cmd,
ecs_cluster_name):
instance_id, cluster_arn = ecs_container_instance
ecs_utils.ecs_training_test_executor(ecs_cluster_name, cluster_arn, training_cmd, tenso... | [
"def test_ecs_mxnet_training_mnist_cpu(cpu_only, ecs_container_instance, mxnet_training, training_cmd, ecs_cluster_name):\n instance_id, cluster_arn = ecs_container_instance\n\n ecs_utils.ecs_training_test_executor(ecs_cluster_name, cluster_arn, training_cmd, mxnet_training, instance_id)",
"def task_train()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GPU mnist test for TF Training Instance Type p3.2xlarge Given above parameters, registers a task with family named after this test, runs the task, and waits for the task to be stopped before doing teardown operations of instance and cluster. | def test_ecs_tensorflow_training_mnist_gpu(gpu_only, ecs_container_instance, tensorflow_training, training_cmd,
ecs_cluster_name):
instance_id, cluster_arn = ecs_container_instance
num_gpus = ec2_utils.get_instance_num_gpus(instance_id)
ecs_utils.ecs_training_tes... | [
"def test_ecs_mxnet_training_mnist_gpu(gpu_only, ecs_container_instance, mxnet_training, training_cmd, ecs_cluster_name):\n instance_id, cluster_arn = ecs_container_instance\n\n num_gpus = ec2_utils.get_instance_num_gpus(instance_id)\n\n ecs_utils.ecs_training_test_executor(ecs_cluster_name, cluster_arn, t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GPU Faster RCNN test for TF Training Instance Type g3.8xlarge Given above parameters, registers a task with family named after this test, runs the task, and waits for the task to be stopped before doing teardown operations of instance and cluster. | def test_ecs_tensorflow_training_fasterrcnn_gpu(gpu_only, ecs_container_instance, tensorflow_training, training_cmd,
ecs_cluster_name):
instance_id, cluster_arn = ecs_container_instance
num_gpus = ec2_utils.get_instance_num_gpus(instance_id)
ecs_utils.ecs_trainin... | [
"def test_ecs_tensorflow_training_mnist_gpu(gpu_only, ecs_container_instance, tensorflow_training, training_cmd,\n ecs_cluster_name):\n instance_id, cluster_arn = ecs_container_instance\n\n num_gpus = ec2_utils.get_instance_num_gpus(instance_id)\n\n ecs_utils.ecs_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a results list and puts it in a pandas dataframe together with other relevant variables (runs, generations, and language class) | def language_stats_to_dataframe(results, n_runs, n_gens, possible_form_lengths):
if len(possible_form_lengths) == 1:
n_language_classes = 4
else:
n_language_classes = 7 #TODO: or should this be 6 (i.e. collapsing the two different reduplication strategies?)
column_proportion = np.array(re... | [
"def create_dataframe(result):\n # List of elements in the search result\n names = []\n snippet = []\n url = []\n \n # Append search results to list\n for j,item in enumerate(result):\n for i,element in enumerate(result[j]['items']):\n names.append(result[j]['items'][i]['title... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a pandas dataframe which contains the proportions of language classes over generations and plots timecourses | def plot_timecourse_language_types(lang_class_prop_over_gen_df, title, file_path, file_name):
sns.set_style("darkgrid")
sns.set_context("talk")
fig, ax = plt.subplots()
if len(possible_form_lengths) == 1:
palette = sns.color_palette(["black", "red", "green", "grey"])
else:
palette ... | [
"def plot_word_class_pr_genre(df):\n df['nouns'] = df['nouns'] * 100\n df['verbs'] = df['verbs'] * 100\n df['adverbs'] = df['adverbs'] * 100\n # plotting nouns\n plotting_helper_method('nouns', 'genre', df)\n plt.title('Amount of nouns pr song pr. genre')\n plt.xlabel(\"Amount of nouns in each ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a pandas dataframe which contains the proportions of language classes over generations and generates a barplot (excluding the burnin period) | def plot_barplot_language_types(lang_class_prop_over_gen_df, title, file_path, file_name, n_runs, n_batches, n_gens, gen_start, lang_class_baselines_all, lang_class_baselines_fully_expressive, possible_form_lengths):
sns.set_style("darkgrid")
sns.set_context("talk")
if len(possible_form_lengths) == 1:
... | [
"def bar_plot(df_NP):\n cnt = Counter()\n for tax_list in df_NP.taxonomy:\n for tax in list(tax_list):\n if tax != 'no':\n cnt[tax] += 1\n plt.bar(cnt.keys(),cnt.values())\n plt.xlabel('taxonomic provenance')\n plt.ylabel('number of molecules')\n plt.title('number ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a new HTTP client event router object uri is a URI for this event router. A new URI derived from this is created for the HTTP client event relay. host is the IP address of host name to which the HTTP connection is made. port is the TCP port number to which the HTTP connection is made. | def __init__(self, uri=None, host='', port=8082, simplex=False):
super(EventRouterHTTPC, self).__init__(uri)
relayuri = self.getUri()+"/HTTPC"
self._relay = EventRelayHTTPC(self, relayuri, host, port, simplex)
return | [
"def __init__(self, router, uri=None, host='', port=8082, simplex=False):\n super(EventRelayHTTPC, self).__init__(uri)\n self._router = router\n self._queue = Queue()\n self._event = threading.Event()\n self._closing = False\n self._queueEvent = threading.Event()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function called to close down event router. | def close(self):
self._relay.close()
super(EventRouterHTTPC, self).close()
return | [
"def event_close(self):\n self.state = 'close'",
"def close(self):\n if self.render_app:\n requests.post('http://127.0.0.1:8050/shutdown')\n return",
"def closeEvent(self, event):\n self._parent.quit_application(event)",
"def close(self):\r\n self._heartbeat.stop(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a new HTTP client event passing object An HTTP client is associated with an existing event router, and sends all messages received from that router to the HTTP connection, and forwards all messages received from the HTTP connection to the router. Interaction with the indicated EventRouter object takes place ... | def __init__(self, router, uri=None, host='', port=8082, simplex=False):
super(EventRelayHTTPC, self).__init__(uri)
self._router = router
self._queue = Queue()
self._event = threading.Event()
self._closing = False
self._queueEvent = threading.Event()
self._si... | [
"def __init__(self, uri=None, host='', port=8082, simplex=False):\n super(EventRouterHTTPC, self).__init__(uri)\n relayuri = self.getUri()+\"/HTTPC\"\n self._relay = EventRelayHTTPC(self, relayuri, host, port, simplex)\n return",
"def __init__(self, router):\n assert isinstance(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add item to the queue, and return a deferred object that fires when an item is removed (or the queue is empty). | def queueItem(self, item):
Trace("%s queueItem (%s)"%(self.getUri(),item), "EventLib.EventRelayHTTPC")
if not self._closing:
self._queue.put(item)
self._queueEvent.set()
return makeQueueDeferred(StatusVal.OK, self._queue, self._event)
return makeDeferr... | [
"def queue(self, item):\n self._queue.append(item)",
"def enqueue(self, item):\n self.queue.append(item)",
"def Add(self, queue, *args, **kwargs):\n self.assertIsInstance(queue, Queue)\n return queue.add_async(*args, **kwargs).get_result()",
"async def aput(self, item):\n\n self._qu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait for an item to be queued, then return it. | def getQueuedItem(self):
Trace("%s getQueuedItem ..."%(self.getUri()), context="EventLib.EventRelayHTTPC")
item = self._queue.get()
Trace("%s getQueuedItem (%s)"%(self.getUri(),item), context="EventLib.EventRelayHTTPC")
self._event.set()
return item | [
"def get(self, block=True, timeout=None):\n self.mutex.lock()\n try:\n if not block:\n if not len(self.queue):\n raise Empty\n elif timeout is None:\n while not len(self.queue):\n self.not_empty.wait(self.mutex)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively load all teachers that can be found in the current experiment's directory. | def load_teachers(self):
# Get the experiment's directory to load from
ex_dir = ask_for_experiment(max_display=10, env_name=self.env_real.name, perma=False)
self.load_teacher_experiment(ex_dir)
if len(self.teacher_policies) < self.num_teachers:
print(
f"You ha... | [
"def _load_teachers(self) -> None:\n # Opens the .txt file from which informations about teachers are loaded.\n data = None\n with open(self._teachers_path) as data_file:\n data = data_file.readlines()\n self.teachers.clear()\n # Fills the teachers' array.\n for ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load teachers from PDDRTeachers experiment. | def load_teacher_experiment(self, exp: Experiment):
_, _, extra = load_experiment(exp)
self.unpack_teachers(extra) | [
"def load_teachers(self):\n # Get the experiment's directory to load from\n ex_dir = ask_for_experiment(max_display=10, env_name=self.env_real.name, perma=False)\n self.load_teacher_experiment(ex_dir)\n if len(self.teacher_policies) < self.num_teachers:\n print(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unpack teachers from PDDRTeachers experiment. | def unpack_teachers(self, extra: dict):
self.teacher_policies.extend(extra["teacher_policies"])
self.teacher_envs.extend(extra["teacher_envs"])
self.teacher_expl_strats.extend(extra["teacher_expl_strats"])
self.teacher_critics.extend(extra["teacher_critics"])
self.teacher_ex_dirs... | [
"def load_teacher_experiment(self, exp: Experiment):\n _, _, extra = load_experiment(exp)\n self.unpack_teachers(extra)",
"def _load_teachers(self) -> None:\n # Opens the .txt file from which informations about teachers are loaded.\n data = None\n with open(self._teachers_path) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prune teachers to only use the first num_teachers of them. | def prune_teachers(self):
self.teacher_policies = self.teacher_policies[: self.num_teachers]
self.teacher_envs = self.teacher_envs[: self.num_teachers]
self.teacher_expl_strats = self.teacher_expl_strats[: self.num_teachers]
self.teacher_critics = self.teacher_critics[: self.num_teachers... | [
"def cleanOrphanedLearners(self):\n\n # Before deleting Learners, ensure that if any Learners that are about to be\n # deleted point to a Team as their action, then that Team's count of\n # referincing Learners is decremented.\n for learner in self.learner_pop:\n if learner.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return orthanc object of study | def get(self):
return orthanc.study(self.orthanc_id) | [
"def orthanc_studies(self):\n return [orthanc.study(x.orthanc_id) for x in self.studies]",
"def give_salome_study(self):\n return SalomeStudy(self.get_sobj().GetStudy())",
"def salome_study_init(theStudyId=0):\n\n global salome_study_initial\n global myStudyManager, myStudyId, myStudy, myStu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return orthanc objects of studies | def orthanc_studies(self):
return [orthanc.study(x.orthanc_id) for x in self.studies] | [
"def get(self):\n return orthanc.study(self.orthanc_id)",
"def studies(self):\n return self._study_queryset",
"def DumpStudies():\n for name in myStudyManager.GetOpenStudies():\n s=myStudyManager.GetStudyByName(name)\n print \"study:\",name, s._get_StudyId()\n DumpStudy(s)",
"def searc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all numbers below N, that is a multiple of M. | def findMultiples(M, N):
numbers = []
for i in range(N):
if(i + 1 == N):
break
if(((i + 1) % M) == 0):
numbers.append(i+1)
return numbers | [
"def multiples(m, n):\n return [n * x for x in range(1, m + 1)]",
"def sixn(m):\n if m <= 2:\n return ()\n if m > 2:\n yield 2\n if m > 3:\n yield 3\n for n in count(1):\n x = 6 * n - 1\n y = x + 2\n if x < m:\n yield x\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
auth_state enabled and available | async def test_auth_state(app, auth_state_enabled):
name = 'kiwi'
user = add_user(app.db, app, name=name)
assert user.encrypted_auth_state is None
cookies = await app.login_user(name)
auth_state = await user.get_auth_state()
assert auth_state == app.authenticator.auth_state | [
"def get_auth_state(self):\n raise NotImplementedError()",
"def auth_enabled(self) -> bool:\n return pulumi.get(self, \"auth_enabled\")",
"def get_authorization():\n return True",
"def supports_auth(self):\n return False",
"def check_auth():\n\n if \"auth\" in session:\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
auth_state enabled at the Authenticator level, but unavailable due to no crypto keys. | def auth_state_unavailable(auth_state_enabled):
crypto.CryptKeeper.instance().keys = []
yield | [
"def get_auth_state(self):\n raise NotImplementedError()",
"async def test_auth_state(app, auth_state_enabled):\n name = 'kiwi'\n user = add_user(app.db, app, name=name)\n assert user.encrypted_auth_state is None\n cookies = await app.login_user(name)\n auth_state = await user.get_auth_state... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests whether ``SoundboardSound.__repr__`` works as intended. | def test__SoundboardSound__repr():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240032
volume = 0.69
sound_id = 202305240033
guild_id = 202305240034
sound = SoundboardSound.precreate(
sound_id,
guild_id = guild_id,
av... | [
"def test_repr(self):\n dummy = DummyCryptographicObject()\n repr(dummy)",
"def test_repr_full_deck(self):\n self.assertEqual(self.deck.__repr__(), \"Deck of 52 cards\")",
"def test_testing_board_repr() -> None:\n tb = MockBoard(\"TESTSERIAL1\")\n assert repr(tb) == f\"<MockBoard seri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests whether ``SoundboardSound.__hash__`` works as intended. | def test__SoundboardSound__hash():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240035
volume = 0.69
sound_id = 202305240036
guild_id = 202305240037
keyword_parameters = {
'available': available,
'emoji': emoji,
'name... | [
"def test__SoundboardSound__eq():\n available = False\n emoji = BUILTIN_EMOJIS['heart']\n name = 'rember'\n user_id = 202305240038\n volume = 0.69\n \n sound_id = 202305240039\n guild_id = 202305240040\n \n keyword_parameters = {\n 'available': available,\n 'emoji': emoji... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests whether ``SoundboardSound.__eq__`` works as intended. | def test__SoundboardSound__eq():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240038
volume = 0.69
sound_id = 202305240039
guild_id = 202305240040
keyword_parameters = {
'available': available,
'emoji': emoji,
'name':... | [
"def __eq__(self: 'SALboard', other: object) -> bool:\n return (isinstance(other, SALboard) and\n self.numSquares == other.numSquares and\n self.snadders == other.snadders)",
"def __eq__(self, other : dumbEmoji) -> bool:\n return type(other) == dumbEmoji and self.sendab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for usr_ping_count, mapped from YANG variable /mpls_state/statistics_oam/usr_ping_count (uint32) | def _get_usr_ping_count(self):
return self.__usr_ping_count | [
"def _set_usr_ping_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"usr-ping-count\", rest_name=\"usr-ping-count\", pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for usr_ping_count, mapped from YANG variable /mpls_state/statistics_oam/usr_ping_count (uint32) | def _set_usr_ping_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="usr-ping-count", rest_name="usr-ping-count", parent=self, path... | [
"def _get_usr_ping_count(self):\n return self.__usr_ping_count",
"def _set_usr_traceroute_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for usr_traceroute_count, mapped from YANG variable /mpls_state/statistics_oam/usr_traceroute_count (uint32) | def _get_usr_traceroute_count(self):
return self.__usr_traceroute_count | [
"def _set_usr_traceroute_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"usr-traceroute-count\", rest_name=\"usr-trac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for usr_traceroute_count, mapped from YANG variable /mpls_state/statistics_oam/usr_traceroute_count (uint32) | def _set_usr_traceroute_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="usr-traceroute-count", rest_name="usr-traceroute-count",... | [
"def _get_usr_traceroute_count(self):\n return self.__usr_traceroute_count",
"def _set_usr_ping_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for echo_req_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_sent_count (uint32) | def _get_echo_req_sent_count(self):
return self.__echo_req_sent_count | [
"def _set_echo_req_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-sent-count\", rest_name=\"echo-req-s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for echo_req_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_sent_count (uint32) | def _set_echo_req_sent_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-sent-count", rest_name="echo-req-sent-count", pa... | [
"def _set_echo_resp_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-sent-count\", rest_name=\"echo-res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for echo_req_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_received_count (uint32) | def _get_echo_req_received_count(self):
return self.__echo_req_received_count | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for echo_req_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_received_count (uint32) | def _set_echo_req_received_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-received-count", rest_name="echo-req-receive... | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for echo_req_timeout_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_timeout_count (uint32) | def _get_echo_req_timeout_count(self):
return self.__echo_req_timeout_count | [
"def _set_echo_req_timeout_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-timeout-count\", rest_name=\"echo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for echo_req_timeout_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_timeout_count (uint32) | def _set_echo_req_timeout_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-timeout-count", rest_name="echo-req-timeout-c... | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for echo_resp_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_sent_count (uint32) | def _get_echo_resp_sent_count(self):
return self.__echo_resp_sent_count | [
"def _set_echo_resp_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-sent-count\", rest_name=\"echo-res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for echo_resp_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_sent_count (uint32) | def _set_echo_resp_sent_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-resp-sent-count", rest_name="echo-resp-sent-count",... | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for echo_resp_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_received_count (uint32) | def _get_echo_resp_received_count(self):
return self.__echo_resp_received_count | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for echo_resp_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_received_count (uint32) | def _set_echo_resp_received_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-resp-received-count", rest_name="echo-resp-rece... | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter method for return_codes, mapped from YANG variable /mpls_state/statistics_oam/return_codes (list) | def _get_return_codes(self):
return self.__return_codes | [
"def _set_return_codes(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGListType(\"number\",return_codes.return_codes, yang_name=\"return-codes\", rest_name=\"return-codes\", parent=self, is_container='list', user_ordered=False, path_helper=se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter method for return_codes, mapped from YANG variable /mpls_state/statistics_oam/return_codes (list) | def _set_return_codes(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGListType("number",return_codes.return_codes, yang_name="return-codes", rest_name="return-codes", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, ... | [
"def _get_return_codes(self):\n return self.__return_codes",
"def return_code(self, return_code):\n\n self._return_code = return_code",
"def traffic_statuscodes_cachecodes(self, **kwargs):\n url_path = 'traffic/statuscodes/cachecodes'\n self.logger.debug(f\"Get list of cache codes\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assumes binary array of 1 and 0 as input. Calculate longest ranges of 1's. | def count_ranges(a):
ranges = []
count = 0
for i, v in enumerate(a):
if v == 1: # same as previous value
count += 1
else:
if count > 1:
ranges.append([i, count]) # [end, length]
count = 0
return ranges | [
"def longest_run_1d(arr: Sequence[bool]) -> int:\n v, rl = rle_1d(arr)[:2]\n return np.where(v, rl, 0).max()",
"def longest_range(arr: list) -> list:\n lookup = {entry: False for entry in arr}\n largest_range = 0\n largest_low = None\n largest_high = None\n for number in arr:\n if not ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
from range of count_ranges, return the 'howmany' longest ranges | def find_longest_ranges(range, howmany):
range.sort(key=lambda x: x[1]) # sort by length
if howmany > 1:
range = range[-howmany:] # get last few
range.sort(key=lambda x: x[0]) # sorted by starttime
return range
else:
return range[-1] | [
"def longest_range(arr: list) -> list:\n lookup = {entry: False for entry in arr}\n largest_range = 0\n largest_low = None\n largest_high = None\n for number in arr:\n if not lookup[number]: # valid starting point\n lookup[number] = True\n curr_low = number\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function used to attach form fields to wtforms. Not really a great solution but is approved by wtforms. | def attach_custom_user_fields(form_cls, **kwargs):
new_fields = UserFields.query.filter_by(**kwargs).all()
for field in new_fields:
validators = []
if field.required:
validators.append(InputRequired())
if field.field_type == "text":
input_field = StringField(
... | [
"def form_CustomisedFormLayoutFields(request):\n schema = schemaish.Structure()\n schema.add( 'firstName', schemaish.String())\n schema.add( 'surname', schemaish.String())\n schema.add( 'age', schemaish.Integer())\n schema.add( 'sex', schemaish.String())\n\n form = formish.Form(schema, 'form')\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If we have a registration code required, we attach it to the form similar to attach_custom_user_fields | def attach_registration_code_field(form_cls):
if Configs.registration_code:
setattr( # noqa B010
form_cls,
"registration_code",
StringField(
"Registration Code",
description="Registration code required to create account",
v... | [
"def handle_register(self, code):\n\n if code in self.factory.users_codes and not self.factory.debug and False:\n self._snd(u\"Codigo Ya Registrado\\nIntroduzca codigo\")\n return\n\n if self.get_odoo_connexion(code):\n self.state = \"tasks\"\n self.menu1_ta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom init to persist the obj parameter to the rest of the form | def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
obj = kwargs.get("obj")
if obj:
self.obj = obj | [
"def __init__(self, *args, **kwargs):\n self.instance = kwargs.pop(\"instance\", None)\n\n initial = kwargs.setdefault(\"initial\", {})\n initial[\"name\"] = self.instance.name\n initial[\"description\"] = self.instance.description\n initial[\"status\"] = self.instance.status\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Labeled tokens come back from the UI as JSON. This method pulls them from the json and dumps | def get_labels():
json_request = request.json # get the json from the server
keys = sort_keys(json_request.keys()) # sort the keys (i.e. the token ids)
labels = []
for k in keys:
# get the labels that the user input to the UI
val = (json_request[k]['text'], json_request[k]['value'])
... | [
"def act(self):\n if not self.label_candidates:\n self.label_candidates = True\n for text in self.observation.get('label_candidates', ()):\n if text:\n tokens = self.tokenize(text)\n self.add_to_dict([self.get_template(tokens)])\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |