query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Write data to log file on predicted directory contents.
def log_dir_stacks_contents(dir_stacks): for directory in dir_stacks: logging.info('-'*80) logging.info('Predicted directory contents of:\n{0}' .format(directory.path)) files = directory.file_names files = sorted(files) logging.info('Number of file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_data(self):\n\n self.check_dir()\n with open(self.log_file, \"a\") as logger_file:\n logger_file.write(\"{}, {}\\n\".format(self.time, self.msg))", "def write_data(self, data):\n print \"Writing data...\"\n # Write data into log\n self.log.write_file(data)\n\...
[ "0.666307", "0.6575131", "0.6570006", "0.6507889", "0.64625835", "0.64397556", "0.61870855", "0.614731", "0.61356354", "0.611342", "0.6105818", "0.6066165", "0.60469264", "0.6040188", "0.6036969", "0.60118806", "0.6003082", "0.6002379", "0.59288365", "0.58907926", "0.58439434...
0.0
-1
Writes the output in simple shell script format. The default format is a shell script file containing the command lines.
def write_default(workflows, output_dir): # Calculate the total number of commands number_of_commands = 0 for workflow in workflows: number_of_commands += sum(map(len, workflow)) # Create command line strings i = 0 out_lines = ['echo Started executing shell script at:', 'date'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_subshell_file_contents(cmd, skip_module_loading, skip_module_unloading):\r\n\r\n\r\n out_lines = []\r\n\r\n # Invoke commands to produce their output command string(s)\r\n cmd_list = cmd.command_lines\r\n cmd_list = map(clean_command_lines, cmd_list)\r\n\r\n # Write current command to s...
[ "0.6161045", "0.5830803", "0.5830141", "0.5728146", "0.5581661", "0.5542562", "0.5534459", "0.5473914", "0.5465518", "0.54606724", "0.5454724", "0.54491675", "0.5440373", "0.54200655", "0.54052734", "0.5380631", "0.53805697", "0.53546333", "0.534062", "0.5320091", "0.53145796...
0.6917708
0
Infer the number of threads to create and allocate commands to each.
def determine_job_workloads(workloads, command_line_parameters): # Group commands by id parallelized_workloads = [] i = 0 for workflow in workloads: i += 1 # Workflow is split by user with SPLIT command or automatically split # at brach/join events thread_allocat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNumThreads(self, num):\r\n self.threads = num", "def Threads():\n for i in range(0, idc.get_thread_qty()):\n yield idc.getn_thread(i)", "def getThreads():\r\n return multiprocessing.cpu_count()", "def manage_threads(_) -> int:\n return 1 << 33", "def manage_threads(_) -> int:\...
[ "0.6624441", "0.6596549", "0.6585806", "0.6577315", "0.6577315", "0.6420568", "0.63426775", "0.6258061", "0.62413865", "0.6231553", "0.6227415", "0.6212451", "0.61994797", "0.61715746", "0.60731506", "0.6033056", "0.6029094", "0.6028547", "0.6028547", "0.6010339", "0.6005012"...
0.0
-1
Infer which ids should be run in the same thread.
def infer_id_groups(workflow, command_line_parameters): # Find the step in the current workflow with the highest number of ids # per command and group ids based on that (as a starting point). workflow_step_index_with_max_ids_per_cmd = 0 max_ids = 0 for workflow_step_index in xrange(len(workflow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n for id, thread in threading._active.items(): \n if thread is self: \n return id", "def use_public_threads(_) -> int:\n return 1 << 34", "def use_public_threads(_) -> int:\n return 1 << 34", "def Threads():\n for i in range(0, idc.get_threa...
[ "0.6132015", "0.5585469", "0.5585469", "0.5548456", "0.55260503", "0.55260503", "0.55258983", "0.55258983", "0.53816414", "0.5298817", "0.5154055", "0.5151005", "0.5147153", "0.5091501", "0.5091501", "0.5067499", "0.5065719", "0.50139385", "0.499055", "0.4987107", "0.49789983...
0.45081964
91
Writes the output in LSF job array format. Creates sub shell scripts that contain the workflow for each input file separately. After this main shell script containing TORQUE configuration is created. This script is responsible for starting the sub shells as separate processes.
def write_lsf(workloads, input_file_parameters, command_line_parameters): workload_index = 0 workload_zfill_amount = len(str(len(workloads))) workload_file_paths = [] for workload in workloads: # Each workflow part will have separate file to submit to TORQUE with # sbatch command. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_unix(workloads, input_file_parameters, command_line_parameters):\r\n\r\n workload_index = 0\r\n workload_zfill_amount = len(str(len(workloads)))\r\n background_process_list = []\r\n for workload in workloads:\r\n # Each workflow part will have separate file to submit to TORQUE with\r\n...
[ "0.7333931", "0.71901464", "0.67998576", "0.6780292", "0.63524926", "0.63199294", "0.6265143", "0.6096322", "0.6079112", "0.588439", "0.58698326", "0.58114004", "0.5785257", "0.57349914", "0.56735706", "0.5660371", "0.56586134", "0.5653163", "0.56474715", "0.5637175", "0.5635...
0.73390156
0
Writes the output in Sun Grid Engine job array submission format. Creates sub shell scripts that contain the workflow for each input file separately. After this main shell script containing SGE configuration is created. This script is responsible for starting the sub shells as separate processes.
def write_sge(workloads, input_file_parameters, command_line_parameters): validate_resource_manager_parameters( input_file_parameters.resource_manager_params, ['# -o', '# -e', '# -t']) workload_index = 0 workload_zfill_amount = len(str(len(workloads))) workload_file_paths = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_jobs(fpath, num_runs, netid):\n\n run = \"\"\n run += \"import sys\\n\"\n run += \"import subprocess\\n\"\n run += \"cmd_array = (\"\n for i in range(num_runs):\n run += \"r\\\"python test.py %d\\\"\" % i\n run += \",\\n\"\n\n run += \")\\n\"\n run += \"p = subprocess.Pop...
[ "0.6961429", "0.67148894", "0.6494868", "0.6412396", "0.62112385", "0.6205976", "0.61844945", "0.6169179", "0.611067", "0.60501873", "0.6024691", "0.5989451", "0.59104246", "0.5877937", "0.5877124", "0.58605266", "0.5851678", "0.5838534", "0.5806282", "0.5746106", "0.573468",...
0.69199365
1
Writes the output in SLURM array job format. Creates sub shell scripts that contain the workflow for each input file separately. After this main shell script containing SLURM configuration is created. This script is responsible for starting the sub shells as separate processes.
def write_slurm(workloads, input_file_parameters, command_line_parameters): workload_index = 0 workload_zfill_amount = len(str(len(workloads))) workload_file_paths = [] for workload in workloads: # Each workflow part will have separate file to submit to SLURM with # sbatch command....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_sge(workloads, input_file_parameters, command_line_parameters):\r\n validate_resource_manager_parameters(\r\n input_file_parameters.resource_manager_params,\r\n ['# -o', '# -e', '# -t'])\r\n\r\n workload_index = 0\r\n workload_zfill_amount = len(str(len(workloads)))\r\n workload...
[ "0.6855347", "0.68422127", "0.6675286", "0.650287", "0.645152", "0.6278125", "0.6242975", "0.6226567", "0.61965185", "0.61401135", "0.60027885", "0.59648293", "0.5838186", "0.58326197", "0.5755615", "0.5729635", "0.57208526", "0.5701956", "0.56957155", "0.5687705", "0.5686899...
0.7628179
0
Writes the output in TORQUE multiple job submission format. Creates sub shell scripts that contain the workflow for each input file separately. After this main shell script containing TORQUE configuration is created. This script is responsible for starting the sub shells as separate processes.
def write_torque(workloads, input_file_parameters, command_line_parameters): validate_resource_manager_parameters( input_file_parameters.resource_manager_params, ['#PBS -k', '#PBS -N', '#PBS -d', '#PBS -e', '#PBS -t']) workload_index = 0 workload_zfill_amount = len(str(len(workloads))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_unix(workloads, input_file_parameters, command_line_parameters):\r\n\r\n workload_index = 0\r\n workload_zfill_amount = len(str(len(workloads)))\r\n background_process_list = []\r\n for workload in workloads:\r\n # Each workflow part will have separate file to submit to TORQUE with\r\n...
[ "0.7209775", "0.6585105", "0.6554315", "0.64478266", "0.6284272", "0.62066483", "0.61065704", "0.60671365", "0.6054951", "0.60292995", "0.5986418", "0.597275", "0.59198385", "0.5856972", "0.5800811", "0.577773", "0.5759242", "0.57556045", "0.5738472", "0.5737264", "0.5733993"...
0.73230857
0
Writes a parallelized workflow by using UNIX run background feature (&). Creates sub shell scripts that contain the workflow for each input file separately. After this main shell script is written, where each workflow is set to run as background process by using the shell & character. Workflow parts are separated by wa...
def write_unix(workloads, input_file_parameters, command_line_parameters): workload_index = 0 workload_zfill_amount = len(str(len(workloads))) background_process_list = [] for workload in workloads: # Each workflow part will have separate file to submit to TORQUE with # sbatch co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_slurm(workloads, input_file_parameters, command_line_parameters):\r\n workload_index = 0\r\n workload_zfill_amount = len(str(len(workloads)))\r\n workload_file_paths = []\r\n for workload in workloads:\r\n # Each workflow part will have separate file to submit to SLURM with\r\n ...
[ "0.6447484", "0.6394443", "0.62565774", "0.6216091", "0.6154703", "0.6106836", "0.608601", "0.5807879", "0.57455873", "0.57444465", "0.5742326", "0.569049", "0.5653086", "0.5634561", "0.5627084", "0.56151015", "0.5591978", "0.54646945", "0.5456538", "0.5420467", "0.5411606", ...
0.74553514
0
Checks that user is has not defined any parameters that are autocreated
def validate_resource_manager_parameters(user_defined_parameters, auto_defined_parameters): for udp in user_defined_parameters: for adp in auto_defined_parameters: if udp.startswith(adp): raise STAPLERerror.STAPLERerror('Resource mana...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_params(self):\n pass", "def checkNeededParams(self):\n for clp,value in self.neededParamsNames.items():\n if value[0] not in self.neededParams:\n print >> sys.stderr, clp+\" is a mandatory parameter \"\n self.printUsage()\n sys.exit...
[ "0.6632489", "0.6268276", "0.624129", "0.6089055", "0.6051467", "0.6032275", "0.5992193", "0.59893614", "0.5983471", "0.59563446", "0.59472436", "0.590658", "0.5867398", "0.5828247", "0.58234674", "0.58154815", "0.5803279", "0.5785927", "0.57798564", "0.5738635", "0.5737196",...
0.5756114
19
Creates a list of necessary information for each output command.
def generate_subshell_file_contents(cmd, skip_module_loading, skip_module_unloading): out_lines = [] # Invoke commands to produce their output command string(s) cmd_list = cmd.command_lines cmd_list = map(clean_command_lines, cmd_list) # Write current command to stdout out_lines.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_metadata(self):\n return []", "def get_output_descriptions(self):\n raise NotImplementedError", "def output_names(self):\n return []", "def create_output_handlers():\n if not args.outputs:\n return []\n outputs = []\n for name in utils.split_comma(args.outp...
[ "0.73233604", "0.7189033", "0.7010749", "0.69144946", "0.6850369", "0.6815734", "0.6672127", "0.66309345", "0.66142124", "0.6599733", "0.6595081", "0.65784407", "0.6530771", "0.65211886", "0.64531296", "0.64531296", "0.64325684", "0.63889813", "0.63545203", "0.6327555", "0.63...
0.0
-1
Ensures that arguments and values are (single) white space separated.
def clean_command_lines(cmd): cmd = ' '.join(cmd.split()) return cmd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_no_whitespace(args):\n for arg in args:\n for char in arg:\n if char in string.whitespace:\n raise RuntimeError(\"No whitespace characters are currently allowed in input arguments. Replace spaces in file and folder names with underscores ('_').\")\n return", "def ...
[ "0.6807918", "0.66258246", "0.660874", "0.6433869", "0.6125184", "0.5969913", "0.5925186", "0.5903873", "0.58645153", "0.5832036", "0.58220625", "0.5815482", "0.5767105", "0.57398367", "0.5724041", "0.5717531", "0.569505", "0.56815946", "0.5675995", "0.5671961", "0.56262225",...
0.0
-1
Reads log file produced by STAPLERs current run and prints report
def check_log(): errors = 0 warnings = 0 log_handle = open(CurrentLogPath.path) for line in log_handle: if 'ERROR:' in line: errors += 1 elif 'WARNING' in line: warnings += 1 log_handle.close() if errors or warnings: print '!'*80 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n config_file = get_conf(get_config_name())\n if not config_file:\n sys.exit(1)\n log = get_last_file(config_file[\"LOG_DIR\"])\n MAIN_LOGGER.info(\"we've got log file named %s\", log.path)\n file_name = os.path.join(os.path.dirname(__file__), config_file['REPORT_DIR'],\n ...
[ "0.6773412", "0.6640467", "0.65638185", "0.6527636", "0.62079036", "0.60315514", "0.6017948", "0.60173035", "0.59455955", "0.59300786", "0.5924629", "0.589744", "0.58598727", "0.5815822", "0.5798734", "0.576267", "0.57485586", "0.5747062", "0.57360184", "0.5734549", "0.572172...
0.53727585
65
test all ssh kwargs are not excluded from kwargs when preparing the SSH opts
def test_ssh_kwargs(test_opts): opt_key = test_opts[0] opt_value = test_opts[1] # Is the kwarg in salt.utils.parsers? in_parser = test_opts[2] opts = { "eauth": "auto", "username": "test", "password": "test", "client": "ssh", "tgt": "localhost", "fun"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _BuildSshOptions(self, batch, ask_key, use_cluster_key,\n strict_host_check, private_key=None, quiet=True,\n port=None):\n options = [\n \"-oEscapeChar=none\",\n \"-oHashKnownHosts=no\",\n \"-oGlobalKnownHostsFile=%s\" % pathutils.SSH_KNOWN_HOSTS_FI...
[ "0.61168206", "0.6079297", "0.59761137", "0.5973248", "0.5916606", "0.58925116", "0.57788223", "0.5721382", "0.56176704", "0.55686975", "0.5542059", "0.5488901", "0.54882175", "0.54571706", "0.544993", "0.5444227", "0.5437077", "0.54274124", "0.54254705", "0.53893155", "0.538...
0.7008141
0
test expand_target when target is root@
def test_expand_target_ip_address(opts, roster): host = "127.0.0.1" user = "test-user@" opts["tgt"] = user + host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == user + host with patch( "salt.roster....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expand_target_no_host(opts, tmp_path):\n host = \"127.0.0.1\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n roster = \"\"\"\n localhost: 127.0.0.1\n \"\"\"\n roster_file = str(tmp_path / \"test_roster_no_host\")\n with salt.utils.files.fopen(roster_file, \"w\") ...
[ "0.63958097", "0.6291556", "0.62824", "0.5702456", "0.5699233", "0.56938875", "0.549201", "0.54572624", "0.54021007", "0.54021007", "0.53985727", "0.5355268", "0.53440464", "0.52915114", "0.5288271", "0.50941646", "0.50924903", "0.5082354", "0.5047073", "0.50409645", "0.50388...
0.5573608
6
test expand_target when host is not included in the rosterdata
def test_expand_target_no_host(opts, tmp_path): host = "127.0.0.1" user = "test-user@" opts["tgt"] = user + host roster = """ localhost: 127.0.0.1 """ roster_file = str(tmp_path / "test_roster_no_host") with salt.utils.files.fopen(roster_file, "w") as fp: salt.utils.yaml...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expand_target_no_user(opts, roster):\n host = \"127.0.0.1\"\n opts[\"tgt\"] = host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n client = ssh.SSH(opts)\n assert opts[\"tgt\"] == host\n\n with patch(\n \"salt.roster.get_roster_file\"...
[ "0.7059753", "0.6958238", "0.6752136", "0.6731314", "0.5922972", "0.5872034", "0.5807112", "0.57836884", "0.57331073", "0.57315934", "0.57153296", "0.5710335", "0.5678303", "0.56106454", "0.55797064", "0.55640423", "0.5553922", "0.55535734", "0.553814", "0.5440517", "0.536293...
0.7415296
0
test expand_target when target is root@
def test_expand_target_dns(opts, roster): host = "localhost" user = "test-user@" opts["tgt"] = user + host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == user + host with patch( "salt.roster.get_ros...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expand_target_no_host(opts, tmp_path):\n host = \"127.0.0.1\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n roster = \"\"\"\n localhost: 127.0.0.1\n \"\"\"\n roster_file = str(tmp_path / \"test_roster_no_host\")\n with salt.utils.files.fopen(roster_file, \"w\") ...
[ "0.63979805", "0.6293237", "0.6284433", "0.5704041", "0.5698366", "0.5575425", "0.5491849", "0.5453624", "0.53991467", "0.5397131", "0.5397131", "0.535758", "0.53415", "0.52911496", "0.5290956", "0.5091858", "0.50912255", "0.5079253", "0.50453305", "0.5040328", "0.50354356", ...
0.56953484
5
test expand_target when no user defined
def test_expand_target_no_user(opts, roster): host = "127.0.0.1" opts["tgt"] = host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == host with patch( "salt.roster.get_roster_file", MagicMock(return_value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testExpandedTargets(self):\n self.all_targets = self.blade.analyze_targets()\n\n sys.stdout.flush()\n sys.stderr.flush()\n\n self.assertTrue(self.blade.get_expanded())\n self.assertTrue(self.all_targets)\n\n system_lib = ('#', 'pthread')\n proto_lib_option = (se...
[ "0.671508", "0.64208895", "0.60364896", "0.5930217", "0.5846596", "0.5827087", "0.5764492", "0.5736275", "0.561528", "0.556417", "0.55002284", "0.54691464", "0.54557925", "0.54245645", "0.53729737", "0.53693706", "0.5354176", "0.5353399", "0.5351528", "0.53332335", "0.5330246...
0.6405484
2
test update_targets when host is ip address
def test_update_targets_ip_address(opts): host = "127.0.0.1" user = "test-user@" opts["tgt"] = user + host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == user + host client._update_targets() assert opts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_targets_dns(opts):\n host = \"localhost\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n client = ssh.SSH(opts)\n assert opts[\"tgt\"] == user + host\n client._update_targets()...
[ "0.7464471", "0.71415", "0.6910683", "0.6657661", "0.64958376", "0.64322263", "0.6429889", "0.6385466", "0.6237695", "0.61982393", "0.61476934", "0.61162746", "0.6114164", "0.610654", "0.6072472", "0.6027562", "0.6008352", "0.598404", "0.5966812", "0.5915929", "0.5911148", ...
0.8039261
0
test update_targets when host is dns
def test_update_targets_dns(opts): host = "localhost" user = "test-user@" opts["tgt"] = user + host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == user + host client._update_targets() assert opts["tgt"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_targets_ip_address(opts):\n host = \"127.0.0.1\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n client = ssh.SSH(opts)\n assert opts[\"tgt\"] == user + host\n client._update_ta...
[ "0.7475771", "0.7439883", "0.6938763", "0.674091", "0.6428459", "0.61800534", "0.6096695", "0.60605717", "0.58983433", "0.5897955", "0.58913845", "0.5874283", "0.585102", "0.58426744", "0.5839361", "0.5837791", "0.5811867", "0.5776639", "0.5776224", "0.5753839", "0.5708274", ...
0.8254757
0
test update_targets when no user defined
def test_update_targets_no_user(opts): host = "127.0.0.1" opts["tgt"] = host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == host client._update_targets() assert opts["tgt"] == host
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_targets_ip_address(opts):\n host = \"127.0.0.1\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n client = ssh.SSH(opts)\n assert opts[\"tgt\"] == user + host\n client._update_ta...
[ "0.6914559", "0.66063684", "0.65769297", "0.65296984", "0.65164536", "0.64756906", "0.6462618", "0.6382679", "0.6335945", "0.633125", "0.633125", "0.633125", "0.6292728", "0.6273413", "0.62559766", "0.62496156", "0.62388134", "0.6209271", "0.6199935", "0.61500025", "0.614538"...
0.7098015
0
test update_targets and expand_target when host is dns
def test_update_expand_target_dns(opts, roster): host = "localhost" user = "test-user@" opts["tgt"] = user + host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): client = ssh.SSH(opts) assert opts["tgt"] == user + host with patch( "salt.roster....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_targets_dns(opts):\n host = \"localhost\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n client = ssh.SSH(opts)\n assert opts[\"tgt\"] == user + host\n client._update_targets()...
[ "0.79298717", "0.7271698", "0.7193563", "0.66447264", "0.6619049", "0.63972855", "0.6149345", "0.6114023", "0.601661", "0.5973573", "0.59198385", "0.59094423", "0.5870842", "0.58562446", "0.5788324", "0.5756256", "0.57487756", "0.57337517", "0.5731826", "0.57180697", "0.56830...
0.7761494
1
test parse_tgt when user and host set on the ssh cli tgt
def test_parse_tgt(opts): host = "localhost" user = "test-user@" opts["tgt"] = user + host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): assert not opts.get("ssh_cli_tgt") client = ssh.SSH(opts) assert client.parse_tgt["hostname"] == host ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_tgt_no_user(opts):\n host = \"localhost\"\n opts[\"ssh_user\"] = \"ssh-usr\"\n opts[\"tgt\"] = host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n assert not opts.get(\"ssh_cli_tgt\")\n client = ssh.SSH(opts)\n assert clien...
[ "0.7891038", "0.66818714", "0.64358", "0.626521", "0.62499535", "0.6192972", "0.6165336", "0.6032608", "0.599522", "0.59491026", "0.5891626", "0.5764562", "0.56263566", "0.5608297", "0.554224", "0.5528934", "0.55157524", "0.5487462", "0.54454535", "0.5427359", "0.5413081", ...
0.84123373
0
test parse_tgt when only the host set on the ssh cli tgt
def test_parse_tgt_no_user(opts): host = "localhost" opts["ssh_user"] = "ssh-usr" opts["tgt"] = host with patch("salt.utils.network.is_reachable_host", MagicMock(return_value=False)): assert not opts.get("ssh_cli_tgt") client = ssh.SSH(opts) assert client.parse_tgt["hostname"] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_tgt(opts):\n host = \"localhost\"\n user = \"test-user@\"\n opts[\"tgt\"] = user + host\n\n with patch(\"salt.utils.network.is_reachable_host\", MagicMock(return_value=False)):\n assert not opts.get(\"ssh_cli_tgt\")\n client = ssh.SSH(opts)\n assert client.parse_tgt[...
[ "0.7992045", "0.6546669", "0.64141375", "0.6399565", "0.6154963", "0.608924", "0.60557365", "0.594483", "0.58621407", "0.5818358", "0.58130467", "0.5710715", "0.5646345", "0.56421787", "0.55266964", "0.5521712", "0.55002075", "0.54592144", "0.5452184", "0.5410033", "0.5379215...
0.7612063
1
test "extra_filerefs" are not excluded from kwargs when preparing the SSH opts
def test_extra_filerefs(tmp_path, opts): ssh_opts = { "eauth": "auto", "username": "test", "password": "test", "client": "ssh", "tgt": "localhost", "fun": "test.ping", "ssh_port": 22, "extra_filerefs": "salt://foobar", } roster = str(tmp_path /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ssh_kwargs(test_opts):\n opt_key = test_opts[0]\n opt_value = test_opts[1]\n # Is the kwarg in salt.utils.parsers?\n in_parser = test_opts[2]\n\n opts = {\n \"eauth\": \"auto\",\n \"username\": \"test\",\n \"password\": \"test\",\n \"client\": \"ssh\",\n \...
[ "0.585128", "0.5742932", "0.5614613", "0.55098736", "0.5377966", "0.53588086", "0.5335075", "0.5329998", "0.5300597", "0.52753556", "0.5273424", "0.5244408", "0.523141", "0.52186584", "0.52164793", "0.5213526", "0.5114157", "0.50991726", "0.5093965", "0.50867444", "0.50815296...
0.6820886
0
The main function used to produce a model ready for compression finetuning from an original PyTorch model and a configuration object. dummy_forward_fn
def create_compressed_model( model: Module, config: NNCFConfig, compression_state: Optional[Dict[str, Any]] = None, dummy_forward_fn: Callable[[Module], Any] = None, wrap_inputs_fn: Callable[[Tuple, Dict], Tuple[Tuple, Dict]] = None, wrap_outputs_fn: Callable[[Tuple, Dict], Tuple[Tuple, Dict]] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_export_pytorch_model(self):\n pytorch_model = PyTorchLinear()\n dummy_input = torch.empty(10, 10)\n\n with io.BytesIO() as f:\n onnx_converter._export_pytorch_model(f, pytorch_model, dummy_input)", "def __init__(\n self,\n d_model,\n ff1_hsize=1024,\n...
[ "0.6455248", "0.64005536", "0.63606685", "0.6281817", "0.6148253", "0.614193", "0.6059045", "0.60385054", "0.6027797", "0.60148734", "0.60109484", "0.59764093", "0.5941529", "0.5936054", "0.59347934", "0.59182537", "0.59015125", "0.5899236", "0.58604336", "0.58340454", "0.582...
0.68160737
0
The main function used to produce a model ready for adding compression from an original PyTorch model and a configuration object.
def create_nncf_network( model: torch.nn.Module, config: NNCFConfig, dummy_forward_fn: Callable[[Module], Any] = None, wrap_inputs_fn: Callable = None, wrap_outputs_fn: Callable = None, ) -> NNCFNetwork: if dummy_forward_fn is not None and wrap_inputs_fn is None: raise ValueError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_compressed_model(\n model: Module,\n config: NNCFConfig,\n compression_state: Optional[Dict[str, Any]] = None,\n dummy_forward_fn: Callable[[Module], Any] = None,\n wrap_inputs_fn: Callable[[Tuple, Dict], Tuple[Tuple, Dict]] = None,\n wrap_outputs_fn: Callable[[Tuple, Dict], Tuple[Tupl...
[ "0.6805067", "0.64645237", "0.63963777", "0.629331", "0.6279846", "0.62571394", "0.62136424", "0.6200934", "0.6185239", "0.61641246", "0.6146346", "0.61316377", "0.6119912", "0.60950714", "0.60887957", "0.60552573", "0.60521084", "0.6035455", "0.60300136", "0.60277575", "0.60...
0.0
-1
Create compression algorithm builders by a given list of algorithm names.
def create_compression_algorithm_builder(config: NNCFConfig, should_init=True) -> PTCompressionAlgorithmBuilder: algo_names = extract_algorithm_names(config) return create_compression_algorithm_builder_from_algo_names(algo_names, config, should_init)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_compression_algorithm_builder_from_algo_names(\n algo_names: List[str], config: NNCFConfig, should_init: bool\n) -> PTCompressionAlgorithmBuilder:\n if not algo_names:\n algo_builder_classes = [NoCompressionAlgorithmBuilder]\n else:\n algo_builder_classes = [PT_COMPRESSION_ALGORIT...
[ "0.8176492", "0.58072144", "0.56273663", "0.5360396", "0.5243267", "0.5199738", "0.5186726", "0.5184808", "0.5183975", "0.5176187", "0.5148908", "0.51379925", "0.51363987", "0.5109506", "0.5105624", "0.51028985", "0.5090822", "0.50801146", "0.50719637", "0.5062348", "0.505617...
0.62809783
1
Create compression algorithm builders by a given list of algorithm names.
def create_compression_algorithm_builder_from_algo_names( algo_names: List[str], config: NNCFConfig, should_init: bool ) -> PTCompressionAlgorithmBuilder: if not algo_names: algo_builder_classes = [NoCompressionAlgorithmBuilder] else: algo_builder_classes = [PT_COMPRESSION_ALGORITHMS.get(alg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_compression_algorithm_builder(config: NNCFConfig, should_init=True) -> PTCompressionAlgorithmBuilder:\n algo_names = extract_algorithm_names(config)\n return create_compression_algorithm_builder_from_algo_names(algo_names, config, should_init)", "def algorithms_factory():\n all_algorithms = [...
[ "0.62809783", "0.58072144", "0.56273663", "0.5360396", "0.5243267", "0.5199738", "0.5186726", "0.5184808", "0.5183975", "0.5176187", "0.5148908", "0.51379925", "0.51363987", "0.5109506", "0.5105624", "0.51028985", "0.5090822", "0.50801146", "0.50719637", "0.5062348", "0.50561...
0.8176492
0
Helper to call ``ir.actions.report.xml.render_report()``.
def render_report(cr, uid, ids, name, data, context=None): registry = yuancloud.modules.registry.RegistryManager.get(cr.dbname) return registry['ir.actions.report.xml'].render_report(cr, uid, ids, name, data, context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_xml_report(self, parser, data, objects,context=None):\n raise NotImplementedError()", "def display_reports(self, layout): # pylint: disable=arguments-differ", "def _generate_report(self):\n raise NotImplementedError", "def render_report(self, res_ids, name, data):\n report =...
[ "0.6349062", "0.63135356", "0.60601676", "0.60378766", "0.59094083", "0.59055895", "0.58374727", "0.57946086", "0.57253027", "0.56983304", "0.5696021", "0.5689943", "0.56596303", "0.5653516", "0.56528664", "0.56278044", "0.5620049", "0.56102747", "0.55857426", "0.55817837", "...
0.7703999
0
Returns timings for parts, where the video should be kept
def getSectionsOfNewVideo (silences, duration): return [0.0] + silences + [duration]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video_time():\r\n # The full time has the form \"0:32 / 3:14\"\r\n full_time = world.css_text('div.vidtime')\r\n\r\n # Split the time at the \" / \", to get [\"0:32\", \"3:14\"]\r\n elapsed_str, duration_str = full_time.split(' / ')\r\n\r\n # Convert each string to seconds\r\n return (parse_t...
[ "0.6023563", "0.59063125", "0.56466246", "0.5624058", "0.56141603", "0.560595", "0.5565088", "0.5434631", "0.5414467", "0.538054", "0.538054", "0.538054", "0.5377151", "0.5325003", "0.5311827", "0.5305418", "0.5302824", "0.5241184", "0.5222898", "0.5206784", "0.5206103", "0...
0.5964529
1
Remove implicit resolvers for a particular tag Takes care not to modify resolvers in super classes. We want to load datetimes as strings, not dates, because we go on to serialise as json which doesn't have the advanced types of yaml, and leads to incompatibilities down the track.
def remove_implicit_resolver(cls, tag_to_remove): if 'yaml_implicit_resolvers' not in cls.__dict__: cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy() for first_letter, mappings in cls.yaml_implicit_resolvers.items(): cls.yaml_implicit_resolvers[first_letter] = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_implicit_resolver(cls, tag_to_remove):\n if 'yaml_implicit_resolvers' not in cls.__dict__:\n cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy()\n\n for first_letter, mappings in cls.yaml_implicit_resolvers.items():\n cls.yaml_implicit_resolvers[first_let...
[ "0.72351325", "0.4945799", "0.48895606", "0.4787134", "0.47753465", "0.4747511", "0.47394142", "0.47089127", "0.46628618", "0.46158558", "0.46017975", "0.45002973", "0.44972196", "0.4452387", "0.44437444", "0.44306776", "0.43933737", "0.43895388", "0.43718284", "0.43617448", ...
0.72606164
0
Try to get consent status for a single email address
def test_get_one(self, requests_mock, accepts_marketing): matcher = requests_mock.post( f'{settings.CONSENT_SERVICE_BASE_URL}' f'{consent.CONSENT_SERVICE_PERSON_PATH_LOOKUP}', json={ 'results': [ { 'email': 'foo@bar....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Get_applicant_status(self, email):\n status = None\n if email in self.Attendees:\n status = ApplicantStatus.Accepted\n elif email in self.Waitlist:\n status = ApplicantStatus.Waitlisted\n else:\n raise MissingAddressException(email)\n return s...
[ "0.66149795", "0.58070236", "0.57529634", "0.57529634", "0.5640133", "0.5606867", "0.55703324", "0.5566895", "0.55520564", "0.5475473", "0.54483193", "0.54387474", "0.541679", "0.53587914", "0.5347143", "0.53188384", "0.5258927", "0.525825", "0.52227", "0.5204715", "0.5188246...
0.60032743
1
Try to get consent status for a list of email addresses
def test_get_many(self, requests_mock, accepts_marketing, emails): matcher = requests_mock.post( f'{settings.CONSENT_SERVICE_BASE_URL}' f'{consent.CONSENT_SERVICE_PERSON_PATH_LOOKUP}', json={ 'results': [ { 'email': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Get_applicant_status(self, email):\n status = None\n if email in self.Attendees:\n status = ApplicantStatus.Accepted\n elif email in self.Waitlist:\n status = ApplicantStatus.Waitlisted\n else:\n raise MissingAddressException(email)\n return s...
[ "0.61944306", "0.6052294", "0.57121867", "0.5533557", "0.54612494", "0.54612494", "0.5418097", "0.52885437", "0.5284941", "0.5283386", "0.5248901", "0.5231524", "0.522646", "0.5220439", "0.5209896", "0.520168", "0.51967436", "0.5160234", "0.5155434", "0.5138707", "0.51335585"...
0.6141746
1
Try to update consent status
def test_update(self, requests_mock, accepts_marketing): matcher = requests_mock.post( f'{settings.CONSENT_SERVICE_BASE_URL}' f'{consent.CONSENT_SERVICE_PERSON_PATH}', json={ 'consents': [ CONSENT_SERVICE_EMAIL_CONSENT_TYPE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_confirm_add_flow_request_wrong_consent_status(self):\n self.client.login(username='duck', password='duck')\n res = self.client.get(\n '/v1/flow_requests/consents_confirmed/?success=true&consent_confirm_id={}'.format(WRONG_CONFIRM_ID))\n self.assertEqual(res.status_code, 302...
[ "0.6403219", "0.6326517", "0.6045587", "0.5909922", "0.5812921", "0.57628024", "0.5692828", "0.5603599", "0.55674136", "0.5560386", "0.549486", "0.5482111", "0.5482111", "0.5476812", "0.544154", "0.54324704", "0.5428267", "0.5428241", "0.54031616", "0.5402912", "0.540165", ...
0.64573574
0
This function retrieves all ACISAs
def RetrieveACISA(): db = DBConnector() cur = db.cursor() SQLcmd = "SELECT * FROM snaps.SNAPsLocation" cur.execute(SQLcmd) returnList = [] count = 0 for item in cur.fetchall(): count += 1 tmplist = [item[1], item[2], count, str(item[0])] returnList.append(tmplist) return returnList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_acls():\n return config.get_cfg_storage(ID_ACL)", "def getAcdcs(url, requests):\n acdcs = []\n for request in requests:\n name=request['id']\n #if a wrong or weird name\n if len(request['key'])<3:\n print request\n continue\n if 'ACDC' not in nam...
[ "0.6468968", "0.62329483", "0.6149895", "0.6125198", "0.6006901", "0.59983075", "0.59268194", "0.58295614", "0.58222836", "0.58132493", "0.5776532", "0.57738966", "0.5739669", "0.57129836", "0.57093567", "0.5707091", "0.5696865", "0.5693562", "0.5683094", "0.5662152", "0.5629...
0.63769305
1
Method to calculate a stat over all time steps
def time_stat(self, stat="mean"): # create cdo command and run it cdo_command = f"cdo -tim{stat}" run_this(cdo_command, self, output="ensemble")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_stat_values(self):", "def compute_stats(self):\n if self.stats is not None:\n return\n self.stats = np.zeros(STEPS_MAX + 1)\n for m in self.missions:\n m.compute_stats()\n self.stats += 100 * m.stats\n self.stats /= len(self.missions)", "def...
[ "0.7152318", "0.6610999", "0.64921373", "0.6394629", "0.63097644", "0.62772894", "0.6209305", "0.6110621", "0.6110621", "0.6110621", "0.61086136", "0.6045909", "0.596642", "0.5933937", "0.5890365", "0.58721894", "0.58537525", "0.5809977", "0.58057666", "0.57885444", "0.573436...
0.68386406
1
Calculate the sum of all values.
def sum(self): return time_stat(self, stat="sum")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(self):\n return sum(self.values)", "def sum(self) -> float:\n return sum(self.values)", "def sum (self):\n return self.values.sum ()", "def sum (self):\n return self.values.sum ()", "def _sum(self):\n s = 0\n for element, value in self.items():\n ...
[ "0.829055", "0.81755704", "0.8065702", "0.8065702", "0.7918524", "0.7903193", "0.7888516", "0.7864948", "0.7796982", "0.77682406", "0.77394885", "0.76733375", "0.76402175", "0.76350355", "0.7526063", "0.74657136", "0.7424097", "0.73245305", "0.7189328", "0.71821636", "0.71768...
0.6479448
62
Calculate the mean of all values.
def mean(self): return time_stat(self, stat="mean")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean(values):\r\n return sum(values) / float(len(values))", "def mean(vals):", "def mean(self):\n return self.aggregate(np.mean)", "def mean(self, values):\n return self.aggregate(values, \"mean\")", "def get_mean(self):\n self.meanval = np.mean(self.adulist)", "def mean(value...
[ "0.80817807", "0.80095905", "0.79848087", "0.79562736", "0.7932791", "0.7910605", "0.7860225", "0.78547275", "0.7822969", "0.78094804", "0.76588786", "0.7649044", "0.75542116", "0.75120634", "0.75096875", "0.7501223", "0.74895203", "0.7484985", "0.7479248", "0.74709976", "0.7...
0.0
-1
Calculate the minimums of all values.
def min(self): return time_stat(self, stat="min")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self, values):\n return self.aggregate(values, \"min\")", "def argmin(self, values):\n return self.aggregate(values, \"argmin\")", "def get_minimum():\n return [\n convert_variables([0.78547, 0.78547, 0.78547]),\n ]", "def pmin(\n *x: NumericType,\n ...
[ "0.74669844", "0.7113077", "0.70211583", "0.6998979", "0.6964122", "0.68508005", "0.6805708", "0.6718231", "0.6707366", "0.6705791", "0.6616426", "0.6613132", "0.6566346", "0.65005034", "0.64451647", "0.64139503", "0.6405389", "0.6403661", "0.63760275", "0.63603747", "0.63527...
0.0
-1
Calculate the maximums of all values.
def max(self): return time_stat(self, stat="max")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max(self, values):\n return self.aggregate(values, \"max\")", "def argmax(self, values):\n return self.aggregate(values, \"argmax\")", "def maxs(self):\n return self._maxs", "def max(self):\n return self._reduce_for_stat_function(F.max, only_numeric=False)", "def _multiple_v...
[ "0.75460076", "0.7304106", "0.7165441", "0.70699817", "0.6978723", "0.6956079", "0.68157953", "0.68139267", "0.6805858", "0.67493033", "0.67341715", "0.6709677", "0.6672466", "0.66649884", "0.66636693", "0.6657917", "0.6644122", "0.6643254", "0.6637891", "0.6631197", "0.66247...
0.6113221
68
Calculate the ranges of all values.
def range(self): return time_stat(self, stat="range")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ranges(self) -> typing.List[typing.Tuple[float, float]]:\n return self.ranges[:]", "def ranges(self):\n return self._ranges", "def _calc_range(self) -> np.ndarray:\n if self._is_ct25k():\n range_resolution = 30\n n_gates = 256\n else:\n n_gat...
[ "0.7304999", "0.7190477", "0.70206416", "0.6923109", "0.671551", "0.6701029", "0.66305655", "0.66285425", "0.6583244", "0.65568984", "0.6547148", "0.6417848", "0.6378743", "0.6366492", "0.6347865", "0.63414705", "0.6340766", "0.63363886", "0.6291575", "0.62688875", "0.6259675...
0.5900169
59
Calculate the variances of all values.
def var(self): return time_stat(self, stat="var")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variance(self):\n return 1 / self.count() * sum((number-self.average())**2 for number in self.numbers)", "def variance(dataset):\n avg = sum(dataset)/len(dataset)\n v = 0.0\n for data in dataset:\n v += (data - avg) * (data - avg)\n v = v / len(dataset)\n return v", "def varian...
[ "0.80125666", "0.77931684", "0.7649437", "0.7533885", "0.75283134", "0.74715513", "0.7426311", "0.7419505", "0.7395441", "0.73077893", "0.73077893", "0.7302322", "0.7250643", "0.724442", "0.724442", "0.724442", "0.72422016", "0.72269577", "0.7226093", "0.7064695", "0.7051725"...
0.0
-1
Calculate the cumulative sums of all values.
def cum_sum(self): # create cdo command and runit cdo_command = "cdo -timcumsum" run_this(cdo_command, self, output="ensemble")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cumulative_sum(xs):\r\n cumsum = 0\r\n for x in xs:\r\n cumsum += x\r\n yield cumsum", "def cumsum(self):\n return self._lift(lambda c: c.cumsum)", "def cumulative_sum(x):\n total = 0\n sum = []\n for num in x:\n total += num\n sum.append(total)\n retur...
[ "0.76194537", "0.75675356", "0.7451289", "0.7389407", "0.7123383", "0.70414937", "0.7039762", "0.69669527", "0.69507825", "0.69205093", "0.69205093", "0.69205093", "0.6823596", "0.68017983", "0.67675036", "0.672222", "0.6675939", "0.6646776", "0.6646776", "0.6646776", "0.6630...
0.66462934
20
Calculate the percentile of all values
def percentile(self, p=None): if p is None: raise ValueError("Please supply p") if type(p) not in [int, float]: raise TypeError("p is a " + str(type(p)) + ", not int or float") if (p < 0) or (p > 100): raise ValueError("p: " + str(p) + " is not between 0 and 100!") self.run() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentile(self, values, percent):\r\n if not values:\r\n return None\r\n k = (len(values)-1) * percent\r\n f = math.floor(k)\r\n c = math.ceil(k)\r\n if f == c:\r\n return values[int(k)]\r\n d0 = values[int(f)] * (c-k)\r\n d1 = values[int(...
[ "0.7536633", "0.73546964", "0.7115302", "0.7113865", "0.7047356", "0.6971398", "0.69039315", "0.6857011", "0.68506926", "0.6806298", "0.6801701", "0.6801701", "0.67855835", "0.67740655", "0.67420775", "0.6736659", "0.6730492", "0.67275125", "0.67147666", "0.67132276", "0.6688...
0.6432344
48
Member function finding the connected elements of the Operator. Starting from a given visible state v, it finds all other visible states v' such that the Operator matrix element H(v,v') is different from zero.
def find_conn(self, v): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connected((e,r)):\n \n # Deal with the middle case so we don't divide by zero\n if r==0: return [(1,1),(2,1),(3,1),(4,1),(5,1),(0,1)]\n # If the input is impossible, return nothing to prune the branch (shouldn't\n # happen)\n if e>=6*r: return []\n connected=[]\n mult=e//r\n rem=e % r...
[ "0.5978792", "0.5884315", "0.58464736", "0.5796087", "0.57762533", "0.57726276", "0.5764417", "0.5762539", "0.56606954", "0.5632598", "0.56248784", "0.5591906", "0.55837506", "0.55837506", "0.5572793", "0.5548584", "0.5541398", "0.5533818", "0.5529619", "0.54843754", "0.54757...
0.0
-1
Member function return random state of the Operator.
def random_states(self, num_of_states): return numpy.random.choice([-1, 1], size=(num_of_states, ) + self.hilbert_state_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand(self):\n self.state = (self.a * self.state + self.c)\n return self.state", "def _random_function(self, random_state):\n return random_state.rand", "def rand(self):\n return self.State.rand()", "def _get_random_state(self):\n self._validate_random_state()\n r...
[ "0.77615845", "0.7757945", "0.76763046", "0.73098624", "0.7200661", "0.7015469", "0.6799375", "0.67601836", "0.67269987", "0.6699716", "0.6632682", "0.66309154", "0.6621688", "0.6599762", "0.6579501", "0.6552287", "0.6517373", "0.65139276", "0.64921236", "0.6456837", "0.64295...
0.0
-1
Calculate the aggregated mean and stds.
def _get_aggregated_mean_std(self, means, stds, n): mean = means.view(n, -1).sum(0) / n std = ( stds.view(n, -1).sum(0) / n + ((means.view(n, -1) - mean) ** 2).view(n, -1).sum(0) / n ) return mean.detach(), std.detach()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_stats(self):\n if self.split_bn.track_running_stats:\n (\n self.bn.running_mean.data,\n self.bn.running_var.data,\n ) = self._get_aggregated_mean_std(\n self.split_bn.running_mean,\n self.split_bn.running_var,\n ...
[ "0.75994617", "0.7462015", "0.73687404", "0.72231203", "0.7077105", "0.6966083", "0.69622374", "0.69211644", "0.691378", "0.6900489", "0.6860511", "0.6856823", "0.6847475", "0.6832801", "0.68259156", "0.6784394", "0.67798734", "0.6750028", "0.67471087", "0.6724783", "0.668773...
0.75622755
1
Synchronize running_mean, and running_var. Call this before eval.
def aggregate_stats(self): if self.split_bn.track_running_stats: ( self.bn.running_mean.data, self.bn.running_var.data, ) = self._get_aggregated_mean_std( self.split_bn.running_mean, self.split_bn.running_var, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _synchronize_vars_using_mean(new_var: NestedMap,\n old_var: NestedMap) -> NestedMap:\n delta = new_var - old_var\n delta_mean = jax.lax.pmean(delta, axis_name=data_parallel_axis_name)\n updated_var = old_var + delta_mean\n return updated_var", "def _for...
[ "0.61866266", "0.59162766", "0.5869464", "0.5706126", "0.5659805", "0.55348825", "0.54772735", "0.54338247", "0.5433502", "0.5417435", "0.5414351", "0.53781146", "0.5374504", "0.53155285", "0.53055024", "0.5271861", "0.5214751", "0.52096206", "0.520088", "0.5198845", "0.51728...
0.5927717
1
Return duration in years
def duration(self): if self.is_valid: return relativedelta(self.expiry, datetime.date.today()).years else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_to_years(datum):\n return datum/DAYS_PER_YEAR", "def year(self):\n return self._years", "def unit_yr(self):\n return ((self.time_base * 60.0) * 24.0) * 365.0", "def periods_in_a_year(self) -> float:\n return self.length / self.yearfrac", "def _unit_yr(self):\n return ((se...
[ "0.72326726", "0.7115902", "0.70439005", "0.70209014", "0.6918941", "0.68189144", "0.6782731", "0.67128307", "0.66573805", "0.6547447", "0.6528867", "0.6528867", "0.6477337", "0.64250714", "0.6410062", "0.64020795", "0.63959104", "0.6354012", "0.6353335", "0.6349158", "0.6343...
0.7217856
1
Transition from iceboot to domapp by uploading 'domappFile', uncompressing it and executing from iceboot. Load domapp FPGA first.
def uploadDomapp2(self, domappFile): if not os.path.exists(domappFile): raise DomappFileNotFoundException(domappFile) size = os.stat(domappFile)[ST_SIZE] if size <= 0: return (False, "size error: %s %d bytes" % (domappFile, size)) # Load domapp FPGA ok, txt = self.se("s\" domapp....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(app, verbose, replay, exp_config=None):\n if replay:\n exp_config = exp_config or {}\n exp_config[\"replay\"] = True\n log(header, chevrons=False)\n loader = LoaderDeployment(app, Output(), verbose, exp_config)\n loader.run()", "def software_load(self, filename: str) -> None:\n...
[ "0.55233026", "0.5206039", "0.51236546", "0.50307345", "0.4985857", "0.49178445", "0.48859143", "0.48607603", "0.48495775", "0.48479488", "0.4829573", "0.4828603", "0.48110473", "0.47907218", "0.47523627", "0.4730287", "0.46991777", "0.46957707", "0.46943602", "0.4688376", "0...
0.7968039
0
Function decorator for unittest test cases to specify test case timeout.
def timeout(time_limit): class TimeoutException(Exception): """ Subclass Exception to catch timer expiration during search """ pass def handler(*args, **kwargs): """ Generic handler to raise an exception when a timer expires """ raise TimeoutException("Test aborted due to timeo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timeout(timeout):\n def decor(f):\n @functools.wraps(f)\n def inner(self, *args, **kwargs):\n self.useFixture(fixtures.Timeout(timeout, gentle=True))\n return f(self, *args, **kwargs)\n return inner\n return decor", "def pytest_timeout_set_timer(item, sett...
[ "0.79690397", "0.75481164", "0.7531505", "0.74053466", "0.7395922", "0.7079493", "0.70790184", "0.69973075", "0.69770676", "0.69770676", "0.69739807", "0.6917172", "0.67718583", "0.6764333", "0.67116076", "0.6696234", "0.668591", "0.6672928", "0.6670006", "0.6657833", "0.6647...
0.7551795
1
Generic handler to raise an exception when a timer expires
def handler(*args, **kwargs): raise TimeoutException("Test aborted due to timeout. Test was " + "expected to finish in less than {} second(s).".format(time_limit))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _api_timer_expiration_handler(self):\n\n try:\n self._api_lock.release()\n except:\n pass", "def timer_object_timeout(seconds=5):\n def raise_timeout_exception():\n raise TimeoutReachedException(seconds=seconds)\n\n return Timer(seconds, raise_timeout_exceptio...
[ "0.7070175", "0.6462937", "0.64580625", "0.6379626", "0.63559324", "0.62736166", "0.62136364", "0.6183778", "0.6169782", "0.61290145", "0.60942507", "0.60581577", "0.5950327", "0.5919582", "0.58957946", "0.58702505", "0.58493656", "0.5843904", "0.58418983", "0.58407634", "0.5...
0.5578642
38
Return counts of (total, unique) nodes visited
def counts(self): return sum(self.counter.values()), len(self.visited)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_nodes(self):\n\t\treturn self.__count_nodes(self)", "def count_unvisited(data):\n count = sum(n.count(\"n\") for n in data)\n return count", "def count(self):\n\t\treturn len(list(self.nodes))", "def node_count(self) -> int:\n return int(self.graph_tuple_stats.node_count or 0)", "def get...
[ "0.7426861", "0.736728", "0.7362337", "0.71854764", "0.7132183", "0.7039101", "0.70088387", "0.6983478", "0.67954326", "0.678729", "0.6775083", "0.6736858", "0.6726595", "0.67247325", "0.6679473", "0.66466904", "0.66429496", "0.6642772", "0.6615163", "0.66069305", "0.6603299"...
0.78785557
1
Test pruning in CustomPlayer.alphabeta
def test_alphabeta_pruning(self): h, w = 15, 15 depth = 6 method = "alphabeta" value_table = [[0] * w for _ in range(h)] value_table[3][14] = 1 eval_fn = EvalTable(value_table) blocked_cells = [(0, 9), (0, 13), (0, 14), (1, 8), (1, 9), (1, 14), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_punish():\n game = Game()\n game.punish()\n assert game.mistake_count == 1", "def test_fav_6(self):\n\t\tplayer_list = [Player(\"Blake Base\", 1, 300000, 10), Player(\"Corey Catcher\", 2, 500000, 20), Player(\"Dexter Dugout\", 3, 200000, 50)]\n\t\tself.assertEqual( free_agent_vorp(player_list, ...
[ "0.63363713", "0.6252242", "0.5996028", "0.59319055", "0.58755577", "0.58621126", "0.584469", "0.58357257", "0.5830485", "0.57789344", "0.5775311", "0.5746706", "0.5746534", "0.572389", "0.5722571", "0.5664175", "0.56187457", "0.56148756", "0.5613109", "0.55841666", "0.557837...
0.54096156
38
Test iterative deepening for CustomPlayer.minimax
def test_id(self): w, h = 11, 11 method = "minimax" value_table = [[0] * w for _ in range(h)] value_table[3][0] = 1 value_table[2][3] = 1 value_table[4][4] = 2 value_table[7][2] = 3 eval_fn = EvalTable(value_table) depths = ["7+", "6", "5", "4", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_minimax(self):\n h, w = 7, 7 # board size\n starting_location = (2, 3)\n adversary_location = (0, 0) # top left corner\n iterative_search = False\n method = \"minimax\"\n\n # The agent under test starts at position (2, 3) on the board, which\n # gives eig...
[ "0.6731821", "0.6642983", "0.66008", "0.6585139", "0.65825796", "0.6374647", "0.636703", "0.62933755", "0.6269931", "0.6251355", "0.6185939", "0.61643016", "0.6150096", "0.6106896", "0.60983247", "0.6084524", "0.6046474", "0.60085076", "0.60018104", "0.5991797", "0.5991797", ...
0.65098166
5
Test output interface of CustomEval
def test_custom_eval(self): player1 = "Player1" player2 = "Player2" game = isolation.Board(player1, player2) heuristic = game_agent.CustomEval() self.assertIsInstance(heuristic.score(game, player1), float, "The heuristic function should return a floating point")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self):\n self.eval()", "def evaluate_output(self, output: int) -> Callable[[str], bool]:\n raise NotImplementedError", "def evaluate_outputs(self):\n raise NotImplementedError(\n 'evaluate_outputs called but not implemented in the derived class.'\n )", "def eva...
[ "0.73954976", "0.724084", "0.68502486", "0.67774224", "0.67774224", "0.6679344", "0.6601674", "0.65922654", "0.6552735", "0.65413964", "0.65413964", "0.65413964", "0.64627516", "0.64274406", "0.63952595", "0.6380676", "0.63543075", "0.6329702", "0.62897515", "0.62686455", "0....
0.6096009
28
Get data from an Amarok database. We fetch rating and score as well as Amarok's unique id for the track to have more reliable syncing after the initial import.
def get_amarok_data(item, db): if hasattr(item, 'amarok_uid') and item.amarok_uid: condition = "REPLACE(uniqueid, 'amarok-sqltrackuid://', '') = '%s'" % MySQLdb.escape_string(item.amarok_uid) else: condition = "REPLACE(CONCAT_WS('/',lastmountpoint, rpath), '/./', '/') = '%s'" % MySQLdb.escape_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_from_db(self):\n pass", "def fetch_from_db(self):\n self._potential_deals = DBApi.get_instance().potential_records\n self._filters = DBApi.get_instance().filters\n # Add markdown for url\n for data in self._potential_deals:\n data[\"url\"] = f\"[Link]({d...
[ "0.5660886", "0.54901147", "0.53773314", "0.53103805", "0.5294919", "0.5287652", "0.5280436", "0.5218586", "0.5123491", "0.51149195", "0.50887793", "0.50697964", "0.50557685", "0.50500786", "0.5047312", "0.5042681", "0.50382304", "0.5036712", "0.50281346", "0.5021935", "0.501...
0.719275
0
get word2idx and word_embed
def read_old_glove(filepath): print('reading glove files:', filepath) word2idx = {} word_embed = [['0'] * 300] # word_embed[0] = [0] * 300, represent the <PAD> with open(filepath, 'r') as f: for idx, line in enumerate(f): line_list = line.split() word = ' '.join(line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_idx2word():\n idx2word = {}\n d = train_data.shared['word2idx']\n for word, idx in d.items():\n print(word)\n idx2word[idx] = word\n if config.use_glove_for_unk:\n d2 = train_data.shared['new_word2idx']\n for word, idx in d2.items():\...
[ "0.7195846", "0.7079771", "0.6538253", "0.64752114", "0.6429589", "0.63948965", "0.62947494", "0.62401897", "0.6234027", "0.62185585", "0.618277", "0.61729795", "0.617209", "0.6092618", "0.60700834", "0.60502183", "0.5999034", "0.5995582", "0.59707487", "0.59692556", "0.59548...
0.5724637
53
This is the method to call and analyze text with the supplied features
def analyze(self, features, text=None, url=None, html=None, clean=True, xpath=None, fallback_to_raw=True, return_analyzed_text=False, language=None): body = { 'clean': clean, 'fallback_to_raw': fallback_to_raw, 'return_analyzed_text': return_an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__extract_features(self):\n text_sample = \"I really really love this movie\"\n feature_sample = ['really','love','good']\n feature_score_type = \"presence\"\n model_sample = Model(feature_sample,feature_score_type)\n result_features = model_sample.extract_features(text_s...
[ "0.65689343", "0.6477436", "0.64146715", "0.6368037", "0.6330938", "0.6260085", "0.6223099", "0.6171409", "0.616159", "0.61302584", "0.61197525", "0.6115434", "0.6103395", "0.6098626", "0.60901034", "0.60735404", "0.60727555", "0.6036561", "0.6018226", "0.6005281", "0.6003854...
0.72335
0
Wrapper to customize reward of energym environments.
def __init__(self, env: gym.Env, info_obs_weights: dict): super().__init__(env) self.info_obs_weights = info_obs_weights
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, env):\n gym.RewardWrapper.__init__(self, env)", "def reward(self, env):\n del env\n return 1", "def add_env_args(parser):\n # sawyer\n parser.add_argument(\n \"--reward_type\",\n type=str,\n default=\"dense\",\n choices=[\"dense\", \"sparse\"],\...
[ "0.64872587", "0.6484783", "0.64239675", "0.62843674", "0.6223589", "0.6176895", "0.6125481", "0.59527415", "0.59006923", "0.58524704", "0.5797344", "0.576553", "0.57535696", "0.5753127", "0.57492626", "0.5742453", "0.5741872", "0.57114106", "0.56750464", "0.5674529", "0.5666...
0.0
-1
Check if all files are available before going deeper
def _check_before_run(self): if not osp.exists(self.dataset_dir): raise RuntimeError("'{}' is not available".format(self.dataset_dir)) if not osp.exists(self.train_dir): raise RuntimeError("'{}' is not available".format(self.train_dir)) if not osp.exists(self.query_dir): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_check(self):\n for required_file in self._required_files:\n # Check if required files are there\n # FIXME Sometimes it doesn't work :?\n if required_file not in self.files:\n self.valid = False", "def check_for_missing_files(self, path):\n re...
[ "0.6751535", "0.67471784", "0.67164296", "0.6647079", "0.6547783", "0.6459677", "0.639774", "0.63332593", "0.6278475", "0.6277023", "0.62649715", "0.62649715", "0.62649715", "0.62176186", "0.61934626", "0.61883324", "0.6181167", "0.6169776", "0.6145234", "0.6128254", "0.60981...
0.6022399
38
Called if no route is entered
def main(): return redirect('chat')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_runroute_callable(self, route, request):\n return None", "def route(self):\n pass", "def post_runroute_callable(self, request):\n return None", "def test_abort_route_when_id_route_not_exist(self):\n\n pass", "def route(self, env):\n return None", "def route(...
[ "0.713702", "0.6929891", "0.6734935", "0.632262", "0.62484354", "0.62403715", "0.6215604", "0.6121625", "0.6100147", "0.60336834", "0.5908486", "0.5858942", "0.5817849", "0.57772964", "0.5679842", "0.5653751", "0.56365013", "0.5586848", "0.5540685", "0.5540685", "0.5502926", ...
0.0
-1
Main page, for chatting
def chat(): username = request.cookies.get('username') if username != None and username != "": return r.renderContent('chat.html', name=username) return redirect('/login')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat():\n kwargs = {\"title\": u\"chat channel\", \"entries\": log.getLogEntries()}\n return render_template(\"chat.html\", **kwargs)", "def view_contact_chat(self):\n if self._user.chats == {}:\n print(\"No chats to be viewed yet\")\n self.homepage()\n \n ...
[ "0.73176163", "0.71010524", "0.6999558", "0.69722027", "0.69469863", "0.6837348", "0.682718", "0.6773148", "0.6714431", "0.6714431", "0.6714431", "0.6694911", "0.66823596", "0.66393375", "0.6454156", "0.6447436", "0.641861", "0.6282684", "0.62469214", "0.62395823", "0.6222036...
0.63437665
17
Route for handling logging in
def login(): error = None if request.method == 'POST': if not db.login(request.form['username'], request.form['password']): error = 'Invalid username or password. Please try again!' else: resp = make_response(redirect(url_for('main'))) resp.set_cookie('username', request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_login(sender, request, user, **kwargs):\n stracks.user(user).log(\"? has logged in\", action=stracks.login())", "def handle_login(self, request):\n self._verify_headers(request)\n self._verify_auth_parameters(request, check_session=False)\n data = self.responses['login']\n ...
[ "0.6088461", "0.60372317", "0.6023485", "0.58360314", "0.5830466", "0.5750337", "0.57417244", "0.5734808", "0.57280153", "0.5713437", "0.5711979", "0.5710559", "0.5706287", "0.56738955", "0.5670487", "0.5635086", "0.56344676", "0.56225646", "0.56205153", "0.56148446", "0.5611...
0.0
-1
Route for posting messages or getting the prerendered html
def message(): if request.method == 'POST': db.log_msg(request.form['text'], request.cookies.get('username')) return db.get_all_messages()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_POST(self, request):\n\t\tprint request.args[\"message\"][0]\n\t\tself.jabberClient.sendMessage(request.args[\"message\"][0])\n\t\treturn ''", "def post(self, request, *args, **kwargs):\n return self.render_to_response(self.get_context_data())", "def input_post(): #TODO, error handling for pr...
[ "0.6790318", "0.67297566", "0.66144854", "0.6388285", "0.63673466", "0.6282351", "0.6156348", "0.6152705", "0.61418", "0.61377877", "0.61028284", "0.6077809", "0.60488695", "0.6045633", "0.60317683", "0.5997232", "0.5917214", "0.5899693", "0.5897377", "0.58870757", "0.5816963...
0.59398806
16
Method for showing kanban board
def kanban(): if request.method == 'GET': (todo, doing, done) = db.get_all_kanban() return r.renderContent('kanban.html', todo=Markup(todo), doing=Markup(doing), done=Markup(done)) else: db.log_kanban(request.form['status'], request.form['value']) return r.renderContent('kanban.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_board(self):\n self._game_board.display()", "def show_board(self):\n print(self.game_board)", "def show_board(self):\n board_vis = f\"\\n{'*' * 22}Board state{'*' * 23}\\n\"\n str_p2_store=\" \"+str(self.p2_store()) if self.p2_store()<10 else str(self.p2_store())\n b...
[ "0.72244227", "0.6975949", "0.68790525", "0.67226493", "0.6711845", "0.66894794", "0.66305685", "0.6616085", "0.6584913", "0.6556513", "0.652724", "0.6510904", "0.64619637", "0.6442191", "0.6401692", "0.6401686", "0.6382453", "0.6379178", "0.63448644", "0.63213986", "0.629003...
0.6246042
29
Remove ``>`` from beginning of a line.
def clean(self, line): m = self.RE.match(line) if line.strip() == ">": return "" elif m: return m.group(2) else: return line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(self, line):\r\n m = self.RE.match(line)\r\n if line.strip() == \">\":\r\n return \"\"\r\n elif m:\r\n return m.group(2)\r\n else:\r\n return line", "def dealFirstLine(line):\n\n print \"%s\" % (line.strip('\\n'))", "def _remove_beginnin...
[ "0.7322892", "0.65217817", "0.6428228", "0.64100033", "0.6187956", "0.61572856", "0.6113667", "0.6068053", "0.6057279", "0.6052678", "0.5984401", "0.59601843", "0.5782217", "0.5741116", "0.5701244", "0.5687602", "0.56819564", "0.5668284", "0.5666465", "0.5642651", "0.5623701"...
0.7390938
0
Convert ttyrec files to videos
def main(ctx, ttyrec, encoding, ibm, outfile, size, fps, font_size, font_file, bold_font_file, info, info_all): if ibm: encoding = 'cp437' fp, def_outfile = open_or_get(ttyrec) try: with fp: updates = list(read_ttyrec(fp, encoding=encoding, errors='replace')) except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seqIo_toVid(fName, ext='avi'):\n\n assert fName[-3:]=='seq', 'Not a seq file'\n sr = seqIo_reader(fName)\n N = sr.header['numFrames']\n h = sr.header['height']\n w = sr.header['width']\n fps = sr.header['fps']\n\n out = fName[:-3]+ext\n sw = skvideo.io.FFmpegWriter(out)\n # sw = cv2...
[ "0.67228967", "0.6123915", "0.6026224", "0.6026062", "0.6018919", "0.60161096", "0.5921599", "0.58913285", "0.58782333", "0.58761436", "0.5870621", "0.5852439", "0.58420694", "0.5806366", "0.5802016", "0.57724094", "0.57724094", "0.574259", "0.5720971", "0.5720353", "0.570617...
0.70133644
0
Set the SQLAlchemy query
def set_sa_query(self, query): self.sa_query = query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_query(self, query):\n return self.set_param(\"query\", query)", "def query(self, query):\n self._query = query", "def set_query(self, query):\n query = pylastica.query.Query.create(query)\n data = query.to_dict()\n return self.set_param('query', data['query'])", "de...
[ "0.7269278", "0.71905774", "0.70059764", "0.6978373", "0.69707596", "0.69707596", "0.69707596", "0.67561483", "0.668698", "0.6570881", "0.64990544", "0.6484255", "0.64412546", "0.6415398", "0.63802713", "0.6367533", "0.62840843", "0.6221531", "0.6157206", "0.6138676", "0.6108...
0.7026373
2
Set the "entity_class_registry" field
def set_entity_class_registry(self, entity_class_registry): self.entity_class_registry = entity_class_registry
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_class(self, entity_class):\n key = entity_class.__collection_name__\n\n if key not in self._registered_types:\n self._registered_types[key] = entity_class", "def _extract_entity_class_registry(self):\n for description in self.sa_query.column_descriptions:\n ...
[ "0.6296474", "0.6145517", "0.5784777", "0.57402545", "0.5640025", "0.5552346", "0.54653853", "0.52816427", "0.5269132", "0.5262372", "0.5256132", "0.52219176", "0.5213515", "0.5207139", "0.5203314", "0.52020997", "0.52020997", "0.51808226", "0.5144154", "0.51290417", "0.51211...
0.8463285
0
Extract an entity class registry from one of the models of the inner SQLAlchemy query. This result of this function is used by several SQLAlchemy components during the extraction of the SQL query from a SQLAlchemy query.
def _extract_entity_class_registry(self): for description in self.sa_query.column_descriptions: if "entity" in description: declarative_meta = description["entity"] _class_registry = getattr( declarative_meta, "_decl_class_registry", None) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_real_object(self):\n query_string = dedent(f\"\"\"\\\n import app.config.models_importer as models_importer\n\n class_ = models_importer.all_models['{self.ref_class}']\n \n class_.query.get({self.ref_id})\"\"\")\n\n return exec(query_string)", "def _n...
[ "0.5555714", "0.5259711", "0.5109347", "0.50943285", "0.50772786", "0.49984002", "0.4953237", "0.49206263", "0.47721955", "0.47709483", "0.47572222", "0.47535753", "0.47392863", "0.47341767", "0.47276932", "0.46964145", "0.46887028", "0.46723166", "0.4664276", "0.4661921", "0...
0.75623906
0
Execute the query, and return its result as rows
def matching_objects(self, filter_deleted): from rome.core.orm.utils import get_literal_query from rome.lang.sql_parser import QueryParser from rome.core.rows.rows import construct_rows read_deleted = self.read_deleted if filter_deleted: read_deleted = "no" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self, query):\n with self.conn.cursor() as cur:\n # Execute the query\n try:\n cur.execute(query)\n except Exception as exc:\n print(\"Unable to execute query. Error was {0}\".format(str(exc)))\n exit()\n ro...
[ "0.8222279", "0.7665415", "0.76420516", "0.7597238", "0.7581581", "0.75336605", "0.75020784", "0.75014627", "0.7499659", "0.7481231", "0.7469864", "0.7459134", "0.74526256", "0.7436286", "0.7409394", "0.7389792", "0.73760194", "0.7298189", "0.72854406", "0.7282933", "0.725281...
0.0
-1
Execute the query, and return its result as rows
def all(self, filter_deleted=False): objects = self.matching_objects(filter_deleted=filter_deleted) return objects
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self, query):\n with self.conn.cursor() as cur:\n # Execute the query\n try:\n cur.execute(query)\n except Exception as exc:\n print(\"Unable to execute query. Error was {0}\".format(str(exc)))\n exit()\n ro...
[ "0.8222279", "0.7665415", "0.76420516", "0.7597238", "0.7581581", "0.75336605", "0.75020784", "0.75014627", "0.7499659", "0.7481231", "0.7469864", "0.7459134", "0.74526256", "0.7436286", "0.7409394", "0.7389792", "0.73760194", "0.7298189", "0.72854406", "0.7282933", "0.725281...
0.0
-1
Executes the query and returns the first matching row.
def first(self, filter_deleted=False): objects = self.matching_objects(filter_deleted=filter_deleted) if len(objects) > 0: value = objects[0] if self.session is not None: if hasattr(value, "id"): self.session.watch(value) return va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchone(self):\n\n self._check_executed()\n\n if self._query_id == -1:\n msg = \"query didn't result in a resultset\"\n self._exception_handler(ProgrammingError, msg)\n\n if self.rownumber >= self.rowcount:\n return None\n\n if self.rownumber >= (se...
[ "0.8280298", "0.80509466", "0.79736346", "0.7938769", "0.79376507", "0.78329694", "0.7832246", "0.76202947", "0.7573742", "0.75649405", "0.7521718", "0.75176406", "0.7498476", "0.74828917", "0.7433074", "0.7370562", "0.72961265", "0.72804594", "0.7238881", "0.72119147", "0.72...
0.0
-1
Executes the query and returns the number of matching rows.
def count(self): objects = self.all() return len(objects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute_rowcount(self, query, *parameters, **kwparameters):\n result = -1\n cursor = self._cursor()\n ret = self._execute(cursor, query, parameters, kwparameters)\n if ret != -1:\n result = cursor.rowcount\n cursor.close()\n return result", "def execute_r...
[ "0.8263714", "0.75019467", "0.74157685", "0.74035823", "0.73712915", "0.73479736", "0.7320812", "0.7266392", "0.7265946", "0.72563446", "0.72047913", "0.7165406", "0.71650726", "0.71557415", "0.71451116", "0.71380395", "0.7132593", "0.701933", "0.6974487", "0.69694316", "0.69...
0.0
-1
Handle only one batch, updating the internal state Params ======
def train_one_batch(self, imgs: Tensor) -> None: with torch.no_grad(): # b * c * w * h embeddings = self._embed_batch(imgs.to(self.device)) if self.embedding_list is None: self.embedding_list = reshape_embedding(embeddings.cpu().detach().numpy()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_batch(self, *args, **kwargs):\n pass", "def process_state_batch(self, batch):\n return batch", "def process_state_batch(self, batch):\n return batch", "def handle_batch(self, batch: Mapping[str, Any]) -> None:\n self.batch = {**batch, **self.forward(batch)}", "def on_...
[ "0.7484445", "0.70731485", "0.70731485", "0.6753256", "0.63523346", "0.6343672", "0.6236089", "0.6083565", "0.60835004", "0.59652734", "0.5964963", "0.59062594", "0.58258647", "0.58248407", "0.58213854", "0.58161604", "0.5768676", "0.56665844", "0.56641805", "0.5637965", "0.5...
0.0
-1
Computes the distance matrix for each image patch Params ======
def predict(self, new_imgs: Tensor, compare_all: bool = False) -> Tensor: embeddings = self._embed_batch(new_imgs) embeddings = reshape_embedding(embeddings.cpu().detach().numpy()) #print(self.embedding_coreset.shape) #print(embeddings.shape) knn =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def im_dist_mat(self):\n mat = np.zeros([self.I, self.M])\n for i in range(self.I):\n for m in range(self.M):\n mat[i, m] = distance(self.I_coords[i], self.M_coords[m])\n return mat", "def _calculate_distances(boxes, homography):\n pos_markers = []\n p...
[ "0.62255037", "0.6161878", "0.61389506", "0.59978783", "0.59745884", "0.593692", "0.59346217", "0.5861669", "0.5828466", "0.57970315", "0.5744683", "0.5730956", "0.5708846", "0.5702996", "0.56961113", "0.56669694", "0.5647084", "0.56355965", "0.5611184", "0.5610667", "0.55949...
0.0
-1
Call f on each item in seq, calling inter() in between.
def interleave(inter, f, seq): seq = iter(seq) try: f(next(seq)) except StopIteration: pass else: for x in seq: inter() f(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence(f, lst: list) -> list:\n ret = []\n for ele in lst:\n ret.append(f(ele))\n return ret", "def intersperse(value, seq):\n seq = iter(seq)\n\n try:\n yield next(seq)\n except StopIteration:\n return\n\n for item in seq:\n yield value\n yield item"...
[ "0.61680573", "0.6034688", "0.6013112", "0.5890083", "0.5763176", "0.5744706", "0.5691687", "0.5686545", "0.56322396", "0.5617056", "0.5564194", "0.55386853", "0.55105126", "0.5491585", "0.5479231", "0.5478667", "0.5475974", "0.54754245", "0.5453396", "0.5437749", "0.5408432"...
0.77389354
0
CodeGenerator(tree, file=sys.stdout) > None. Print the source for tree to file.
def __init__(self, tree, file = sys.stdout): self.f = file self.future_imports = [] self._indent = 0 # dict of locals used to determine if variable already exists in assignments self._locals = ["pyflamegpu"] self._device_functions = [] self._message_iterator_var =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n tree = self._generator.build_tree()\n\n for entry in tree:\n print(entry)", "def log_tree(self, description, tree):\n if self.log:\n print(description)\n print_content(astor.to_source(tree), '.py')\n print()\n print...
[ "0.64935875", "0.61715996", "0.6161561", "0.6096719", "0.5994618", "0.5992754", "0.5926395", "0.5877472", "0.5846541", "0.5706362", "0.56789345", "0.5666667", "0.56597686", "0.56378835", "0.5628827", "0.56088674", "0.558582", "0.5557028", "0.5552948", "0.55473834", "0.5543297...
0.0
-1
Gets the device function name by translating a typed Python version to a templated cpp version. Python functions looks like getVariableFloatArray6 and translate to getVariable This function will detect and test against a set of known types and also extract the Array length This function returns None if the string is in...
def _deviceVariableFunctionName(self, tree, permitted_prefixes, allow_lengths = True): cpp_func_name = "" py_func = tree.attr # extract function name start for prefix in permitted_prefixes: if py_func.startswith(prefix): cpp_func_name = prefix ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def function_name_to_string(func):\n if func == statistical_parity_difference:\n return \"Statistical Parity Difference\"\n if func == theil_index:\n return \"Theil Index\"\n if func == equal_opportunity_difference:\n return \"Equal Opportunity Difference\"\n if func == disparate_i...
[ "0.5464446", "0.5418039", "0.53736573", "0.5311592", "0.53082407", "0.52509713", "0.52308387", "0.52233297", "0.5139834", "0.5137596", "0.5136655", "0.51061374", "0.50472605", "0.50168824", "0.5014381", "0.49955937", "0.4979121", "0.49771407", "0.49526176", "0.4947558", "0.49...
0.69010454
0
Function will handle a getMacroEnvironment function (assuming it is correctly formatted (by checking with _deviceVariableFunctionName first))
def dispatchMacroEnvFunction(self, tree, tree_parent): cpp_func_name = "getMacroProperty" py_func = tree.attr # extract type from function name py_type = py_func[len(cpp_func_name):] if py_type not in self._fgpu_types: self.RaiseError(tree, f"'{py_type}' is not a vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_environment_string(self):\n pass", "def __MakeEnvironment(self):\n environment= os.environ.copy()\n\n for key, value in self.__context.items():\n if type(value) is str:\n name = \"QMV_\" + key.replace(\".\", \"__\")\n environment[name]= value\n\n return environment...
[ "0.58264863", "0.5568216", "0.53334945", "0.5327967", "0.51543343", "0.51488876", "0.51430243", "0.5069374", "0.50373465", "0.5026348", "0.50191504", "0.5002579", "0.49759382", "0.49720997", "0.49513227", "0.49360543", "0.4913783", "0.49026003", "0.48999316", "0.4882077", "0....
0.61382043
0
There is a limited set of types and formats of type description supported. Types can be either; 1) A python built in type of int or float, or 2) A subset of numpy types prefixed with either numpy or np. e.g. np.int16 This function translates and a catches unsupported types but does not translate a function call (i.e. c...
def dispatchType(self, tree): if isinstance(tree, ast.Name): if tree.id not in self.basic_arg_types: self.RaiseError(tree, "Not a supported type") self.write(tree.id) elif isinstance(tree, ast.Attribute): if not isinstance(tree.value, ast.Name) : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type_translate(p_type, default_v=None):\n translate_dict = {'float': 'float',\n 'double': 'real',\n 'int': 'int',\n 'gr_complex': 'complex',\n 'char': 'byte',\n ...
[ "0.65132457", "0.6380109", "0.63286304", "0.6217381", "0.6156143", "0.6123783", "0.6113949", "0.6086107", "0.6069828", "0.60447073", "0.602957", "0.600259", "0.5983749", "0.597207", "0.5966418", "0.5907714", "0.58719164", "0.58526105", "0.5849916", "0.5831822", "0.5815611", ...
0.5697489
36
Handles arguments for a FLAME GPU device function. Arguments must use type hinting to be translated to cpp.
def dispatchFGPUDeviceFunctionArgs(self, tree): # reset the locals variable stack self._locals = ["pyflamegpu"] # input message first = True annotation = None for arg in tree.args.args: # ensure that there is a type annotation if not arg.annotation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deviceVariableFunctionName(self, tree, permitted_prefixes, allow_lengths = True):\n cpp_func_name = \"\"\n py_func = tree.attr\n # extract function name start\n for prefix in permitted_prefixes:\n if py_func.startswith(prefix):\n cpp_func_name = prefix\n ...
[ "0.6057609", "0.5804018", "0.5786905", "0.5687931", "0.5632874", "0.55926454", "0.55586314", "0.54775053", "0.5402661", "0.53772503", "0.5370256", "0.5299433", "0.5298682", "0.5296351", "0.52958226", "0.52583855", "0.52490014", "0.5243063", "0.52260655", "0.51923186", "0.5190...
0.77259445
0
Message iterator call maybe a simple one (e.g. message_in(x, y, z)) or a call to a member (e.g. message_in.wrap()) Using this function avoid using the global call one which may accept member function calls to things that are not iterators.
def dispatchMessageIteratorCall(self, tree): # simple case not a member function just an iterator with arguments if isinstance(tree.func, ast.Name): self.write(f"FLAMEGPU->{tree.func.id}") if isinstance(tree.func, ast.Attribute) : if isinstance(tree.func.value, ast.Name):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self, message: Message) -> None:\n self.fn(message)", "def _call(self, x):\n return x.inner(x)", "def test_dispatch_inbound(self):\n msg_helper = MessageHelper()\n worker_helper = WorkerHelper()\n broker = self.setup_broker(worker_helper)\n self.assertEqual(br...
[ "0.5965189", "0.5781531", "0.5567268", "0.5560412", "0.5555918", "0.5474647", "0.53749025", "0.5369496", "0.5356947", "0.532416", "0.53201944", "0.52734697", "0.5214312", "0.51924616", "0.51724297", "0.51710767", "0.51597893", "0.51278067", "0.5124339", "0.5106569", "0.509719...
0.73008895
0
This is a special case of a range based for loop in which iterator item returns a const referecne to the message. Any user specified message value can be used.
def dispatchMessageLoop(self, tree): self.fill("for (const auto& ") self.dispatch(tree.target) self.write(" : ") # if simple message iterator if isinstance(tree.iter, ast.Name): if not tree.iter.id == self._input_message_var: self.RaiseError(t, f"Messa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self, i):\n pass", "def __iter__(self):\n return iter([self.format_message(record) for record in self._messages])", "def _For(self, t):\n # if message loop then process differently\n if isinstance(t.iter, ast.Name):\n if t.iter.id == self._input_message_va...
[ "0.6812082", "0.6144076", "0.59823215", "0.57963836", "0.5497247", "0.5477851", "0.5458338", "0.5450091", "0.5326207", "0.5284618", "0.52789956", "0.51939684", "0.5179175", "0.51783484", "0.51677006", "0.5141689", "0.510057", "0.5071497", "0.5068647", "0.5062799", "0.5049284"...
0.5924833
3
A very limited set of function calls to members are supported so these are fully evaluated here. t_parent is the Call ast object required if the argument need to be modified (i.e. in the case of macro environment properties) Function calls permitted are; pyflamegpu.function a supported function call. e.g. pyflamegpu.ge...
def dispatchMemberFunction(self, t, t_parent): # it could be possible that the Call object has no value property e.g. a()() if not hasattr(t, "value"): self.RaiseError(t, f"Function call is in an unsupported format.") # Nested member functions (e.g. x.y.z()) if isinstance(t....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Call(self, t):\n # check calls but let attributes check in their own dispatcher\n funcs = self._device_functions + self.pythonbuiltins + [self._input_message_var] # message_input variable is a valid function name as certain message types have arguments on iterator\n if isinstance(t.func, ...
[ "0.6362595", "0.58942914", "0.57930183", "0.5696235", "0.56648827", "0.5555311", "0.5387862", "0.52408487", "0.5235522", "0.52275836", "0.51776576", "0.5120119", "0.51014704", "0.509886", "0.506699", "0.50667155", "0.5059268", "0.50211924", "0.49914703", "0.4978251", "0.49437...
0.790886
0
Same as a standard python expression but ends with semicolon
def _Expr(self, tree): # Catch odd case of multi line strings and doc strings which are Expr with a Constant string type value if isinstance(tree.value, ast.Constant): if isinstance(tree.value.value, str): return # catch special case of Python 3.7 Where doc string is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expr():\n def p(tok):\n # commas can appear in quantified variables\n return not(tok.value in [';','.'])\n return reparse('expr').process(c.balanced_condition(p))", "def compile(expression):", "def evaluate(compiled_expression):", "def result(self) -> global___Expression:", "def exp...
[ "0.65578294", "0.5910947", "0.5799009", "0.5718435", "0.562569", "0.5539511", "0.5498102", "0.5459333", "0.5452541", "0.54354775", "0.54278094", "0.5413188", "0.5406052", "0.54030687", "0.53684604", "0.52868867", "0.52864975", "0.5281365", "0.5280854", "0.5279634", "0.5274355...
0.53314483
15
No such concept in C++. Standard assignment can be used in any location.
def _NamedExpr(self, tree): self.write("(") self.dispatch(tree.target) self.write(" = ") self.dispatch(tree.value) self.write(")")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_50_assign_statement(self):\n\t\tinput = \"\"\"var x,y:integer;\n\t\tfunction f(): array[1 .. 3] of real;\n\t\tvar a: array[1 .. 3] of real;\n\t\tbegin a[2]:=1.1; return a; end\n\t\tprocedure main(); var x:array[1 .. 2]of real;\n\t\tbegin f()[1]:=x[1]:=1; with y:real;y:real; do begin end end\"\"\"\n\t\texp...
[ "0.5709383", "0.56389916", "0.56078136", "0.5524775", "0.55129427", "0.5444868", "0.54026616", "0.53342205", "0.53342205", "0.53342205", "0.53342205", "0.5263527", "0.52464676", "0.52318645", "0.5230673", "0.52164626", "0.5199737", "0.51738065", "0.5153252", "0.51271296", "0....
0.0
-1
Assignment will use the auto type to define a variable at first use else will perform standard assignment.
def _Assign(self, t): if len(t.targets) > 1: self.RaiseError(t, "Assignment to multiple targets not supported") if not isinstance(t.targets[0], ast.Name): self.RaiseError(t, "Assignment to complex expressions not supported") self.fill() # check if target exists in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_47_assign_statement(self):\n\t\tinput = \"\"\"var x,y:integer;\n\t\tfunction f(): array[1 .. 3] of real;\n\t\tvar a: array[1 .. 3] of real;\n\t\tbegin a[2]:=1.1; return a; end\n\t\tprocedure main(); var x:array[1 .. 3]of real;\n\t\tbegin f()[1]:=x[1]:=1; with y:real;y:real; do begin end end\"\"\"\n\t\texp...
[ "0.65518016", "0.63790643", "0.6358774", "0.6354869", "0.61757886", "0.61371475", "0.6126114", "0.6119964", "0.60451835", "0.5970678", "0.5915198", "0.58865404", "0.5870152", "0.5870152", "0.5870152", "0.5870152", "0.5810308", "0.5782519", "0.57597", "0.57563984", "0.5729333"...
0.6059261
8
Similar to assignment in terms of restrictions. E.g. Allow only single named variable assignments. Also requires the named variable to already exist in scope.
def _AugAssign(self, t): if not isinstance(t.target, ast.Name): self.RaiseError(t, "Augmented assignment to complex expressions not supported") # check if target exists in locals if t.target.id not in self._locals : self.RaiseError(t, "Augmented assignment not permitted o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_46_assign_statement(self):\n\t\tinput = \"\"\"var x,y:integer;\n\t\tprocedure main(); var x:array[1 .. 3]of real; begin x[1]:=1;\n\t\twith y:integer;y:real; do begin end end\"\"\"\n\t\texpect = \"Redeclared Variable: y\"\n\t\tself.assertTrue(TestChecker.test(input,expect,446))", "def _variable(self, nam...
[ "0.62667334", "0.6235484", "0.62117046", "0.6118622", "0.60492593", "0.59797275", "0.59298253", "0.5684028", "0.5679982", "0.5677362", "0.5655891", "0.5630487", "0.5610054", "0.5558762", "0.54264975", "0.5404717", "0.5368703", "0.5344528", "0.5336999", "0.5330405", "0.5314537...
0.0
-1
Standard cpp like return with semicolon.
def _Return(self, t): self.fill("return") if t.value: self.write(" ") self.dispatch(t.value) self.write(";")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_return(self) -> None:\n self._consume('return')\n if self._get_current_token() != ';':\n self.compile_expression()\n else:\n self.writer.write_push('CONST', 0)\n self.writer.write_return()\n self._consume(';')", "def compile_return(self):\r\n ...
[ "0.7318816", "0.69216275", "0.6916768", "0.6747743", "0.6609503", "0.6026339", "0.60176194", "0.59240377", "0.58299434", "0.57947284", "0.56949216", "0.5653559", "0.56448203", "0.56211615", "0.5538628", "0.55126405", "0.549617", "0.54757154", "0.5461631", "0.54565257", "0.537...
0.61995023
5
cassert does exist but probably not required in FGPU functions and unclear if supported by jitfy
def _Assert(self, t): self.RaiseError(t, "Assert not supported")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_perspective_transform():\n # TODO: write this\n assert(True)", "def boolean():\n\n bool(Assert(1))\n\n with Assert.raises(AssertionError):\n bool(Assert(0))", "def boolean():\r\n\r\n bool(Assert(1))\r\n\r\n with Assert.raises(AssertionError):\r\n bool(Assert(0))", "de...
[ "0.5553334", "0.53317463", "0.5246943", "0.52441424", "0.5225567", "0.50993943", "0.50408936", "0.49993053", "0.49924356", "0.49918866", "0.49887422", "0.49359533", "0.4932513", "0.4932513", "0.49268204", "0.49176776", "0.49025792", "0.4897762", "0.48943457", "0.48824537", "0...
0.4522558
64
This is old school python printing so no need to support
def _Print(self, t): self.RaiseError(t, "Print not supported")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _printable(self):\n pass", "def print_out():\n pass", "def my_print(self):\n if self.__size == 0:\n print(\"\")\n return\n [print(\"\") for x in range(0, self.__position[1])]\n for i in range(0, self.__size):\n [print(\" \", end=\"\") for ...
[ "0.73725426", "0.72929084", "0.7111852", "0.70446706", "0.7013182", "0.70031095", "0.69107485", "0.69100827", "0.6871159", "0.68606776", "0.6803045", "0.680181", "0.6794203", "0.67602473", "0.6700353", "0.6650724", "0.66261536", "0.66122717", "0.6503248", "0.64987963", "0.649...
0.6141068
66
Exceptions are obviously supported in cpp but not in CUDA device code
def _Raise(self, t): self.RaiseError(t, "Exception raising not supported")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_device_error(self, device: SimplePeriphDev):\r\n pass", "def test_nonpositive_nu_raises_exception(nu):\n with pytest.raises(ValueError):\n kernels.Matern(input_dim=1, nu=nu)", "def unexpected_error(self, exception):", "def test_gcc_crash(self):\r\n self.validate((1, 10, 213...
[ "0.6091167", "0.5937788", "0.5826724", "0.5811849", "0.56694853", "0.5567256", "0.5509975", "0.55026484", "0.54509616", "0.54496866", "0.54445916", "0.5436744", "0.5431065", "0.5427501", "0.5389274", "0.538114", "0.5358859", "0.5358747", "0.5344634", "0.5293775", "0.52785766"...
0.0
-1
Checks the decorators of the function definition much must be either 'pyflamegpu.agent_function', 'pyflamegpu.agent_function_condition' or 'pyflamegpu.device_function'. Each is then processed in a different way using a specific dispatcher. Function calls are actually checked and only permitted (or user defined) functio...
def _FunctionDef(self, t): self.write("\n") # check decorators if len(t.decorator_list) != 1 or not isinstance(t.decorator_list[0], ast.Attribute): self.RaiseError(t, "Function definitions require a single pyflamegpu decorator of either 'pyflamegpu.agent_function', 'pyflamegpu.agent_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_FunctionDef(self, node):\n self.functions[node.name] = self._generate_pytest_decorators(node.decorator_list)\n self.generic_visit(node)", "def isValidFunction(self):\n for token in self.value:\n if token.type == 'defFunction' or token.type == 'callFunction':\n ...
[ "0.6134093", "0.5936042", "0.57259756", "0.56994855", "0.5666439", "0.5570822", "0.5568335", "0.55557805", "0.5536746", "0.55267", "0.5503715", "0.55015457", "0.54883873", "0.5477766", "0.5459286", "0.54585314", "0.5451225", "0.543271", "0.54145896", "0.5368069", "0.53297734"...
0.7230727
0
Two type for for loop are supported. Either; 1) Message for loop in which case the format requires a iterator using the named pyflamegpu function argument of 'message_in' 2) A range based for loop with 1 to 3 arguments which is converted into a c style loop
def _For(self, t): # if message loop then process differently if isinstance(t.iter, ast.Name): if t.iter.id == self._input_message_var: self.dispatchMessageLoop(t) else: self.RaiseError(t, "Range based for loops only support message iteration using...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatchMessageLoop(self, tree):\n self.fill(\"for (const auto& \")\n self.dispatch(tree.target)\n self.write(\" : \")\n # if simple message iterator\n if isinstance(tree.iter, ast.Name):\n if not tree.iter.id == self._input_message_var:\n self.Raise...
[ "0.6300082", "0.5951897", "0.5818866", "0.57553744", "0.55254656", "0.55113477", "0.5369612", "0.5264706", "0.51863104", "0.5155934", "0.5096092", "0.50791895", "0.5068876", "0.5014519", "0.49778667", "0.49353746", "0.48620737", "0.48602274", "0.48535544", "0.48398575", "0.48...
0.6590012
0
Fairly straightforward translation to if, else if, else format
def _If(self, t): self.fill("if (") self.dispatch(t.test) self.write(")") self.enter() self.dispatch(t.body) self.leave() # collapse nested ifs into equivalent elifs. while (t.orelse and len(t.orelse) == 1 and isinstance(t.orelse[0], ast.If)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ifelse(test, if_true, if_false):\n if test:\n return if_true\n else:\n return if_false", "def switch(cond, ift, iff):", "def _ifelse(self):\n debug.show(\"ifelse:Stack = \" + str(self.opStack))\n if self.opStack.size() >= 3:\n falseCode = check.isCode(self.opSta...
[ "0.6925929", "0.6345551", "0.6319299", "0.6283738", "0.62381434", "0.62381434", "0.62381434", "0.62381434", "0.6104107", "0.60394055", "0.5961958", "0.59224445", "0.58788913", "0.5835179", "0.57912", "0.57817644", "0.5748567", "0.57284987", "0.5728384", "0.5704196", "0.568847...
0.5588862
26
Straightforward translation to c style while loop
def _While(self, t): self.fill("while (") self.dispatch(t.test) self.write(")") self.enter() self.dispatch(t.body) self.leave() if t.orelse: self.RaiseError(t, "While else not supported")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def syntax_while():\n i = 0\n while i < 5:\n print(i)\n i += 1\n\n ## Output\n # 0\n # 1\n # 2\n # 3\n # 4", "def while_loop(n):\n\tprint(\"\\n\\nlet's see what a while loop is\\n\")\n\twhile n > 0:\n\t\tprint(f\"n = {n}\")\n\t\tn -= 1", "def whileLoop(count):\n result=...
[ "0.6793967", "0.66965246", "0.65839756", "0.6332659", "0.6076374", "0.6045058", "0.60284704", "0.5919505", "0.5916802", "0.5843467", "0.5810192", "0.57871115", "0.577109", "0.5753707", "0.571716", "0.5670822", "0.56154424", "0.55902815", "0.5575924", "0.55405825", "0.54837346...
0.6501587
3
Everything ends up as a Name once it is an identifier
def _Name(self, t): self.write(t.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identifier(self):", "def get_identifier(self):", "def name(self, name):\n pass", "def name(self):", "def name(self):", "def name(self):", "def name(self):", "def get_name():", "def name(self):\n ...", "def name():\n pass", "def name():\n pass", "def getName():"...
[ "0.792435", "0.74011093", "0.73938805", "0.7328443", "0.7328443", "0.7328443", "0.7328443", "0.7276922", "0.72753966", "0.72493345", "0.72493345", "0.72163546", "0.72163546", "0.72163546", "0.72163546", "0.72163546", "0.72163546", "0.7212629", "0.7212629", "0.7212629", "0.721...
0.68990785
37