query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This function changes list of pictures and call help_main function, which create display for pictures
def help_update_str(): global picture_lst picture_lst = ["test/update1.jpg", "test/update2.jpg", "test/update3.jpg", "test/update4.jpg", "test/update5.jpg", "test/update6.jpg"] help_main()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_main_but():\n global picture_lst\n picture_lst = [\"test/main.png\", \"test/main2.jpg\", \"test/main3.jpg\", \"test/main4.jpg\", \"test/main5.jpg\",\n \"test/main6.jpg\"]\n help_main()", "def help_load_file():\n global picture_lst\n picture_lst = [\"test/load1.png\", \"t...
[ "0.79425746", "0.73836595", "0.73811275", "0.72621405", "0.7133004", "0.6876637", "0.66291463", "0.6532651", "0.6516761", "0.6424798", "0.63387024", "0.62726146", "0.6183507", "0.60914105", "0.6088568", "0.6069086", "0.6051887", "0.60462165", "0.60432994", "0.60386354", "0.60...
0.77630895
1
This function displays the help window and sets the base picture
def forward(): global my_iterator, iterable, canvas, help_window, forward_button, image try: iterable = next(my_iterator) pill_image = Image.open(iterable) image = ImageTk.PhotoImage(pill_image) canvas.create_image(10, 10, anchor=NW, image=image) help_window.mainloop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advanced_help(self, master, helpText):\r\n osName = platform.system()\r\n popHelp = Toplevel()\r\n popHelp.grid()\r\n winH = 0\r\n winW = 0\r\n if osName == 'Windows':\r\n winH = 300 * WIN_SCALE\r\n winW = 400 * WIN_SCALE\r\n elif osName ==...
[ "0.73189175", "0.7190062", "0.71479684", "0.706672", "0.7060949", "0.6942171", "0.6936415", "0.687681", "0.6875518", "0.68695897", "0.6822802", "0.68087476", "0.6770278", "0.67591894", "0.6671781", "0.6671781", "0.66247714", "0.6584681", "0.65500015", "0.65222883", "0.6520766...
0.0
-1
This function allows you to process the list of pictures and display them on the screen
def help_main(): global help_window, my_iterator, iterable, canvas, forward_button, picture_lst, image my_iterator = iter(picture_lst) pill_image = Image.open(image_base) image = ImageTk.PhotoImage(pill_image) canvas = Canvas(help_window, width=700 + 15, height=490 + 15) canvas.create_image(10,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_imgs(img_dir,img_list):\n for img in img_list:\n display_img(img_dir, img)", "def displayPicture(self):\n size = 0\n image = None\n for url in self.__imageList:\n im = Image.open(requests.get(url, stream=True).raw)\n height, weight = im.size\n ...
[ "0.81997085", "0.78418124", "0.75920194", "0.72652036", "0.6936187", "0.6872061", "0.6844369", "0.6740941", "0.6690921", "0.6686519", "0.6643934", "0.66293555", "0.66269916", "0.65662026", "0.65644515", "0.65527403", "0.6545706", "0.6534102", "0.65303874", "0.6500039", "0.647...
0.0
-1
Read in the material data from the material database.
def read_material_data(self, material): material_yaml_file = glob.glob(os.path.join(material_dir, material + '.yaml')) inputs = utilities.yaml_reader(material_yaml_file, material_dir, material) self.name = inputs['Name'] self.materialName = material self.elements = inputs['Eleme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_all():\n # Query the database for all the materials\n materials = Material.query.order_by(Material.family_id, Material.material_name).all()\n\n # Serialize the list of materials from our data\n material_schema = MaterialSchema(many=True, exclude=[\"family.materials\"])\n data = material_sch...
[ "0.71424776", "0.66165495", "0.6378552", "0.6362262", "0.6314939", "0.62842715", "0.6042298", "0.59660155", "0.59192973", "0.5802709", "0.57972896", "0.57700974", "0.5761436", "0.5720924", "0.56990093", "0.5696563", "0.56369025", "0.562053", "0.56137866", "0.5604925", "0.5596...
0.6612797
2
Create a material based on the data from the material database.
def create_material_data(self): for num, zaid in enumerate(self.enrichmentZaids): enriched_isotope_dict = {} for isoNum, isotopes in enumerate(self.enrichmentIsotopes[num]): enriched_isotope_dict[isotopes] = self.enrichmentVector[num][isoNum] self.enrichmentDi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(family_id, material):\n # get the parent family\n family = Family.query.filter(Family.family_id == family_id).one_or_none()\n\n # Was a family found?\n if family is None:\n abort(404, f\"Family not found for Id: {family_id}\")\n\n # Create a material schema instance\n schema = M...
[ "0.6878708", "0.67428756", "0.6482157", "0.62919706", "0.62456435", "0.6221243", "0.6193749", "0.6030492", "0.6000505", "0.5976781", "0.5975966", "0.5921028", "0.59049356", "0.5898126", "0.58538455", "0.57992667", "0.5799235", "0.5794137", "0.5772259", "0.5765052", "0.5759379...
0.64906377
2
Adjust the element's natural abundance to compensate for enrichment.
def set_elemental_enrichment(self): for elementEnrichement, zaidVector in self.enrichmentDict.items(): for zaid, enrichmentPercent in zaidVector.items(): self.elementDict[elementEnrichement].weightPercentDict[zaid] = enrichmentPercent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normal_abnormal(self):\n mp_pool()\n print(\"Classification of WCE to normal vs abnormal --> DONE\")", "def __deriveElementalWeightsByNaturalNuclideAbundances():\n for element in elements.byName.values():\n numer = 0.0\n denom = 0.0\n for nb in element.getNaturalIsotopi...
[ "0.57051605", "0.54225665", "0.54017174", "0.5270537", "0.52331305", "0.5229417", "0.5192499", "0.51712704", "0.51697654", "0.5167327", "0.51232815", "0.5111488", "0.5110367", "0.50913906", "0.50826037", "0.5043937", "0.50328887", "0.5024053", "0.49982327", "0.49904492", "0.4...
0.5740942
0
Calculates the weight percent of a material.
def set_weight_percent(self, void_percent=1.0): weight_total = 0.0 for zaidNum, zaid in enumerate(self.zaids): for isotope, isotopeFraction in self.elementDict[zaid].weightPercentDict.items(): if isotopeFraction != 0.0: self.weightPercent[isotope] = isotop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWeight(self) -> float:\n ...", "def weight(self) -> float:\n self.sanitize(raise_exception=False)\n return Descriptors.ExactMolWt(self.rd_mol)", "def calculate_weight(self, element, total_cores_used, total_disk_used,\n total_memory_used):\n cpu_capacit...
[ "0.6778616", "0.66045725", "0.66026527", "0.6512171", "0.6507674", "0.64926773", "0.6436281", "0.64110833", "0.6392683", "0.6337113", "0.6324131", "0.63018006", "0.62751645", "0.62480426", "0.6246338", "0.623802", "0.623802", "0.62005895", "0.61958903", "0.61779964", "0.61770...
0.6889777
0
Adjust the atom density/atom percent of a material to account for voiding.
def set_void(self, void_percent): self.set_weight_percent(void_percent) self.atomDensity, self.atomPercent = set_atom_percent(self.weightPercent, self.density, self.elementDict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_atom_fractions(self, void_percent=1.0):\n for zaidNum, zaid in enumerate(self.zaids):\n for isotope, isotopeFraction in self.elementDict[zaid].atomPercentDict.items():\n if zaid in self.isotopicAtomPercents:\n print(self.elementDict[zaid].weightPercentDic...
[ "0.5972262", "0.5922541", "0.57685566", "0.5742786", "0.57123256", "0.56042546", "0.5561478", "0.54767036", "0.53915685", "0.53881294", "0.53662884", "0.5363659", "0.5363659", "0.5342414", "0.531014", "0.53071153", "0.52754444", "0.5274383", "0.51955503", "0.51866984", "0.517...
0.60428965
0
Calculates the atom density of a material given a material with atom densities defined.
def set_atom_fractions(self, void_percent=1.0): for zaidNum, zaid in enumerate(self.zaids): for isotope, isotopeFraction in self.elementDict[zaid].atomPercentDict.items(): if zaid in self.isotopicAtomPercents: print(self.elementDict[zaid].weightPercentDict[isotope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Density(material):\n if material == \"mild\":\n return 7850.0\n else:\n if material == \"al\":\n return 2700.0\n else:\n raise ValueError(\"Invalid material `\"+material+\"'\")", "def GetDensityForShape(*args):\n return _XCAFDoc.XCAFDoc_MaterialTool_Get...
[ "0.7006211", "0.65377265", "0.64411473", "0.6376021", "0.6268337", "0.6262631", "0.6240578", "0.6213191", "0.6193817", "0.61501926", "0.6084178", "0.6075045", "0.60393673", "0.5935808", "0.5922256", "0.5920612", "0.5896682", "0.5895164", "0.58939546", "0.58643734", "0.5850352...
0.0
-1
Converts the weight percent of a material to the atom percent and atom density.
def set_atom_percent(weight_percents, density, element_dict): atom_densities = {} atom_percent = {} for zaid, weight in weight_percents.items(): element = str(zaid) if len(element) < 5: current_element = int(element[:1] + '000') else: current_element = int(ele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Density(material):\n if material == \"mild\":\n return 7850.0\n else:\n if material == \"al\":\n return 2700.0\n else:\n raise ValueError(\"Invalid material `\"+material+\"'\")", "def atomWeight(matID):\n mat = goodID(matID)\n compound = xl.CompoundParse...
[ "0.64119893", "0.59639645", "0.57990247", "0.56953514", "0.562632", "0.5625964", "0.54547775", "0.5433132", "0.540137", "0.53775764", "0.5360344", "0.52982795", "0.5252613", "0.52484334", "0.5236156", "0.52221453", "0.5220146", "0.5213132", "0.5144586", "0.51058364", "0.50965...
0.70738566
0
Create the material data card for a smeared material.
def get_smeared_material(materials, void_material='', void_percent=1.0): smear_material = {} for material, materialWeightPercent in materials.items(): void_multiplier = 1.0 if material == 'Void': pass else: base_material = Material() base_material.set_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_material_data(self):\n for num, zaid in enumerate(self.enrichmentZaids):\n enriched_isotope_dict = {}\n for isoNum, isotopes in enumerate(self.enrichmentIsotopes[num]):\n enriched_isotope_dict[isotopes] = self.enrichmentVector[num][isoNum]\n self.en...
[ "0.6239184", "0.5838182", "0.5823315", "0.5809612", "0.5803698", "0.57793164", "0.56875765", "0.5664696", "0.56497055", "0.55801505", "0.55265605", "0.5521103", "0.5520303", "0.5515589", "0.5510146", "0.5486669", "0.5461987", "0.54357195", "0.54301006", "0.5421089", "0.538638...
0.61714965
1
Returns a smeared material for the coolant and wire wrap.
def smear_coolant_wirewrap(info): height = info[0] fuel_radius = info[1] / 2 wirewrap_radius = info[2] / 2 wire_wrap_axial_pitch = info[3] fuel_pitch = info[4] coolant_material = info[5] clad_material = info[6] fuel_volume = utilities.get_cylinder_volume(fuel_radius, height) wire_wra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_smeared_material(materials, void_material='', void_percent=1.0):\n smear_material = {}\n for material, materialWeightPercent in materials.items():\n void_multiplier = 1.0\n if material == 'Void':\n pass\n else:\n base_material = Material()\n base_...
[ "0.66321373", "0.62594223", "0.60387546", "0.5944046", "0.5875552", "0.5739568", "0.56960857", "0.56770736", "0.564192", "0.55646825", "0.5525133", "0.5470988", "0.5465184", "0.54306227", "0.54144156", "0.5376519", "0.5360755", "0.5315837", "0.52805245", "0.52402693", "0.5233...
0.7692396
0
Generates a kubernetes config from a kustomize template All parameters are configurable in the invoke config
def kustomize(ctx, path=None, output_file=None): cmd = ctx.get('kustomize_cmd', 'kustomize') kustomize_root = ctx.get('kustomize_root', 'k8s') build_path = path or ctx.get('kustomize_path', join(kustomize_root, 'overlays', ctx['env'])) output_string = '-o {}'.format(output_file) if output_file else '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_template(self) -> cconfig.Config:", "def generate_haproxy_config(template=None, instances=None):\n\n return Template(filename=template).render(instances=instances)", "def export_scraper_kubernetes_config(filename_template, experiments,\n contents_template, ...
[ "0.6615139", "0.61634254", "0.6152234", "0.60913444", "0.60837996", "0.60783774", "0.5980321", "0.59794945", "0.59225446", "0.58424973", "0.58103037", "0.5769593", "0.5748882", "0.5738248", "0.5714511", "0.5577814", "0.5558549", "0.5553356", "0.55321664", "0.5517282", "0.5506...
0.68263984
0
Finds the pareto front, i.e. the pareto dominant solutions.
def _pareto_front(teams_population, novelty): for team in teams_population: team.dom_by_ = 0 team.dom_of_ = 0 front = [] dominateds = [] for teamA in teams_population: for teamB in teams_population: # check if there are teams ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pareto_frontier(self) -> Tuple[Tensor, Tensor]:\n raise NotImplementedError(\"Pareto frontier not yet implemented.\")", "def pareto_front_cut(self):\n return self.NDA([kernel.objective_values for kernel in self.kernels \\\n if kernel.objective_values is not None],\n ...
[ "0.6347055", "0.6301714", "0.6221045", "0.5980256", "0.5856892", "0.5821961", "0.5495132", "0.549147", "0.5490508", "0.5476367", "0.5469471", "0.5450582", "0.54449403", "0.53219175", "0.5274065", "0.5214968", "0.52133995", "0.5212093", "0.5197233", "0.5162972", "0.5153386", ...
0.66619694
0
Check if a solution is domninated or equal to another, assuming that higher results are better than lower ones.
def _is_dominated(teamA, teamB, novelty): if (teamB.fitness_ >= teamA.fitness_ and teamB.diversity_[novelty] >= teamA.diversity_[novelty] and ((teamB.fitness_ > teamA.fitness_ and not is_nearly_equal_to(teamA.fitness_, teamB.fitness_)) or (teamB.diversity_[novelty] > teamA....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dominates(self, other):\n at_least_as_good = all(s <= o for s, o in zip(self.scores, other.scores))\n better_in_some_respect = any(s < o for s, o in zip(self.scores, other.scores))\n\n return at_least_as_good and better_in_some_respect", "def dominates(obj1, obj2):\r\n indicator = Fal...
[ "0.76156557", "0.6864491", "0.6659109", "0.64177674", "0.64068395", "0.640622", "0.63531184", "0.63237095", "0.6236788", "0.6108801", "0.6085843", "0.60785174", "0.6005172", "0.5974256", "0.5972757", "0.59573954", "0.59234536", "0.5914746", "0.5893265", "0.5885522", "0.588454...
0.68252283
2
If a directory does not exist, create it.
def mkdir_p(path): try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dir_if_doesnt_exist(dir_path):\n if not os.path.exists(dir_path):\n os.makedirs(dir_path)\n return", "def create_directory_if_not_exists(directory_path):\n os.makedirs(directory_path, exist_ok=True)", "def create_directory(dir_path):\r\n if not os.path.exists(dir_path):\r\n ...
[ "0.84811324", "0.84565175", "0.8370963", "0.83575743", "0.8304016", "0.8238036", "0.8188436", "0.818484", "0.818484", "0.8175315", "0.816422", "0.816422", "0.816422", "0.816422", "0.816422", "0.81605583", "0.8157574", "0.8154168", "0.8154073", "0.8154073", "0.81411254", "0....
0.0
-1
This helper function just uses the targetpath to extract the shapename
def get_shp_file(self): files = os.listdir(self.targetpath) file = files[0].split('.')[0] return self.targetpath + '/' + file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _HandleTargetPath(self, target_path):\n target_path = target_path.strip('/')\n bucket_id, unused_slash, path_in_bucket = target_path.partition('/')\n return bucket_id, path_in_bucket", "def test_path_basename():\n mock_path = \"E:\\\\Repos\\\\pc-setup\\\\powershell\\\\provision_python.ps1\"\n ...
[ "0.66777307", "0.62640786", "0.625805", "0.61832654", "0.6159013", "0.59796685", "0.59773374", "0.59422845", "0.5922217", "0.58801436", "0.5866622", "0.58515364", "0.5830707", "0.5825387", "0.5780092", "0.5780052", "0.5774511", "0.57384986", "0.5714872", "0.57106626", "0.5681...
0.59841496
5
Returns the full path of the final (uncompressed) shapefile
def filename(self): _, tail = os.path.split(self.url) return self.folder + '/' + tail[:-4] + '/' + tail[:-3] + 'shp'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shp_file(self):\n files = os.listdir(self.targetpath)\n file = files[0].split('.')[0]\n return self.targetpath + '/' + file", "def filename(self):\n return os.path.basename(self._spatial_filename)", "def get_file_full_path(self):\n return self.save_dir + os.sep + self...
[ "0.74278766", "0.64146143", "0.61104494", "0.6057461", "0.605376", "0.60332054", "0.5975038", "0.59692514", "0.59462243", "0.586062", "0.58414674", "0.58365583", "0.58347934", "0.5832067", "0.5812978", "0.58093446", "0.58087647", "0.5803587", "0.57945704", "0.5789323", "0.578...
0.70179445
1
Returns the path of the local (downloaded) zip file
def zipname(self): _, tail = os.path.split(self.url) return self.folder + '/' + tail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_ReportsZipPath(self):\n path_to_zip_file = self.xbrl_download_dir + '\\Informes.zip'\n return path_to_zip_file", "def getZipArchiveFullPath(self):\n\n if self._mode == \"zip\":\n return self._rootExportPath + \".zip\"\n\n return \"\"", "def get_zipfile_path(url,...
[ "0.7133516", "0.709186", "0.7052304", "0.67431414", "0.6729529", "0.6682555", "0.6651933", "0.66154504", "0.65643615", "0.65585375", "0.64418876", "0.64405274", "0.6428813", "0.63516", "0.63464946", "0.6346317", "0.6336631", "0.62781155", "0.6277847", "0.6277847", "0.6265609"...
0.681256
3
Returns the folder path for unzip location (same name as zipfile)
def dirname(self): _, tail = os.path.split(self.url) return self.folder + '/' + tail[:-4]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zipname(self):\n _, tail = os.path.split(self.url)\n return self.folder + '/' + tail", "def getZipArchiveFullPath(self):\n\n if self._mode == \"zip\":\n return self._rootExportPath + \".zip\"\n\n return \"\"", "def unzip_file(path_to_zip_file: str, dir_to_extract_to: ...
[ "0.73470795", "0.7271013", "0.70324916", "0.6980988", "0.68663573", "0.67971087", "0.6564444", "0.64905655", "0.64746135", "0.6423368", "0.64165545", "0.64151853", "0.6386143", "0.6345518", "0.6337802", "0.6264535", "0.6258273", "0.61156636", "0.6075614", "0.6073631", "0.6068...
0.59148234
30
Takes the URL and extracts the table name based on filename
def tablename(self): _, tail = os.path.split(self.url) return tail[:-4]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_table_name(url):\n try:\n return urlparse(url).path.strip('/').split('/')[1]\n except IndexError:\n return None", "def convertTableName(fileName: str):\n if m := pattern.match(fileName):\n return m.group(\"tableName\")", "def get_table_from_dataset_path(ds...
[ "0.8116714", "0.6845925", "0.6461912", "0.6457437", "0.63222957", "0.6306733", "0.62379616", "0.6237906", "0.60564196", "0.6036914", "0.601242", "0.60033494", "0.59999204", "0.5986188", "0.58853424", "0.58568525", "0.581859", "0.5806277", "0.5776187", "0.57597035", "0.5732305...
0.7307592
1
Returns the shpfile info in the format shp2pgsql needs
def shpname(self): _, tail = os.path.split(self.url) return self.folder + ('/' + tail[:-4]) * 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shapshot_info(qcowf, ss_offset):\n qcowf.seek(int(ss_offset)+12)#length of id\n len_id = qcowf.read(2)\n len_id = struct.unpack('>H', len_id)\n\n qcowf.seek(int(ss_offset)+14)#length of name\n len_name = qcowf.read(2)\n len_name = struct.unpack('>H', len_name)\n\n qcowf.seek(int(ss_off...
[ "0.5495842", "0.5445684", "0.52829593", "0.52474034", "0.51641226", "0.5149622", "0.5123918", "0.5064583", "0.502691", "0.49665922", "0.49257147", "0.49116912", "0.49004054", "0.48878777", "0.48724437", "0.48684594", "0.48587266", "0.48520553", "0.48469713", "0.48455408", "0....
0.0
-1
Returns the full path of the final (uncompressed) shapefile
def run(self): command = ("shp2pgsql -I -s 4326 -d {} {}.{}|psql").format(self.shpname(), self.schema, self.tablename()) self.pgw.shell(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shp_file(self):\n files = os.listdir(self.targetpath)\n file = files[0].split('.')[0]\n return self.targetpath + '/' + file", "def filename(self):\n _, tail = os.path.split(self.url)\n return self.folder + '/' + tail[:-4] + '/' + tail[:-3] + 'shp'", "def filename(self...
[ "0.74278766", "0.70179445", "0.64146143", "0.61104494", "0.6057461", "0.605376", "0.60332054", "0.5975038", "0.59692514", "0.59462243", "0.586062", "0.58414674", "0.58365583", "0.58347934", "0.5832067", "0.5812978", "0.58093446", "0.58087647", "0.5803587", "0.57945704", "0.57...
0.0
-1
Run some commands on a remote host.
def run_remotely(username, address, commands, port=22): return Effect(RunRemotely( username=username, address=address, commands=commands, port=port))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_remote(ipaddr, command):\n\n\treturn execute(['ssh', '-f', '-t', '-oPasswordAuthentication=no',\n\t\t'-l', 'alt', ipaddr, command])", "def run_ssh(self, commands):\n identity_file = self.ssh_keys_private.get('root')\n conn = get_ssh_conn(self.ip_address, identity_file=identity_file)\n ...
[ "0.7470057", "0.71017545", "0.705206", "0.6936262", "0.69022465", "0.6875782", "0.68295854", "0.6815731", "0.6720564", "0.6570794", "0.65618455", "0.65581673", "0.6545677", "0.653016", "0.6527113", "0.6519", "0.6518625", "0.6506977", "0.64970636", "0.6496187", "0.62741613", ...
0.65816426
9
Run a shell command on a remote host.
def run(command): return Effect(Run(command=command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh(host_=None):\n run_command_on_selected_server(open_shell, host_=host_)", "def execute_remote(ipaddr, command):\n\n\treturn execute(['ssh', '-f', '-t', '-oPasswordAuthentication=no',\n\t\t'-l', 'alt', ipaddr, command])", "def execute_over_ssh(cmd, ssh, cwd=None, shell='bash'):\n port = None\n p...
[ "0.76004213", "0.7483789", "0.7370638", "0.7229267", "0.71617603", "0.7080486", "0.6838938", "0.6738889", "0.669617", "0.66663575", "0.6651115", "0.66463304", "0.66299087", "0.6612199", "0.65171385", "0.64853966", "0.64671046", "0.64588445", "0.6453881", "0.6417447", "0.63852...
0.0
-1
Run a shell command on a remote host with sudo.
def sudo(command): return Effect(Sudo(command=command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_shell_and_run_su_user(driver):\n global sudo_results\n cmd = 'sudo ls /var/lib/sudo'\n sudo_results = ssh_sudo(cmd, host, 'ericbsd', 'testing')", "def sudo(self, script, *args, **kwargs):\n return self._run('sudo', script, *args, **kwargs)", "def sudo_subprocess(command, environment=No...
[ "0.731115", "0.69078445", "0.6687307", "0.6599232", "0.6552791", "0.65431005", "0.6532725", "0.6423601", "0.6387818", "0.63546616", "0.6227134", "0.6208304", "0.6147234", "0.6145686", "0.6144694", "0.61430246", "0.6142701", "0.6127885", "0.61182", "0.60464144", "0.59921855", ...
0.6990591
1
Create a file with the given content on a remote host.
def put(content, path): return Effect(Put(content=content, path=path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_content_to_file(\n vm_name, file_name, content=config.TEXT_CONTENT,\n vm_executor=None\n):\n command = ECHO_CMD % (content, file_name)\n return _run_cmd_on_remote_machine(vm_name, command, vm_executor)", "def write_remote_file(sid, path, data):\n with slycat.web.server.remote.get_session...
[ "0.6651096", "0.6555246", "0.65259326", "0.6323192", "0.6305615", "0.62884504", "0.6267451", "0.62600976", "0.6232476", "0.616867", "0.6152561", "0.61277485", "0.6113248", "0.6068161", "0.5963198", "0.59464216", "0.59212387", "0.59114516", "0.5850127", "0.5828734", "0.5800728...
0.0
-1
Record a comment to be shown in the documentation corresponding to a task.
def comment(comment): return Effect(Comment(comment=comment))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment(self, comment):\r\n\r\n core.FW_conf['connection'].comment(comment)", "def cli(ctx, comment, metadata=\"\"):\n return ctx.gi.cannedcomments.add_comment(comment, metadata=metadata)", "def comment():", "def comment(self, comment: str):\n\n self._comment = comment", "def comment(s...
[ "0.6946464", "0.6839067", "0.6809453", "0.6738576", "0.6738576", "0.66777056", "0.66684735", "0.6638487", "0.66173565", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.66052246", "0.64562595", "0...
0.57091665
55
Run a command on a remote host. This quotes the provided arguments, so they are not interpreted by the shell.
def run_from_args(command): return Effect(Run.from_args(command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_remote(ipaddr, command):\n\n\treturn execute(['ssh', '-f', '-t', '-oPasswordAuthentication=no',\n\t\t'-l', 'alt', ipaddr, command])", "def execute_remote_cmd(ip, user, cmd, timeout=10, suppress_output=False):\n cmd = \"ssh -o StrictHostKeyChecking=no %s@%s \\\"%s\\\"\" % (user, ip, cmd)\n l.inf...
[ "0.72855353", "0.69158375", "0.66972923", "0.66607344", "0.63648075", "0.6304905", "0.6188655", "0.61696726", "0.61534214", "0.60774004", "0.6062434", "0.60599905", "0.60233504", "0.6008754", "0.59659916", "0.5950795", "0.592406", "0.5847339", "0.5816316", "0.5809154", "0.580...
0.0
-1
Run a command on a remote host with sudo. This quotes the provided arguments, so they are not interpreted by the shell.
def sudo_from_args(command): return Effect(Sudo.from_args(command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sudo(command):\n return Effect(Sudo(command=command))", "def sudo(self, script, *args, **kwargs):\n return self._run('sudo', script, *args, **kwargs)", "def sudo_subprocess(command, environment=None, shell=False):\n sudo = '/usr/bin/sudo'\n #check if we've been passed an iterable or a strin...
[ "0.720367", "0.71116996", "0.6575359", "0.65090317", "0.63917536", "0.6276574", "0.621761", "0.61792326", "0.6110883", "0.6103212", "0.60678804", "0.6061076", "0.6055272", "0.6053011", "0.6008199", "0.599101", "0.59807026", "0.5938771", "0.5887863", "0.5876875", "0.5800341", ...
0.7261695
0
Write to invoice_file all other parameters. If invoice_file exists append, else new
def add_furniture(invoice_file, customer_name, item_code, item_description, item_monthly_price): with open(invoice_file, "a+") as passed_csv: csv_writer = csv.writer(passed_csv, delimiter=',', lineterminator='\n') csv_writer.writerow([customer_name, item_code, item_description, item_monthly_price])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_furniture(invoice_file, customer_name, item_code, item_description,\n item_monthly_price):\n add_line = [customer_name, item_code, item_description, item_monthly_price]\n with open(invoice_file, \"a+\", newline=\"\") as file:\n file_write = csv.writer(file)\n file_write...
[ "0.6355147", "0.6000983", "0.5830138", "0.5747909", "0.57349044", "0.5717122", "0.57094413", "0.5617954", "0.5610167", "0.5608352", "0.5599389", "0.5582126", "0.557653", "0.5549714", "0.5542313", "0.5532071", "0.5531101", "0.5515582", "0.55137223", "0.5482978", "0.54709476", ...
0.65328264
0
Create function to curry customer_name and invoice_file for add_furniture
def single_customer(customer_name, invoice_file): def customer_rental(rental_items): """ Loop through rental_items file and append each row to curried invoice_file with same customer_name """ customer = partial(add_furniture, invoice_file=invoice_file, customer_name=customer_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_customer(customer_name, invoice_file):\n def customer_rental(rental_items):\n \"\"\"Closure to add single customer details\"\"\"\n with open(rental_items, 'r', newline='') as rentals:\n reader = csv.reader(rentals)\n add_invoice_items = partial(add_furniture, invoi...
[ "0.792377", "0.77332824", "0.7487173", "0.6835596", "0.6785258", "0.6430023", "0.634362", "0.60337305", "0.59824455", "0.58750504", "0.58009964", "0.5692271", "0.54978555", "0.53667754", "0.5289584", "0.5270777", "0.52136415", "0.5209183", "0.51590586", "0.5138142", "0.513643...
0.803983
0
Loop through rental_items file and append each row to curried invoice_file with same customer_name
def customer_rental(rental_items): customer = partial(add_furniture, invoice_file=invoice_file, customer_name=customer_name) with open(rental_items, "r") as rental_csv: for row in csv.reader(rental_csv): customer(item_code=row[0], item_description=row[1], item_monthly_price=r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_rental(rental_items):\n with open(rental_items, 'r', newline='') as rentals:\n reader = csv.reader(rentals)\n add_invoice_items = partial(add_furniture, invoice_file, customer_name)\n for row in reader:\n add_invoice_items(item_code=row[0],\n ...
[ "0.7658972", "0.67179143", "0.65718687", "0.6480623", "0.64166206", "0.64045084", "0.61987185", "0.6101383", "0.6043975", "0.6015696", "0.5919876", "0.5629334", "0.5546214", "0.5532705", "0.5362652", "0.5360632", "0.53073716", "0.5276745", "0.5262303", "0.5254163", "0.5254014...
0.6442575
4
Add memory and learn
def step(self, state, action, next_state, reward, is_done): state = state.astype('float32') next_state = next_state.astype('float32') self.memory.push(state, action, next_state, reward, is_done*1.) if len(self.memory) > self.batch_size: experience = self.memory.sample(self.b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learn_from_memory():\n\n # Get a random minibatch from the replay memory and learns from it.\n if agent.memory.size > args.batch_size:\n s1, a, s2, isterminal, r = agent.memory.get_sample(args.batch_size)\n\n q = agent.get_q_values(s2).cpu().data.numpy()\n q2 = np.max(q, axis=1)\n\n ...
[ "0.7014484", "0.67839587", "0.67839587", "0.6405744", "0.6341193", "0.6324903", "0.6263211", "0.61680615", "0.6160995", "0.6145434", "0.6111768", "0.6102797", "0.6068112", "0.6056911", "0.60407424", "0.60407424", "0.60253936", "0.5966162", "0.59457546", "0.5913437", "0.588878...
0.0
-1
Start setter. Also adds start position as root in nodes tree. Raise exception if s position is nonexistent or occupied.
def start(self, s): if s is not None: if self.charMap[s[0]][s[1]].c == "1": # wall print("[Error] Invalid start position.", file=sys.stderr) raise UserInputException try: self.charMap[s[0]][s[1]] = CharMapCell(3) except IndexEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self, start: pos.Pos) -> None:\n self.__start = start", "def set_starting_pos(self):\n if self.start and self.is_unoccupied(*self.start):\n self.current_pos = self.start[:]\n else:\n self.set_random_pos('starting')", "def set_start_pos(self, start_pos):\n ...
[ "0.68785596", "0.68763584", "0.67034364", "0.64853793", "0.6435945", "0.63806355", "0.6226598", "0.61423135", "0.6120722", "0.6118055", "0.60489506", "0.6041604", "0.5977694", "0.590638", "0.590638", "0.590638", "0.590638", "0.5894897", "0.58449125", "0.5830393", "0.58269316"...
0.7155249
0
End setter. Raise exception if e position is nonexistent or occupied.
def end(self, e): if e is not None: if self.charMap[e[0]][e[1]].c in ["1", "3"]: # wall or start print("[Error] Invalid end position.", file=sys.stderr) raise UserInputException try: self.charMap[e[0]][e[1]] = CharMapCell(4) ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self, end: pos.Pos) -> None:\n self.__end = end", "def _set_end(self, coordinates):\n self._end = coordinates", "def end(self) -> pos.Pos:\n return self.__end", "def end (self):\n return self._end if self._end != self.inf else self.e", "def end(self, end):\n\n sel...
[ "0.6942056", "0.65282995", "0.64921516", "0.6274082", "0.61936074", "0.61936074", "0.61936074", "0.61865526", "0.61027116", "0.60362554", "0.5967699", "0.5932613", "0.5924512", "0.59088475", "0.5858222", "0.58360934", "0.5801321", "0.579298", "0.579298", "0.579298", "0.578462...
0.71403795
0
Reads map from file and save it at charMap attribute. Raise exception if map file is not found.
def read(self, filename): try: with open(filename) as f: line = f.readline() while line: charLine = line.strip().split(',') l = [] for c in charLine: l.append(CharMapCell(c)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_map_file(filename):\n\n char_map = {}\n\n comment_pattern = r'#.*$'\n comment_regex = re.compile(comment_pattern)\n\n try:\n with open(filename) as mapfile:\n for line in mapfile:\n line = comment_regex.sub(\"\", line)\n line = line.strip()\n ...
[ "0.6719685", "0.6276671", "0.5967251", "0.5937029", "0.5818556", "0.5798427", "0.5779811", "0.57254493", "0.5720013", "0.5699773", "0.56770283", "0.56561714", "0.56312644", "0.55790895", "0.5568862", "0.5544906", "0.5523356", "0.5522929", "0.5499309", "0.5497237", "0.5479893"...
0.70331043
0
Check if cell is end or not visited and add it to tree nodes.
def check(self, cell, node): self.n_checked += 1 if( self.charMap[cell[0]][cell[1]] == '4' ): # end return node.myId elif ( self.charMap[cell[0]][cell[1]] == '0' ): # empty newNode = Node(cell[0], cell[1], len(self.nodes), node.myId) self.charMap[cell[0]][c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_adj_nodes(self):\n\n for x, row in enumerate(self.grid):\n for y, cell in enumerate(row):\n if x-1 >= 0:\n cell.above = self.grid[x-1][y]\n if y+1 < len(self.grid[0]):\n cell.right = self.grid[x][y+1]\n if ...
[ "0.59315574", "0.58631754", "0.57864785", "0.57118577", "0.5659919", "0.55606645", "0.5521971", "0.5503676", "0.5491862", "0.54597443", "0.5422849", "0.53985804", "0.539017", "0.53452873", "0.5342217", "0.5342217", "0.5342217", "0.53192717", "0.53167254", "0.5315962", "0.5315...
0.48770857
82
Set cell as current for displaying reasons.
def set_current(self, cell): if self.aux is not None: self.charMap[self.aux[0]][self.aux[1]].is_current = False self.aux = cell self.charMap[cell[0]][cell[1]].is_current = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_change_current(self):\n\n # Add exception handling for case when new row is added to unmodified file to avoid crash\n try:\n if self.check_cell_change:\n row = self.csv_data_table.currentRow()\n col = self.csv_data_table.currentColumn()\n ...
[ "0.712428", "0.6909218", "0.6481031", "0.64398044", "0.6349584", "0.62911284", "0.62911284", "0.6284106", "0.60889435", "0.6020969", "0.5974405", "0.5971483", "0.59589314", "0.594331", "0.58936125", "0.58742833", "0.5872844", "0.584892", "0.58379185", "0.5736245", "0.57244974...
0.7455061
0
Set all cells as not news for displaying reasons.
def clear_news(self): for row in self.charMap: for c in row: c.is_new = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_cells(self):\n for index in range(0, 9):\n cell = getattr(self, 'cell_' + str(index))\n cell.config(state=DISABLED)", "def cells_off(self):\n self.plotter.cells_off(self.ax)\n self.fig.canvas.draw()", "def reset(self):\r\n self._cells = [ [0 for dum...
[ "0.63755906", "0.5658254", "0.55495757", "0.55495477", "0.5543785", "0.55149907", "0.55124176", "0.549704", "0.54951626", "0.54830384", "0.546032", "0.5444433", "0.54270226", "0.53753173", "0.537151", "0.5365851", "0.53350466", "0.5330353", "0.53057486", "0.5303426", "0.52900...
0.6274183
1
Set all cells as not visited, clear tree nodes and reser checked cells counter.
def reset(self): self.nodes = [] self.start = self.start self.end = self.end for row in self.charMap: for c in row: if c == "2": c.c = "0" self.n_checked = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_visited(self):\n self.__visited = False", "def cell_setLeaf(self, curr):\r\n curr.n_count = 0\r\n return", "def reset(self):\r\n # replace with your code\r\n for row in range(0, self._grid_height):\r\n for col in range(0, self._grid_width):\r\n ...
[ "0.6694965", "0.6592553", "0.6555045", "0.6448469", "0.64426607", "0.63172984", "0.6266281", "0.62570244", "0.6246257", "0.62340647", "0.61984485", "0.6176044", "0.61566675", "0.615334", "0.61527544", "0.6111782", "0.61082333", "0.6097741", "0.6068501", "0.6059537", "0.604492...
0.6323089
5
Goes through the nodes tree to find the path found.
def get_route(nodes, goalParentId): print("%%%%%%%%%%%%%%%%%%%") route = [] ok = False while not ok: for node in nodes: if( node.myId == goalParentId ): route.insert(0, node) node.dump() goalParentId = node.parentId if( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Find_Path(self):\n closed_nodes_map = [] # map of closed (tried-out) nodes\n open_nodes_map = [] # map of open (not-yet-tried) nodes\n dir_map = [] # map of directions\n row = [0] * self.n\n for i in range(self.m): # create 2d arrays\n closed_nodes_map.append(list(...
[ "0.6728191", "0.6725814", "0.6699903", "0.65695447", "0.6567905", "0.6521103", "0.6516508", "0.6491645", "0.6429434", "0.639764", "0.6392933", "0.6367705", "0.6301358", "0.6298645", "0.62574273", "0.6247552", "0.6230995", "0.618227", "0.61582357", "0.6153822", "0.61382973", ...
0.0
-1
Prints the statistical results obtained with a certain format.
def print_results(results): print() print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print("%% RESULTS %%") print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print() print("Route \t Cells \t") print("Length\tChecked\t Time") print("--------------------------------") print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_results():\n now_time = time.time()\n diff_time_in_sec = now_time - start_time\n generated_per_second = total / diff_time_in_sec\n generated_per_hour = 3600 * generated_per_second\n saved_per_second = success / diff_time_in_sec\n saved_per_hour = 3600 * saved_per_second\n\n os.system...
[ "0.7506107", "0.73828995", "0.7245905", "0.7204499", "0.71939254", "0.70919615", "0.70678526", "0.7062476", "0.70574224", "0.70333666", "0.7020387", "0.6972043", "0.69648933", "0.6964832", "0.69200766", "0.691272", "0.689942", "0.689622", "0.68788344", "0.6861918", "0.6849482...
0.7086726
6
This function creates a rectangle representing the ROI on an image.
def overlayROI(Image, pt1, pt2, colour=(0, 0, 255), weight=3): if isinstance(Image, str): roiView = cv2.imread(Image) else: roiView = Image cv2.rectangle(roiView, pt1, pt2, colour, weight) # ROI_overlay_Name = "image_withROI.jpg" # cv2.imwrite(ROI_overlay_Name, roiView) return ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawRectangle(img, top_left, bottom_right, color = (0,0,255), thickness = 3):\n\tcv2.rectangle(img, top_left, bottom_right, color, thickness)", "def draw_rectangle(image, rect, color=(0,255,255)):\n x,y,w,h = rect\n cv2.rectangle(image, (x,y), (x+w,y+h), color, 3)\n return image", "def draw_rectan...
[ "0.720591", "0.7094911", "0.7062148", "0.70147365", "0.68810683", "0.6870141", "0.68368596", "0.67766196", "0.66660345", "0.65711164", "0.6570867", "0.6522308", "0.65122247", "0.6486683", "0.64737606", "0.64584535", "0.6447159", "0.6447159", "0.64184815", "0.64016515", "0.634...
0.63608557
20
Deletes a list of files in the current working directory (or with a relative path to the file).
def cleanFiles(a_file_list): for entry in a_file_list: cmd = 'sudo rm ' + entry os.system(cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_files(file_list):\n###############################################################################\n for fpath in file_list:\n if os.path.exists(fpath):\n os.remove(fpath)\n # End if\n # End for", "def delete_files(src_files):\n for i, src_file in enumerate(src_files)...
[ "0.7681146", "0.7342622", "0.72560227", "0.72442174", "0.72149247", "0.7199949", "0.69961345", "0.6985785", "0.69741106", "0.6955694", "0.69102764", "0.6862502", "0.6817767", "0.6777019", "0.6762577", "0.66766524", "0.6643055", "0.6610461", "0.65953046", "0.65306336", "0.6524...
0.6894238
11
Saves a reference picture and an accompanying difference picture to /saved_images/ in the current working directory.
def saveMotionDiffPair(aMotionImg, aDiffImg, aTimestamp, aTag): motionImgName = './saved_images/' + aTimestamp + aTag + '.jpg' diffImgName = './saved_images/' + aTimestamp + aTag + 'diff.jpg' cv2.imwrite(motionImgName, aMotionImg) cv2.imwrite(diffImgName, aDiffImg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_img(self):\r\n self.extract_info_from_file()\r\n path_0 = os.path.join(self.output_path, self.field_id, self.patient_id + self.ext)\r\n path_1 = os.path.join(self.output_path, self.field_id + '_' + self.instance, self.patient_id + self.ext)\r\n if self.shot == '0': # first sho...
[ "0.706071", "0.6954861", "0.6775793", "0.6679474", "0.63764745", "0.6267105", "0.62616324", "0.61953914", "0.6180397", "0.61716527", "0.6164669", "0.6147488", "0.61230916", "0.6097626", "0.6087242", "0.6083324", "0.601656", "0.5958957", "0.59300005", "0.59122884", "0.5903185"...
0.61618084
11
Will erode and then dilate an image a set number of times.
def erodeThenDilate(aImg, aKernelSize, aIterationsErode, aIterationsDilate): kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (aKernelSize, aKernelSize)) erodedImg = cv2.erode(aImg, kernel, iterations=aIterationsErode) dilatedImg = cv2.dilate(erodedImg, kernel, it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dilateImage(frame, interations=2 ):\n return cv2.dilate(frame, None, iterations=2)", "def dilate(image, iterations, kernel_size=(5, 5)):\n kernel = np.ones(kernel_size, np.uint8)\n image = cv2.dilate(image, kernel, iterations=iterations)\n return image", "def delete_all_images(self, index):\n ...
[ "0.62405246", "0.60861903", "0.5994465", "0.594241", "0.5771356", "0.5756219", "0.5744127", "0.57018226", "0.5684512", "0.56539184", "0.5640855", "0.55728686", "0.5532998", "0.5532909", "0.55139565", "0.5504118", "0.54828435", "0.5466541", "0.5459345", "0.54554796", "0.542121...
0.5724264
7
Will dilate and then erode an image a set number of times.
def dilateThenErode(aImg, aKernelSize, aIterationsDilate, aIterationsErode): kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (aKernelSize, aKernelSize)) dilatedImg = cv2.dilate(aImg, kernel, iterations=aIterationsDilate) erodedImg = cv2.erode(dilatedImg, kernel, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_all_images(self, index):\n self.__accessed_image[:] = False\n self.__check_delete_images()", "def delete_any_image(self, index):\n self.__accessed_image[index] = False\n self.__check_delete_images()", "def dilateImage(frame, interations=2 ):\n return cv2.dilate(frame, None, iterations...
[ "0.6281137", "0.6220283", "0.61669844", "0.5958564", "0.59307873", "0.5707694", "0.5697314", "0.56664956", "0.561231", "0.56062305", "0.55741495", "0.5556041", "0.55404866", "0.5526424", "0.5501318", "0.54982936", "0.5495505", "0.54820246", "0.5464272", "0.54130936", "0.53762...
0.5495022
17
Will perform the cv2 close operation on an image with a supplied kernel size.
def closeImage(aImg, aKernelSize): kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (aKernelSize, aKernelSize)) imgToClose = np.ndarray.copy(aImg) return cv2.morphologyEx(imgToClose, cv2.MORPH_CLOSE, kernel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closing(img, kernel):\n return cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)", "def closing(img, kernel = (5,5)):\n\ttmp = grayscale(img)\n\tk = np.ones(kernel, np.uint8)\n\treturn cv2.morphologyEx(tmp, cv2.MORPH_CLOSE, k)", "def morphologicalCloseImage(input_img, input_mode, stel=50, output_path=None)...
[ "0.71369916", "0.70792645", "0.671198", "0.6522336", "0.60474676", "0.60404617", "0.60299605", "0.6013882", "0.5999484", "0.5999484", "0.599614", "0.599614", "0.5957011", "0.5887619", "0.57013613", "0.5606918", "0.55500656", "0.55485415", "0.5494814", "0.54410523", "0.5425918...
0.7415862
0
Will perform the cv2 open operation on an image with a supplied kernel size.
def openImage(aImg, aKernelSize): kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (aKernelSize, aKernelSize)) imgToJoin = np.ndarray.copy(aImg) return cv2.morphologyEx(imgToJoin, cv2.MORPH_OPEN, kernel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opening_image(img, kernelSize=(4,4)):\n\n kernel = np.ones(kernelSize, np.uint8)\n return cv.morphologyEx(img, cv.MORPH_OPEN, kernel)", "def opening(img, kernel = (5,5)):\n\ttmp = grayscale(img)\n\tk = np.ones(kernel, np.uint8)\n\treturn cv2.morphologyEx(tmp, cv2.MORPH_OPEN, k)", "def opening(img, ke...
[ "0.72848976", "0.6829455", "0.6727168", "0.63418067", "0.63418067", "0.58024263", "0.5726842", "0.5686477", "0.5683024", "0.56766963", "0.56628484", "0.55771744", "0.55771744", "0.54886824", "0.54546475", "0.54535484", "0.5445776", "0.5436338", "0.54294664", "0.5410496", "0.5...
0.66342497
3
Takes a list of two ROI points and extracts the x,y pairs that makes up this ROI.
def xyFromROI(aROIPoints): pt1 = aROIPoints[0] pt2 = aROIPoints[1] x0, y0 = pt1 x1, y1 = pt2 return x0, y0, x1, y1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def afficher_points_2D(set_points):\n X, Y = [p[0][0] for p in set_points], [p[0][1] for p in set_points]\n return(X, Y)", "def convert_shapely_points_to_tuples(list_of_points) -> list:\n return [(p.x, p.y) for p in list_of_points]", "def find_obstacle_loc(self, obstacle_list):\n\n x_obst =...
[ "0.66329336", "0.6383057", "0.6255719", "0.62015814", "0.61615396", "0.6008022", "0.6007293", "0.5977887", "0.5976967", "0.59528244", "0.5932191", "0.5911589", "0.59030205", "0.5898188", "0.5877641", "0.586304", "0.5857344", "0.5854106", "0.58280975", "0.5813919", "0.5803706"...
0.73372746
0
Will remove the blobs that are smaller than the specified amount in an image.
def removeSmallBlobs(aDiffImg, aMinArea): # First let us get a list of all the blob areas in the picture blobs, numBlobs = getBlobs(aDiffImg) blobAreaList = getBlobAreaList(blobs, numBlobs) # Extract the labels we want to remove. The label is index+1. labelList = list() for index in range(len(b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size_filter(db, threshold):\n idx2rm = []\n for i, x in db.iterrows():\n if x['size'] < threshold:\n idx2rm.append(i)\n\n print(\"Numero de imagenes: \",len(db)-len(idx2rm),\" de \", len(db))\n return db.drop(idx2rm)", "def remove_small_objects(img, min_size=7500):\n img2 = n...
[ "0.70217144", "0.654012", "0.63129383", "0.63080096", "0.62526983", "0.61300766", "0.5933446", "0.59267145", "0.5919248", "0.59090453", "0.59090453", "0.588557", "0.5872041", "0.58580405", "0.5851809", "0.5838447", "0.56530607", "0.56007165", "0.5590379", "0.5580091", "0.5575...
0.6408585
2
Labels all blobs in an image and gives a count of how many there are.
def getBlobs(aDiffImg): # Get the blobs and number of blobs present in the diff image # Returned as (blobs, num_blobs) return ndimage.label(aDiffImg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_image(image):\n \n #Label the blobs using ndimage\n labeled_blobs, n_features = ndimage.label(b_image)\n \n #calculate the center of mass of each labelled feature\n centers = ndimage.center_of_mass(b_image, labeled_blobs, np.arange(n_features) + 1)\n \n return labeled_blobs, n_fea...
[ "0.6986971", "0.6802597", "0.6727697", "0.6519466", "0.6519401", "0.6509179", "0.64929754", "0.64482576", "0.64359516", "0.6434438", "0.6432851", "0.64273655", "0.64195573", "0.640973", "0.6405099", "0.6390278", "0.6388595", "0.63581777", "0.6344433", "0.63441384", "0.6341060...
0.67864203
2
Give blob and contour data and statistics for a supplied difference image.
def getBlobStatistics(aDiffImg): # Avoid modifying original image, take a copy diffToAnalyse = np.ndarray.copy(aDiffImg) # Get the number of blobs present in the diff image blobs, num_blobs = getBlobs(aDiffImg) # Get the area of all blobs in picture contours, hierarchy = cv2.findContours(diffT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_image_stats(self, image):\n ti = image\n image_data = ti.data\n if not ti.data:\n return ti\n ti.size = len(image_data)\n try:\n with connect(Blobby) as c:\n ti.shahash = c.get_data_bhash(image_data)\n except o.Exception, e...
[ "0.58736897", "0.587175", "0.5855929", "0.57700926", "0.57581383", "0.5716692", "0.5712425", "0.5709784", "0.56439084", "0.55087656", "0.5496739", "0.5445337", "0.5425442", "0.5422044", "0.53891593", "0.5356671", "0.5350178", "0.5340862", "0.53199863", "0.5300444", "0.5236212...
0.6104837
0
Algorithm similar to simple3Diff() but with blurring of the diffs before comparisons.
def blur3Diff(aImgkMin2, aImgkMin1, aImgk, aTimestamp, aROIPoints, aThreshold, aSaveImages=False): x0, y0, x1, y1 = xyFromROI(aROIPoints) ROIkMin2 = aImgkMin2[y0:y1, x0:x1] ROIkMin1 = aImgkMin1[y0:y1, x0:x1] ROIk = aImgk[y0:y1, x0:x1] # Create two sets of difference images, one from ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_difference():", "def diff_image(images):\n prev_image = cv2.absdiff(images[0], images[1])\n cur_image = cv2.absdiff(images[1], images[2])\n return cv2.bitwise_and(prev_image, cur_image)", "def approximately_equal(new_data, old_data):\n absolute_difference = 0\n for i in [0, 1] if len...
[ "0.6460433", "0.5812309", "0.5776946", "0.5762013", "0.57468545", "0.568286", "0.56775904", "0.5657951", "0.56509876", "0.56102353", "0.5580713", "0.55426943", "0.55166334", "0.5507752", "0.54874486", "0.54869384", "0.54841775", "0.54781616", "0.5472756", "0.54597867", "0.545...
0.56887347
5
Correctly update board with horizontal capture
def test_makeCapture_horizontal(self): # Given board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(3, 4) captureCoordinate = coordinate.Coordinate(4, 4) endCoordinate = coordinate.Coordinate(5, 4) board.setState(startCoordinate, types.FOX) board.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_board(board):", "def _update_board(self, move: int) -> None:\n row = self._column_to_row[move] # Find what row to place the disk in\n if self._is_red_active:\n self.board_array[row][move] = 1\n self.hash = self.hash ^ int(self._red_hash_keys[row][move]) # Update hash...
[ "0.64486885", "0.6380397", "0.629372", "0.6237077", "0.6200867", "0.61697966", "0.6162075", "0.61288935", "0.6127971", "0.6103654", "0.61014205", "0.60617924", "0.6029901", "0.5985955", "0.59807956", "0.5978988", "0.5956534", "0.5917749", "0.5913385", "0.5900268", "0.5880136"...
0.61658394
6
Correctly update board with vertical capture
def test_makeCapture_vertical(self): # Given board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(4, 4) captureCoordinate = coordinate.Coordinate(4, 5) endCoordinate = coordinate.Coordinate(4, 6) board.setState(startCoordinate, types.FOX) board.setS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_board(board):", "def _update_board(self):\n\n self.game_board.update_board(self.tetrino_set)", "def update_board(self, mpos):\n pass", "def update(match):\r\n \r\n \r\n coordinates= match.board\r\n \r\n rows=len(match.board)\r\n column=len(match.board[0])\r\n for x ...
[ "0.6425805", "0.6328396", "0.63144124", "0.62630606", "0.61620307", "0.6100997", "0.60915416", "0.6063423", "0.6010481", "0.6000855", "0.59570855", "0.5950957", "0.5938916", "0.59062433", "0.590119", "0.589448", "0.586444", "0.5863165", "0.58574224", "0.58382803", "0.583359",...
0.6473007
0
Correctly update board with diagonal capture
def test_makeCapture_diagonal(self): # Given board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(3, 4) captureCoordinate = coordinate.Coordinate(4, 5) endCoordinate = coordinate.Coordinate(5, 6) board.setState(startCoordinate, types.FOX) board.setS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(match):\r\n \r\n \r\n coordinates= match.board\r\n \r\n rows=len(match.board)\r\n column=len(match.board[0])\r\n for x in range(rows):\r\n for y in range(column):\r\n cell_up = match.board[wrapx(x)][wrapy(y+1)]\r\n cell_down = match.board[wrapx(x)][wrapy...
[ "0.67066777", "0.6653555", "0.6310921", "0.62940824", "0.62870485", "0.6235907", "0.61921644", "0.61821514", "0.61482", "0.6075506", "0.6075506", "0.60700727", "0.6066241", "0.60207224", "0.6016407", "0.6004347", "0.6002625", "0.598104", "0.59781307", "0.59653074", "0.5961077...
0.6236551
5
Correctly handle a bad X ending coordinate
def test_makeCapture_horizontal_bad_x(self): # Given board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(3, 4) captureCoordinate = coordinate.Coordinate(4, 4) endCoordinate = coordinate.Coordinate(6, 4) board.setState(startCoordinate, types.FOX) bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_findXCoordinateFromDirection_bad(self):\n self.assertRaises(ValueError,\n rules.findXCoordinateFromDirection,\n 80)", "def test_get_xy_invalid_space():\n pass", "def __validatePoint(self, point):\n # print point\n if point[0] > ...
[ "0.639812", "0.63095856", "0.6109865", "0.60649306", "0.5974216", "0.5973128", "0.5954983", "0.5954983", "0.5897984", "0.5896169", "0.58895147", "0.5876551", "0.5802894", "0.57689273", "0.57250774", "0.5698702", "0.5694625", "0.5631535", "0.56206", "0.5615806", "0.5613484", ...
0.55864614
31
Correctly handle a bad Y ending coordinate
def test_makeCapture_horizontal_bad_y(self): # Given board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(3, 3) captureCoordinate = coordinate.Coordinate(3, 5) endCoordinate = coordinate.Coordinate(3, 6) board.setState(startCoordinate, types.FOX) bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_findYCoordinateFromDirection_bad(self):\n self.assertRaises(ValueError,\n rules.findYCoordinateFromDirection,\n 80)", "def checkYPos(self, *args):\n x = self.initialXScale.get()\n y = self.initialYScale.get()\n\n if x ** 2 + y...
[ "0.70044225", "0.66201675", "0.66045654", "0.64544284", "0.61765784", "0.6135376", "0.60918397", "0.60906065", "0.60843825", "0.6062142", "0.60559744", "0.60528415", "0.6030086", "0.6013174", "0.6006758", "0.59601814", "0.59543526", "0.5938975", "0.5928812", "0.59230953", "0....
0.0
-1
Correctly handle capture over the same coordinate
def test_makeCapture_horizontal_same_coordinates(self): # Given board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(3, 3) captureCoordinate = coordinate.Coordinate(3, 5) board.setState(startCoordinate, types.FOX) board.setState(captureCoordinate, types.GOO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapFrame(camera):\n return camera.read()[1]", "def check_for_captures(self, selected_piece_coords, player):\n capture_coords = [] # a list of capture coords will be returned\n special_coords = [(0, 0), (0, 8), (8, 0), (8, 8), (4, 4)]\n neighbor_coords = [(selected_piece_coords[0]+1, sel...
[ "0.62073547", "0.6043828", "0.5825863", "0.57963836", "0.57198095", "0.5678012", "0.5608898", "0.559589", "0.5589825", "0.55645317", "0.55438054", "0.5532692", "0.5512359", "0.5443185", "0.53654444", "0.536494", "0.5356785", "0.5356554", "0.5350847", "0.53404737", "0.534016",...
0.61416686
1
Find direction between two adjacent coordinates
def test_findDirection_1(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(5, 7) expected_result = 1 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.6271627
34
Find direction between two adjacent coordinates
def test_findDirection_2(self): startCoordinate = coordinate.Coordinate(3, 3) endCoordinate = coordinate.Coordinate(5, 5) expected_result = 2 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.63237786
33
Find direction between two adjacent coordinates
def test_findDirection_3(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(7, 5) expected_result = 3 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.59365916
73
Find direction between two adjacent coordinates
def test_findDirection_4(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(7, 3) expected_result = 4 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.61190236
46
Find direction between two adjacent coordinates
def test_findDirection_5(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(5, 3) expected_result = 5 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.57839215
95
Find direction between two adjacent coordinates
def test_findDirection_6(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(3, 3) expected_result = 6 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.59577954
68
Find direction between two adjacent coordinates
def test_findDirection_7(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(3, 5) expected_result = 7 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.5814512
93
Find direction between two adjacent coordinates
def test_findDirection_8(self): startCoordinate = coordinate.Coordinate(5, 5) endCoordinate = coordinate.Coordinate(3, 7) expected_result = 8 actual_result = rules.findDirection(startCoordinate, endCoordinate) self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getDirection(coord1, coord2):\n x1, y1 = coord1\n x2, y2 = coord2\n\n if x1 == x2 and y1 == y2:\n return None # two coordinates are the same.\n elif x1 == x2 and y1 > y2:\n return UP\n elif x1 == x2 and y1 < y2:\n return DOWN\n elif x1 > x2 and y1 == y2:\n return ...
[ "0.7478504", "0.73279333", "0.72977996", "0.727206", "0.7238701", "0.7234094", "0.71428716", "0.7114425", "0.71055007", "0.69699013", "0.6897107", "0.68798685", "0.6838712", "0.6714547", "0.6707587", "0.66554946", "0.66287845", "0.6621937", "0.65961", "0.6558181", "0.65289116...
0.5921196
78
Coordinates are not adjacent, so don't have an associated direction
def test_findDirection_bad(self): startCoordinate = coordinate.Coordinate(4, 4) self.assertRaises(ValueError, rules.findDirection, startCoordinate, startCoordinate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjacent(self):\n x, y = self.opentile\n return (x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1) # left, right, up, down", "def get_directions():\n return [(1, 0), (0, 1), (-1, 0), (0, -1)]", "def adjacent(self, x, y):\n pass", "def checkAdjacent(self, direction, maze):\n\n ...
[ "0.6544545", "0.64622706", "0.6436069", "0.6277589", "0.627061", "0.6228641", "0.6160248", "0.611755", "0.61077577", "0.6107208", "0.60327595", "0.59413457", "0.5925891", "0.5893834", "0.586183", "0.5858371", "0.5841898", "0.57917356", "0.576745", "0.57640463", "0.5739784", ...
0.558675
58
Test a known good value
def test_convertCharToInt_good_value_1(self): result = rules.convertCharToInt('1') self.assertEqual(result, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_value(self, value):", "def test_positive_value_exists(self):\n #######################################\n # Test for True\n value_to_test = 1\n self.assertEqual(positive_value_exists(value_to_test), True,\n \"Testing value: {value_to_test}, True expect...
[ "0.7408431", "0.7000339", "0.69370025", "0.6846117", "0.682976", "0.6721417", "0.66934437", "0.66284007", "0.6621848", "0.6621848", "0.65682507", "0.6505969", "0.6491225", "0.6478166", "0.6456342", "0.645553", "0.64243543", "0.641759", "0.64096326", "0.6385234", "0.63703245",...
0.0
-1
Test a known good value
def test_convertCharToInt_good_value_3(self): result = rules.convertCharToInt('3') self.assertEqual(result, 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_value(self, value):", "def test_positive_value_exists(self):\n #######################################\n # Test for True\n value_to_test = 1\n self.assertEqual(positive_value_exists(value_to_test), True,\n \"Testing value: {value_to_test}, True expect...
[ "0.7408431", "0.7000339", "0.69370025", "0.6846117", "0.682976", "0.6721417", "0.66934437", "0.66284007", "0.6621848", "0.6621848", "0.65682507", "0.6505969", "0.6491225", "0.6478166", "0.6456342", "0.645553", "0.64243543", "0.641759", "0.64096326", "0.6385234", "0.63703245",...
0.0
-1
Test a value that should be too high
def test_convertCharToInt_upper_value_10(self): self.assertRaises(ValueError, rules.convertCharToInt, '10')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ge(value, limit):\n return value >= limit", "def _validate_value(self, value):\n if self.limits[0] <= value <= self.limits[1]:\n return True\n else:\n return False", "def _validate_value(self, value):\n return (self.maximum_value is None) or (value <= self.maxi...
[ "0.67636096", "0.6741185", "0.6671219", "0.6585299", "0.65791917", "0.6575315", "0.6562263", "0.6544747", "0.6520215", "0.65016514", "0.65000653", "0.6499795", "0.6482189", "0.6450466", "0.6424353", "0.6417102", "0.64039016", "0.6396827", "0.63956976", "0.63956976", "0.635251...
0.0
-1
Test a value that should be too low
def test_convertCharToInt_lower_value_5(self): self.assertRaises(ValueError, rules.convertCharToInt, '-5')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ge(value, limit):\n return value >= limit", "def above_threshold(self, value):\n # We use floating point number here so we have to take care\n return finf(value,self.min) or finf(self.max,value)", "def _validate_value(self, value):\n if self.limits[0] <= value <= self.limits[1]:\n ...
[ "0.6942858", "0.6929475", "0.67821515", "0.6742913", "0.67409074", "0.6690708", "0.6674597", "0.6669648", "0.6665438", "0.66640806", "0.6657935", "0.66571206", "0.66571206", "0.66276145", "0.6610337", "0.6609357", "0.656149", "0.6550324", "0.6533624", "0.6524813", "0.65126675...
0.0
-1
Test a value that isn't an int
def test_convertCharToInt_bad_value(self): self.assertRaises(ValueError, rules.convertCharToInt, 'qq')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_int(value):\n return isinstance(value, int)", "def _is_non_negative_int(item):\n if not isinstance(item, int):\n return False\n return item >= 0", "def _is_int(test_val):\n try:\n int(test_val)\n return True\n except ValueError:\n return False", "def check_fo...
[ "0.77869165", "0.77729654", "0.741681", "0.74123967", "0.72614413", "0.72164434", "0.72164434", "0.7208203", "0.71881294", "0.7177373", "0.7160789", "0.7160789", "0.7138969", "0.71309215", "0.7126058", "0.7083577", "0.70681787", "0.703275", "0.70183045", "0.70153105", "0.6995...
0.0
-1
ReadConnectionFile parses file content
def test_readConnectionFile_parsing(self): fake_data = ("3,1 1 3,2", "5,3 2 4,3") with patch("builtins.open", mock_open(read_data="data")): rules_obj = rules.Rules(test_mode=True) actual_result = rules_obj.readConnectionFile("nonexistant_file", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(filename, conn):\n\n conn.send(open(filename).read())", "def read_file(self):\n try:\n with open(self.file_name, 'r') as ach_file:\n file_contents = ach_file.read().replace('\\n', '').replace('\\r', '')\n\n self._parse_ach_file(file_contents)\n excep...
[ "0.6705614", "0.663129", "0.66100514", "0.6560931", "0.6560931", "0.6504904", "0.63073784", "0.6230969", "0.6161956", "0.61591184", "0.6083685", "0.60218704", "0.60149306", "0.6009339", "0.60074335", "0.6005854", "0.59724516", "0.5966861", "0.5955304", "0.5914373", "0.5902289...
0.6774612
0
Connection line is properly parsed
def test_parseConnectionLine(self): fake_connection = "5,3 2 4,3" actual_result = rules.parseConnectionLine(fake_connection) self.assertEqual(actual_result.startX, 5) self.assertEqual(actual_result.startY, 3) self.assertEqual(actual_result.direction, 2) self.assertEqual(a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse(self, line):\n comd, value = cmd.parse(line, CLIENT_PREFIX)\n if comd == 'reg':\n self.peername = value\n elif comd == 'eof':\n self._reset()\n msg = cmd.clientcmd(comd, value)\n msg = cmd.addFirst(msg, self.peername)\n self.sen...
[ "0.6803587", "0.65556264", "0.6434497", "0.6407294", "0.6296616", "0.6289814", "0.62807256", "0.62698454", "0.6261781", "0.6125609", "0.6038081", "0.60051864", "0.586589", "0.58577013", "0.58292764", "0.5771236", "0.5771236", "0.5771236", "0.5771236", "0.5750047", "0.57388276...
0.67662257
1
FindConnectionP isn't able to find a connection
def test_findConnectionP_nonexistant(self): fake_data = ("3,1 1 3,2", "5,3 2 4,3") rules_obj = rules.Rules(test_mode=True) with patch("builtins.open", mock_open(read_data="data")): fake_file = "nonexistant_file" rules_obj.boardConnections = \ rules_obj.rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_conn(self, v):\n pass", "def _identify_connection(self):\n pass #nothing to identify...\n #raise NotImplementedError(\"Implement!\")", "def ConnectByNameError(self) -> _n_0_t_14:", "def check_connection(self):\n pass", "def _search_connection(self, host, login, passwd, ...
[ "0.7082688", "0.6881263", "0.65791893", "0.65525514", "0.64184034", "0.62352926", "0.6232686", "0.62264067", "0.61363274", "0.61014915", "0.6071076", "0.60610104", "0.6045385", "0.6043979", "0.6031223", "0.5972832", "0.59663445", "0.59311026", "0.59269714", "0.5915659", "0.58...
0.58827156
21
FindConnectionP is able to find a connection
def test_findConnectionP_exists(self): fake_data = ("3,1 1 3,2", "5,3 2 4,3") rules_obj = rules.Rules(test_mode=True) with patch("builtins.open", mock_open(read_data="data")): fake_file = "nonexistant_file" rules_obj.boardConnections = \ rules_obj.readConn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_conn(self, v):\n pass", "def _identify_connection(self):\n pass #nothing to identify...\n #raise NotImplementedError(\"Implement!\")", "def _search_connection(self, host, login, passwd, conn):\n self._connections_lock.acquireRead()\n try:\n if (host in sel...
[ "0.682037", "0.6578726", "0.64755344", "0.62262493", "0.60939974", "0.60898346", "0.6086989", "0.605391", "0.5970069", "0.59026736", "0.58664703", "0.5826271", "0.58093894", "0.5761103", "0.5755418", "0.57515424", "0.573511", "0.57293797", "0.5728661", "0.5695982", "0.5694662...
0.6089858
5
Goose moving backwards returns false
def test_legalMoveP_backwards_goose(self): rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(3, 1) endCoordinate = coordinate.Coordinate(3, 2) board.setState(startCoordinate, types.GOOSE) actual_result = rules_obj....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_backward():\n pass", "def move(self) -> bool:\n pass", "def one_step_back(self):\n if (self.row -1<0):\n return False\n elif (self.battery == 0):\n return False\n elif (self.maze[self.row - 1][self.column] == False):\n return False\n ...
[ "0.6996258", "0.6972506", "0.6767822", "0.66996866", "0.66520476", "0.6422665", "0.64223343", "0.6385307", "0.63798046", "0.6372059", "0.6338462", "0.63350445", "0.63216394", "0.62871516", "0.6245895", "0.6219977", "0.6219153", "0.62103695", "0.6196986", "0.61793756", "0.6178...
0.6965173
2
Legal move returns true
def test_legalMoveP_good(self, mock_findConnectionP): mock_findConnectionP.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(5, 3) endCoordinate = coordinate.Coordinate(4, 3) board.setState(star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_valid(move):\n return True", "def move_check(self):\r\n \r\n if not self.run:\r\n return False\r\n \r\n if self.get_num_legal_moves() == 0:\r\n SlTrace.lg(\"NO more legal moves!\", \"nolegalmoves\")\r\n ###return False \r\n \r\...
[ "0.8601768", "0.8019651", "0.7979659", "0.79416096", "0.7936701", "0.781393", "0.7713825", "0.7678717", "0.76205117", "0.7579721", "0.7558382", "0.7512303", "0.74953485", "0.742789", "0.738678", "0.73684084", "0.7321592", "0.7292538", "0.7287924", "0.7286208", "0.7279261", ...
0.0
-1
Not legal move returns False
def test_legalMoveP_bad(self, mock_findConnectionP): mock_findConnectionP.return_value = False rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() startCoordinate = coordinate.Coordinate(5, 3) endCoordinate = coordinate.Coordinate(3, 3) board.setState(star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_valid(move):\n return True", "def move(self) -> bool:\n pass", "def op_move_preconditions(self):\n\n if(self.next_move != self.FREE):\n return False\n\n return True", "def valid_move(self, player, move):\n return (True)", "def _ispinnedmove(self, from_, to...
[ "0.8531332", "0.8101516", "0.77512884", "0.7572069", "0.75306517", "0.74937654", "0.74894065", "0.7446326", "0.7396082", "0.73288786", "0.7279223", "0.72778267", "0.72046465", "0.7175427", "0.716437", "0.71170056", "0.70695394", "0.7045566", "0.7027917", "0.70271397", "0.7016...
0.0
-1
When a capture looks good, return True
def test_captureHelper_true(self, mock_findConnectionP): mock_findConnectionP.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) delta_mid = {'x':0, 'y':1} delta_end = {'x':0, 'y':2} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_capture(self, capture):\n info = None\n seen = set()\n for packet in capture:\n try:\n self.logger.debug(ppp(\"Got packet:\", packet))\n ip = packet[IP]\n icmp = packet[ICMP]\n payload_info = self.payload_to_info...
[ "0.66411865", "0.6300321", "0.6215171", "0.62041456", "0.60171986", "0.59564036", "0.59564036", "0.59389675", "0.59389675", "0.59346396", "0.59199476", "0.5840002", "0.58058304", "0.58021176", "0.57466877", "0.5745309", "0.5694399", "0.5679914", "0.5679914", "0.5679525", "0.5...
0.5644404
23
When a capture does not exist, return False
def test_captureHelper_false(self, mock_findConnectionP): mock_findConnectionP.return_value = False rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) delta_mid = {'x':0, 'y':1} delta_end = {'x':0, 'y':2} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_existsCaptureP_no_capture(self, mock_isACaptureP):\n mock_isACaptureP.return_value = False\n rules_obj = rules.Rules(test_mode=True)\n foxOne = coordinate.Coordinate(5, 5)\n foxTwo = coordinate.Coordinate(3, 7)\n board = gamenode.GameNode()\n board.setState(foxOne...
[ "0.688857", "0.6636777", "0.6381677", "0.574671", "0.5574745", "0.5567988", "0.53919494", "0.53919494", "0.5373975", "0.5368798", "0.5315828", "0.53098834", "0.52868664", "0.52399147", "0.5230729", "0.5187527", "0.51812625", "0.51812625", "0.51665545", "0.5159384", "0.515716"...
0.49099582
48
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_1(self, mock_captureHelper): direction = 1 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_2(self, mock_captureHelper):\n direction = 2\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.7616921", "0.74508667", "0.74225676", "0.7362415", "0.7337908", "0.73119944", "0.73008204", "0.7197092", "0.7115965", "0.67446953", "0.59996974", "0.5809121", "0.5626506", "0.559787", "0.52908087", "0.5219593", "0.51766074", "0.51409155", "0.5096357", "0.5073802", "0.50342...
0.7827176
0
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_2(self, mock_captureHelper): direction = 2 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.7827176", "0.74508667", "0.74225676", "0.7362415", "0.7337908", "0.73119944", "0.73008204", "0.7197092", "0.7115965", "0.67446953", "0.59996974", "0.5809121", "0.5626506", "0.559787", "0.52908087", "0.5219593", "0.51766074", "0.51409155", "0.5096357", "0.5073802", "0.50342...
0.7616921
1
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_3(self, mock_captureHelper): direction = 3 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.7827176", "0.7616921", "0.74225676", "0.7362415", "0.7337908", "0.73119944", "0.73008204", "0.7197092", "0.7115965", "0.67446953", "0.59996974", "0.5809121", "0.5626506", "0.559787", "0.52908087", "0.5219593", "0.51766074", "0.51409155", "0.5096357", "0.5073802", "0.503429...
0.74508667
2
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_4(self, mock_captureHelper): direction = 4 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.78262836", "0.7615663", "0.74501765", "0.7361566", "0.7337232", "0.73109853", "0.7300279", "0.71961313", "0.7118076", "0.6746303", "0.59997517", "0.5811478", "0.56288916", "0.5602401", "0.52926755", "0.5221797", "0.51790094", "0.51422054", "0.5097492", "0.5076611", "0.5036...
0.7421455
3
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_5(self, mock_captureHelper): direction = 5 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.7827176", "0.7616921", "0.74508667", "0.74225676", "0.7362415", "0.7337908", "0.73008204", "0.7197092", "0.7115965", "0.67446953", "0.59996974", "0.5809121", "0.5626506", "0.559787", "0.52908087", "0.5219593", "0.51766074", "0.51409155", "0.5096357", "0.5073802", "0.503429...
0.73119944
6
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_6(self, mock_captureHelper): direction = 6 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.7827176", "0.7616921", "0.74508667", "0.74225676", "0.7362415", "0.73119944", "0.73008204", "0.7197092", "0.7115965", "0.67446953", "0.59996974", "0.5809121", "0.5626506", "0.559787", "0.52908087", "0.5219593", "0.51766074", "0.51409155", "0.5096357", "0.5073802", "0.50342...
0.7337908
5
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_7(self, mock_captureHelper): direction = 7 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.7827176", "0.7616921", "0.74508667", "0.74225676", "0.7362415", "0.7337908", "0.73119944", "0.7197092", "0.7115965", "0.67446953", "0.59996974", "0.5809121", "0.5626506", "0.559787", "0.52908087", "0.5219593", "0.51766074", "0.51409155", "0.5096357", "0.5073802", "0.503429...
0.73008204
7
IsACaptureP calls direction with correct args
def test_isACaptureP_direction_8(self, mock_captureHelper): direction = 8 mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) actual_result = rules_obj.isACaptureP(board, fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isACaptureP_direction_1(self, mock_captureHelper):\n direction = 1\n mock_captureHelper.return_value = True\n rules_obj = rules.Rules(test_mode=True)\n board = gamenode.GameNode()\n foxCoordinate = coordinate.Coordinate(3, 3)\n actual_result = rules_obj.isACapture...
[ "0.78262836", "0.7615663", "0.74501765", "0.7421455", "0.7361566", "0.7337232", "0.73109853", "0.7300279", "0.7118076", "0.6746303", "0.59997517", "0.5811478", "0.56288916", "0.5602401", "0.52926755", "0.5221797", "0.51790094", "0.51422054", "0.5097492", "0.5076611", "0.50364...
0.71961313
8
IsACaptureP return False with a bad direction
def test_isACaptureP_bad_direction(self, mock_captureHelper): mock_captureHelper.return_value = True rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() foxCoordinate = coordinate.Coordinate(3, 3) direction = 20 actual_result = rules_obj.isACaptureP(board,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_existsCaptureP_no_capture(self, mock_isACaptureP):\n mock_isACaptureP.return_value = False\n rules_obj = rules.Rules(test_mode=True)\n foxOne = coordinate.Coordinate(5, 5)\n foxTwo = coordinate.Coordinate(3, 7)\n board = gamenode.GameNode()\n board.setState(foxOne...
[ "0.712023", "0.7091089", "0.7087022", "0.6901648", "0.6804134", "0.67686427", "0.67600137", "0.67172676", "0.6703477", "0.6656205", "0.6449109", "0.5892749", "0.5776631", "0.5767976", "0.57583785", "0.5687516", "0.568495", "0.55937904", "0.55921763", "0.5576948", "0.5561439",...
0.78809065
0
Raise an error if the board is missing its two foxes
def test_existsCaptureP_no_foxes(self): rules_obj = rules.Rules(test_mode=True) board = gamenode.GameNode() self.assertRaises(ValueError, rules_obj.existsCaptureP, board)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_integrity(self):\n\n count = 0\n for (x, y) in self.__players[ChessGame.BLACK].union(\n self.__players[ChessGame.WHITE]):\n assert (x, y) in self.__board\n count += 1\n\n assert count == len(self.__board)", "def test_cell_existence(board: list, i: ...
[ "0.6799718", "0.66046333", "0.6481224", "0.6441163", "0.6361035", "0.6144287", "0.60678715", "0.5998796", "0.5998635", "0.5986695", "0.59737736", "0.5971271", "0.59661907", "0.59661907", "0.5945186", "0.5941779", "0.5941779", "0.59388196", "0.5937872", "0.5937872", "0.5918816...
0.0
-1
Board with no geese has no captures
def test_existsCaptureP_no_capture(self, mock_isACaptureP): mock_isACaptureP.return_value = False rules_obj = rules.Rules(test_mode=True) foxOne = coordinate.Coordinate(5, 5) foxTwo = coordinate.Coordinate(3, 7) board = gamenode.GameNode() board.setState(foxOne, types.FOX...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture(board,player,possible_moves, pos, loc, i):\r\n \r\n if player == 1 and encode(loc+i) in board.black:\r\n next_piece = encode(loc+i) \r\n new_pos = int(loc + (i*2)) \r\n if not((pos[0] == 'B') and ((next_piece)[0] == 'A')) and not((pos[0] == 'G') and ((next_piece)[0]...
[ "0.6636181", "0.64437646", "0.63770175", "0.6365882", "0.6343839", "0.62969637", "0.6261921", "0.62012243", "0.6197485", "0.619615", "0.6181246", "0.61352706", "0.61244595", "0.61030847", "0.6084181", "0.6060234", "0.60397047", "0.60350484", "0.6017387", "0.5989781", "0.59880...
0.0
-1
When isACaptureP returns True, there must be a capture
def test_existsCaptureP_capture(self, mock_isACaptureP): mock_isACaptureP.return_value = True rules_obj = rules.Rules(test_mode=True) foxOne = coordinate.Coordinate(5, 5) foxTwo = coordinate.Coordinate(3, 7) board = gamenode.GameNode() board.setState(foxOne, types.FOX) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_existsCaptureP_no_capture(self, mock_isACaptureP):\n mock_isACaptureP.return_value = False\n rules_obj = rules.Rules(test_mode=True)\n foxOne = coordinate.Coordinate(5, 5)\n foxTwo = coordinate.Coordinate(3, 7)\n board = gamenode.GameNode()\n board.setState(foxOne...
[ "0.7213472", "0.67100275", "0.66877633", "0.64083725", "0.63236207", "0.61772436", "0.6169892", "0.6114282", "0.60935915", "0.6044126", "0.60277975", "0.6020794", "0.60195595", "0.5987006", "0.59656787", "0.5963024", "0.5920054", "0.5840749", "0.58303916", "0.58218515", "0.58...
0.75167173
0
Don't promote a goose when it's outside of the promotion area
def test_resultingGoose_outside(self): goose = coordinate.Coordinate(5, 5) actual_result = rules.resultingGoose(types.GOOSE, goose) expected_result = types.GOOSE self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def promote(name):\r\n print('A CEO cannot be promoted')", "def hesitant_action(self):\n if not self.agent.done:\n if not self.opponenet.done:\n self.EV = self.opponenet.pumps - np.random.randint(1,5)\n else:\n if self.opponenet.cashed:\n ...
[ "0.669666", "0.59399617", "0.59149307", "0.58212084", "0.58070666", "0.5658504", "0.55831605", "0.5576499", "0.55677056", "0.548775", "0.54679835", "0.54491276", "0.54394567", "0.54304725", "0.54116637", "0.5381715", "0.5366996", "0.5364018", "0.53463715", "0.5313949", "0.530...
0.52112085
37
Promote the goose when it's inside the promotion area
def test_resultingGoose_inside(self): goose = coordinate.Coordinate(4, 2) actual_result = rules.resultingGoose(types.GOOSE, goose) expected_result = types.SUPERGOOSE self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_got_promotion():\n im = region_grabber((550, 250, 815, 320)) # Hardcoded\n pos = imagesearcharea(\"Images/promotion_queen.jpg\", 0, 0, 0, 0, 0.9, im)\n if pos != [-1, -1]:\n print(\"Got promotion\")\n pos_image = [550 + pos[0], 250 + pos[1]]\n click_image(\"Images/promotion...
[ "0.6246671", "0.6093629", "0.5632974", "0.5445051", "0.54214436", "0.5348592", "0.532672", "0.5289607", "0.5235892", "0.52281296", "0.52173364", "0.5195113", "0.5186877", "0.5184673", "0.51635957", "0.5153188", "0.51470053", "0.5137283", "0.51296633", "0.51043504", "0.5090028...
0.0
-1
Get the delta X from an up direction
def test_findXCoordinateFromDirection_up(self): actual_result = rules.findXCoordinateFromDirection(1) expected_result = 0 self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upleft(self):\n return Coord([self.x - 1, self.y - 1])", "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def __get_x__(self):\n return self.Direction['x']", "def pos_up(self, y=1):\n\n self.y -= y\n return self.pos(self.x, self.y)", "def get(self):\n ...
[ "0.71839446", "0.68121356", "0.6662667", "0.66416675", "0.6618666", "0.6570197", "0.6359116", "0.62589014", "0.6230458", "0.61865497", "0.61432135", "0.6131637", "0.60760754", "0.60349697", "0.6014604", "0.5948748", "0.593659", "0.5913311", "0.5892898", "0.5881522", "0.587470...
0.6160588
10
Get the delta X from a right direction
def test_findXCoordinateFromDirection_right(self): actual_result = rules.findXCoordinateFromDirection(3) expected_result = 2 self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_right(self, x=1):\n\n self.x += x\n return self.pos(self.x, self.y)", "def right_distance(self):\n return self.board.length - 1 - self.x", "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def __get_x__(self):\n return self.Direction['x']", "def dow...
[ "0.7264559", "0.7254064", "0.70186067", "0.69288874", "0.68650204", "0.6834055", "0.6834055", "0.68162286", "0.68127686", "0.6766622", "0.6632616", "0.6575811", "0.653798", "0.651622", "0.64885324", "0.6469153", "0.6453102", "0.64430046", "0.64377105", "0.6426004", "0.6399436...
0.6203853
28