query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Test that a registry file present in the 'SourceMods' directory is correctly used over the standard input registry file.
def test_SourceMods_metadata_file_registry(self): # Setup test filename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_mf.xml") out_name = "physics_types_ddt" in_source = os.path.join(_SAMPLE_FILES_DIR, out_name + '_se.F90') in_meta = os.path.join(_SAMPLE_FILES_DIR, out_name + '_se....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_simple_registry(self):\n # Setup test\n filename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n out_source_name = \"physics_types_simple\"\n in_source = os.path.join(_SAMPLE_FILES_DIR, out_source_name + '.F90')\n in_meta = os.path.join(_SAMPLE_FILES_DI...
[ "0.67218894", "0.6483869", "0.6474242", "0.6357241", "0.61895543", "0.60502476", "0.5949013", "0.5829016", "0.5799409", "0.5791394", "0.56686485", "0.5634118", "0.56161326", "0.5592709", "0.5548186", "0.55382824", "0.55196774", "0.5492724", "0.5464126", "0.54572386", "0.54529...
0.7359067
0
Test that a good registry with variables, metadata files, DDTs, Arrays, and parameters validates, i.e. try and test everything at once. Check that generate_registry_data.py generates good Fortran and metadata files with all of the proper code features.
def test_good_complete_registry(self): # Setup test filename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_complete.xml") out_source_name = "physics_types_complete" in_source = os.path.join(_SAMPLE_FILES_DIR, out_source_name + '.F90') in_meta = os.path.join(_SAMPLE_FILES_DIR, out_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_simple_registry(self):\n # Setup test\n filename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n out_source_name = \"physics_types_simple\"\n in_source = os.path.join(_SAMPLE_FILES_DIR, out_source_name + '.F90')\n in_meta = os.path.join(_SAMPLE_FILES_DI...
[ "0.77946204", "0.74846876", "0.7268391", "0.7240888", "0.7174737", "0.6882679", "0.66573495", "0.6609682", "0.64437586", "0.6333907", "0.62853116", "0.6259751", "0.61872965", "0.601907", "0.5955148", "0.5898957", "0.5830323", "0.5821156", "0.5804863", "0.5803006", "0.57896", ...
0.76914966
1
Test code and metadata generation from a good registry with a nonexistent metadata file. Check that generate_registry_data.py raises the correct error.
def test_no_metadata_file_registry(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_mf.xml") filename = os.path.join(_TMP_DIR, "reg_no_mf.xml") out_source_name = "physics_types_no_mf" out_source = out_source_name + '.F90' out_meta_name = out_sour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_metadata_file_registry(self):\n # Setup test\n filename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_mf.xml\")\n out_name = \"physics_types_ddt\"\n in_source = os.path.join(_SAMPLE_FILES_DIR, out_name + '_se.F90')\n in_meta = os.path.join(_SAMPLE_FILES_DIR, out_name...
[ "0.7480908", "0.7356885", "0.7253543", "0.71558", "0.6907145", "0.6682387", "0.66737413", "0.6602701", "0.6570605", "0.6513604", "0.6342649", "0.628816", "0.6108481", "0.6094093", "0.60692817", "0.6037539", "0.60087895", "0.6002953", "0.5962621", "0.59451896", "0.59387237", ...
0.7776031
0
Test a registry with a bad version number. Check that it does not validate and does not generate any Fortran or metadata files
def test_bad_registry_version(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_bad_version.xml") out_source_name = "physics_types_bad_ver" out_source = os.path.join(_TMP_DIR, out_source_name + '.F90') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_registry(self):\n validate_registry()", "def test_version_control_invalid(self):\n versions = ('Thirteen', '-1', -1, '' , 13)\n # A fresh repository doesn't go up to version 13 yet\n for version in versions:\n #self.assertRaises(ControlledSchema.InvalidVersionError...
[ "0.6545276", "0.6419098", "0.6352311", "0.6315899", "0.6280753", "0.62619764", "0.6206099", "0.61629176", "0.6118971", "0.60387933", "0.60372806", "0.5976604", "0.5947295", "0.5931549", "0.59286225", "0.59160125", "0.5907703", "0.59011877", "0.5900795", "0.5888661", "0.588519...
0.8273525
0
Test a registry with a missing standard name. Check that it does not validate and does not generate any Fortran or metadata files
def test_missing_standard_name(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_no_std_name.xml") out_source_name = "physics_types_no_std_name" out_source = os.path.join(_TMP_DIR, out_source_name + '.F9...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_registry(self):\n validate_registry()", "def test_no_metadata_file_registry(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_mf.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_no_mf.xml\")\n out_source_name = \"physics_types_no_mf\"\n ...
[ "0.68783224", "0.6453713", "0.64522105", "0.63392645", "0.6313093", "0.61355084", "0.60785717", "0.59977686", "0.5938566", "0.5891832", "0.5828589", "0.5826495", "0.5821727", "0.5809477", "0.57814956", "0.5778031", "0.5775003", "0.57567817", "0.5706741", "0.569216", "0.562601...
0.7792895
0
Test a registry with a variable with bad dimensions. Check that it does not validate and does not generate any Fortran or metadata files
def test_bad_dimensions(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_bad_dimensions.xml") out_source_name = "physics_types_bad_dimensions" out_source = os.path.join(_TMP_DIR, out_source_name + '.F90...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unknown_dimensions(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_unknown_dimension.xml\")\n out_source_name = \"physics_types_unknown_dimension\"\n out_source = os.path.join(_TMP_DI...
[ "0.75462794", "0.6411463", "0.62967855", "0.62515324", "0.6189864", "0.6188676", "0.6178864", "0.6171215", "0.6079786", "0.6078226", "0.6064769", "0.60445994", "0.5981591", "0.5934239", "0.59190875", "0.5906177", "0.58930516", "0.5876798", "0.5871445", "0.5838422", "0.5821763...
0.7870279
0
Test a registry with a variable with an unknown dimension. Check that it does not validate and does not generate any Fortran or metadata files
def test_unknown_dimensions(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_unknown_dimension.xml") out_source_name = "physics_types_unknown_dimension" out_source = os.path.join(_TMP_DIR, out_source_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_dimensions(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_bad_dimensions.xml\")\n out_source_name = \"physics_types_bad_dimensions\"\n out_source = os.path.join(_TMP_DIR, out_sou...
[ "0.7130763", "0.6584589", "0.6220614", "0.6113159", "0.60474735", "0.6031712", "0.6024205", "0.58651763", "0.5841678", "0.58213997", "0.5703707", "0.5687972", "0.5668023", "0.5664469", "0.5656372", "0.56385857", "0.5585897", "0.5577033", "0.5537176", "0.55331725", "0.5528648"...
0.7580312
0
Test a registry with a parameter with no initial value. Check that it does not validate and does not generate any Fortran or metadata files
def test_no_init_value(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_no_init_value.xml") out_source_name = "physics_types_no_init_value" out_source = os.path.join(_TMP_DIR, out_source_name + '.F90') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_registry(self):\n validate_registry()", "def test_good_simple_registry(self):\n # Setup test\n filename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n out_source_name = \"physics_types_simple\"\n in_source = os.path.join(_SAMPLE_FILES_DIR, out_source_name...
[ "0.6738387", "0.6208876", "0.6150374", "0.5964314", "0.59352034", "0.59266925", "0.591991", "0.5883104", "0.5859615", "0.58049744", "0.5753334", "0.57347953", "0.5707049", "0.56895137", "0.5646527", "0.5611914", "0.55544466", "0.550884", "0.54767793", "0.5465385", "0.5456172"...
0.7060637
0
Test a registry with a duplicate DDT type. Check that it raises an exception and does not generate any Fortran or metadata files
def test_duplicate_type(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_ddt.xml") filename = os.path.join(_TMP_DIR, "reg_dup_ddt.xml") out_source_name = "physics_types_dup_ddt" out_source = os.path.join(_TMP_DIR, out_source_name + '.F90') out_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_ddt_registry2(self):\n # Setup test\n filename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_ddt2.xml\")\n out_name = \"physics_types_ddt2\"\n out_source_name = out_name + '.F90'\n out_meta_name = out_name + '.meta'\n in_source = os.path.join(_SAMPLE_FILES_DIR...
[ "0.69772834", "0.68932724", "0.66369087", "0.6441797", "0.63986206", "0.636329", "0.62513334", "0.6244751", "0.6170574", "0.615846", "0.6149776", "0.59216523", "0.5910761", "0.58644223", "0.5852968", "0.5833739", "0.5813733", "0.5812187", "0.5761434", "0.57343495", "0.5719569...
0.80503964
0
Test a registry with a DDT variable that has a kind attribute. Check that it raises an exception and does not generate any Fortran or metadata files
def test_ddt_with_kind(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_ddt.xml") filename = os.path.join(_TMP_DIR, "reg_ddt_with_kind.xml") out_source_name = "physics_types_ddt_with_kind" out_source = os.path.join(_TMP_DIR, out_source_name + '.F90') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ddt_with_unknown_type(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_ddt.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_ddt_var_unknown.xml\")\n out_source_name = \"physics_types_ddt_var_unknown_type\"\n out_source = os.path.join(_TMP_D...
[ "0.62541693", "0.6181157", "0.6161756", "0.5971583", "0.5942705", "0.58668464", "0.5816771", "0.5774226", "0.5762913", "0.5747795", "0.57199615", "0.56552935", "0.5652728", "0.5602194", "0.559683", "0.5592391", "0.55627656", "0.5551885", "0.5521057", "0.55121905", "0.54599315...
0.7301836
0
Test a registry with a DDT variable of unknown type. Check that it raises an exception and does not generate any Fortran or metadata files
def test_ddt_with_unknown_type(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_ddt.xml") filename = os.path.join(_TMP_DIR, "reg_ddt_var_unknown.xml") out_source_name = "physics_types_ddt_var_unknown_type" out_source = os.path.join(_TMP_DIR, out_source_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ddt_with_unknown_variable(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_ddt.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_ddt_unknown_variable.xml\")\n out_source_name = \"physics_types_ddt_unknown_variable\"\n out_source = os.path.jo...
[ "0.6971652", "0.670089", "0.6442694", "0.6426899", "0.63827103", "0.62923175", "0.609903", "0.6070227", "0.60336775", "0.5924302", "0.5894286", "0.5887874", "0.58692116", "0.57829285", "0.57525015", "0.57277215", "0.5715574", "0.5707631", "0.567574", "0.5664655", "0.5663183",...
0.7472598
0
Test a registry with a DDT which extends an unknown type attributes. Check that it raises an exception and does not generate any Fortran or metadata files
def test_ddt_with_unknown_extends(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_ddt.xml") filename = os.path.join(_TMP_DIR, "reg_ddt_unknown_extends.xml") out_source_name = "physics_types_ddt_unknown_extends" out_source = os.path.join(_TMP_DIR, out_so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ddt_with_unknown_type(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_ddt.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_ddt_var_unknown.xml\")\n out_source_name = \"physics_types_ddt_var_unknown_type\"\n out_source = os.path.join(_TMP_D...
[ "0.68669564", "0.66500145", "0.6563421", "0.6520671", "0.6400025", "0.63397396", "0.62079716", "0.610052", "0.6079133", "0.60700876", "0.5945194", "0.59088856", "0.5856565", "0.584296", "0.5805596", "0.5791145", "0.57819915", "0.5692231", "0.5683479", "0.56698895", "0.5615208...
0.7077637
0
Test a registry with a DDT with both the extends and bindC attributes. Check that it raises an exception and does not generate any Fortran or metadata files
def test_ddt_with_incompatible_attr(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_ddt2.xml") filename = os.path.join(_TMP_DIR, "reg_ddt_incompatible_attributes.xml") out_source_name = "physics_types_ddt_incompatible_attributes" out_source = os.path.jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_ddt_registry(self):\n # Setup test\n filename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_ddt.xml\")\n out_name = \"physics_types_ddt\"\n for dycore in ['fv', 'eul', 'se']:\n out_source_name = out_name + '_' + dycore + '.F90'\n out_meta_name = out_na...
[ "0.65156037", "0.6257643", "0.61623746", "0.5772863", "0.5760598", "0.5674095", "0.5577385", "0.5478984", "0.5367307", "0.536263", "0.5299145", "0.5268823", "0.5268676", "0.523342", "0.51973474", "0.51728916", "0.51606345", "0.5141639", "0.51329637", "0.50996685", "0.5074558"...
0.65799934
0
Test a registry with a duplicate local name. Check that it raises an exception and does not generate any Fortran or metadata files
def test_duplicate_local_name(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_duplicate_local_name.xml") out_source_name = "physics_types_duplicate_local_name" out_source = os.path.join(_TMP_DIR, out_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_standard_name(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_duplicate_standard_name.xml\")\n out_source_name = \"physics_types_duplicate_standard_name\"\n out_source = os....
[ "0.6969478", "0.64901084", "0.6328697", "0.6248966", "0.6201441", "0.6149709", "0.60684025", "0.6004039", "0.5991497", "0.59882283", "0.59814984", "0.5919021", "0.58246166", "0.58238685", "0.5763673", "0.5760139", "0.57580084", "0.5737761", "0.57237136", "0.5715417", "0.57045...
0.74251866
0
Test a registry with a duplicate standard name. Check that it raises an exception and does not generate any Fortran or metadata files
def test_duplicate_standard_name(self): # Setup test infilename = os.path.join(_SAMPLE_FILES_DIR, "reg_good_simple.xml") filename = os.path.join(_TMP_DIR, "reg_duplicate_standard_name.xml") out_source_name = "physics_types_duplicate_standard_name" out_source = os.path.join(_TMP_D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_standard_name(self):\n # Setup test\n infilename = os.path.join(_SAMPLE_FILES_DIR, \"reg_good_simple.xml\")\n filename = os.path.join(_TMP_DIR, \"reg_no_std_name.xml\")\n out_source_name = \"physics_types_no_std_name\"\n out_source = os.path.join(_TMP_DIR, out_so...
[ "0.7268166", "0.6754639", "0.66809714", "0.6457518", "0.6436753", "0.6342827", "0.63371575", "0.6329708", "0.6175662", "0.60707486", "0.60575706", "0.60110015", "0.5986638", "0.5855588", "0.58451885", "0.5843605", "0.58302236", "0.5812083", "0.5798823", "0.57651955", "0.57607...
0.74243414
0
Creates day 2 test data
def day2_data(): test_data = [] test_data.append([5, 1, 9, 5]) test_data.append([7, 5, 3]) test_data.append([2, 4, 6, 8]) return test_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day2part2_data():\n test_data = []\n test_data.append([5, 9, 2, 8])\n test_data.append([9, 4, 7, 3])\n test_data.append([3, 8, 6, 5])\n return test_data", "def test_create_run(self):\n pass", "def gen_test(self):\n count = 500\n dates = []\n value = []\n no...
[ "0.67011356", "0.6214024", "0.6158094", "0.61273336", "0.6084919", "0.6042311", "0.60085887", "0.5950836", "0.59017235", "0.57384264", "0.57280016", "0.57157147", "0.5684867", "0.56830144", "0.56721896", "0.5658856", "0.565823", "0.5653165", "0.56479806", "0.5637888", "0.5630...
0.6713459
0
Creates day 2 test data
def day2part2_data(): test_data = [] test_data.append([5, 9, 2, 8]) test_data.append([9, 4, 7, 3]) test_data.append([3, 8, 6, 5]) return test_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day2_data():\n test_data = []\n test_data.append([5, 1, 9, 5])\n test_data.append([7, 5, 3])\n test_data.append([2, 4, 6, 8])\n return test_data", "def test_create_run(self):\n pass", "def gen_test(self):\n count = 500\n dates = []\n value = []\n now = date...
[ "0.6713459", "0.6214024", "0.6158094", "0.61273336", "0.6084919", "0.6042311", "0.60085887", "0.5950836", "0.59017235", "0.57384264", "0.57280016", "0.57157147", "0.5684867", "0.56830144", "0.56721896", "0.5658856", "0.565823", "0.5653165", "0.56479806", "0.5637888", "0.56309...
0.67011356
1
endpoint which is used to have the number of condominium of a specific company
def number_condominium_company_business(id_company): number_condominium_company_bus = requests.get('http://127.0.0.1:5050/{}/number_condominium'.format(id_company), headers={"Content-Type": "application/json"}) data = json.loads(number_condominium_company_bus.text) if 'counter' in data and data.get('status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_condominium_all_business():\n\n number_condominium_bus = requests.get('http://127.0.0.1:5050/number_condominium', headers={\"Content-Type\": \"application/json\"})\n data = json.loads(number_condominium_bus.text)\n if 'counter' in data and data.get('status', '') == 'OK':\n response = {\n...
[ "0.6461232", "0.59551543", "0.5814411", "0.5752769", "0.5704058", "0.56992", "0.5684131", "0.55898553", "0.55335146", "0.5525256", "0.54799855", "0.54207873", "0.5406967", "0.5380945", "0.533283", "0.53135675", "0.5309109", "0.5307097", "0.5271826", "0.5259793", "0.5253334", ...
0.6953116
0
endpoint which is used to have the number of condominium of a specific technician
def number_condominium_all_business(): number_condominium_bus = requests.get('http://127.0.0.1:5050/number_condominium', headers={"Content-Type": "application/json"}) data = json.loads(number_condominium_bus.text) if 'counter' in data and data.get('status', '') == 'OK': response = { "me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_count(request):\n return request.param", "def pullGateCount(start_date, end_date):\n headers = getSenSourceHeaders()\n url = \"https://vea.sensourceinc.com/api/data/traffic?dateGroupings=hour(1)&endDate={1}T00:00:00.000Z&entityType=zone&excludeClosedHours=false&include=zone,sensor,site,locati...
[ "0.60693365", "0.5490316", "0.5473667", "0.54516476", "0.53546196", "0.53246987", "0.53217185", "0.5284929", "0.5191751", "0.5144557", "0.5129488", "0.51015234", "0.50962454", "0.5085166", "0.50825655", "0.5078483", "0.50769144", "0.5037914", "0.50340676", "0.50330245", "0.50...
0.54972935
1
Computes the mean rate and the mean PNSR associated to the compression of the RGB digits via an entropy autoencoder. An image of the RGB digits after being compressed via the entropy autoencoder is saved.
def compute_rate_psnr(reference_uint8, mean_training, std_training, entropy_ae, bin_width, nb_vertically, path_to_reconstruction): # The function `svhn.svhn.preprocess_svhn` checks # that `reference_uint8.dtype` is equal to `numpy.uint8` # and `reference_uint8.ndim` is equal to 2. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meanRGB(im_list):\n print 'Computing mean RGB pixel ...'\n mean, std = np.zeros(3), np.zeros(3)\n for i, filename in enumerate(im_list):\n # Write completion bar\n n = 1. * i / len(im_list)\n sys.stdout.write('\\r')\n sys.stdout.write(\"[{:20}] {}%\".format('='*int(n/0.05),...
[ "0.54239196", "0.5348026", "0.52801806", "0.5279056", "0.5247555", "0.52301896", "0.5173954", "0.51683193", "0.5155519", "0.5141951", "0.50923276", "0.5051895", "0.5036153", "0.5027491", "0.5020776", "0.50200474", "0.5014729", "0.5013626", "0.5006129", "0.49713975", "0.494735...
0.5814594
0
Obtain batch of training examples from a list of tasks
def _generate_batch(self, tasks: List): x_batch = np.stack([np.random.uniform(low=self.domain_bounds[0], high=self.domain_bounds[1], size=(self.inner_update_k, 1)) for _ in range(len(tasks))]) y_batch = np.stack([[tasks[t](x) for x in x_batch[t]] for t in range(len(tasks))]) return x_batch, y_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_task(train_steps_per_task, args):\n sample_task_ids = []\n for task_id in range(len(args.tasks)):\n sample_task_ids += [task_id] * train_steps_per_task[task_id]\n sample_task_ids = np.random.choice(sample_task_ids, len(sample_task_ids), replace = False)\n return sample_task_ids", "d...
[ "0.6764151", "0.6256729", "0.6006875", "0.59977233", "0.5992006", "0.5957553", "0.5951511", "0.59101415", "0.58730215", "0.58566725", "0.58561206", "0.5849685", "0.583922", "0.58386934", "0.58358675", "0.580385", "0.5794363", "0.57939523", "0.5788787", "0.5740647", "0.5740185...
0.6392144
1
If using fixed validation this method returns a set of tasks that are equally spread across the task distribution space.
def _get_fixed_validation_tasks(self): # mesh of equally partitioned state space if self.task_type == 'sin3d': amplitude_spectrum, phase_spectrum, frequency_spectrum = np.mgrid[ self.amplitude_bounds[0]:self.amplitude_bounds[1]:self.validation_block_sizes[0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _constraints_task_spread(self):\n # encourage scheduling a chunk for every 24 hours\n diag = util.blockdiag(self.num_timeslots, incr=tutil.SLOTS_PER_DAY)\n slots = diag.shape[0]\n\n def rule(model, p, j):\n \"\"\"\n For spread-activated tasks, this rule is used...
[ "0.66843224", "0.6570821", "0.6186791", "0.60791546", "0.6059422", "0.5946523", "0.59432817", "0.593259", "0.5836882", "0.5822492", "0.5776005", "0.5774551", "0.57341987", "0.57272375", "0.5721996", "0.57161814", "0.5704121", "0.5700247", "0.5662424", "0.558567", "0.5548219",...
0.69486487
1
Produces plot of priority queue (losses or counts) Discrete vs continuous, 2d heatmap vs 3d.
def visualise_priority_queue(self, feature='losses'): if type(self._queue) == np.ndarray: if len(self._queue.shape) == 2: fig = plt.figure() if feature == 'losses': plt.imshow(self._queue) elif feature == 'counts': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_priority_queue(self, feature='losses'):\n if type(self.queue) == np.ndarray:\n if len(self.queue.shape) == 2:\n fig = plt.figure()\n if feature == 'losses':\n plt.imshow(self.queue)\n elif feature == 'counts':\n ...
[ "0.7220506", "0.71330494", "0.7064842", "0.5994764", "0.5889273", "0.5744702", "0.57151496", "0.5676757", "0.5674659", "0.56460506", "0.5598416", "0.5581794", "0.55762786", "0.55606663", "0.5551708", "0.5542", "0.55366516", "0.5528649", "0.5526613", "0.5518681", "0.5516258", ...
0.7176055
1
Produces probability distribution plot of losses in the priority queue
def visualise_priority_queue_loss_distribution(self): all_losses = self._queue.flatten() hist, bin_edges = np.histogram(all_losses, bins=int(0.1 * len(all_losses))) bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2 fig = plt.figure() plt.plot(bin_centers, hist) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_priority_queue_loss_distribution(self):\n all_losses = self.queue.flatten()\n\n hist, bin_edges = np.histogram(all_losses, bins=int(0.1 * len(all_losses)))\n bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2\n\n fig = plt.figure()\n plt.plot(bin_centers, hist)\n ...
[ "0.79763114", "0.62169874", "0.6176602", "0.61589974", "0.6142269", "0.6137438", "0.6110094", "0.59648865", "0.5910791", "0.58894414", "0.5887954", "0.58584875", "0.58149755", "0.5791838", "0.5789426", "0.5725533", "0.5718719", "0.570774", "0.5702456", "0.5687776", "0.5667206...
0.79057306
1
Check the goal of hero current position.
def check_goal(self): hero = self.objects[0] others = self.objects[1:] for other in others: if other.x == hero.x and other.y == hero.y: self.objects.remove(other) if other.reward == 1: self.objects.append(GameObject(self.__new_posi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_goal(self):\n if self.team1.get_cur_hp() == 0:\n return 1\n elif self.team2.get_cur_hp() == 0:\n return -1\n else:\n return 0", "def at_goal(self):\n return self.distance_from_goal < self.robot.wheels.base_length/2", "def at_goal(self):\n ...
[ "0.7637334", "0.75702274", "0.75702274", "0.7456017", "0.7297082", "0.7249588", "0.7196583", "0.71933985", "0.71090716", "0.7034965", "0.69736075", "0.693964", "0.6897753", "0.68059707", "0.67369914", "0.6715049", "0.6705636", "0.6645705", "0.65577596", "0.6555632", "0.654914...
0.7681781
0
Creates list dict from parsing list Key refers to the asserted index (key_ind), value by default takes all the indexes (including the key index)
def create_dict_from_list(parse_list, key_ind, *val_inds): parse_dict=defaultdict(list) for string in parse_list: if not val_inds: parse_dict[string[key_ind]]=string else: parse_dict[string[key_ind]]=[string[i] for i in range(len(string)) if i in val_inds] return(pars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_dict(list: list, keys: list):\n dictionary = dict()\n for key in keys:\n try:\n index = list.index(f'{key}:')\n dictionary[list[index].strip(':')] = list[index + 1]\n except ValueError:\n print(f'{key} not found!')\n return dictionary", "def lst...
[ "0.65613437", "0.6516232", "0.62374157", "0.60704374", "0.59829146", "0.5794201", "0.5784662", "0.5772795", "0.57321256", "0.5710158", "0.5698239", "0.56723595", "0.56688994", "0.56288064", "0.5603838", "0.5602279", "0.5576343", "0.55386806", "0.5537447", "0.55233806", "0.551...
0.81510866
0
Reads csv file and returns list without header by default If headless argument is false, parses the whole file
def read_csv_to_list(in_file, headless=True, delim='\t'): ret_list=list() with open(in_file,'r') as csv_file: my_reader = csv.reader(csv_file, delimiter=delim) if headless: next(my_reader) for row in my_reader: ret_list.append(list(row)) return(ret_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv(file, header=False):\n data = []\n with open(file, 'r') as f:\n reader = csv.reader(f)\n for row in reader:\n if header:\n continue\n line = [v_parse(val) for val in row]\n data.append(line)\n\n return data", "def read_csv():", ...
[ "0.6847907", "0.66721034", "0.66177195", "0.6546124", "0.65415746", "0.65190655", "0.63968724", "0.63822967", "0.63740385", "0.6350739", "0.6303523", "0.629375", "0.6287847", "0.62027615", "0.61776584", "0.6153537", "0.6136374", "0.6112305", "0.60884196", "0.60882014", "0.607...
0.7652836
0
A universal function for writing lists to csvfiles If input is list of lists uses writerows function else iteratively writes If strings for header are specified, writes header to the output, saves headless table otherwise
def write_csv(row_list,out_name,*header_strings : str): with open(out_name,'w',newline='') as result_file: wr = csv.writer(result_file, delimiter='\t') if header_strings: wr.writerow([name for name in header_strings]) if type(row_list[0]) is list: wr.writerows(row_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(csv_list, out_csv_path):\n with open(out_csv_path, 'w', newline='') as csv_file:\n csv_writer = csv.writer(csv_file)\n for row in csv_list:\n csv_writer.writerow(row)", "def CSVWriter (iterable, outLoc, header=\"\", ):\n if not iterable:\n print (\"nothing to write\")\n ...
[ "0.7178422", "0.7149983", "0.70599604", "0.6969489", "0.68787044", "0.68137985", "0.6790172", "0.6779861", "0.67584366", "0.67406625", "0.67328304", "0.6723648", "0.66114855", "0.65844285", "0.6522215", "0.65164346", "0.6485995", "0.6484298", "0.6440069", "0.6423858", "0.6407...
0.7827139
0
Subscribe a subscription actor
def subscribe(self, subscription): try: if isinstance(subscription, Subscription): sub = Subscribe(subscription, self.__pool, self.myAddress) self.send(self.__pool, sub) except Exception: handle_actor_system_fail()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(self, subject):\n pass", "def subscribe(receiver):", "def subscribe(receiver):", "def subscribe(receiver):", "def subscribe(self, subscriber):\n self.subscribers.append(subscriber)", "def subscribe(self, channel, **kwargs):\n pass", "def subscribe(receiver, catchup):"...
[ "0.7633558", "0.7517482", "0.7517482", "0.7517482", "0.7173707", "0.7017681", "0.7009267", "0.6963345", "0.68712676", "0.684188", "0.684188", "0.68111676", "0.6791407", "0.67772454", "0.67747897", "0.6762076", "0.6739845", "0.6728023", "0.6716424", "0.67043054", "0.6698741", ...
0.7764038
0
DeSubscribe a subscription actor
def desubscribe(self, subscription): try: if isinstance(subscription, Subscription): sub = DeSubscribe(subscription, self.__pool, self.myAddress) self.send(self.__pool, sub) except Exception: handle_actor_system_fail()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe(receiver):", "def unsubscribe(receiver):", "def unsubscribe(receiver):", "def unsubscribe(receiver):", "def unsubscribe(receiver):", "def unsubscribeFromEvent(eventName,subscriber):", "def unsubscribe(self, subject):\n pass", "def unsubscribe(self):\n pass # pragma: no ...
[ "0.7506494", "0.7506494", "0.7506494", "0.7506494", "0.7506494", "0.7483194", "0.739891", "0.7196337", "0.7185205", "0.71839064", "0.71839064", "0.712321", "0.71022123", "0.6942072", "0.6925207", "0.67813927", "0.676329", "0.676329", "0.6761287", "0.6758794", "0.6665434", "...
0.82628363
0
Set the drop policy
def set_drop_policy(self, msg, sender): payload = msg.payload if isinstance(payload, str): self.drop_policy = payload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_drop_rate(self, drop_rate=0.0):\n zero_ary = np.zeros((1,))\n new_val = zero_ary + drop_rate\n self.drop_rate.set_value(to_fX(new_val))\n return", "def _fire_dropping(self):\n\t\tif len(self.droppings) < self.settings.droppings_allowed:\n\t\t\tnew_dropping = Dropping(self)\n\t...
[ "0.62874126", "0.5738691", "0.57316375", "0.5635339", "0.5635339", "0.558581", "0.5538982", "0.53915924", "0.53859526", "0.5357516", "0.5329708", "0.5325387", "0.5261155", "0.5260422", "0.5251651", "0.52394503", "0.5231641", "0.5231641", "0.5231641", "0.52263457", "0.5214995"...
0.78656536
0
Retrieve comments from local database.
def get_comments(): conn = pymongo.Connection("localhost",27017) db = conn["paperDB"] infoDB = db.infoDB record = infoDB.find_one() return record['comment']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comments(self):\n\t\treturn self._client.get_comments(self)", "async def fetch(self, conn, page=None, fdt=None, tdt=None):\n\n sql = \"\"\"SELECT\n comm.id,\n to_json(created_dt) as created_dt,\n entity_type,\n entity_id,\...
[ "0.7064629", "0.6681351", "0.6620849", "0.6592539", "0.6541127", "0.6494092", "0.6372003", "0.6320355", "0.6309952", "0.6252478", "0.6239982", "0.62279224", "0.6218002", "0.6187091", "0.6181334", "0.61559385", "0.61494726", "0.61394703", "0.6135342", "0.612159", "0.612159", ...
0.6762753
1
Retrieve a blog from local database.
def get_blog(): conn = pymongo.Connection("localhost",27017) db = conn["paperDB"] infoDB = db.infoDB record = infoDB.find_one() del record['_id'] del record['comment'] # reserve space # Since there's only one blog per page, use namedtuple blog = namedtuple('Blog', record.keys())(*reco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, id):\n blog = get_a_blog(id)\n if not blog:\n api.abort(404)\n else:\n return blog", "def get_blog(id):\n key = KEY_BLOG_PREFIX + str(id)\n blog = RedisHelper.get_cache(key)\n if RedisHelper.is_cache_exist(key) is False:\n b...
[ "0.74063104", "0.70923954", "0.68982506", "0.66677237", "0.6504868", "0.6470374", "0.6397252", "0.63660216", "0.62819064", "0.6276584", "0.6198686", "0.61943203", "0.6191495", "0.61681527", "0.6160327", "0.6146221", "0.61458546", "0.61158967", "0.6110245", "0.6061843", "0.606...
0.740376
1
Set the pixel at x, y to be of colour colour (default 1 = black ink). Any colour value other than 0 (white paper) is taken to be 1 (black ink).
def set(self, x, y, colour=1): inkCol = None if colour == 0: # self.__draw.setink(bitmap._pixelWhite) inkCol = bitmap._pixelWhite else: # self.__draw.setink(bitmap._pixelBlack) inkCol = bitmap._pixelBlack self.__draw.point((x, y), fill=ink...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPixel (self, x, y, colour):\r\n self.image [y][x] = colour", "def set_green(self, x, y, newval):\n self.__check_dimensions(x, y)\n return self.pixels[(x, y)].set_green(newval)", "def point(self, x, y, color=color(255, 200, 200)):\n self.pixels[y][x] = color", "def set_red(s...
[ "0.7721065", "0.75571316", "0.742605", "0.7423392", "0.73962665", "0.73569864", "0.731735", "0.71543", "0.70558524", "0.7053134", "0.70124", "0.6983806", "0.6962721", "0.68620807", "0.68554205", "0.6843948", "0.679545", "0.67586654", "0.67520475", "0.6744397", "0.67354393", ...
0.77082294
1
Write this bitmap to a file with the given filename. File type is deduced from the extension (exception if it can't be figured out).
def write(self, filename): self.__image.save(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file(self, filename):\n\n loader = ImageLoader()\n loader.write(self, filename)", "def save(self, filename):\n \n path, name = os.path.split(filename)\n ext = name.split(\".\")[-1]\n _tkExec(self.image.write, filename, format=ext)", "def save_image(self, f...
[ "0.7149323", "0.70618206", "0.6819262", "0.66685086", "0.65889823", "0.65778375", "0.65671325", "0.64307857", "0.6429537", "0.63720363", "0.63674146", "0.6357037", "0.63439417", "0.63439417", "0.62539864", "0.6237493", "0.6234686", "0.62038857", "0.6192816", "0.61659116", "0....
0.70885915
1
Return a new bitmap, twice as big linearly, by pixelcoding every pixel of bmp into a grid of 4 pixels. Pixelcoding means translating each pixel into a grid of pixels in a clever way which is the core idea of visual cryptography. Read the poster for more on that.
def pixelcode(self): maxX, maxY = self.size() result = bitmap((2*maxX, 2*maxY)) for x in range(maxX): for y in range(maxY): pixel = self.get(x,y) result.set(2*x,2*y, pixel) result.set(2*x,2*y+1, not pixel) result.set(2*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_map(self):\n for y_coord, row in enumerate(self.contents):\n for x_coord, tile in enumerate(row):\n bit_map = self.get_tile_bitmap(tile)\n self.image[y_coord * TILE_SIZE:(y_coord+1) * TILE_SIZE,\n x_coord * TILE_SIZE:(x_coord+1) * TILE_SIZE...
[ "0.62403923", "0.61142445", "0.5879032", "0.5820169", "0.58180964", "0.57284975", "0.5693612", "0.56906396", "0.5685871", "0.5598315", "0.55573237", "0.55334276", "0.55279595", "0.5505642", "0.54977006", "0.54744554", "0.54629886", "0.54627955", "0.5429451", "0.54240716", "0....
0.80257624
0
Apply the boolean operation 'operation' (a binary function of two integers returning an integer) to the list of bitmaps in 'bitmaps'
def boolean(operation, bitmaps): maxX, maxY = size = bitmaps[0].size() result = bitmap(size) for x in range(maxX): for y in range(maxY): pixel = bitmaps[0].get(x,y) for b in bitmaps[1:]: pixel = apply(operation, (pixel, b.get(x,y))) result.set(x,y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_apply_flags():\n true_value = dqflags.pixel['HOT'] + dqflags.pixel['DO_NOT_USE']\n\n print(true_value)\n\n badmap = np.zeros((10, 10), dtype=np.int)\n true_map = np.zeros((10, 10), dtype=np.uint32)\n for i in range(10):\n badmap[i, i] = 1\n true_map[i, i] = true_value\n\n\n ...
[ "0.594747", "0.59029555", "0.5850317", "0.5511171", "0.54550177", "0.54521996", "0.53777885", "0.5342763", "0.53383815", "0.52507347", "0.5222576", "0.5173792", "0.5158152", "0.51560235", "0.5144772", "0.511357", "0.51105577", "0.50971717", "0.5084718", "0.5066907", "0.506333...
0.8371338
0
Take a size (2tuple of x and y) and return a bitmap of that size filled with random pixels. WARNING! THE CODE HERE IS ONLY FOR DEMONSTRATION PURPOSES, SINCE IT CALLS THE STANDARD PYTHON RANDOM NUMBER GENERATOR, which is fine for statistics but not good enough for crypto. For real use, substitute this with really random...
def randomBitmap(size): b = bitmap(size) xmax, ymax = size for x in xrange(xmax): for y in xrange(ymax): b.set(x, y, random.randint(0,1)) return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomImage(size, lims=[0,255]):\n a,b = lims\n image_array = (b-a)*np.random.random(size) + a\n image = sitk.GetImageFromArray(image_array.astype(int))\n return image", "def generate_random_data(size, x_min=X_MIN, x_max=X_MAX, y_min=Y_MIN, y_max=Y_MAX):\n result = []\n for _i in ra...
[ "0.64976865", "0.63691264", "0.634531", "0.6285787", "0.6231544", "0.6023711", "0.6009832", "0.5896117", "0.5896117", "0.5896117", "0.58802867", "0.58769035", "0.5862035", "0.584376", "0.5806515", "0.5797296", "0.5791597", "0.57906556", "0.5751607", "0.57470214", "0.5721243",...
0.8235494
0
Take a plaintext bitmap and, optionally, a supposedly random pad of the same size (one will be made up on the spot if not supplied). Return a 2tuple containing the large pixelcoded versions of ciphertext and pad.
def encrypt(rawPlaintext, rawPad = None): # The raw versions are the same size as the original rawPlaintext if not rawPad: rawPad = randomBitmap(rawPlaintext.size()) rawCiphertext = XOR(rawPlaintext, rawPad) # The final versions are linearly twice as big due to pixelcoding ciphertext = raw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEncryptDecrypt(root):\n\n plaintext = bitmap(\"vck.gif\")\n ciphertext, pad = encrypt(plaintext)\n decryptedResult = decrypt(ciphertext, pad)\n\n v1 = plaintext.view(root, \"plaintext\")\n v2 = pad.view(root, \"pad (pixelcoded)\")\n v3 = ciphertext.view(root, \"ciphertext (pixelcoded)\")\...
[ "0.59108573", "0.5745054", "0.5651977", "0.5580657", "0.5576877", "0.544669", "0.5434631", "0.5371988", "0.5199491", "0.51550895", "0.5116362", "0.50629896", "0.5053799", "0.49261492", "0.48904338", "0.4856117", "0.4847589", "0.48363352", "0.48305053", "0.48204824", "0.481956...
0.6024275
0
Execute the supplied function. The function may create new windows by calling bitmap.view() or by making instances of viewer, but it must return a list of any such windows it makes. The point of this wrapper is merely to shield the caller away from the quirks of initialising Tkinter, running its main loop and ensuring ...
def mainApp(function): root = Tkinter.Tk() quit = Tkinter.Button(root, text="Quit", command=root.quit) quit.pack() Tkinter.Wm.title(root, "VCK main") windows = function(root) root.update() root.mainloop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _showView(self, win, fn=None):\n raise RuntimeError('Not implemented')", "def showWindow(*args, **kwargs)->None:\n pass", "def run_func(self, f):\n self.ai.start()\n self.subview_open = True # a subview may have been opened\n try:\n f()\n finally:\n ...
[ "0.5495983", "0.5481922", "0.532415", "0.5315301", "0.5145624", "0.51372254", "0.51099557", "0.50847876", "0.5047604", "0.49833563", "0.49782652", "0.48917472", "0.48865655", "0.48813784", "0.48549965", "0.48539612", "0.4848087", "0.4830732", "0.4766348", "0.47514927", "0.474...
0.59081197
0
Take a function f(x,y) that accepts a position in the moonfield and returns an integer value. Fill every cell in the moonfield with the value returned by the filler (taken modulo mod).
def fill(self, filler): for x in range(self.__xmax): for y in range(self.__ymax): self.__data[(x,y)] = filler(x,y) % self.mod
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill(self, func=lambda: random().getdigits(1), diag=None):\n for y,x in self.coords(diag):\n self.store(y,x, func())", "def fill_tiles(tiles, fill_func):\n return np.array([[fill_func(x) for x in row] for row in tiles])", "def _minefield(xsize, ysize, mines):\n #empty field\n fie...
[ "0.56665254", "0.5480169", "0.54226756", "0.53269565", "0.5322333", "0.5282611", "0.52708155", "0.52400184", "0.5235174", "0.5226314", "0.5183224", "0.518304", "0.51623565", "0.51411325", "0.51411325", "0.5124774", "0.5104777", "0.50967914", "0.50915366", "0.50831383", "0.506...
0.5810752
0
Fill the moonfield with random values in the range min..max
def randomFill(self, low=0, high=mod-1): def randomFiller(x,y, low=low, high=high): return random.randint(low, high) self.fill(randomFiller)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NewTile(field):\n var = False\n while not var:\n temp = random.randrange(0, len(field), 1)\n if field[temp] == 0:\n r = random.randrange(0, 100, 1)\n if r > 80:\n field[temp] = -4\n else:\n field[temp] = -2\n \n ...
[ "0.6547927", "0.6363217", "0.62581474", "0.6123896", "0.6114875", "0.6112529", "0.61115974", "0.6089117", "0.60342366", "0.5954066", "0.59406", "0.5868433", "0.58077395", "0.5781089", "0.5735586", "0.57292426", "0.5725517", "0.5709174", "0.5708557", "0.56889147", "0.5675421",...
0.655479
0
Take a canvas and render the moonfield on it. The radius of the halfmoons must be specified in canvas units.
def renderOnCanvas(self, canvas, radius=moonfieldViewer.R): for x in range(self.__xmax): for y in range(self.__ymax): # Make the halfmoon at x,y canvas.create_arc( radius*2*x, radius*2*y, radius*2*(x+1)-1, radius*2*(y+1)-1, sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circlePrimitive(self):\n\n def drawWireframe(self):\n\n # Draw line\n glFT.glBegin(OpenMayaRender.MGL_LINE_STRIP)\n\n # Get Color\n # self.getColor(\"edge\")\n\n def_circle = 100\n for idx in range(def_circle + 1):\n\n ...
[ "0.5596325", "0.527236", "0.5267317", "0.5222884", "0.5121671", "0.5113481", "0.5112079", "0.51002467", "0.5006017", "0.49577767", "0.49461675", "0.49051005", "0.49016312", "0.48850065", "0.48694047", "0.48683727", "0.4855251", "0.4844581", "0.48251632", "0.4763794", "0.47636...
0.7728807
0
Return a moonfield obtained by rebuilding the one that had been dumped to the given file.
def moonfield_undump(filename): return pickle.load(open(filename))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dem(file, verbose=False):\n import subprocess, os\n from uuid import uuid4\n jarCall = list(REP_DEM_JARBASE)\n jarCall[-2] = file\n if not os.path.exists(OPTIONS.JB.SCRATCH): os.makedirs(OPTIONS.JB.SCRATCH)\n jarCall[-1] = os.path.abspath(os.path.join(OPTIONS.JB.S...
[ "0.5254479", "0.5199455", "0.5056278", "0.5030532", "0.49958634", "0.49910355", "0.49443787", "0.4933189", "0.49221107", "0.49202457", "0.49138758", "0.49132457", "0.48853654", "0.48731923", "0.48621103", "0.47984117", "0.47887012", "0.47599447", "0.47252813", "0.4725085", "0...
0.5446412
0
Generate a cryptograph. Take a monochrome image (the filename of a
def makeCryptograph(imageFile, codedFile="coded.tif", dumpFile="media/rawpad.pbm"): print(os.getcwd()) pad = bitmap(dumpFile) plaintext = bitmap(imageFile) ciphertext = XOR(pad, plaintext) expandedCiphertext = ciphertext.pixelcode() expandedCiphertext.write(codedFile) return expandedCipherte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeCryptographG(root, image, codedFile=\"coded.ps\", dumpFile=\"rawpad.mfd\"):\n\n pad = moonfield_undump(dumpFile)\n ciphertext = pad.imageComplement(image)\n v = ciphertext.view(root)\n v.psprint(codedFile)\n return ciphertext, v", "def generate(self, chars, format='png'):\n im = sel...
[ "0.7001225", "0.5998753", "0.58525455", "0.5743074", "0.5738473", "0.57305825", "0.57303643", "0.5718139", "0.5708833", "0.5696355", "0.5678775", "0.565903", "0.56439596", "0.5638306", "0.5606758", "0.559986", "0.5509329", "0.5507098", "0.55001724", "0.54975194", "0.54861534"...
0.72718316
0
Generate a cryptograph. Take an image (either a PIL image of type "L" or a filename) and a file with a dump of a raw pad moonfield
def makeCryptographG(root, image, codedFile="coded.ps", dumpFile="rawpad.mfd"): pad = moonfield_undump(dumpFile) ciphertext = pad.imageComplement(image) v = ciphertext.view(root) v.psprint(codedFile) return ciphertext, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeCryptograph(imageFile, codedFile=\"coded.tif\", dumpFile=\"media/rawpad.pbm\"):\n print(os.getcwd())\n pad = bitmap(dumpFile)\n plaintext = bitmap(imageFile)\n ciphertext = XOR(pad, plaintext)\n expandedCiphertext = ciphertext.pixelcode()\n expandedCiphertext.write(codedFile)\n return ...
[ "0.74112827", "0.5874175", "0.57477146", "0.5720473", "0.5640478", "0.5629848", "0.5589144", "0.5494364", "0.5491806", "0.54778856", "0.54219174", "0.5415345", "0.5391834", "0.53862137", "0.53822064", "0.537455", "0.53732455", "0.53603226", "0.53302133", "0.5311692", "0.52953...
0.7543645
0
Not for spies, really, just for cute demos. Take a greyscale image (either an "L" image object or a filename) and produce two postscript files of halfmoons that, when superimposed, will yield the image. Return a quadruple made of the two shares and two viewers showing them.
def splitImageG(root, image, shareFile1="share1.ps", shareFile2="share2.ps"): if type(image) == type(""): image = Image.open(image).convert("L") p, v1 = makePadG(root, image.size, shareFile1) c, v2 = makeCryptographG(root, image, shareFile2) return p, c, v1, v2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration(im1, im2, num = 10, opt = 'py', outputPath = 'None'):\n\n # determin which one is the right side of the breast\n b_size = 5\n n_row, n_col = im1.shape\n side = 0\n if np.sum(im1[0:b_size,0:b_size]) < np.sum(im1[0:b_size,n_col-b_size:n_col]):\n side = 1 \n\n # flip the ri...
[ "0.59580815", "0.57319605", "0.5666899", "0.5647397", "0.5616396", "0.5591074", "0.5550293", "0.54917914", "0.54630196", "0.54307246", "0.54281276", "0.5389044", "0.53461725", "0.5320913", "0.53189945", "0.5296825", "0.5273694", "0.5267991", "0.52513266", "0.525075", "0.52354...
0.60357505
0
Encrypt a monochrome image and decrypt it, showing the results on screen (work in memory, don't save to files).
def testEncryptDecrypt(root): plaintext = bitmap("vck.gif") ciphertext, pad = encrypt(plaintext) decryptedResult = decrypt(ciphertext, pad) v1 = plaintext.view(root, "plaintext") v2 = pad.view(root, "pad (pixelcoded)") v3 = ciphertext.view(root, "ciphertext (pixelcoded)") v4 = decryptedRes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeCryptograph(imageFile, codedFile=\"coded.tif\", dumpFile=\"media/rawpad.pbm\"):\n print(os.getcwd())\n pad = bitmap(dumpFile)\n plaintext = bitmap(imageFile)\n ciphertext = XOR(pad, plaintext)\n expandedCiphertext = ciphertext.pixelcode()\n expandedCiphertext.write(codedFile)\n return ...
[ "0.63463193", "0.61998963", "0.60572505", "0.6052732", "0.60071874", "0.59531033", "0.58699334", "0.58630574", "0.5862685", "0.58160424", "0.5692689", "0.56634945", "0.56028706", "0.55618733", "0.5501264", "0.5481826", "0.5423521", "0.5374415", "0.53729236", "0.5370423", "0.5...
0.65935284
0
Demonstrate the boolean operations available in VCK by combining an image (vck.tif must be in the current directory) with a diagonal cross.
def testBooleanOps(root): letters = bitmap("vck.tif") v1 = letters.view(root, "vck") cross = bitmap(letters.size()) xmax, ymax = cross.size() r = ymax*1.0/xmax for x in range(xmax): cross.set(x, x*r) cross.set(x, x*r+1) cross.set(x, x*r-1) cross.set(x, ymax-x*r)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cross(self):\n self.assertEqual(solution.cross(solution.ROWS, solution.COLS), self.boxes)", "def show_brain(img, cut_coords=None, \n figsize=(10,5), cmap=\"nipy_spectral\",\n draw_cross = True,\n return_fig = False\n ):\n \n if(isinsta...
[ "0.55940515", "0.55658823", "0.55531025", "0.5303724", "0.53027135", "0.5215481", "0.5194644", "0.51835155", "0.51489913", "0.5147673", "0.51268923", "0.51232177", "0.5067777", "0.5017318", "0.5010345", "0.49866322", "0.49746567", "0.4965992", "0.4950514", "0.48939678", "0.48...
0.7456106
0
Split a greyscale image into two shares (postscript files).
def testSplitImageG(root): p, c, v1, v2 = splitImageG(root, "guido.tif") p.renderOnCanvas(v2.canvas()) v2.psprint("guido-decrypted.ps") return v2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitImageG(root, image, shareFile1=\"share1.ps\", shareFile2=\"share2.ps\"):\n\n if type(image) == type(\"\"):\n image = Image.open(image).convert(\"L\")\n p, v1 = makePadG(root, image.size, shareFile1)\n c, v2 = makeCryptographG(root, image, shareFile2)\n return p, c, v1, v2", "def split...
[ "0.7408066", "0.6834673", "0.6513133", "0.64576316", "0.6375847", "0.634675", "0.63456315", "0.63162243", "0.62870765", "0.62732786", "0.62268686", "0.62089974", "0.59814006", "0.5953241", "0.5953241", "0.59247196", "0.5839758", "0.57436526", "0.56770337", "0.5638628", "0.562...
0.70860046
1
Test that packrat parsing was enabled
def test_enable_pyparsing_packrat_parsing(): import pyparsing assert pyparsing.ParserElement._packratEnabled is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_parse(self):\n pass", "def test_make_tool_plugin_parse_invalid():\n mtp = setup_make_tool_plugin()\n package = Package('valid_package', os.path.join(os.path.dirname(__file__),\n 'valid_package'))\n output = \"invalid text\"\n i...
[ "0.61371994", "0.59740555", "0.5969093", "0.59328425", "0.58286375", "0.5820763", "0.5747854", "0.56952053", "0.5689685", "0.56856596", "0.5629848", "0.5592767", "0.54870564", "0.54000187", "0.52928615", "0.5260998", "0.51749104", "0.51687807", "0.51541376", "0.5144933", "0.5...
0.84438384
0
Test that pyparsing._trim_arity has been replaced
def test_disable_pyparsing_arity_trimming(): import pyparsing import dice.utilities assert pyparsing._trim_arity is dice.utilities._trim_arity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disable_pyparsing_arity_trimming_works():\n for func in [lambda a: None, lambda a, b: None, lambda a, b, c, d: None]:\n element = Literal('test').setParseAction(func)\n with raises(TypeError):\n element.parseString('test')", "def test_optimize_parse():\n assert True", "d...
[ "0.711281", "0.61242956", "0.60069615", "0.59246254", "0.57724845", "0.57588845", "0.56580096", "0.5623034", "0.5597817", "0.556037", "0.5527974", "0.55235416", "0.5513629", "0.55133563", "0.5497831", "0.5484468", "0.54644597", "0.5441194", "0.540431", "0.53548", "0.5349217",...
0.862749
0
Tests that arity trimming has been disabled and parse actions with the wrong number of arguments will raise TypeErrors
def test_disable_pyparsing_arity_trimming_works(): for func in [lambda a: None, lambda a, b: None, lambda a, b, c, d: None]: element = Literal('test').setParseAction(func) with raises(TypeError): element.parseString('test')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disable_pyparsing_arity_trimming():\n import pyparsing\n import dice.utilities\n assert pyparsing._trim_arity is dice.utilities._trim_arity", "def __check_arg_count(self):\n if len(self.args) > 6 or len(self.args) == 0:\n raise ArgError(\"Unsupported amount of arguments! (\" +...
[ "0.6583479", "0.6110803", "0.58622015", "0.5861272", "0.5859838", "0.585505", "0.58159614", "0.5777218", "0.5760543", "0.5758822", "0.57464963", "0.5741264", "0.5732394", "0.5731643", "0.57102835", "0.57033575", "0.56919837", "0.56891906", "0.5684384", "0.5670958", "0.5663268...
0.6866184
0
Get authorization header for user using the passed client.
def get_authorization_header(client, user): # obtain authorization token response = client.post( reverse('token-obtain'), data={'username': user.username, 'password': user.raw_password}, content_type='application/json' ) token = response.json()['access'] return {'HTTP_AUTHORI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_oauth_headers(self, user):\n access_token = AccessTokenFactory.create(user=user, application=ApplicationFactory()).token\n headers = {\n 'HTTP_AUTHORIZATION': 'Bearer ' + access_token\n }\n return headers", "def _get_oauth_headers(self, user):\n access_token...
[ "0.6606202", "0.6606202", "0.65720737", "0.65720737", "0.64708054", "0.60986817", "0.60356957", "0.60226136", "0.5895739", "0.5854155", "0.5800252", "0.5783965", "0.5766352", "0.57551414", "0.5745023", "0.57149726", "0.5712809", "0.56914514", "0.56868017", "0.56868017", "0.56...
0.81782097
0
Open the file and return the docx document.
def get_docx_document(docx_file: str) -> docx.Document: if os.path.isfile(docx_file): return docx.Document(docx_file) else: logging.error("Could not find file at: " + str(docx_file)) return docx.Document()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_doc(filename):\n # open the file as read only.\n with open(filename, 'r') as fp:\n return fp.read()", "def load_doc(filename):\n file = open(filename, 'r')\n text = file.read()\n file.close()\n return text", "def load_doc(filename):\n file = open(filename, 'r')\n text = ...
[ "0.6939246", "0.6820275", "0.6820275", "0.67631406", "0.6685772", "0.6578017", "0.6400751", "0.6345493", "0.6329383", "0.6304231", "0.6248296", "0.6189699", "0.61339325", "0.6116645", "0.6103893", "0.60872394", "0.6079321", "0.60725486", "0.59273493", "0.5842191", "0.58403105...
0.79042196
0
Rename output file replacing placeholders from meta dict (edition, component, language, version).
def rename_output_file(file_type: str, style: str, meta: Dict[str, str]) -> str: args_output_file: str = convert_vars.args.outputfile logging.debug(f" --- args_output_file = {args_output_file}") if args_output_file: # Output file is specified as an argument if os.path.isabs(args_output_file)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_version(version):\n filename = 'conda.recipe/meta.yaml'\n pattern = r'version: .*'\n replacement = 'version: {version}'.format(version=version)\n lines = []\n with open(filename) as meta_file:\n for line in meta_file.readlines():\n lines.append(re.sub(pattern, replaceme...
[ "0.6091523", "0.6027287", "0.59290147", "0.591457", "0.5911239", "0.5784234", "0.55994457", "0.5539033", "0.55334276", "0.5532396", "0.5529095", "0.55093235", "0.54837656", "0.5478287", "0.5463414", "0.54589385", "0.5432972", "0.5407495", "0.5383941", "0.5367489", "0.5361352"...
0.6548754
0
Replace the text in the docx document.
def replace_docx_inline_text(doc: docx.Document, data: Dict[str, str]) -> docx.Document: logging.debug(" --- starting docx_replace") if convert_vars.making_template: replacement_values = sort_keys_longest_to_shortest(data) else: replacement_values = list(data.items()) paragraphs = get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_text(self, text):\n self.clear()\n self.paragraphs[0].text = _to_unicode(text)", "def DocumentReplace(self, wave_id, wavelet_id, blip_id, content):\n op = Operation(DOCUMENT_REPLACE, wave_id, wavelet_id, blip_id,\n prop=content)\n self.__context.AddOperation(op)", ...
[ "0.6550158", "0.6284812", "0.6267964", "0.62250334", "0.6197341", "0.61367464", "0.6065157", "0.60601646", "0.59871674", "0.59497625", "0.588583", "0.58857197", "0.58528304", "0.5852493", "0.581473", "0.57980645", "0.57849985", "0.5776463", "0.57284117", "0.56931525", "0.5686...
0.73871547
0
Zip all the files recursively from path into zip_filename (excluding root path)
def zip_dir(path: str, zip_filename: str) -> None: with zipfile.ZipFile(zip_filename, "w", zipfile.ZIP_DEFLATED) as zip_file: for root, dirs, files in os.walk(path): for file in files: f = os.path.join(root, file) zip_file.write(f, f[len(path) :])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zip_dir(dir_path, zip_path):\n file_paths = glob.glob(dir_path + \"/*\") #create path to search for files.\n\n zf = zipfile.ZipFile(zip_path, 'w')\n dir_name = os.path.basename(dir_path)\n for p in file_paths:\n file_name = os.path.basename(p)\n zf.write(p, arcname=os.path.join(dir_na...
[ "0.815368", "0.800909", "0.7667411", "0.7530536", "0.74899787", "0.74849504", "0.7091973", "0.708407", "0.7012907", "0.6965188", "0.6924263", "0.6918558", "0.68827873", "0.68759257", "0.68328434", "0.67170364", "0.6677294", "0.6562033", "0.6543498", "0.6535591", "0.65342045",...
0.8318932
0
fetch the top k similar parameters as argument indices
def fetch_top_k(vect, mat, k): resultant = np.dot(mat, vect) arglist = np.argsort(resultant) arglist = arglist[-1:(-1 - k):-1] return arglist, resultant
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tops(similarities, k):\n tops = similarities.argsort(axis=1)[:, :k].tolist()\n return tops", "def indices_of_top_k(arr, k):\n return np.sort(np.argpartition(np.array(arr), -k)[-k:])", "def top_k(input, k=1, sorted=True, index_type=dtypes.int32, name=None): # pylint: disable=redefined-builtin\...
[ "0.7306273", "0.70302224", "0.6975524", "0.6865334", "0.68008673", "0.6756751", "0.67192507", "0.6700658", "0.669529", "0.6654222", "0.66084296", "0.6494168", "0.64292496", "0.63879097", "0.63829416", "0.6356177", "0.63346577", "0.6290724", "0.6277449", "0.6264", "0.6261429",...
0.73662317
0
Query available sources for sequence details. Overwrite method in subclasses to fetch data.
def _query_sequence_sources(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_sequence_sources(self):\n if self.uniprot_id:\n self._query_uniprot()\n elif self.ncbi_id:\n self._query_ncbi()\n if \"mutations\" in self.metadata.keys():\n mutations = self.metadata[\"mutations\"].split()\n del self.metadata[\"mutations\...
[ "0.7347312", "0.6428539", "0.63581556", "0.62222606", "0.6215273", "0.605844", "0.6022547", "0.60114974", "0.59975344", "0.5989412", "0.59347624", "0.58985054", "0.58523315", "0.5847188", "0.57564455", "0.57560974", "0.5731976", "0.5727327", "0.57136726", "0.5706441", "0.5665...
0.856156
0
Delete all elements between first and last positions including bounds. Optionally, provide an additional insert that shell be placed at the position of the deletion.
def delete(self, first, last, insert=""): assert all(new in self.ALPHABET for new in insert) if first < 1 or last > len(self.sequence): raise ValueError(f"Deletion {first}-{last} out of bounds for given sequence.") self.sequence = f"{self.sequence[: first - 1]}{insert}{self.sequence[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doDelete(self, upperRow, upperCol, lowerRow, lowerCol):\n if app.config.strict_debug:\n assert isinstance(upperRow, int)\n assert isinstance(upperCol, int)\n assert isinstance(lowerRow, int)\n assert isinstance(lowerCol, int)\n assert upperRow <= lo...
[ "0.55952847", "0.55635625", "0.5523364", "0.5496952", "0.54360694", "0.5378807", "0.5370156", "0.5327958", "0.5311247", "0.5301489", "0.53007907", "0.5267537", "0.52364385", "0.5230855", "0.5223544", "0.5215047", "0.5189803", "0.51681954", "0.51643956", "0.5163454", "0.515824...
0.64676976
0
Insert a sequence at the given position.
def insert(self, position, insert): assert all(new in self.ALPHABET for new in insert) if position < 1 or position - 1 > len(self.sequence): raise ValueError(f"Insertion position {position} out of bonds for given sequence.") self.sequence = f"{self.sequence[: position - 1]}{insert}{s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_at(sequence, index, element):\n # ... and the rest is up to you\n\n new_sequence = sequence[:index] + element + sequence[index:]\n return new_sequence", "def insert(self, pos, length):\n if pos in self.insertions:\n self.insertions[pos] += length\n else:\n ...
[ "0.71550727", "0.70287114", "0.6779251", "0.65152967", "0.65025556", "0.6484994", "0.64291614", "0.64140797", "0.6331637", "0.6325899", "0.6309266", "0.6307709", "0.6244849", "0.62239134", "0.6169491", "0.6159841", "0.61403745", "0.6126771", "0.6121638", "0.61068463", "0.6040...
0.78549856
0
Query available sources for sequence details. Add additional methods below to allow fetching from other sources. Perform mutations etc if given via metadata.
def _query_sequence_sources(self): if self.uniprot_id: self._query_uniprot() elif self.ncbi_id: self._query_ncbi() if "mutations" in self.metadata.keys(): mutations = self.metadata["mutations"].split() del self.metadata["mutations"] # remove mutat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_sequence_sources(self):\n pass", "def sources(self):\n raise NotImplementedError()", "def sources(self) -> Sequence[Any]:\n return pulumi.get(self, \"sources\")", "def Sources():\n return _sources", "def get_sources():\n url = base_url + \"sources\"\n params = {\"langua...
[ "0.8097473", "0.6100885", "0.60805374", "0.6005931", "0.59740376", "0.59586805", "0.5943371", "0.5855276", "0.5833726", "0.57552046", "0.5639203", "0.56306523", "0.56072867", "0.5561753", "0.55252784", "0.5504846", "0.5489657", "0.5404618", "0.53689575", "0.53590906", "0.5343...
0.7529572
1
Fetch the amino acid sequence from UniProt.
def _query_uniprot(self): import requests import json response = requests.get(f"https://www.ebi.ac.uk/proteins/api/proteins/{self.uniprot_id}") if response.status_code != 200: raise ValueError(f"Failed to fetch sequence for UniProt ID {self.uniprot_id}") response = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ammino_chain_seq(self):\n return self.ammino_chain_seq", "def get_protein_fasta(uniprot_id):\r\n url = \"http://www.uniprot.org/uniprot/{}.fasta\".format(uniprot_id)\r\n string = re.split(\"\\n\",ur.urlopen(url).read().decode(),1)[1]\r\n return re.sub(\"\\n\",\"\",string)", "def fetch_s...
[ "0.68327534", "0.6824056", "0.673438", "0.6438054", "0.6297511", "0.6046749", "0.6019707", "0.5975876", "0.58982", "0.58658123", "0.5819892", "0.58193094", "0.58126384", "0.58094496", "0.57807785", "0.5752036", "0.57341754", "0.57231337", "0.5720918", "0.57136667", "0.5696425...
0.6859231
0
Fetch the amino acid sequence from NCBI.
def _query_ncbi(self): import requests response = requests.get( f"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?" f"db=protein&id={self.ncbi_id}&rettype=fasta&retmode=text" ) if response.status_code != 200: raise ValueError(f"Failed to fet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Ab_seq(RNs):\n seq = []\n for res in range(cf.nkey):\n randi = RNs.getR()\n for i in range(20):\n if randi < cf.cumprob20[i]:\n seq.append(i + 1) # want amino acids between 1 and 20\n break\n return seq", "def readSeq(self):\n # clear bu...
[ "0.6415695", "0.6361457", "0.63236594", "0.62089646", "0.6145889", "0.60673016", "0.6062683", "0.6014599", "0.5984326", "0.5929971", "0.5848606", "0.5832283", "0.5815409", "0.57637674", "0.5723754", "0.5714167", "0.5687113", "0.5683692", "0.56290364", "0.5596451", "0.55877256...
0.7259921
0
Convert an NCBI protein accession to the corresponding UniProt ID.
def ncbi_to_uniprot(ncbi_id): import requests url = "https://www.uniprot.org/uploadlists/" params = {"from": "P_REFSEQ_AC", "to": "SWISSPROT", "format": "tab", "query": ncbi_id} response = requests.get(url, params=params) response = response.text.split("\n") if len(resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up_id_from_rx_id(reactome_id):\n react_url = 'http://www.reactome.org/ContentService/data/query/' \\\n + reactome_id + '/referenceEntity'\n res = requests.get(react_url)\n if not res.status_code == 200:\n return None\n _, entry, entry_type = res.text.split('\\t')\n if entry...
[ "0.58744323", "0.58327836", "0.58312136", "0.5826488", "0.560999", "0.55734795", "0.55658156", "0.5527375", "0.55139893", "0.5471779", "0.5445939", "0.5426472", "0.54051423", "0.53973645", "0.5395546", "0.53718233", "0.53613937", "0.53598034", "0.5337227", "0.5323168", "0.532...
0.6222745
0
Performs validation through type checking on the given value. The value should be an instance of ``typ`` to pass validation. Otherwise ``ValidationError`` is raised. If ``allow_empty`` is False, ``Missing`` is raised when the value is None.
def validate(self): if self.value is None and self.allow_empty: return self.value if self.value is None: raise Missing(f"{self.name} is required") if not type(self.value) == self.typ: raise ValidationError( f"{self.name} should be {self.typ}. "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_type_value(val, name, expected_type, allow_none=False, print_value=True, none_msg=''):\n message = name\n\n if print_value:\n message += ' of value ' + str(val)\n\n if val is None and not allow_none:\n raise ValueError(message + ' should not be None.' + none_msg)\n if not isinst...
[ "0.64157945", "0.6363033", "0.6236938", "0.6150538", "0.598982", "0.5872883", "0.5844264", "0.58251375", "0.5796149", "0.5772052", "0.5769857", "0.57654285", "0.57485723", "0.574662", "0.57443565", "0.5723437", "0.5696615", "0.5691731", "0.5691433", "0.5681707", "0.56229943",...
0.65268826
0
Given the polynomial expansion in the denominator and numerator of the controller function K and G then this function returns the poles and zeros of the closed loop transfer function in terms of reference signal the arrays for the input must range from the highest order of the polynomial to the lowest
def Poly_Zeros_T(Poly_z_K,Poly_p_K,Poly_z_G,Poly_p_G): Poly_z=numpy.polymul(Poly_z_K,Poly_z_G) Poly_p=numpy.polyadd(numpy.polymul(Poly_p_K, Poly_z_G), numpy.polymul(Poly_p_K, Poly_p_G)) # return the poles and zeros of T Zeros=numpy.roots(Poly_z) Poles=numpy.roots(Poly_p) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observables(p0,pl0,e0,rho0,nb0,derivatives,E,Pl,Rho,Nb):\r\n global g , pmin\r\n y = array([p0,0,0,0,0,0,0])\r\n r = 0 ; dr = rk_step\r\n\r\n while not isinstance(y[0],complex):\r\n l = y[6]\r\n dy = derivatives(r,y,E,Pl,Rho,Nb)\r\n if y[0] + dy[0]*rk_max_step <= pmin or Pl(y[0...
[ "0.60467046", "0.595055", "0.5762542", "0.57365304", "0.5731243", "0.5719839", "0.5620502", "0.56176364", "0.5615557", "0.55954736", "0.5594152", "0.55781645", "0.5561719", "0.55575573", "0.55421484", "0.5533695", "0.55295366", "0.55249697", "0.5521817", "0.5500973", "0.54880...
0.6169341
0
Append an ical event
def append(self, event): self.cal.add_component(event) self.size +=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_event(self, timestamp: datetime, event_type: EventType):", "def write_event(self, event):\n self.events_written.append(event)", "def add_event(self, event):\n self._warn_if_event_writer_is_closed()\n self.event_writer.add_event(event)", "def add_event(self, event_data):\n event_dat...
[ "0.69733065", "0.67928123", "0.6711852", "0.67013526", "0.67011946", "0.6671989", "0.6611609", "0.65846604", "0.65293515", "0.64909345", "0.6480856", "0.63793904", "0.6364987", "0.62900877", "0.62291545", "0.6196822", "0.617522", "0.6154197", "0.61203355", "0.60819244", "0.60...
0.7409203
0
Decode the 1D barcodes in a set of images and log the result.
def main(): stats = [] start = timer() for file_name in get_dataset(): # load image and ground truth detection mask img = cv2.imread(settings.PATH + file_name) ground_truth_mask = cv2.imread(settings.PATH_GT_MASKS + file_name) # Find list of barcode regions (rotated rectan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decoding_batch(self):\r\n\r\n # Data path\r\n cur_dir = os.path.abspath(os.path.join(os.path.realpath(__file__), '..'))\r\n img_path = os.path.join(cur_dir, 'resources', 'input_decode')\r\n img_names = os.listdir(img_path)\r\n for img_name in img_names:\r\n\r\n ...
[ "0.6372125", "0.5747843", "0.5733915", "0.57131827", "0.5696812", "0.56227416", "0.55989796", "0.5555719", "0.55344516", "0.54838777", "0.54605776", "0.545988", "0.54575324", "0.5444393", "0.5409825", "0.5386224", "0.5370383", "0.53402704", "0.5327589", "0.53238285", "0.52975...
0.63964194
0
Clears the features group list
def clear_features(self): self.features_group_list = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_Groups(self):\n\n\t\tself.__groups[:] = []", "def clear(self):\n [group.clear() for group in self.roi_groups]\n self.signal_status_message.emit('Cleared data')", "def clear(self):\n self.cb_attr.clear()\n self.group_listbox.clear()\n self.data = None\n self._...
[ "0.7862644", "0.72819334", "0.7109521", "0.7095973", "0.65692186", "0.65674514", "0.6548146", "0.648422", "0.6478382", "0.64322615", "0.6375677", "0.6356103", "0.6340664", "0.6327569", "0.63159734", "0.6313404", "0.63016254", "0.62997174", "0.62882406", "0.6277245", "0.627459...
0.93102765
0
Initialize first row and column of array with values = 1
def initArrayWithNumbers(self, array): for i in range(array.shape[0]): array[i][0] = 1 for j in range(array.shape[1]): array[0][j] = 1 return array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_one_d_array(len, val):\n return [val for i in range(len)]", "def retrun_1(x):\n ret = np.ones(len(x))\n return ret", "def solution(array):\n rows = array.shape[0]\n cols = array.shape[1]\n result = np.ones((rows,cols))\n result[1:rows-1,1:cols-1] = 0\n return result", ...
[ "0.66019726", "0.64953053", "0.62792915", "0.6143192", "0.5942737", "0.59208524", "0.5901191", "0.5849399", "0.5773588", "0.575488", "0.5726838", "0.5722176", "0.57102257", "0.5664245", "0.56531435", "0.5650586", "0.56443846", "0.5638618", "0.55994517", "0.5581435", "0.556378...
0.70962864
0
Finds fist parent of element of the given type
def findTypeParent(element, tag): p = element while True: p = p.getparent() if p.tag == tag: return p # Not found return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFirstTypeParent(start, node_type):\n parents = start.getAllParents()\n for parent in parents:\n if parent.nodeType() == node_type:\n return parent\n\n return None", "def get_ancestor(self, element_type):\n parent = self.parent\n while parent is not None:\n ...
[ "0.82822514", "0.7596108", "0.7381799", "0.72917825", "0.71402866", "0.71003413", "0.6809031", "0.6788971", "0.6776615", "0.65819633", "0.6573836", "0.6464274", "0.6399609", "0.63518083", "0.63356715", "0.6292741", "0.6281949", "0.62757623", "0.6272431", "0.6268884", "0.62633...
0.81040007
1
returns list of all skills for specific profile from profile_id through GET request
def get_skills_by_profile(profile_id=None): # get profile object profile = storage.get("Profile", profile_id) if profile is not None: result = [] # use relationship to get all skills for that profile for skills in profile.skills: # append each skill's dictionary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_skills_to_profile():\n # get specific objects\n profile = storage.get(\"Profile\", profile_id)\n skills = storage.get(\"Skills\", skills_id)\n if profile is not None and skills is not None:\n # check every skill in profile\n for profile_skill in profile.skills:\n # if t...
[ "0.69133246", "0.66342425", "0.65856653", "0.6338872", "0.6259936", "0.6162146", "0.6099772", "0.60846806", "0.59353155", "0.5879025", "0.58728546", "0.58463925", "0.57258147", "0.570384", "0.56988627", "0.5688974", "0.5644184", "0.56299645", "0.5622129", "0.56207824", "0.559...
0.8303151
0
removes specific skill from specific profile with their ids through DELETE request
def remove_skills_from_profile(profile_id=None, skills_id=None): # get specific objects profile = storage.get("Profile", profile_id) skills = storage.get("Skills", skills_id) if profile is not None and skills is not None: # check every skill in profile for profile_skill in profile.skills...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_skill(id, skill):\n with app.app_context():\n user = User.query.get(id)\n if user is None:\n return \"User not found\", 404\n skill_db = Skill.query.filter_by(name=skill).first()\n if skill_db is None:\n return \"Skill not found\", 404\n user.s...
[ "0.75606334", "0.660845", "0.6570731", "0.6341808", "0.6311867", "0.62871933", "0.6272751", "0.62726325", "0.62651616", "0.6249961", "0.6230055", "0.62095857", "0.62064105", "0.6173634", "0.6155074", "0.6049852", "0.6022258", "0.60183495", "0.60167265", "0.60048485", "0.59956...
0.8113127
0
links specific skills to specific profile through ids through POST request
def add_skills_to_profile(): # get specific objects profile = storage.get("Profile", profile_id) skills = storage.get("Skills", skills_id) if profile is not None and skills is not None: # check every skill in profile for profile_skill in profile.skills: # if the given skill i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_skills_from_profile(profile_id=None, skills_id=None):\n # get specific objects\n profile = storage.get(\"Profile\", profile_id)\n skills = storage.get(\"Skills\", skills_id)\n if profile is not None and skills is not None:\n # check every skill in profile\n for profile_skill in...
[ "0.62215006", "0.6141321", "0.6136334", "0.57999974", "0.5705954", "0.5663529", "0.558497", "0.55590993", "0.55184203", "0.5481559", "0.54679495", "0.5321111", "0.5228129", "0.5181957", "0.5173843", "0.51125044", "0.51064503", "0.5100115", "0.5055007", "0.5051161", "0.5051161...
0.7546346
0
Initializes the state of the boids as a tensor. The state of the boids stores their attributes across dimensions, such as locations, velocities, and acclerations.
def _init_boids_state(self) -> np.ndarray: dims, n_boids, n_attrs = self.dims, self.num_boids, len(Boids.Attr) max_vel, max_acc = self.max_vel, self.max_acc state = np.zeros([dims, n_boids, n_attrs], dtype="float") for idx, env_dim in zip(range(dims), self.env_bounds): state...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n super().__init__()\n\n self._model = None # type: StateSpaceModel\n self._kernel = None # type: Distribution", "def init_state(self) -> None:\n self.state = np.zeros(self.shape, dtype=int)", "def initialise_positions(self):\r\n #print(\"initia...
[ "0.641103", "0.64015085", "0.6290652", "0.61923504", "0.6124658", "0.6108405", "0.61000854", "0.60805786", "0.60086787", "0.59405243", "0.593704", "0.5917944", "0.5908505", "0.59078985", "0.59047085", "0.58944666", "0.5888651", "0.5884673", "0.58619195", "0.58615464", "0.5844...
0.7495143
0
Returns a matrix of the square of the euclidean distance between the the boid at the current index and all other boids
def compute_distance(self): loc = np.extend_dims(self.state[:, :, Boids.Attr.LOC], axis=-1) m = np.tile(loc, (1, 1, self.num_boids)) pos_diff = m-m.transpose(0, 2, 1) self.distance = np.linalg.norm(pos_diff, axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distances(self):\n N = len(self.cells) # Number of cells\n distances = np.zeros([N, N]) # distances between cells\n positions = self.position_matrix() # positions of cells \n \n # get distances between cells (exploit symmetry between upper and lower triangular form)\n ...
[ "0.65788776", "0.62750953", "0.6217638", "0.6121492", "0.6085673", "0.60633767", "0.60478675", "0.600901", "0.6004509", "0.5993548", "0.5988138", "0.5983611", "0.59626466", "0.59524053", "0.5930206", "0.5899279", "0.5891765", "0.5880584", "0.5845569", "0.5835575", "0.5826348"...
0.65351623
1
Returns an acceleration delta as the result of the alignment rule The acceleration delta is defined by the difference between a boids' orientation and a linear combination of its neighbors' orientations. The mut_influence tensor will supply the needed cofficients.
def align(self) -> np.ndarray: vel = self.state[:, :, Boids.Attr.VEL] vel_norm = np.linalg.norm(vel, axis=0) orientation = vel / (vel_norm + EPSILON) mut_influence = self._perceive(self.p_range) desired_orientation = np.dot(orientation, mut_influence) desired_orientation ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attraction(self, other: Body) -> Vector:\n dist = self.position - other.position\n dist_modsq = dist.lensq\n dist_unit = dist / math.sqrt(dist_modsq) # Unit vector\n G = 6.674384e-11\n force_mod = G * self.mass * other.mass / dist_modsq\n return dist_unit * force_mod"...
[ "0.5631432", "0.53779525", "0.5343708", "0.5326276", "0.5238663", "0.5213455", "0.52063924", "0.5198728", "0.517895", "0.5168603", "0.51656646", "0.5158626", "0.5147069", "0.5146312", "0.51226294", "0.5091565", "0.5070579", "0.50507545", "0.50394076", "0.50353134", "0.5035313...
0.59572816
0
Temporarily extends boids' p_ranges if no neighbors For a neighborless boid, temporaily increases a boid's p_range to the upper bound of proxim_bounds, else maintain at p_range.
def _extend_p_range(self) -> np.ndarray: mut_influence = self._perceive(self.p_range) neighborless = np.diagonal(mut_influence) return self.proxim_bounds[-1]*neighborless + self.p_range
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_boundaries(self):\n\n bound_conns=[]\n bound_coords=[]\n bound_vert_index=[]\n throat_vert_index=[]\n #Find boundary extent\n [x_min,x_max,y_min,y_max,z_min,z_max]=vo.vertex_dimension(self,self.pores(),parm='minmax')\n min_point = np.around(np.array([x_min,y...
[ "0.6101234", "0.5793829", "0.55662537", "0.5443786", "0.5387319", "0.53691626", "0.5328649", "0.5318401", "0.5242199", "0.5231628", "0.5195283", "0.5167414", "0.5166692", "0.51378727", "0.5109484", "0.5109263", "0.51036495", "0.51005894", "0.50930136", "0.5068288", "0.5061894...
0.6947805
0
Updates the boids' accleration by an acceleration delta.
def update_acc(self, acc_delta: np.ndarray, coeff: float) -> None: self.state[:, :, Boids.Attr.ACC] += acc_delta*coeff self.state[:, :, Boids.Attr.ACC] = maglim( self.state[:, :, Boids.Attr.ACC], self.max_acc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSpeed(self,accel,dangle,brake):\n self.dangle += dangle\n self.dangle = self.dangle * self.drag*(1-brake/3)*0.6\n self.angle += self.dangle\n self.accel = accel\n self.vx += accel * np.cos(self.angle)\n self.vy += accel * np.sin(self.angle)\n # flat cap on...
[ "0.6547468", "0.62164307", "0.6075985", "0.6019702", "0.6014206", "0.59946066", "0.59403485", "0.5915659", "0.58757704", "0.5862938", "0.5822585", "0.57710654", "0.5743851", "0.57107526", "0.5701706", "0.568265", "0.5651833", "0.5651099", "0.56291", "0.5601613", "0.5579539", ...
0.67566806
0
Append a new rule to the boids' default behavioral rules appends a new rule to the boids' existing rule
def append_rules(self, *args: Tuple[Callable, float]) -> None: for rule, _ in args: setattr(Boids, rule.__name__, rule) self.rules.update({rule: coeff for (rule, coeff) in args})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rule(self, rule):\n self.rule.append(rule)", "def add_rule(self, rule) -> None:\n self.add_rules([rule])", "def add_rule(self, rule):\n \n self.rules.append(rule)", "def add_rule(rule):\n global RULE_DICT\n\n if rule[0] not in RULE_DICT:\n RULE_DICT[rule[0]] =...
[ "0.71578425", "0.69797266", "0.69791746", "0.6923265", "0.68801445", "0.68325424", "0.6799666", "0.6794736", "0.6519926", "0.6495337", "0.6444254", "0.6375227", "0.6325688", "0.62689775", "0.6252311", "0.6248839", "0.6220549", "0.60842717", "0.60406107", "0.6034459", "0.60220...
0.7229486
0
Updates coefficient of rules
def update_coeff(self, **kwargs: float) -> None: for rule_name, coeff in kwargs.items(): if rule_name not in self.rules: raise ValueError(f"Behavioral rule {rule_name} does not exist") else: self.rules[getattr(self, rule_name)] = coeff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_acc_by_rules(self) -> None:\n for rule, coeff in self.rules.items():\n acc_delta = rule(self) # can't call self.rule\n self.update_acc(acc_delta, coeff)", "def coefficient(self) -> float:\n ...", "def updateCoeff(self, **args):\n for par in args:\n ...
[ "0.7021181", "0.6503927", "0.6470416", "0.6426122", "0.5931218", "0.5844983", "0.58382565", "0.5831694", "0.58292526", "0.5770156", "0.56280273", "0.5623547", "0.56131375", "0.558246", "0.5574215", "0.55633146", "0.55625576", "0.5557575", "0.5522799", "0.551493", "0.5499725",...
0.77729297
0
Limits the magnitude of the input matrix/vector along the 0th axis. This function will only activate if the magnitude of the input is greater than the specified limit.
def maglim(arr: np.ndarray, limit: float) -> np.ndarray: norm = np.linalg.norm(arr, axis=0) return arr / np.where(norm>limit, norm/limit, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit(self, lim: float):\n if self.mag() > lim:\n self.values = tuple(self.norm()*lim)\n return self", "def limit_vec(self, vec, limit=None):\n mag = np.linalg.norm(vec)\n if not limit:\n limit = self.vec_mag_limit\n\n if mag < limit:\n retu...
[ "0.6425002", "0.639677", "0.58209056", "0.58038825", "0.5767511", "0.56844366", "0.559588", "0.55820006", "0.5580737", "0.54883015", "0.54722536", "0.54082", "0.540348", "0.53970385", "0.5388405", "0.5331233", "0.53288496", "0.52706766", "0.5270119", "0.52564836", "0.52482295...
0.6473633
0
Get the tag handler.
def _get_tag_handler(holder): return TagHandler(holder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_handler(self):\n return self._Handler(self)", "def getHandler(self):\n raise NotImplementedError(\"Shouldn't be called\")", "def get_handler(cls):\n if not cls.hnd:\n raise ValueError((\"You must set handler by using set_hnd() method, \"\n \"...
[ "0.7390751", "0.70873034", "0.70747286", "0.6681303", "0.6602314", "0.64641625", "0.6440971", "0.6412648", "0.6359679", "0.6359679", "0.635592", "0.6303713", "0.61454725", "0.6129054", "0.6048078", "0.60089046", "0.60020477", "0.59126776", "0.5908906", "0.58600235", "0.582110...
0.82849914
0
Search all objects having a given tag and optional category. Return all objects (characters, rooms) matching the search query, in no specific order.
def search(cls, tag_name: str, category: ty.Optional[str] = None ) -> ty.Set[db.Entity]: tags = cls.select(lambda t: t.name == tag_name) if category is not None: tags = tags.filter(category=category) objects = set() for tag in tags: for obj in tag.obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def search(self, ctx: Context, category: str, *, query: str) -> None:\n if category not in config.basic_search_categories:\n await ctx.send(f\"Invalid Category! ```Available Categories : {', '.join(config.basic_search_categories)}```\")\n return\n await self._basic_search(...
[ "0.61743087", "0.5757445", "0.5729092", "0.5714598", "0.5711094", "0.57100546", "0.5600094", "0.55246806", "0.55111974", "0.5492803", "0.5490088", "0.54680336", "0.5434262", "0.541594", "0.5407207", "0.53957635", "0.53823465", "0.5378291", "0.5363373", "0.53506255", "0.533964...
0.73592836
0
Return all the tags on this object, in the given category.
def with_category(self, category: str) -> list: return list(self.__holder.db_tags.filter( lambda t: t.category == category))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj_categories(self):\r\n return self._tags", "def tag(self, category_tagger={}):\n self.tags.update(category_tagger)\n return self.tags", "def search(cls, tag_name: str, category: ty.Optional[str] = None\n ) -> ty.Set[db.Entity]:\n tags = cls.select(lambda t: t.name ...
[ "0.72470844", "0.6895858", "0.68126684", "0.6623663", "0.6261047", "0.62491196", "0.62253946", "0.6223657", "0.617257", "0.6166665", "0.6159755", "0.6157589", "0.6147112", "0.6143004", "0.61422914", "0.6136447", "0.61342096", "0.61030024", "0.60924834", "0.6087911", "0.607700...
0.8041095
0
Handles a request to a grit application by feeding it through the pipeline set up in the application config. The final element of the pipeline is typically the Dispatcher, which dispatches the request either to a subapplication or a request handler. Other pipeline elements are . TxWrapper, which initializes the databas...
def handle_request(request, *args, **kwargs): root = request.route.grit_params["root"] logger.info("WSGIApplication::handle_request path: %s method: %s", request.path_qs, request.method) reqctx = RequestCtx(request, request.response, kwargs) def run_pipeline(l): if l: handler_cls = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app(self) -> traits.RESTAware:", "def app(self) -> traits.RESTAware:", "def __call__(self, *args, **kwargs):\n\t\treturn self.handler()(self.request(kwargs))", "def process_request(self, req):\n req.context = self.make_context(req)", "def pipeline(ctx):\n asyncio.run(pipeline_impl(ctx.obj[\"c...
[ "0.55649227", "0.55649227", "0.54985476", "0.54326373", "0.53876936", "0.52995735", "0.52364475", "0.52364475", "0.5178268", "0.51756144", "0.51714", "0.5149646", "0.5129351", "0.5089516", "0.5083932", "0.50790006", "0.50751257", "0.5045947", "0.5028837", "0.50211316", "0.501...
0.62153035
0
Node advertises a Node type mDNS announcement with ver_ TXT records in the absence of a Registration API
def test_01(self, test): api = self.apis[NODE_API_KEY] if CONFIG.DNS_SD_MODE != "multicast": return test.DISABLED("This test cannot be performed when DNS_SD_MODE is not 'multicast'") ServiceBrowser(self.zc, "_nmos-node._tcp.local.", self.zc_listener) # Wait for n s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arp_announce(self):\n pass", "def _Announce(self):\n key = self._GetServerKey(self.peer_id)\n logging.debug('Encrypting announcement.')\n value = self._Encrypt('%s:%d' % (self.host, self.port))\n logging.debug('Posting announcement.')\n self._dht.Put(key, value)", "def test_adddnsreco...
[ "0.58849066", "0.58719283", "0.55826145", "0.5537382", "0.54082507", "0.5305669", "0.5230102", "0.52278024", "0.51270974", "0.5118239", "0.5091226", "0.50118995", "0.5008273", "0.50034016", "0.49943268", "0.49788436", "0.49406862", "0.4939622", "0.4922022", "0.4916725", "0.48...
0.6180619
0
Set the IO pins direction of use as either input or output. If resistor is not None, only an output direction on the pin can be used.
def set_dir(self, dir, resistor=None): self.IN = mraa.DIR_IN self.OUT = mraa.DIR_OUT self.PULL_UP = mraa.DIR_OUT_HIGH self.PULL_DOWN = mraa.DIR_OUT_LOW if dir not in (mraa.DIR_OUT, mraa.DIR_IN): # incorrect arguments passed in raise Exception("Incorrect pi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pin_direction(self, pin, direction):\n pin = pin - 1\n if pin < 8:\n self.__port_a_direction = self.__helper.updatebyte(\n self.__port_a_direction, pin, direction)\n self.__bus.write_byte_data(\n self.__ioaddress, self.IODIRA, self.__port_a_...
[ "0.61990273", "0.59651965", "0.5712942", "0.5556715", "0.55221224", "0.5499385", "0.54466933", "0.54257834", "0.5368346", "0.533255", "0.5320318", "0.52283466", "0.5209405", "0.5146044", "0.5129886", "0.5101642", "0.50995606", "0.50891316", "0.5050393", "0.50453216", "0.50453...
0.72490793
0
Execute document indexing with given options
def execute_(options): # initialize configuration config = Configuration() # set formatting and redirect logger output to console (stdout) fmt = logging.Formatter("%(asctime)s: [ %(message)s ]", "%m/%d/%Y %I:%M:%S %p") console = logging.StreamHandler() console.setFormatter(fmt) logger = log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_documents(DomainName=None):\n pass", "def option_search(args):\n print(\"= SEARCH =\")\n print()\n print(\"Index file:\\t\\t{}\".format(args.indexfile))\n print(\"QE enabled:\\t\\t{}\".format(args.queryexpansion))\n if not os.path.exists(args.indexfile):\n raise OSError(\"No su...
[ "0.665944", "0.66010916", "0.65042526", "0.64679635", "0.6442658", "0.6383008", "0.6379554", "0.6309592", "0.6149711", "0.61225575", "0.6075539", "0.60249144", "0.5970656", "0.5935891", "0.5919974", "0.5918913", "0.58848995", "0.5884015", "0.5858732", "0.58433425", "0.5789127...
0.7544036
0
Parses a speed in N.NNx format
def parse_speed(as_str: str) -> float: return float(as_str.rstrip("x"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_speed_ms(self):\n xknx = XKNX(loop=self.loop)\n sensor = Sensor(\n xknx,\n 'TestSensor',\n group_address_state='1/2/3',\n value_type=\"speed_ms\")\n sensor.sensor_value.payload = DPTArray((0x00, 0x1b,))\n\n self.assertEqual(sensor...
[ "0.59168065", "0.57169265", "0.5648697", "0.5614916", "0.55387485", "0.54947567", "0.5481302", "0.546624", "0.5388698", "0.5378634", "0.5369194", "0.5330012", "0.52841556", "0.52841556", "0.52822226", "0.5273008", "0.52728057", "0.52705544", "0.52695155", "0.5227184", "0.5205...
0.6761596
0
Makes the fd with the given number unbuffered
def unbuffer_fd(fileno: int): fcntl.fcntl(fileno, fcntl.F_SETFL, fcntl.fcntl(fileno, fcntl.F_GETFL) | os.O_NONBLOCK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNonBlocking(fd):\n flags = fcntl.fcntl(fd, fcntl.F_GETFL)\n flags = flags | os.O_NONBLOCK\n fcntl.fcntl(fd, fcntl.F_SETFL, flags)", "def setNonBlocking(fd):\n\n import fcntl\n\n flags = fcntl.fcntl(fd, fcntl.F_GETFL)\n flags = flags | os.O_NONBLOCK\n fcntl.fcntl(fd, fcntl.F_SETFL, fla...
[ "0.6721954", "0.6677031", "0.6642116", "0.6503985", "0.59729093", "0.5880701", "0.5825916", "0.5762", "0.55968446", "0.55225", "0.545276", "0.5408295", "0.53971344", "0.53867716", "0.5341515", "0.53174305", "0.5292797", "0.52739173", "0.52726823", "0.52119046", "0.51980495", ...
0.7850452
0
Parses log lines and try to find the most recent progress log
def process_logs(lines: Sequence[str]) -> Optional[Progress]: for line in reversed(lines): raw_status = dict(PROGRESS_RE.findall(line)) if raw_status: LOGGER.debug(raw_status) try: return Progress.from_raw_dict(raw_status) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parselog(filen, progress=0):\n\n # Process a file and return a populated logfile object\n #\n # Maximum size of text buffer to use\n bufsize = 50\n # Initial size of chunks to process\n chunksize = 50\n # Regular expression object\n regex = patternmatch()\n # Buffer objects\n buff...
[ "0.6663905", "0.65600365", "0.6549606", "0.6464251", "0.6427406", "0.63401806", "0.6339228", "0.6189355", "0.611719", "0.611494", "0.60878724", "0.5995834", "0.59651095", "0.5953685", "0.59022427", "0.5836189", "0.58231217", "0.5819332", "0.577752", "0.5772057", "0.57680726",...
0.7453415
0
Sends a stop signal the running ffmpeg process. Raises `RuntimeError` if ffmpeg is not running.
def stop(self): if not self.ffmpeg: raise RuntimeError("ffmpeg is not running") self.ffmpeg.send_signal(signal.SIGINT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def async_stop_ffmpeg(self):\n return self.ffmpeg.close()", "def stop(self):\n if self._proc_is_alive():\n\n if os.name == 'nt':\n # os.killpg is not available on Windows\n # See: https://bugs.python.org/issue5115\n self._proc.kill()\n\n ...
[ "0.71782357", "0.65574616", "0.6426135", "0.630364", "0.6288393", "0.6271376", "0.61770505", "0.61292684", "0.6119764", "0.61035895", "0.6064683", "0.60510534", "0.604966", "0.6037311", "0.6027255", "0.5995974", "0.5995836", "0.5977587", "0.5972965", "0.5972965", "0.59546506"...
0.85106707
0
Nearest neighbor algorithm. A is an NxN array indicating distance between N locations start is the index of the starting location Returns the path and cost of the found solution
def NN(A): A = np.array(A) path = [0] cost = 0 N = A.shape[0] mask = np.ones(N, dtype=bool) # boolean values indicating which # locations have not been visited mask[0] = False for i in range(N-1): last = path[-1] next_ind = np.argmin(A[la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dijkstra(grid,start,end, heuristic_cost=null_heuristic):\n return a_star(grid,start,end, heuristic_cost)", "def shortest_path(N, a_0, a_1=None):\n path = HJ_path(a_1*N, a_0*N)\n path = [c/d/N for c, d in path]\n return path", "def a_star(start: Vector2D, goal: Vector2D, grid: Scene, heuristic: ...
[ "0.68307453", "0.649503", "0.64640605", "0.6367975", "0.6341499", "0.6321802", "0.6265098", "0.62211084", "0.62197375", "0.6209912", "0.6203883", "0.6162819", "0.6151186", "0.61108226", "0.61098117", "0.6084825", "0.60834485", "0.6063341", "0.605831", "0.60542953", "0.6038042...
0.7770427
0
Serialize and sync config with trains
def update_config(config: OmegaConf): # expected config_global format schema = OmegaConf.structured(config._metadata.object_type) # serialize config # For config logging we use yaml format (Trains: Artifacts -> Model configuration) # save config in a temp yaml file config_global_file = tempfil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_config(self):\n try:\n print(\"Clearing active users\")\n for room in self.rooms:\n room.room_attrbts['active'].clear()\n print('Saving config...')\n print(\"Known clients:\")\n self.pp.pprint(self.clients)\n print(\"K...
[ "0.63680726", "0.62565494", "0.60836035", "0.60825515", "0.60202646", "0.6019191", "0.5997849", "0.59705126", "0.59296525", "0.5899515", "0.58539534", "0.57819426", "0.5778849", "0.5770601", "0.57524097", "0.57503784", "0.57208854", "0.5717648", "0.5698998", "0.5695949", "0.5...
0.6447348
0
Main test program calculates score for program. It first tests the getEuler method on graphs in test files. Then tests it on randomly generated undirected simple graphs.
def main(): dirPath = "./tests/" score = 0 # Run test files to check correctness print("\n======================= TEST CORRECTNESS =======================\n") print("\n------- There are no Euler circuits in the first two tests -----\n") score += 4 - testInput(dirPath + "disconnected", 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n test = TesterNeighbour()\r\n test.setUp()\r\n test.test_result_n()\r\n print(\"result_of_algorithm_test - passed\")", "def testDriver():\n exam1=90\n exam2=85\n assignmentScores = [50, 60, 70, 80, ]\n computeGrades(exam1, exam2, assignmentScores)", "def main():\n grap...
[ "0.696306", "0.67919636", "0.6725287", "0.65254366", "0.64116526", "0.64007914", "0.63393736", "0.6326266", "0.62680435", "0.62680423", "0.62652576", "0.62574565", "0.6235062", "0.6194972", "0.61702234", "0.6135317", "0.61095923", "0.60870665", "0.60427105", "0.60209143", "0....
0.8242494
0
Tests the getEuler method for a graph. Prints the results.
def testOnGraph(graph): print("Graph has " + str(graph.totalVertices()) + " vertices, and " + str(graph.totalEdges()) + " edges.") circuit = graph.findEuler if (circuit is None): print("Graph has no Euler Circuit") return 0 elif (isValidEuler(graph, circuit)): print("Va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindEulerCycle(self):\n\n if self.IsEulerGraph():\n nodes_copy = [n for n in self.nodes]\n edges_copy = [e for e in self.edges]\n connections_copy = [(a, b) for (a, b) in self.connections]\n euler_cycle = list()\n\n starting_node_index = random.rand...
[ "0.62757117", "0.62112796", "0.5911731", "0.5793879", "0.5645929", "0.5617068", "0.5448576", "0.5327997", "0.53233737", "0.5322592", "0.531852", "0.5252856", "0.52205455", "0.5206971", "0.5174406", "0.5174288", "0.5161026", "0.5157217", "0.5141315", "0.51329046", "0.51275337"...
0.69095933
0
Verifies whether a walk is a valid Euler circuit for a graph.
def isValidEuler(graph, circuit): # First check if the path is a circuit if not circuit.isCircuit(): print("Error: Path returned is not a circuit") return False # Then check if the circuit has the correct number of edges circuitLength = circuit.length() totalEdges = graph.totalEdge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOnGraph(graph):\n print(\"Graph has \" + str(graph.totalVertices())\n + \" vertices, and \" + str(graph.totalEdges()) + \" edges.\")\n circuit = graph.findEuler\n if (circuit is None):\n print(\"Graph has no Euler Circuit\")\n return 0\n elif (isValidEuler(graph, circuit)...
[ "0.7077891", "0.6748674", "0.671496", "0.66013277", "0.646215", "0.61688495", "0.6031889", "0.60264033", "0.59228605", "0.5884901", "0.58279693", "0.58067167", "0.5763232", "0.57263094", "0.57240915", "0.56921077", "0.56534195", "0.5619454", "0.5601871", "0.5574548", "0.55597...
0.773384
0