query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Get the meta collection.
def __get_meta_collection(self, db_name): connection = self.get_connection() return connection[db_name][self.__meta_collection_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta(self):\n return self._meta", "def meta(self):\n return self._meta", "def meta(self):\n return self._meta", "def meta(self) -> api.Meta:\n return self._get_model(model=api.Meta)", "def get_meta():\n meta = {\n 'pages': _get_pages()\n }\n return meta", "def get_...
[ "0.70105207", "0.70105207", "0.70105207", "0.6931683", "0.6923093", "0.68248093", "0.6665794", "0.66212577", "0.650282", "0.64837134", "0.64532983", "0.64490813", "0.644765", "0.6437629", "0.6393375", "0.63647205", "0.6336677", "0.63231474", "0.6307536", "0.6300341", "0.62797...
0.8037996
0
Close the collection. It is essential for collection in 'w'/'a' mode.
def close(self): if self.__mode == 'w' or self.__mode == 'a': IRMongodbHelper.get_instance().update_meta( self.__db_name, self.__collection_name, True) self.__is_closed = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __is_collection_close(self):\n if self.__is_closed:\n from ir_log import IRLog\n IRLog.get_instance().println(\n 'Error! Cannot write to closed collection.')\n assert False", "def close (self):\n pass\n #TODO: implement more realistic closing seman...
[ "0.6777659", "0.6699592", "0.6682129", "0.6664807", "0.6655077", "0.6655077", "0.66498816", "0.66411", "0.6637717", "0.6605826", "0.6604219", "0.6604219", "0.6599263", "0.65854615", "0.65854615", "0.65854615", "0.65854615", "0.65854615", "0.65854615", "0.65854615", "0.6585461...
0.7351191
0
Check if current mode supports modifying operation.
def __is_modification_legal_in_current_mode(self): self.__is_collection_close() if self.__mode == 'r': from ir_log import IRLog IRLog.get_instance().println( 'Error! Cannot write to collection being opened in read mode.') assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_edit(self):\n return self._can_edit", "def _check_writable_(self):\n self._check_within_context_()\n if self._mode != 'w':\n raise Exception('Cannot update database: read only mode')", "def _can_do_updates(self):\n return True", "def can_edit(self):\n ret...
[ "0.67782974", "0.66233355", "0.6596447", "0.644579", "0.6415377", "0.6361345", "0.63455313", "0.6305399", "0.62147707", "0.6190402", "0.6159321", "0.6154194", "0.6130663", "0.60890514", "0.60737497", "0.6054814", "0.60085136", "0.5989308", "0.5933696", "0.5915068", "0.5897786...
0.6711812
1
Check if the operation is conducted after the collection is closed.
def __is_collection_close(self): if self.__is_closed: from ir_log import IRLog IRLog.get_instance().println( 'Error! Cannot write to closed collection.') assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_closed(self) -> bool:", "def is_closed(self):\n return None", "def closed(self) -> bool:\n return self._out_of_scope or self._consumed", "def is_closed(self):\n raise NotImplementedError", "def closed(self):\n\n return not self.open", "def closed(self):\n return ...
[ "0.73205477", "0.7113332", "0.706652", "0.6847022", "0.6838632", "0.68133086", "0.6795782", "0.6793344", "0.67337465", "0.67239463", "0.66559035", "0.6654742", "0.66481453", "0.6612063", "0.66008794", "0.65897036", "0.65853167", "0.6532008", "0.6532008", "0.65242404", "0.6522...
0.7941964
0
set self._adding_meals to value. If value == True, it assigns False to the other two atributes
def adding_meals(self, value): self._adding_meals = value if value: self._adding_ingridients = not value self._removing_ingridients = not value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adding_ingridients(self, value):\n self._adding_ingridients = value\n if value:\n self._adding_meals = not value\n self._removing_ingridients = not value", "def loading_meals(self, value):\n self._loading_meals = value\n if value:\n self._loading_i...
[ "0.63944167", "0.6172581", "0.56520134", "0.5524404", "0.54862875", "0.54854774", "0.54742014", "0.54492575", "0.5414315", "0.54137987", "0.53864753", "0.53779346", "0.53670925", "0.5317445", "0.52451706", "0.52167964", "0.5213384", "0.5204808", "0.5199225", "0.517757", "0.51...
0.8030182
0
set self._adding_ingridients to value. If value == True, it assigns False to the other two atributes
def adding_ingridients(self, value): self._adding_ingridients = value if value: self._adding_meals = not value self._removing_ingridients = not value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removing_ingridients(self, value):\n self._removing_ingridients = value\n if value:\n self._adding_ingridients = not value\n self._adding_meals = not value", "def loading_ingridients(self, value):\n self._loading_ingridients = value\n if value:\n s...
[ "0.666816", "0.5885458", "0.5837507", "0.57875705", "0.57584536", "0.5729448", "0.5535935", "0.5396909", "0.5315843", "0.53109646", "0.52644414", "0.52418196", "0.5178458", "0.51680106", "0.516052", "0.51560545", "0.51510334", "0.514686", "0.51179755", "0.5113408", "0.5097386...
0.74521077
0
set self._removing_ingridients to value. If value == True, it assigns False to the other two atributes
def removing_ingridients(self, value): self._removing_ingridients = value if value: self._adding_ingridients = not value self._adding_meals = not value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adding_ingridients(self, value):\n self._adding_ingridients = value\n if value:\n self._adding_meals = not value\n self._removing_ingridients = not value", "def setFalse(self):\n self.cond = CT.FALSE\n self.left = self.right = None\n self.z3 = BoolSort...
[ "0.61106735", "0.598406", "0.5783493", "0.57688135", "0.56591856", "0.55636936", "0.55505586", "0.5548208", "0.54547286", "0.54056245", "0.5317853", "0.52002484", "0.51865023", "0.518524", "0.51793474", "0.51634955", "0.5125913", "0.5118861", "0.50934196", "0.50916517", "0.50...
0.77088696
0
set self._loading_meals to value. If value == True, it assigns False to the other atribute
def loading_meals(self, value): self._loading_meals = value if value: self._loading_ingridients = not value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loading_ingridients(self, value):\n self._loading_ingridients = value\n if value:\n self._loading_meals = not value", "def adding_meals(self, value):\n self._adding_meals = value\n if value:\n self._adding_ingridients = not value\n self._removing_i...
[ "0.7370048", "0.6022426", "0.56713253", "0.55646056", "0.5558975", "0.550815", "0.54810375", "0.5433471", "0.5365253", "0.5299352", "0.52663404", "0.52450716", "0.5225585", "0.5184682", "0.51777154", "0.5124575", "0.5107784", "0.5097972", "0.5095779", "0.5073497", "0.5054324"...
0.85743046
0
set self._loading_ingridients to value. If value == True, it assigns False to the other atribute
def loading_ingridients(self, value): self._loading_ingridients = value if value: self._loading_meals = not value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loading_meals(self, value):\n self._loading_meals = value\n if value:\n self._loading_ingridients = not value", "def set_bool_value(self, event):\n\n self.undo_add()\n\n key_list = list(self.patch.engine.misc_data.keys())\n key = key_list[self.selected_index]\n ...
[ "0.6881819", "0.5635553", "0.5582467", "0.5569656", "0.54552335", "0.54477334", "0.5418314", "0.53993464", "0.5346534", "0.53407025", "0.5305068", "0.5256796", "0.51591444", "0.51568955", "0.5089924", "0.5078869", "0.50590384", "0.50410765", "0.5013075", "0.5012027", "0.50109...
0.79069674
0
it assigns a telegram replay keyboard to self._keyboard
def keyboard(self, value): if value is None: self._keyboard = telegram.ReplyKeyboardRemove() elif value == "add_ingridients": keyboard = [[key] for key in self.ingridients] self._keyboard = telegram.ReplyKeyboardMarkup(keyboard) elif value == "remove_ingridien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_keyboard(self, keyboard: Keyboard) -> None:\n lib.wlr_seat_set_keyboard(self._ptr, keyboard._ptr)", "def __init__(self, keyboard: Keyboard) -> None:\n self.keyboard = keyboard", "def keyboard_mode(self, bot, update):\n bot.send_message(update.message.chat_id,\n ...
[ "0.64693403", "0.61509687", "0.60095644", "0.5850403", "0.5577479", "0.55557674", "0.5521336", "0.54666775", "0.54314536", "0.543021", "0.5410926", "0.5339978", "0.53325224", "0.5306431", "0.5289016", "0.5285933", "0.5273634", "0.52421707", "0.5228268", "0.5175297", "0.515438...
0.61858547
1
this function handles text messages without commands. Depending on the last command used it might add ingridients from a meal to the list, a particular ingridient, remove an ingridient from the list or do nothing
def text_message(self, update, context): # check mode if self.adding_meals: # text from the message is retrieved typed_meal = update.message.text # we get the instance from the meal list. It might be None meal = self.meal_list.get(typed_meal) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_text_messages(self, update, context):\n\n # Split user input into single words\n words = set(update.message.text.lower().split())\n logging.debug(f'Received message: {update.message.text}')\n\n # For debugging: Log users that received something from bot\n chat_user_cli...
[ "0.6213361", "0.6120879", "0.57841563", "0.559476", "0.55828923", "0.5582176", "0.55789375", "0.55648065", "0.55351096", "0.55351096", "0.55351096", "0.5519756", "0.5501564", "0.5486176", "0.54804116", "0.5470896", "0.546417", "0.5452235", "0.5441572", "0.5437703", "0.5435344...
0.73647946
0
if the commands /load_meals or /load_ingridients were used, this will save files with the code of the chat
def file_message(self, update, context): # asigns file_tipe according to the program status if self.loading_meals: file_type = "_meals" elif self.load_ingridients: file_type = "_ingridients" else: # if the script isn't loading_meals or loading_ingridie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveqbotfile(path):\n\n pathdata = loadpathfile(path)\n\n qbot = {\"messages\": []}\n for data in pathdata:\n if not data[\"ignore\"] and data[\"love\"]:\n qbot[\"messages\"].append({\"text\": data[\"text\"], \"image\": data[\"file\"]})\n\n qbotpath = os.path.join(path, \"qbot.jso...
[ "0.58813375", "0.56725603", "0.5555561", "0.5519338", "0.5513649", "0.5470462", "0.5467868", "0.54489017", "0.54416317", "0.5431381", "0.54022944", "0.53942263", "0.5392521", "0.53788966", "0.5366203", "0.53368163", "0.533002", "0.5329104", "0.53127515", "0.5300927", "0.52787...
0.6012662
0
gets size of table
def get_size(self): return len(self.table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table_size(self):\r\n return self.table_size", "def Size(self):\n return _table.Table_Size(self)", "def get_table_size_from_IS(self, table_name):\n result = self.query(sql.show_table_stats(self._current_db), (self.table_name,))\n if result:\n return result[0][\"Da...
[ "0.87047595", "0.8124882", "0.8011023", "0.80048555", "0.7884163", "0.77463186", "0.7735885", "0.7597051", "0.7561745", "0.74926305", "0.7452804", "0.73185897", "0.7313231", "0.7313231", "0.72824794", "0.72824794", "0.72299665", "0.7226761", "0.7218778", "0.7197132", "0.71912...
0.86656815
1
gets left child for parent if exists
def left_child(self, position): child = 2 * position + 1 if child > len(self.table) - 1: return None return child
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_left(self):\n temp = self._leftchild\n self._leftchild.set_parent(None)\n self.set_leftchild(None)\n return temp", "def get_leftchild(self):\n return self._leftchild", "def get_leftmost_child(self):\n\t\tif self.left_child == None:\n\t\t\treturn self\n\t\telse:\n\t...
[ "0.74676347", "0.7344041", "0.7248138", "0.69870234", "0.6981038", "0.6981038", "0.697943", "0.69625574", "0.69566643", "0.69527584", "0.6893687", "0.6892701", "0.6885713", "0.68792605", "0.6876851", "0.6869689", "0.6771062", "0.67453647", "0.6720758", "0.66999006", "0.669205...
0.74897206
0
search for value in table, return item index if exists
def find(self, value): for position in range(self.get_size()): if self.table[position] == value: return position
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def look_up(self, val):\n index = 0\n if self.head is None:\n print(\"List is empty\")\n start = self.head\n while start is not None:\n if start.data == val:\n return index\n start = start.next\n index += 1\n return \"No ...
[ "0.7410995", "0.74070716", "0.739428", "0.72275436", "0.7168404", "0.7161596", "0.7035593", "0.7032102", "0.70133287", "0.6961133", "0.6941828", "0.68842304", "0.68809795", "0.6855583", "0.6780624", "0.67613006", "0.67447084", "0.67306924", "0.6714104", "0.67123204", "0.67028...
0.79438955
0
pop specified value from heap them promote children if applicable
def heap_pop(self, value): if value is None or self.get_size() == 0: return if self.find(value) is not None: # end of list position = self.find(value) last = self.get_size() - 1 # pop element and percolate down self.swap(position,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sift_down(self, i):\n #If the current value has at least one child\n while (i * 2) <= self.current_size:\n #For the current value, get the index of the child with the least value (min child)\n mc = self.min_child(i)\n # If the current value is greater than it's \"...
[ "0.6947605", "0.6881581", "0.67385894", "0.6730747", "0.672845", "0.66927874", "0.6691331", "0.6673538", "0.6649974", "0.6618579", "0.6610356", "0.6589481", "0.6561504", "0.6561504", "0.6561504", "0.65521854", "0.6551153", "0.6539436", "0.6496276", "0.6444313", "0.64434135", ...
0.70860285
0
Visualize cumulative rewards for all agents
def show_rewards(agents, fname=None): fig = plt.figure() ax = plt.subplot(111) box = ax.get_position() ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) ax.set_ylabel('Cumulative Reward') for agent in agents: agent.show_rewards() ax.legend([a.id for a in agents], loc='ce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_data(total_rewards):\n\n x_values = arange(0, len(total_rewards), 1)\n y_values = total_rewards\n plot(x_values, y_values)\n xlabel('episodes')\n ylabel('cumulative rewards')\n title('Reward by Episode')\n grid(True)\n show()", "def _accumulate_rewards(self) -> None:\n ...
[ "0.6847692", "0.6379131", "0.63644534", "0.6120268", "0.5998525", "0.59910023", "0.59619606", "0.58717906", "0.57953393", "0.57864386", "0.57710594", "0.56867826", "0.5617722", "0.5602543", "0.5597367", "0.55621725", "0.55621725", "0.55366075", "0.55354184", "0.54906374", "0....
0.74582165
0
Funcion que cuenta cantidad de arrobas "@" devuelve True si cantidad de @ es 1 devuelve False si cantidad de @ es 1
def count_ats(str): contador_de_arrobas=0 for char in str: if char == "@": contador_de_arrobas+=1 if contador_de_arrobas == 1 : return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validaAnnoe(anno):\n valid = ((len(anno) == 4) and (int(anno)) > 2000)\n if (valid and((len(anno) == 4) and (int(anno)) > 2000)):\n valid=True\n if(valid == False):\n print(\"fechas invalidas.\")\n labelinformativo('fechas invalidas')\n return valid", "def have_at_symbol(...
[ "0.6419612", "0.6128215", "0.5909211", "0.58536625", "0.57843757", "0.56822264", "0.562617", "0.5619252", "0.55618554", "0.55565", "0.55414504", "0.55098337", "0.5484123", "0.548406", "0.5414359", "0.540152", "0.53738904", "0.53632617", "0.53212667", "0.52822495", "0.5237984"...
0.6987274
0
List of variables in the graphical model; equals model.X
def vars(self): return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return [i.name for i in self.inputs + self.outputs]", "def variables(model: Model) -> AbstractSet[str]:\r\n assert is_model(model)\r\n return model.keys()", "def get_variables(self):\n return [self.g_t, self.m_t]", "def variables(model: Model) -> AbstractSet[str]:\n ...
[ "0.71537", "0.7095497", "0.7092222", "0.70812196", "0.7028589", "0.69994986", "0.6974364", "0.68044204", "0.680155", "0.67825454", "0.6702427", "0.6689236", "0.66822815", "0.6648105", "0.6611602", "0.66026515", "0.658932", "0.6582367", "0.6562528", "0.65559936", "0.6520596", ...
0.7132254
1
Return a variable object (with states) for id 'i'; equals model.X[i]
def var(self,i): # TODO: change to property to access (read only?) X? return Var(i,self.dims[i])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)", "def x(self):\n # REPLACE THE FOLLOWING WITH THE LOGIC TO CONSTRUCT/RETURN THE STATE\n x = {key: 0.0 for key in self.model.states}\n\n return x", "def get_variable_fr...
[ "0.60665554", "0.59195673", "0.5838082", "0.5730709", "0.570854", "0.5686629", "0.566703", "0.5563087", "0.5541318", "0.55122286", "0.54958653", "0.5446443", "0.53824", "0.5346341", "0.53371876", "0.53250223", "0.5296448", "0.5295435", "0.52895856", "0.5281432", "0.5272852", ...
0.7190818
0
The number of factors in the model
def nfactors(self): return self.L.nnz
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_train(self):\n return self.factors[0].shape[0]", "def n_test(self):\n return self.factors[1].shape[0]", "def get_num_classes(self):", "def get_number_of_models():\n return 8", "def num_training_examples(self):", "def factors(self):\n self.assert_sampled()\n return self._factors", "...
[ "0.83153796", "0.7359624", "0.7263654", "0.71743155", "0.706136", "0.70101225", "0.6998573", "0.695702", "0.68989336", "0.68989336", "0.68904746", "0.68893725", "0.6880292", "0.6880292", "0.6880292", "0.6856286", "0.6836514", "0.6818136", "0.6803569", "0.6799407", "0.6779937"...
0.78478533
1
Return a list of factors (converted to tables) in the model that contain the variable 'v'
def factorsWith(self,v,copy=True): Lv = self.L.getrow(v).tocoo(); factors = [Factor([Var(int(v),2)],[-th,th]).exp() for th in [self.h[v]] if self.dims[i]>1] factors = factors + [Factor([Var(int(v),2),Var(int(j),2)],[[th,-th],[-th,th]]).exp() for j,th in zip(Lv.col,Lv.data)] return factors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorsWithAny(self,vs):\n factors = []\n for v in vs:\n factors += [Factor([Var(int(v),2)],[-th,th]).exp() for th in [self.h[v]] if self.dims[i]>1]\n for u in self.markovBlanket(v):\n if u not in vs or v < u:\n factors += [Factor([Var(int(v),2),Var(int(u),2)],[[th,-th],[-th,th]...
[ "0.5869001", "0.58155155", "0.5789809", "0.5686439", "0.56629384", "0.54530644", "0.53012073", "0.5286338", "0.52594876", "0.51934284", "0.5140766", "0.5101376", "0.5074709", "0.50717956", "0.5069599", "0.5064107", "0.502561", "0.5019655", "0.5017653", "0.50075674", "0.497859...
0.6264502
0
Return a list of factors (converted to tables) in the model that contain any of the variables in 'vs'
def factorsWithAny(self,vs): factors = [] for v in vs: factors += [Factor([Var(int(v),2)],[-th,th]).exp() for th in [self.h[v]] if self.dims[i]>1] for u in self.markovBlanket(v): if u not in vs or v < u: factors += [Factor([Var(int(v),2),Var(int(u),2)],[[th,-th],[-th,th]]).exp() fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _varfilter(self, vrs, response, predictor) -> List[str]:\n if not response and not predictor:\n return vrs\n if response:\n vrs = _list_union(vrs, self.response_vars)\n if predictor:\n vrs = _list_union(vrs, self.predictor_vars)\n return vrs", "def...
[ "0.5768305", "0.54934895", "0.54779506", "0.54699045", "0.54582846", "0.543421", "0.53726864", "0.5357016", "0.53253573", "0.531142", "0.523551", "0.5215524", "0.51316875", "0.5116226", "0.5044459", "0.50395584", "0.5030651", "0.49905887", "0.4964612", "0.4958615", "0.49508",...
0.67677164
0
Return the Markov Blanket (list of neighbors) of a given variable in the model
def markovBlanket(self,v): return VarSet([Var(int(i),2) for i in self.L.getrow(int(v)).nonzero()[1]]) #return self.L.getrow(int(v)).nonzero()[1].astype(int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_markov_blanket(self, node):\n children = self.get_children(node)\n parents = self.get_parents(node)\n blanket_nodes = children + parents\n for child_node in children:\n blanket_nodes.extend(self.get_parents(child_node))\n blanket_nodes = set(blanket_nodes)\n ...
[ "0.6299859", "0.5831786", "0.5572019", "0.5507167", "0.54026747", "0.5366719", "0.5362575", "0.5357559", "0.5357559", "0.5357559", "0.5357559", "0.5320898", "0.52805275", "0.52648306", "0.5214216", "0.51764745", "0.5164797", "0.5126213", "0.5110325", "0.5106194", "0.5104233",...
0.6673566
0
Find the connected components of the model's Markov graph. Returns a list of sets of variables.
def connectedComponents(self): components = [] X = set(self.X) while X: Xi = X.pop() if Xi.states <= 1: continue # don't include missing or assigned variables group = {Xi} # start a new group with this variable queue = [Xi] # do DFS on the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nxMarkovGraph(self, all_vars=False):\n import networkx as nx\n return nx.from_scipy_sparse_matrix(self.L!=0)", "def connected_components(self) -> List[list]:\n self.reset_tags()\n ans = []\n visited = dict() # A dictionary of visited nodes\n\n for key in self._graph.get_all...
[ "0.6395554", "0.63244885", "0.61691284", "0.60650057", "0.6025276", "0.59588933", "0.59357953", "0.5887315", "0.586057", "0.58446604", "0.5805392", "0.57900643", "0.5778207", "0.57326496", "0.57238054", "0.5722187", "0.5720171", "0.5711577", "0.57085514", "0.5678446", "0.5657...
0.7487339
0
Return a networkx object representing the Markov graph of the Ising model
def nxMarkovGraph(self, all_vars=False): import networkx as nx return nx.from_scipy_sparse_matrix(self.L!=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_network_graph(mtf):\n # Build the graph with networkx:\n graph = nx.from_numpy_matrix(mtf)\n \n # Loops through the edges to get associate each of them with the\n # corresponding Markov transition probability:\n weights = [mtf[u,v] for u,v in graph.edges()]\n for index, e in enumerate(...
[ "0.6732601", "0.67247236", "0.6400307", "0.63652265", "0.6291419", "0.6240069", "0.6189117", "0.6072611", "0.60335827", "0.60287666", "0.60031044", "0.5992201", "0.59885776", "0.5968755", "0.59255195", "0.5894723", "0.58706594", "0.5809703", "0.5803601", "0.57487637", "0.5747...
0.7314668
0
Compute the pseudo (log) likelihood, \sum_i \sum_j \log p(x^{(j)}_i | x^{(j)}_{\neg i})
def pseudolikelihood(self, data): data = toPM(data); # interface glue: convert {0,1} to {-1,+1} r = self.L.dot(data) r += self.h.reshape(-1,1) if len(data.shape)==2 else self.h lnp = -np.log(1+np.exp(-2*data*r)) # ln p(x_i^(s)|x_{-i}^(s)) for all vars i, samples s return lnp.su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_log_perplexity(self, output, flat_labels): #completed, expensive, should be compiled\n return -np.sum(np.log2(np.clip(output, a_min=1E-12, a_max=1.0))[np.arange(flat_labels.shape[0]), flat_labels[:,1]])", "def calculate_negative_log_likelihood(self):\n data = self.played_points_hist[:...
[ "0.7215922", "0.7133143", "0.70432276", "0.7017532", "0.6941215", "0.6938317", "0.69106257", "0.69013226", "0.68590456", "0.6849183", "0.6836246", "0.68099016", "0.6802675", "0.67602664", "0.67503595", "0.67457527", "0.6743231", "0.6736149", "0.6732113", "0.67182237", "0.6702...
0.763866
0
Estimate an Ising model using Bresler's greedy edge selection approach
def fit_greedy(data, nnbr=10, threshold=0.05, refit=refit_pll): n,m = data.shape; L = np.zeros((n,n)) # initialize parameters scores = np.zeros(n) data = data.astype(int) for i in range(n): Ni = [] while (len(Ni)<nnbr): Vi = (0*data[i,:] + sum(data[j,:]*(2**jj) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelB(G,x=0,i0=0.1,alpha=-0.01,tf=5,Nt=1000):\r\n #set up graph atteributes\r\n N = G.number_of_nodes()\r\n degree_arr=np.asarray(G.degree(),dtype=int)[:,1]\r\n iarray = np.zeros((Nt+1,2*N))\r\n tarray = np.linspace(0,tf,Nt+1)\r\n #calucalte operaters and set intial conditions\r\n A=nx.adja...
[ "0.6350745", "0.62589806", "0.6040089", "0.6003629", "0.5811505", "0.5810818", "0.5794086", "0.5768449", "0.5756225", "0.5752969", "0.57498443", "0.5730941", "0.57198054", "0.5712373", "0.56915325", "0.5691198", "0.5678697", "0.5677809", "0.5666621", "0.56582415", "0.564055",...
0.63231003
1
Run loopy belief propagation (specialized for Ising models) lnZ, bel = LBP(ising, maxIter, verbose)
def LBP(ising, maxIter=100, verbose=False): # TODO: pass requested beliefs (like JT?), or "single", "factors", etc. assert isinstance(ising,Ising), "Model must be an Ising model for this version to work" R = ising.L.tocoo(); row = R.row; col = R.col; mu = csr(([],([],[])),shape=ising.L.shape) L_tanh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loopy_belief_propagation(tests, groups,\n base_infection_rate,\n sensitivity, specificity,\n min_iterations, max_iterations,\n atol):\n n_groups, n_patients = groups.shape\n if np.size(groups) == 0...
[ "0.55514497", "0.55479896", "0.5500377", "0.5468595", "0.5400182", "0.53876376", "0.5350931", "0.53487784", "0.5345041", "0.53391325", "0.5334536", "0.5322883", "0.53198916", "0.53003246", "0.5299647", "0.5282885", "0.5242406", "0.52322274", "0.5230585", "0.5230055", "0.52258...
0.77011764
0
Returns False if the package version or newer is already installed, False otherwise.
def _checkUpdateNeeded(self): try: currentVersionLine = str(subprocess.run(['pacman', '-Q', '-i', self._name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True).stdout) currentVersion = re.sub(r'.*Version\s*: ([\d|\.]*)-.*', r'\1', cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increase_version(self):\n # type: (...) -> bool\n if self.type == RequirementType.FINAL_LATEST_VERSION:\n return False\n\n # get the latest version that may work\n if self.type == RequirementType.NOT_LATEST_VERSION:\n # get version between the current and last\...
[ "0.73764956", "0.7320208", "0.73141676", "0.7307421", "0.7217588", "0.7215344", "0.7184852", "0.7140658", "0.70948553", "0.70781523", "0.7054996", "0.70102936", "0.6954251", "0.69457585", "0.6857291", "0.68349785", "0.68068194", "0.6797386", "0.6789894", "0.6782599", "0.67767...
0.8052965
0
do builder; in this case, old time stamp is removed from filename and a new time stamp is append to the filename
def build_base_filename(self): if self.stream: self.stream.close() self.stream = None # remove old suffix # if self.suffix_time != "": # index = self.baseFilename.find("." + self.suffix_time) # if index == -1: # index = self.baseFi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_base_filename(self):\n if self.stream:\n self.stream.close()\n self.stream = None\n\n # remove old suffix\n if self.suffix_time != \"\":\n index = self.baseFilename.find(\".\" + self.suffix_time)\n if index == -1:\n index = s...
[ "0.70553964", "0.69749874", "0.68303984", "0.6505987", "0.6437434", "0.6416206", "0.6362413", "0.63200045", "0.60268813", "0.59997386", "0.59976786", "0.59762424", "0.5955748", "0.5942343", "0.587975", "0.5873776", "0.5842434", "0.58421123", "0.58421123", "0.5831234", "0.5815...
0.7269255
0
Replaces incorrect words with the closest correct one If no such word is found, commence splitting in split_word
def replace_nearest(word): nearest = spellcheck.correction(word) #When there is no valid word, the nearest word #is the same as the original if word == nearest: #This implies we need to try splitting it return split_word(word) return nearest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_splitwords():\n\n if t_word[:2] == 'un' and (t_pos == 'ADJD' or t_pos == 'ADJA'):\n create_splitword_tags(t_word[:2], t_word[2:])\n create_negation_frame()\n create_splitword_target(t_word[:2])\n ...
[ "0.6981828", "0.6736414", "0.64699274", "0.63430244", "0.6283987", "0.62455136", "0.61750865", "0.61721975", "0.6135052", "0.6119548", "0.611553", "0.6093361", "0.6091531", "0.6079507", "0.6039277", "0.603611", "0.60313684", "0.6015431", "0.5996881", "0.5982785", "0.59806716"...
0.72672725
0
Test that the ``from_crawler`` method should initialize the selenium driver
def test_from_crawler_method_should_initialize_the_driver(self): crawler = Crawler( spidercls=self.spider_klass, settings=self.settings ) selenium_middleware = SeleniumMiddleware.from_crawler(crawler) # The driver must be initialized self.assertIsNotNone...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.driver = webdriver.Chrome()", "def setUp(self):\r\n self.driver = webdriver.Firefox()", "def setUp(self):\r\n self.verificationErrors = []\r\n self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDe...
[ "0.6752897", "0.6720318", "0.67141783", "0.665155", "0.659639", "0.65823466", "0.6549845", "0.6548284", "0.65447414", "0.652005", "0.6445638", "0.6435747", "0.6420393", "0.6366762", "0.6343879", "0.6343164", "0.6343138", "0.6319333", "0.6262687", "0.62545055", "0.6227926", ...
0.8505681
0
Test that the ``spider_closed`` method should close the driver
def test_spider_closed_should_close_the_driver(self): crawler = Crawler( spidercls=self.spider_klass, settings=self.settings ) selenium_middleware = SeleniumMiddleware.from_crawler(crawler) with patch.object(selenium_middleware.driver, 'quit') as mocked_quit: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spider_closing(spider):\n logger.info(\"Spider closed: %s\" % spider)\n if True:\n reactor.stop()", "def spider_closing(spider):\n print(\"Spiderclose\"*10)\n #reactor.stop()", "def close_spider(self, spider):\n self.curr.close()\n self.connection_utils....
[ "0.75399226", "0.7410295", "0.73937637", "0.7142886", "0.69627196", "0.6763172", "0.6763172", "0.67367905", "0.6732758", "0.6619831", "0.6557089", "0.6551975", "0.6495354", "0.6467982", "0.64387274", "0.6410662", "0.64024085", "0.6392943", "0.6377258", "0.63504547", "0.634498...
0.85677516
0
Test that the ``process_request`` should return a request if not selenium request
def test_process_request_should_return_the_request_if_not_selenium_request(self): scrapy_request = Request(url='http://not-an-url') self.assertEqual( self.selenium_middleware.process_request( request=scrapy_request, spider=None ), scr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_request_should_return_a_response_if_selenium_request(self):\n\n selenium_request = SeleniumRequest(url='http://www.python.org')\n\n html_response = self.selenium_middleware.process_request(\n request=selenium_request,\n spider=None\n )\n\n # We hav...
[ "0.7782904", "0.6876636", "0.68162775", "0.6450981", "0.6443321", "0.62916404", "0.62050986", "0.6160339", "0.61578095", "0.61557835", "0.6145541", "0.60554665", "0.6046499", "0.60436505", "0.5979306", "0.5977337", "0.59745866", "0.5972902", "0.59568197", "0.59487456", "0.594...
0.8748925
0
Test that the ``process_request`` should return a response if selenium request
def test_process_request_should_return_a_response_if_selenium_request(self): selenium_request = SeleniumRequest(url='http://www.python.org') html_response = self.selenium_middleware.process_request( request=selenium_request, spider=None ) # We have access to th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_request_should_return_the_request_if_not_selenium_request(self):\n\n scrapy_request = Request(url='http://not-an-url')\n\n self.assertEqual(\n self.selenium_middleware.process_request(\n request=scrapy_request,\n spider=None\n ),\n ...
[ "0.77570677", "0.6666603", "0.6377647", "0.6352617", "0.6313659", "0.6251728", "0.61933583", "0.617999", "0.6179159", "0.6157223", "0.613767", "0.613034", "0.60957634", "0.60805225", "0.6074847", "0.6060231", "0.6040658", "0.59941536", "0.59463805", "0.5916223", "0.59070355",...
0.82235956
0
Test that the ``process_request`` should return a response with a screenshot
def test_process_request_should_return_a_screenshot_if_screenshot_option(self): selenium_request = SeleniumRequest( url='http://www.python.org', screenshot=True ) html_response = self.selenium_middleware.process_request( request=selenium_request, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def capture_and_upload_screenshot(self) -> None:", "async def capture_screenshot(self) -> bytes:", "def test_irobotframework_report_image(self):\n if PLATFORM == \"windows\":\n return\n\n with patch(\"jupyter_kernel_test.validate_message\", fake_validate):\n reply, out...
[ "0.6180433", "0.61329305", "0.5981445", "0.59613127", "0.59158814", "0.58642656", "0.5797827", "0.5747805", "0.5730415", "0.5722605", "0.5716882", "0.5696272", "0.5693902", "0.56812185", "0.56661636", "0.56572115", "0.5637373", "0.56268907", "0.5623144", "0.5621982", "0.56084...
0.7994079
0
An argument parser as an initializing function
def initialize(): parser = argparse.ArgumentParser( description='This function takes a gene count file, a gene name, and \ an output file as parameters, and creates a file with the \ sample IDs and counts for that gene.') parser.add_argument('-i', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Args(parser):", "def _init_parser():\n\t\n\t_parser = argparse.ArgumentParser()\n\t_parser.add_argument(\"--pull\", help=\"pull scripts from UR3\", action=\"store_true\")\n\t_parser.add_argument(\"--create\", help=\"create data base from script files\", action=\"store_true\")\n\t_parser.add_argument(\"--clea...
[ "0.753177", "0.71635896", "0.7149843", "0.69766307", "0.69679993", "0.696592", "0.69447595", "0.69334394", "0.685784", "0.6836484", "0.68265146", "0.67551535", "0.67529", "0.67021227", "0.6690013", "0.66811675", "0.66556257", "0.66447634", "0.662665", "0.6625429", "0.65926546...
0.7339132
1
check if brain has lead image
def brain_has_lead_image(self, brain=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ball(self, blob, im):\n size=self.cam.info.get_pixel_size(blob[0], im)*len(blob)\n return size>15 and size<45", "def check_availability(img_path):\n # loading gray image\n gray_image = cv2.imread(img_path, 0)\n\n # check whether img give empty list or not\n flag = face_recognitio...
[ "0.67208415", "0.6549659", "0.6424981", "0.6267433", "0.62418383", "0.61783123", "0.6171466", "0.6166017", "0.6164968", "0.6160429", "0.6133569", "0.61204714", "0.6114851", "0.6066226", "0.60527056", "0.6045372", "0.60449404", "0.6043452", "0.6028829", "0.5976049", "0.5966996...
0.910233
0
return the issue obj
def get_issue(self, context):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_issue(self):\n issue_id = self.kwargs['issue_id']\n try:\n issue = Issue.objects.get(pk=issue_id)\n except ObjectDoesNotExist:\n raise ObjectNotFound('Not found')\n if issue.project.pk != self.project.pk:\n raise ObjectNotFound('Not found')\n ...
[ "0.7724183", "0.73526764", "0.70980966", "0.7077046", "0.70164293", "0.6997512", "0.6836603", "0.6803096", "0.6654887", "0.6578831", "0.6578831", "0.6359338", "0.6327027", "0.63029647", "0.6269081", "0.6204601", "0.6123286", "0.61033016", "0.61033016", "0.60400707", "0.603705...
0.7701295
1
return a list of result sets based on aggregation sources
def get_results_from_aggregation_sources(self, context):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_results_from_aggregation_sources(self, context):\n sources = context.getContentSources()\n results = []\n for source in sources:\n sresults = source.queryCatalog()\n if not sresults:\n continue\n results.append({\n 'id': so...
[ "0.7396055", "0.6670536", "0.6139287", "0.59427476", "0.57398534", "0.5707704", "0.5705822", "0.5677861", "0.5675235", "0.5640641", "0.56228405", "0.55964017", "0.55739796", "0.5560072", "0.55285263", "0.54851615", "0.5454533", "0.5436064", "0.5424911", "0.5414805", "0.541425...
0.7795179
0
filter given list by portal_type
def type_filter(self, items, types=None): if not types: return items allowed_items = [] for item in items: if item.portal_type not in types: continue allowed_items.append(item) return allowed_items
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_items_of_portal_type(self, portal_type):\n positions = self.getPositions()\n items = []\n for position in positions:\n item = position.getStoredItem()\n if item and item.portal_type == portal_type:\n items.append(item)\n\n return items", "...
[ "0.6785678", "0.6625427", "0.61785436", "0.5918538", "0.5822994", "0.5797092", "0.57849234", "0.5744422", "0.545527", "0.5435968", "0.5430511", "0.5405267", "0.5343092", "0.5328372", "0.530739", "0.53043014", "0.5278536", "0.52743703", "0.5273825", "0.5255314", "0.5230885", ...
0.74198943
0
Confirm that backup reserve sensor is not added if data is unavailable from the device.
async def test_sensor_backup_reserve_unavailable(hass: HomeAssistant) -> None: mock_powerwall = await _mock_powerwall_with_fixtures(hass) mock_powerwall.get_backup_reserve_percentage = Mock( side_effect=MissingAttributeError(Mock(), "backup_reserve_percent", "operation") ) config_entry = MockC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_out_of_date(self):\n self.assertTrue(update_available(0.0))", "def check_availability(self):\n pass", "def _check(self):\n\t\tif not self._raven:\n\t\t\traise NoDeviceFoundException", "def test_notify_no_reserved_seats(self):\n # self.client.force_authenticate(user=self.admin)\n...
[ "0.63336015", "0.6070998", "0.60164124", "0.5928738", "0.5783267", "0.576908", "0.57484996", "0.57390165", "0.57363605", "0.57146716", "0.56859374", "0.56785417", "0.56508255", "0.55821735", "0.55600667", "0.5550947", "0.55306345", "0.55165243", "0.5497446", "0.54666257", "0....
0.727179
0
The 'request' parameter is set for custom auth use by subclasses. The form data comes in via the standard 'data' kwarg.
def __init__(self, request=None, *args, **kwargs): self.request = request self.user_cache = None super(AuthForm, self).__init__(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, request=None, *args, **kwargs):\n self.request = request\n self.user_cache = None\n super(AuthenticationFormCustom, self).__init__(*args, **kwargs)", "def set_input_data(self, request, auth_data):\n request.auth_data = auth_data", "def __init__(self, request=None,...
[ "0.7029772", "0.6973635", "0.68806773", "0.684054", "0.6802682", "0.6762325", "0.6693142", "0.658599", "0.6486834", "0.6468394", "0.6317755", "0.6317755", "0.62940997", "0.6264856", "0.6229171", "0.6193714", "0.6163837", "0.61228687", "0.60734177", "0.6059509", "0.6034855", ...
0.7101403
0
this converts a multiline string into a list of individual lines=entries, stripped of white spaces and \n newlines.
def parse_multiline_string(s): result = [x.strip() for x in s.strip().split('\n')] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_lines(s):\n return [l.strip() for l in s.splitlines() if l.strip()]", "def _str2lines(cls, text):\n lines = text.replace('\\r', '').split('\\n')\n lines[0] = lines[0].strip() # firts line is always detented\n if len(lines) > 1:\n # Get minimal indentation\n ...
[ "0.743767", "0.7229761", "0.7101724", "0.70156485", "0.68796915", "0.6628763", "0.6531216", "0.64587754", "0.6420906", "0.63896006", "0.6380917", "0.63807535", "0.63330936", "0.6249625", "0.62248987", "0.619419", "0.61721647", "0.6137706", "0.6128727", "0.6117737", "0.6110453...
0.7521817
0
main method, shifts between the three modes and rules to utilize depending on context and feedback.
def main()-> None: print("Mode One - One time rules") conflict_check() init_safeboard() corner_init_check() squeeze_rules() progress_handler(False, True) print("Mode Two - iterative rules") while progress_handler(): progress_handler(False, False) mark_check() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(ctx):\n\n print(\"Mode:\")", "def main():\n\n # ARGS\n #\n parser = ArgumentParser()\n parser.add_argument('-c', '--configuration',\n help=\"Configuration of the program\",\n required=True)\n\n action_grp = parser.add_mutually_exclusive_gro...
[ "0.6570712", "0.6241725", "0.61959386", "0.60946965", "0.60019034", "0.5968465", "0.58994526", "0.586812", "0.5860047", "0.58057714", "0.57863784", "0.5766762", "0.57665056", "0.57608014", "0.57501566", "0.57124436", "0.5712039", "0.56679755", "0.5659435", "0.5640172", "0.563...
0.7541584
0
Checks for squeezed variables (4_2_4), which signify a safe mark in the middle and rule of three (4_4_4), which signifies a crossing of edge values. Updates conflict_board when done.
def squeeze_rules() -> None: for x in range(shape): for y in range(1, shape-1): # Vertical check if conflict_space[x, y+1] == conflict_space[x, y-1] and conflict_space[x, y+1] != 0: if conflict_space[x, y] == conflict_space[x, y+1]: example[x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def special_corner() -> None:\r\n if example[1, 1] == 0: # NW\r\n if conflict_space[0, 0] == conflict_space[0, 2] and conflict_space[2, 0] == conflict_space[0, 0] \\\r\n and conflict_space[0, 0] != 0:\r\n example[0, 0] = 0\r\n safeboard[0, 0] = 0\r\n progr...
[ "0.7082645", "0.6798568", "0.65407294", "0.63337123", "0.6302791", "0.5894951", "0.5689586", "0.56274825", "0.55766845", "0.55069464", "0.5418327", "0.53852004", "0.5350573", "0.53499377", "0.53453034", "0.53324044", "0.52625626", "0.5245496", "0.5213092", "0.5192848", "0.519...
0.7034803
1
Progress value is used to determine if program need to switch ruleset or determine progress. operation defines read if true, write if false. Setstate defines what to write. Used by most function to indicate that it has done an operation
def progress_handler(operation: bool = True, setstate: bool = False) -> bool: global progress if operation: return progress else: if setstate: progress = True else: progress = False return progress
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setProgress(self, prog):\n\t\tself.progress = prog", "def set_progress(self, progress: float):", "def update_state(self, progress, policy_state=None):\n raise NotImplementedError", "def set_Progress(self,func):\n self.__obj.set_Progress(func)", "def setProgress(self, progress):\n\t\tself....
[ "0.6293654", "0.62856567", "0.6055803", "0.60213214", "0.6015944", "0.5997522", "0.58386755", "0.5813391", "0.5762794", "0.5664035", "0.5641879", "0.5641879", "0.55601823", "0.5539708", "0.54892194", "0.54886764", "0.5436204", "0.5429723", "0.54256964", "0.53971744", "0.53836...
0.7282679
0
First level iterative checker. Iterates through whole conflict_space and checks for each cell. If the value of the cell is not marked as safe (i.e. cannot me crossed,1), and it is only in conflict with one other cell then it marks itself. Includes horizontal and vertical check.
def mark_check() -> None: for i in range(shape): y = i can_mark = False conflict_counter = 0 # Horizontal Check for j in range(shape): x = j for z in range(shape): if conflict_space[x, y] == conflict_space[z, y] and x != z an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def victory_checker() -> bool:\r\n conflict_check()\r\n for x in range(shape):\r\n for y in range(shape):\r\n if conflict_space[x, y] != 0:\r\n return False\r\n if separation_crawler(False):\r\n return False\r\n return True", "def Check(self):\n cleared ...
[ "0.66137093", "0.63193256", "0.6195305", "0.61903304", "0.6109309", "0.6104149", "0.602397", "0.5841081", "0.5785838", "0.5771878", "0.57661647", "0.5754706", "0.5704862", "0.56913733", "0.56874764", "0.5679572", "0.5659919", "0.56568843", "0.56473964", "0.5587343", "0.557993...
0.7723859
0
Based on input coords, mark surrounding cells and itself as safe in the safe_board
def shade_neighbours(x: int, y: int) -> None: if x > 0: safeboard[x-1, y] = 0 if x < shape-1: safeboard[x+1, y] = 0 if y > 0: safeboard[x, y-1] = 0 if y < shape-1: safeboard[x, y+1] = 0 safeboard[x, y] = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_check() -> None:\r\n for i in range(shape):\r\n y = i\r\n can_mark = False\r\n conflict_counter = 0\r\n\r\n # Horizontal Check\r\n for j in range(shape):\r\n x = j\r\n for z in range(shape):\r\n if conflict_space[x, y] == conflict_...
[ "0.6698566", "0.6651897", "0.65701115", "0.6569384", "0.6431577", "0.6431433", "0.6393516", "0.6337361", "0.6293667", "0.62621784", "0.6128685", "0.61050916", "0.6091913", "0.6003502", "0.5996541", "0.5960589", "0.5947663", "0.5923436", "0.5906991", "0.59047127", "0.5823895",...
0.67102504
0
Verifies if victory is reached. Requires that conflict_space is empty and separation crawler to not find any divided partitions. Returns True if victory is reached, False if not
def victory_checker() -> bool: conflict_check() for x in range(shape): for y in range(shape): if conflict_space[x, y] != 0: return False if separation_crawler(False): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_collisions(self):", "def check_collisions(self):\n for tail in self.tail:\n if tail.position == self.head.position:\n self.die()\n\n future_pos = Position(self.head_x + self.direction.move_x * Const.SQUARE_SIZE,\n self.head_y + self.d...
[ "0.5921852", "0.5688503", "0.5651997", "0.5624778", "0.55720216", "0.55711174", "0.5554331", "0.54907095", "0.54856306", "0.5395822", "0.5390122", "0.5354838", "0.53450274", "0.53404874", "0.5336775", "0.53205425", "0.5275632", "0.52618295", "0.5261268", "0.5256881", "0.52439...
0.7447532
0
Writes end output. state determines if solution(T) or failure(F) output. Ends program.
def completion(state: bool) -> None: if state: print("Solution is reached. Zero represents marked nodes") print_debug("checkstate") print("Preferred output:") for y in range(shape): for x in range(shape): if example[y, x] == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self):\n self.my_print(\"\\t[DONE]\", msg_types.INFO)\n self.in_progress = False", "def state_print_exit(cfg, app, win):", "def eof(self):\n self.report_scenario_completed()\n self.report_feature_completed()\n self.report_failures()\n self.stream.flush()\n ...
[ "0.5810109", "0.5795182", "0.5698138", "0.5690449", "0.56789774", "0.56248546", "0.56185454", "0.55556923", "0.55530185", "0.5529495", "0.5508842", "0.5501936", "0.54913926", "0.5471432", "0.5471426", "0.5463505", "0.5450878", "0.5432113", "0.5401954", "0.5358274", "0.5355043...
0.59610677
0
Mode two rule, rarer situations. This one marks the corner if it is in conflict two direct spaces away and inner corner is marked.Avoids getting blocked in.
def special_corner() -> None: if example[1, 1] == 0: # NW if conflict_space[0, 0] == conflict_space[0, 2] and conflict_space[2, 0] == conflict_space[0, 0] \ and conflict_space[0, 0] != 0: example[0, 0] = 0 safeboard[0, 0] = 0 progress_handler(False,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corner_init_check():\r\n \"\"\"Rule One\"\"\"\r\n z = shape-1\r\n if example[0, 0] == example[0, 1] and example[0, 0] == example[1, 0] and example[0, 0] != 0: # NE\r\n example[0, 0] = 0\r\n shade_neighbours(0, 0)\r\n print(\"RULE 1 NW\")\r\n if example[0, z] == example[0, z-1]...
[ "0.5981702", "0.5498118", "0.5346346", "0.526641", "0.5251681", "0.52326655", "0.5207926", "0.5193102", "0.518958", "0.51500475", "0.5100609", "0.50684613", "0.50634706", "0.5061822", "0.5053548", "0.49817917", "0.4971824", "0.494964", "0.49292374", "0.48934457", "0.48931384"...
0.62581146
0
This is mode three. The system has now determined that it cannot solve it with the rules available and needs to start guessing. Creates a list of all cells left in conflict and does one last test. If crossing one with the most conflicts doesn't solve it, it switches mode into a depth first search function that iterates...
def occam_razor() -> None: print("WARNING! Mode three activated. Time to complete may be several minutes") temp = [] # x-y-conflicts global example backup = example.copy() # Backup so it can backtrack through solutions for x in range(shape): for y in range(shape): confli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):\r\n while not self.done():\r\n self.no_open_cells()\r\n self.all_cells_are_mines()\r\n self.no_mines()\r\n if not self.done():\r\n self.obvious_cells()\r\n if not self.done():\r\n made_progress = self.safe_...
[ "0.62933546", "0.60394496", "0.60394496", "0.60394496", "0.59849966", "0.59767514", "0.59498453", "0.5902804", "0.58814317", "0.58176583", "0.5809066", "0.57780963", "0.5732107", "0.5721115", "0.57163996", "0.56900156", "0.5654619", "0.5654329", "0.5650874", "0.56231433", "0....
0.6647427
0
Number of the previous page.
def prev_num(self): return self.page - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_previous_page(self):\n return max((self.get_page() - 1), self.get_first_page)", "def previous_pages(self):\n \n if self.start > 0:\n return self.all_pages[0:self.start]\n return", "def prev_page(self):\n if self._start == 0:\n raise ValueError('A...
[ "0.8197682", "0.7729763", "0.7716226", "0.7715716", "0.7556896", "0.75410664", "0.73832566", "0.7050944", "0.7017823", "0.6989275", "0.69792265", "0.6874237", "0.6766546", "0.67367965", "0.672437", "0.66341996", "0.66341996", "0.6628823", "0.6625492", "0.6606188", "0.66012436...
0.90779954
0
Number of the next page
def next_num(self): return self.page + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_page(self):\n self._start += self._num", "def get_next_page(self):\n return min((self.get_page() + 1), self.get_last_page())", "def get_num_of_pages(self):", "def get_page(self, num):\n return num + 10", "def next_page(self):\n return self._next_page", "def next_p...
[ "0.7912719", "0.776949", "0.75264466", "0.7490207", "0.7420435", "0.7420435", "0.7358714", "0.7335388", "0.7232458", "0.722517", "0.70511395", "0.70087206", "0.69735175", "0.69493306", "0.6920194", "0.69061184", "0.68802154", "0.6866216", "0.6836325", "0.68159133", "0.6809479...
0.88785183
0
Move forward in the page history.
def forward( self ) -> None: if not self._forward_page_history_stack: # Do nothing if there is no forward page history. return self._back_page_history_stack.append(self._current_page) self._current_page = self._forward_page_history_stack.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goForward(self):\r\n if self.currLoc + 1 < len(self.history):\r\n self.currLoc += 1\r\n return self.history[self.currLoc]", "def go_forward(self):\n if not self._items:\n raise ValueError(\"Empty navigation history\")\n\n if self.can_go_forward():\n self._pointer += 1...
[ "0.753726", "0.7529166", "0.7390683", "0.7294184", "0.6968584", "0.6864742", "0.6859291", "0.67792183", "0.67070913", "0.6690533", "0.66168475", "0.6588484", "0.6566489", "0.655988", "0.6542372", "0.65021604", "0.6479505", "0.64431185", "0.64023757", "0.6396935", "0.6373209",...
0.83035225
0
The class used to create new directory pages.
def directory_page_cls( self ) -> Type[DirectoryPage]: return self._directory_page_cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_page(self):", "def add_directory_page(\n self,\n path: PagePathLike\n ) -> DirectoryPage:\n dir_page = self.directory_page_cls(path)\n\n try:\n self.set_page(PagePath(path), dir_page, allow_overwrite=False)\n except BlockedPageOverwriteError as e:\n ...
[ "0.6876271", "0.64671487", "0.6301305", "0.6073462", "0.6032142", "0.59679025", "0.59594065", "0.58994865", "0.58537525", "0.58387244", "0.58210397", "0.5793927", "0.578222", "0.5776555", "0.57743734", "0.57717276", "0.5752531", "0.5730383", "0.5696773", "0.5685192", "0.56803...
0.6647204
1
The root page within this navigator.
def root_page( self ) -> AbstractPage: return self._root_page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_page(self) -> str:\n return self._home_page", "def root(self) -> str:\n return pulumi.get(self, \"root\")", "def root(self):\n\n return self.parent.root", "def root(self):\n\t\treturn self._root", "def root(self):\n\t\treturn self._root", "def root(self):\n return sel...
[ "0.70294297", "0.7009565", "0.6991737", "0.69309825", "0.69309825", "0.6902258", "0.6902258", "0.6902258", "0.6879144", "0.68653315", "0.68464136", "0.67893165", "0.67376995", "0.6731292", "0.6695941", "0.6685355", "0.6680737", "0.66666514", "0.66562426", "0.6647564", "0.6645...
0.87201524
0
The current page within this navigator.
def current_page( self ) -> AbstractPage: return self._current_page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _currentPage(self):\n view = self._window.currentBrowser()\n if view is None:\n return None\n \n return view.page()", "def GetCurrentPage(self):\r\n\r\n if self._curpage >= 0 and self._curpage < self._tabs.GetPageCount():\r\n return self.GetPage(self._...
[ "0.8514561", "0.79256123", "0.78558654", "0.7707269", "0.7698711", "0.7328907", "0.7261823", "0.72005963", "0.7128613", "0.7108345", "0.70872545", "0.7063684", "0.6865034", "0.6733071", "0.6718827", "0.6714636", "0.67096746", "0.6604453", "0.6533142", "0.6480815", "0.64742553...
0.83133423
1
Add a directory page at the specified path. This method is only used for adding pages that do not already exist. It will also create any intermediate directories within the path that do not already exist.
def add_directory_page( self, path: PagePathLike ) -> DirectoryPage: dir_page = self.directory_page_cls(path) try: self.set_page(PagePath(path), dir_page, allow_overwrite=False) except BlockedPageOverwriteError as e: raise e return dir_page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_dir(self, path):\n assert self._root_dir == path or self._root_dir.is_parent_of(path)\n self._dirs.append(path)", "def add_path(self, path):\n _dir = self._add_dir()\n _special_mkdir('%s/%s' % (self.path, _dir), self.umask)\n return self._add_path(path, _dir)", "def with_dir(...
[ "0.7685346", "0.7401949", "0.65495193", "0.6542977", "0.6518924", "0.63905865", "0.63506055", "0.63326705", "0.6327676", "0.630702", "0.6245604", "0.6225323", "0.6186611", "0.61673325", "0.6165024", "0.61643916", "0.61416674", "0.61135954", "0.60795957", "0.6071639", "0.60459...
0.7941226
0
Checks if this map_obstacle is capable of movement.
def can_move(self): return self.movement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_movement(self):\n is_clear = True # default return value if no obstacles\n # !!! IR_SENSORS DISABLED\n if self.move_state == MOV_FORWARD:\n if self.l.look_for_obstacle(OBST_FRONT) == True:\n is_clear = False\n return is_clear", "def ca...
[ "0.7274342", "0.68518585", "0.67652327", "0.6758304", "0.6754243", "0.6752632", "0.6732429", "0.6578781", "0.6543062", "0.6492408", "0.64774024", "0.64241654", "0.6402476", "0.6391021", "0.63888747", "0.6365543", "0.6341003", "0.6299985", "0.62854004", "0.6270042", "0.6225189...
0.7511879
0
Figure out the sight range of this map_obstacle.
def _get_sight_range(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_sight_range(self):\n if not self.check_map_obstacle_has_sight():\n return 0\n else:\n return self.map_obstacle.sight_range", "def sight_range(self) -> Union[int, float]:\n return self.type_data.proto.sight_range", "def sight_range(self) -> Union[int, flo...
[ "0.8740198", "0.70724773", "0.70724773", "0.6476868", "0.6211137", "0.60339963", "0.59237415", "0.5895679", "0.5869808", "0.5848503", "0.58431524", "0.58291197", "0.5825011", "0.5825011", "0.5825011", "0.5825011", "0.5825011", "0.5825011", "0.5825011", "0.5825011", "0.5814925...
0.7430501
1
Constructs a ``ThreatZone`` based on a graph of a map and a particular object on that map.
def __init__(self, map_obstacle, main_graph): self.map_obstacle = map_obstacle self.main_graph = main_graph self.sight_range = self.calculate_sight_range() self.top_left_y = None self.top_left_x = None self.bottom_right_y = None self.bottom_right_x = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_graph(some_map):\n\n map_height = some_map.height\n map_width = some_map.width\n map_obstacles = some_map.obstacles\n\n nodes = [[None] * map_width] * map_height\n\n # create a node representing each position on the map\n for y in range(0, map_height):\n for x in range(0, map_wi...
[ "0.60009485", "0.5041681", "0.49264517", "0.49222687", "0.48660728", "0.48628318", "0.4804551", "0.47956434", "0.47708657", "0.47001004", "0.46880463", "0.46478447", "0.46415672", "0.45898074", "0.45831951", "0.45799652", "0.45658222", "0.45606983", "0.45602018", "0.4554372", ...
0.6604095
0
Calculate the bounds of the threat zone based on the map obstacle. Returns the top left corner (y, x) and the bottom right corner (y, x) in the form of ((y, x), (y, x), height, width).
def calculate_size(self): top_left_y = 0 top_left_x = 0 bottom_right_y = 1 bottom_right_x = 1 # TODO: calculate the correct bounds of the threat zone. raise NotImplementedError # if there is a sight_range for this map_obstacle then increase the size of the zon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounds(self):\n occupied_locations = self.board.keys()\n min_x = min(p[0] for p in occupied_locations)\n max_x = max(p[0] for p in occupied_locations)\n min_y = min(p[1] for p in occupied_locations)\n max_y = max(p[1] for p in occupied_locations)\n return ((min_x, max_x), (min_y, max_y))"...
[ "0.7409617", "0.71135247", "0.6945548", "0.68523395", "0.6803846", "0.669902", "0.6685926", "0.6656805", "0.6656805", "0.66323423", "0.6606502", "0.6596544", "0.6577578", "0.6510134", "0.64790386", "0.64790386", "0.64790386", "0.64790386", "0.64790386", "0.64790386", "0.64790...
0.74315655
0
Determines if the map object has the sight feature.
def check_map_obstacle_has_sight(self): return self.map_obstacle.sight_range > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_spow_enabled() -> bool:\n\n return _SPOW_ENABLED", "def has_wcs(self):\n return self.wcs is not None", "def exposes_features(self):\n return self._features_op is not None", "def has_feature(self, feature):\n features = self.features\n if features is None:\n re...
[ "0.62063617", "0.6160507", "0.6053094", "0.6021452", "0.59894526", "0.5893399", "0.58866096", "0.5880212", "0.585423", "0.5796465", "0.5779651", "0.5764406", "0.5761272", "0.57584864", "0.5730632", "0.5709549", "0.56936044", "0.5664519", "0.5662932", "0.56593096", "0.5658161"...
0.78120387
0
Get the current facing direction of the map_obstacle.
def get_current_facing_direction(self, DIRECTIONS=DIRECTIONS): return self.map_obstacle.get_current_facing_direction(DIRECTIONS=DIRECTIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_direction(self):\n return self.actual_coordinates[2]", "def direction(self):\r\n return 180 - atan2(self.x, self.y)*180/pi", "def direction(self):\n return atan2d(self.y, self.x)", "def _get_current_facing_direction(self, DIRECTIONS=DIRECTIONS):\n raise NotImplementedError...
[ "0.71916044", "0.6864216", "0.6857686", "0.68540317", "0.68077856", "0.6801024", "0.67543185", "0.6675903", "0.6646047", "0.66074467", "0.6578764", "0.65732384", "0.6533489", "0.6516402", "0.64621323", "0.64621323", "0.63884836", "0.6324804", "0.6301677", "0.6301453", "0.6290...
0.8296232
0
Determines if the map_obstacle is within the bounds of whatever is on screen at the moment. If the object is of a type that is capable of moving, and it is not on screen, then it is not moving.
def is_map_obstacle_in_screen_range(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_obstacles(self):\n obs = False\n obs_p = []\n for point in self.obstacles:\n if -0.15 <= point[1] <= 0.15: # robot is 178mm wide\n # Obstacles should be less than or equal to 0.2 m away before being detected\n if 0 <= point[0] <= .2:\n ...
[ "0.7182401", "0.71817607", "0.7138847", "0.7061933", "0.68010205", "0.67334014", "0.6733266", "0.66714823", "0.6660474", "0.66379917", "0.6631967", "0.65769875", "0.65340596", "0.6531979", "0.6531796", "0.6516765", "0.6484118", "0.6469506", "0.6430552", "0.64257663", "0.64110...
0.799648
0
Based on the nodes in this threat zone, mark each main graph's nodes as members of this threat zone.
def mark_nodes_as_members_of_threat_zone(self): for y in range(self.top_left_y, self.top_left_y + self.height): for x in range(self.top_left_x, self.top_left_x + self.width): main_node = self.main_graph[y][x] main_node.threat_zones.add(self) self.nod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes(self, nodes):\n\n self._nodes = nodes", "def __decorate_nodes(nodes, space):\n for n in nodes:\n if n not in self.__node_spaces:\n self.__node_spaces[n] = set([])\n self.__node_spaces[n].add(space)\n pred_nodes = self.__p...
[ "0.60196775", "0.5955533", "0.59219986", "0.5819174", "0.57993126", "0.57758045", "0.57588553", "0.57361597", "0.5703751", "0.563438", "0.5621395", "0.557243", "0.55421466", "0.55112344", "0.5449", "0.5445592", "0.54265106", "0.5426301", "0.5412472", "0.5403417", "0.53269345"...
0.86081684
0
Updates which node has the obstacle. This does not recompute the graph based on this new information. Each threat zone is responsible for updating its own map objects. So there will never be a time when the current x value attached to the map_obstacle does not represent the actual previous location.
def update_obstacle_location(self): # find the previous location of the obstacle old_y = self.map_obstacle.y old_x = self.map_obstacle.x # remove it from the main graph self.main_graph[old_y][old_x].contents.remove(self.map_obstacle) # get the latest location s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_obstacles(self, new_obs):\n self.obstacles = new_obs", "def updateObstacleMap(self):\n\n all_sensor_readings = self.laser_readings + self.sonar_readings\n\n #we remove all the sensor readings that occur inside the robot frame\n restricted_sensor_readings = []\n for p...
[ "0.6858056", "0.66510636", "0.6521249", "0.6422313", "0.6422313", "0.64151233", "0.61033696", "0.59195876", "0.559934", "0.55672807", "0.55025584", "0.5501277", "0.54630464", "0.54411334", "0.54149264", "0.5392659", "0.5337027", "0.533481", "0.5315811", "0.5307237", "0.529586...
0.79966825
0
Checks if the node is in the range of the threat zone.
def is_node_in_threat_zone(self, y, x): y_condition = self.top_left_y <= y < self.top_left_y + self.height x_condition = self.top_left_x <= x < self.top_left_x + self.width return y_condition and x_condition
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isRangeValid(self) -> bool:\n ...", "def detect_in_bounds(self):\n creature_x, creature_y = self.creature.current_location\n if creature_x < 0 or creature_x >= self.world_width\\\n or creature_y < 0 or creature_y >= self.world_height:\n print('The creature is out of...
[ "0.6810282", "0.678038", "0.6778264", "0.6739963", "0.67206085", "0.66868246", "0.66575336", "0.663661", "0.6615098", "0.65919214", "0.6498303", "0.64342713", "0.6433092", "0.64118105", "0.6405151", "0.6360849", "0.63530123", "0.6347003", "0.6326297", "0.6300016", "0.6292238"...
0.6825708
0
Checks if the node is in the sight range of the threat.
def is_node_in_sight_range(self, y, x, skip_range_check=False): if not skip_range_check: if not self.is_node_in_threat_zone(y, x): return False if self.sight_range == 0: return False # TODO: sight range can be blocked by collidable map objects. But this ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_map_obstacle_has_sight(self):\n return self.map_obstacle.sight_range > 0", "def is_node_in_threat_zone(self, y, x):\n y_condition = self.top_left_y <= y < self.top_left_y + self.height\n x_condition = self.top_left_x <= x < self.top_left_x + self.width\n return y_condition a...
[ "0.7180893", "0.6647947", "0.6592814", "0.622237", "0.6158231", "0.6114385", "0.6052427", "0.5939827", "0.5920186", "0.59067214", "0.589484", "0.58919704", "0.5872522", "0.5868779", "0.58031327", "0.57956624", "0.57941675", "0.57854", "0.57604116", "0.5759087", "0.57342535", ...
0.77908844
0
Calculates the cost of the node w.r.t this threat zone. Turn off consider_sight_range when not in the threat zone.
def calculate_node_cost(self, y, x, consider_sight_range=True, PENALTIES=PENALTIES): penalty = 0 # The node is probably in the threat zone because otherwise why would # this cost function be called? Only the nodes that are members of the # current threat zone would have a reference to t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_cost(self):\n costs = {}\n if np.abs(self.agent.get_position()[1]) > self.y_lim:\n costs['cost_outside_bounds'] = 1.\n if self.agent.velocity_violation:\n costs['cost_velocity_violation'] = 1.\n # sum all costs in one total cost\n costs['cost']...
[ "0.6584841", "0.64993936", "0.6482454", "0.64216805", "0.6402808", "0.62101775", "0.6161945", "0.6063722", "0.5986953", "0.5962853", "0.58811575", "0.58681184", "0.58564776", "0.585045", "0.583234", "0.5831037", "0.578017", "0.5751456", "0.57040656", "0.5678833", "0.5672874",...
0.76773894
0
Draws a path on an image of the current map. The path must be an iterable of nodes to visit in (y, x) format.
def draw_path(self, path): palettes = pokemontools.map_gfx.read_palettes(self.config) map_image = pokemontools.map_gfx.draw_map(self.map_group_id, self.map_id, palettes, show_sprites=True, config=self.config) for coordinates in path: y = coordinates[0] x = coordinates[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_path(self, path):\n for path_point in path:\n arcade.draw_lrtb_rectangle_filled(\n left = path_point[0] - 3,\n right = path_point[0] + 3,\n bottom = abs(path_point[1] + 3 - SCREEN_HEIGHT),\n top = abs(path_point[1] - 3 - SCREEN_...
[ "0.6971819", "0.6712494", "0.6698376", "0.6500138", "0.6472677", "0.64218545", "0.6184771", "0.6149262", "0.6110247", "0.6099752", "0.6080024", "0.60545444", "0.6041732", "0.6008537", "0.6000267", "0.5968503", "0.5950235", "0.59373873", "0.5936614", "0.5926778", "0.5890062", ...
0.789269
0
Return a dictionary mapping the index of each [ command with its corresponding ] command. If the program is illformatted, raise a RuntimeError.
def _preprocess(program: str) -> Dict[int, int]: i_map = {} stack = [] for p_ptr in range(len(program)): if program[p_ptr] == "[": stack.append(p_ptr) elif program[p_ptr] == "]": if len(stack) == 0: raise RuntimeError ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_commands(self):\n # import pdb; pdb.set_trace()\n left_i = 0\n right_i = 1\n commands = {}\n cmd = self.cmd\n\n if not cmd:\n return\n while left_i < len(cmd):\n sub_cmd = cmd[left_i:right_i]\n if sub_cmd in self.action_l...
[ "0.58098394", "0.580049", "0.57894933", "0.5357123", "0.5304718", "0.5215831", "0.5086952", "0.50743556", "0.5065643", "0.503259", "0.4996974", "0.49841496", "0.49748987", "0.49590343", "0.49538773", "0.4938757", "0.49314266", "0.49241066", "0.4917582", "0.4907155", "0.490507...
0.6344164
0
Return the sum of absolute differences between each index in the given tuple and the memory array created by interpreting the given program.
def _evaluate(expect: Tuple[int, ...], program: str) -> int: actual = FitnessEvaluator.interpret(program, len(expect)) z = sum(abs(x - y) for x, y in zip(expect, actual)) return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff_index_calc(oct_abund_list1, oct_abund_list2):\n rel_index_list = []\n abs_index_list = []\n smty_index_list = []\n for i in range(10):\n abund_data_array = sc.asarray(oct_abund_list1[i], dtype='double')\n abund_sim_array = sc.asarray(oct_abund_list2[i], dtype = 'double')\n ...
[ "0.5576279", "0.5485472", "0.53988963", "0.53535146", "0.5312953", "0.527858", "0.52340853", "0.52288437", "0.5216771", "0.51994073", "0.51861805", "0.51805043", "0.5115078", "0.510265", "0.5087568", "0.50774884", "0.4962869", "0.4948819", "0.4940964", "0.493437", "0.49326932...
0.6842148
0
Generates a single random program object no larger than max_len
def generate_random_program(max_len: int) -> Program: # TODO: min length of loop sequence 12 # TODO uncomment valid cmds and program_str if max_len == 0: max_len = 35 sequence_str = "" valid_commands = "><+-" for _ in range(random.randint(0, max_len)): sequence_str += valid_com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate():\n s = random_data.random_bytes(100)\n return generate_from_string(s)", "def create_program(fe: FitnessEvaluator, max_len: int) -> str:\n\n # mut_prob = {\"<\": 0.8, \">\": 0.8, \"+\": 0.6, \"-\": 0.6, \"[\": 0.1, \"]\": 0.1}\n\n # new_population: List[Program] = []\n\n # k = 1000\n ...
[ "0.6970523", "0.6672794", "0.64685977", "0.64397883", "0.6430596", "0.63213915", "0.63004786", "0.6259791", "0.62589043", "0.6232301", "0.62001586", "0.6195343", "0.6162333", "0.61470395", "0.6143417", "0.609811", "0.6085512", "0.6067498", "0.60567415", "0.60479194", "0.60453...
0.82239085
0
Return a program string no longer than max_len that, when interpreted, populates a memory array that exactly matches a target array. Use fe.evaluate(program) to get a program's fitness score (zero is best).
def create_program(fe: FitnessEvaluator, max_len: int) -> str: # mut_prob = {"<": 0.8, ">": 0.8, "+": 0.6, "-": 0.6, "[": 0.1, "]": 0.1} # new_population: List[Program] = [] # k = 1000 # N = 0.5 # N is top percentile for selection process converges = True gen_no = 0 while 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_program(max_len: int) -> Program:\n # TODO: min length of loop sequence 12\n # TODO uncomment valid cmds and program_str\n\n if max_len == 0:\n max_len = 35\n\n sequence_str = \"\"\n valid_commands = \"><+-\"\n for _ in range(random.randint(0, max_len)):\n sequen...
[ "0.6091483", "0.5810651", "0.529065", "0.52254283", "0.5147616", "0.5110546", "0.5041496", "0.501183", "0.4960446", "0.48305133", "0.4821243", "0.48171994", "0.47641626", "0.47570118", "0.47379822", "0.47227547", "0.472037", "0.47045183", "0.46859625", "0.4661021", "0.4653796...
0.6391748
0
Convenience function to retrieve config settings | param section (str) | param key (str) | return value (str)
def _get_config_value(self, section, key): return config.get(section, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(param):\n _config = loadConfig()\n try:\n click.echo(f\"{param}={rgetattr(_config, param)}\")\n except AttributeError as err:\n click.echo(err)", "def config_get(section, option):\n return __CONFIG.get(section, option)", "def get(section, key, inifile=\"settings.ini\"):...
[ "0.7271814", "0.71656626", "0.70512503", "0.70443535", "0.7025696", "0.6973973", "0.6922125", "0.6917554", "0.68923813", "0.6806088", "0.6775098", "0.67735416", "0.67732775", "0.66748327", "0.6657032", "0.6640123", "0.6620822", "0.66054404", "0.6552769", "0.652949", "0.649144...
0.7169004
1
Convenience function to retrieve a template filename from the config | param key (str) | return value (str)
def _get_config_template(self, key): tmp_path = self._get_config_value('templates', 'path') + key return tmp_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template_filename(template):\n config = read_config(SETTINGS_PATH)\n #String templates\n if (template in STRING_TEMPLATES):\n options = config.options(STRING_TEMPLATES_SECTION) \n for option in options:\n if (option==template):\n #Get root path for the temp...
[ "0.7519668", "0.6953125", "0.6910266", "0.6669161", "0.6505582", "0.6487357", "0.6336594", "0.633568", "0.6306973", "0.63053674", "0.6249337", "0.6147609", "0.61448133", "0.61417", "0.6100516", "0.60734236", "0.59488004", "0.5939616", "0.59377986", "0.5913934", "0.58930755", ...
0.78501856
0
Return the client address formatted for logging. Only lookup the hostname if really requested. | return hostname (str)
def address_string(self): if self.server.log_ip_activated: host = self.client_address[0] else: host = '127.0.0.1' if self.server.resolve_clients: return socket.getfqdn(host) else: return host
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname():\n return socket.gethostname()", "def get_host_name():\n return socket.gethostname()", "def get_host(self) -> str:\n return self.socket.getsockname()[0]", "def get_hostname():\n\thostname = socket.gethostname()\n\n\treturn hostname", "def get_client_name(self, client):\n ...
[ "0.7621413", "0.7612991", "0.7497711", "0.7338565", "0.7329123", "0.72413117", "0.7229839", "0.7202391", "0.71277946", "0.70867336", "0.706472", "0.7044149", "0.7043617", "0.7023422", "0.6997026", "0.6986053", "0.69841874", "0.6970315", "0.6961636", "0.6955989", "0.6946957", ...
0.8475575
0
Overwrite the default log_request() method to make it a noop. We call the original method ourselves to pass also the response size.
def log_request(self, code='-', size='-'): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_request(self, code='-', size='-'):\n if self.server.log_requests:\n BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)", "def _log_request(self):\n log = self.server.log\n if log:\n if hasattr(log, \"info\"):\n log.info(self.format_request() + '\\n')\n else...
[ "0.74420726", "0.6813411", "0.66951895", "0.63848644", "0.6231107", "0.6090658", "0.60775", "0.60528934", "0.59490097", "0.5939261", "0.5899911", "0.58897024", "0.588339", "0.5813916", "0.57701254", "0.57680064", "0.57473975", "0.5741251", "0.57133824", "0.5670446", "0.566431...
0.74780226
0
Sends the default startpage. |param message (str) Optional message that should appear on startpage
def _send_homepage(self, message=''): template_filename = self._get_config_template('homepage') text = read_template( template_filename, title=SERVER_NAME, header=SERVER_NAME, msg=message) self._send_response(text, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beginStep(self, message=''):\n if not self.initialized:\n self.start(message)", "def start(bot, update):\n update.message.reply_text(msgStart)", "def start(self, bot, update):\n start_text = \"This is the bot!\"\n bot.send_message(chat_id=update.message.chat_id, text=star...
[ "0.6485225", "0.5690608", "0.5624671", "0.56164324", "0.561026", "0.55332243", "0.55265844", "0.5499421", "0.5499421", "0.5489823", "0.5399729", "0.5390716", "0.5390716", "0.53865314", "0.5369212", "0.53659755", "0.53647655", "0.53558815", "0.53387666", "0.53071404", "0.52961...
0.71103936
0
Send a block page which tells the user that the URL has been blocked for some reason. | param reason Reason, why page has been blocked (str)
def _send_blocked_page(self, reason): template_filename = self._get_config_template('blocked') text = read_template( template_filename, title=SERVER_NAME, header=SERVER_NAME, comment=reason) self._send_response(text,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def block(self, ctx, *, url):\n blocked = await self.db.get('blocked', [])\n if url in blocked:\n return await ctx.send('😾 That image is already blocked.')\n blocked.append(url)\n await self.db.set('blocked', blocked)\n await ctx.send('😾 That image will not be ...
[ "0.6491221", "0.6126464", "0.59755105", "0.5944098", "0.5924648", "0.5901801", "0.5875643", "0.585222", "0.57317865", "0.56913966", "0.5680945", "0.5662643", "0.55770856", "0.5561162", "0.55514646", "0.5515806", "0.5496758", "0.5494105", "0.54503775", "0.544443", "0.5432015",...
0.8534689
0
Send the result page for a new created short URL. | param shorthash new shorthash for URL
def _send_return_page(self, shorthash): template_filename = self._get_config_template('return') if shorthash == '1337': messagetext = '<p>Hey, you are 1337!</p>' else: messagetext = '' text = read_template( template_filename, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortener(url_hash: str) -> TResponse:\n shortened_id = decode(url_hash)\n tags = db.session.query(Shortener).get(shortened_id)\n if tags is None:\n return jsonify(error='/@%s not found' % str(url_hash)), 404\n\n tags = dict(tags.__dict__)\n tags.pop('_sa_instance_state', None)\n\n if ...
[ "0.67695904", "0.6301598", "0.6178934", "0.61067307", "0.61045444", "0.6083676", "0.6045737", "0.6011424", "0.5958981", "0.59028774", "0.5808995", "0.5806816", "0.5795018", "0.57820964", "0.5752409", "0.5699284", "0.5687307", "0.56733274", "0.55893016", "0.5575915", "0.551952...
0.7627942
0
Send HTTP status code 301 | param new_url (str)
def _send_301(self, new_url): try: self.send_response(301) self.send_header('Location', new_url) self.send_header('Content-type', 'text/html') self.end_headers() except UnicodeEncodeError: self._send_internal_server_error()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(url, code=None):\r\n if code is None:\r\n code = 303 if request.get('SERVER_PROTOCOL') == \"HTTP/1.1\" else 302\r\n location = urljoin(request.url, url)\r\n raise HTTPResponse(\"\", status=code, header=dict(Location=location))", "def redirect(url, code=302):\n exc = status_map[cod...
[ "0.71475804", "0.69543874", "0.69186586", "0.6863464", "0.67504436", "0.67118007", "0.667445", "0.65757483", "0.6431167", "0.6272391", "0.62688905", "0.6265775", "0.62635696", "0.6237762", "0.6226041", "0.6171606", "0.6074599", "0.6067249", "0.6028931", "0.5988723", "0.598596...
0.8277798
0
Send HTTP status code 500 due to a database connection error | param header_only (bool)
def _send_database_problem(self): template_filename = self._get_config_template('databaseerror') text = read_template( template_filename, title='%s - Datebase error' % SERVER_NAME, header='Database error') if not text: self._send_internal_server_er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flask_force_error():\n raise Exception('forced 500 error')", "def handler500(request, *args, **argv):\n response = render_to_response('500.html', {})\n response.status_code = 500\n return response", "def handler500(request):\n response = render_to_response('500.html', {}, RequestContext(...
[ "0.6768254", "0.65716976", "0.65647733", "0.655858", "0.64837974", "0.6475549", "0.64526033", "0.6441978", "0.637562", "0.6356871", "0.6353804", "0.63322246", "0.63307244", "0.6286164", "0.62498844", "0.62310505", "0.62143993", "0.6206445", "0.61545306", "0.6127834", "0.61171...
0.68749285
0
Split the URL, decode the Network location part and unsplit the URL again | param url (str) | return url_splitted (str)
def _split_url(self, url): url_split = urlsplit(url) try: if url_split.netloc is not None and url_split.netloc.find(" ") > 0: return None decoded_netloc = url_split.netloc.decode("utf-8").encode("idna") url_parts = ( url_split.scheme, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_url(url):\n return url[1:].split('/')", "def _urlparse_splitnetloc(url, start=0):\r\n\r\n # By default, the netloc is delimited by the end of the URL.\r\n delim = len(url)\r\n\r\n # Find the left-most delimiter.\r\n for char in \"/?#\":\r\n xdelim = url.find(char, start)\r\n if xdelim...
[ "0.7640938", "0.74386454", "0.73310065", "0.7300218", "0.67790633", "0.67196864", "0.6668831", "0.66005135", "0.65997934", "0.6560759", "0.65353304", "0.65006614", "0.6438069", "0.641927", "0.6318777", "0.6307695", "0.62861055", "0.6281011", "0.6254813", "0.6222725", "0.62122...
0.80905616
0
Wrapper function which returns the SHA1hash of given set of strings | param args set of strings (str) | return hash
def _get_hash(self, *args): url_hash = hashlib.sha1() try: for value in args: value = unicode(value).encode('utf-8', 'replace') url_hash.update(value) return url_hash.hexdigest() except UnicodeDecodeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nice_hash(*args):\n h = sha1()\n for item in args:\n h.update(unicode(item))\n return b32encode(h.digest())", "def hash_all(strs, digest=None):\r\n digest = digest or hashlib.sha1()\r\n for s in strs:\r\n digest.update(s)\r\n return digest.hexdigest()", "def hash_args(self, args, secr...
[ "0.7717511", "0.72176147", "0.71247035", "0.70908237", "0.70498157", "0.6982817", "0.6642362", "0.6512389", "0.65015274", "0.6480865", "0.64734024", "0.6456554", "0.64413303", "0.63894093", "0.63641936", "0.63542306", "0.63239336", "0.63013685", "0.6297694", "0.6277206", "0.6...
0.7426758
1
This function is intented to do the part of inserting to database and fetching (if already available) short URL It will return the short hash in case of everything worked well None in case of there was general issue with the URL 1 in case of there was an issue with the database. 2 in case of the hash is already in data...
def _insert_url_to_db(self, url=None): if url and len(url) < 4096 and not self.server.hostname.lower() in url.lower(): # Now check, whether some protocol prefix is # available. If not, assume http:// was intended to put # there. if not '://' in url: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_short_url():\n if request.method == 'POST':\n if 'url' in request.args:\n og_url = request.args['url']\n\n if url_check(og_url) is True:\n if 'custom' in request.args:\n token_string = request.args['custom']\n if 'tag' ...
[ "0.7005038", "0.69177747", "0.658644", "0.6502725", "0.63537794", "0.62950414", "0.626813", "0.62300843", "0.62048924", "0.6189067", "0.6030714", "0.5942488", "0.5919611", "0.5902033", "0.5879902", "0.57781506", "0.574977", "0.5744519", "0.57436305", "0.57372254", "0.5647971"...
0.7674756
0
Shows a page with some statistics for a short URL | param shorthash (string)
def _show_link_stats(self, shorthash=None): # First doing some basis input validation as we don't want to # get fucked by the Jesus if shorthash == None or not shorthash.isalnum(): self._send_404() return else: blocked = self._db.is_hash_blocked(short...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats(short_url):\n stats = get_stats(short_url)\n click.echo(stats)", "def statistics():\n return render_template('statistics.html'), 200", "def shortener(url_hash: str) -> TResponse:\n shortened_id = decode(url_hash)\n tags = db.session.query(Shortener).get(shortened_id)\n if tags is No...
[ "0.7568825", "0.625193", "0.59189993", "0.57579595", "0.56421363", "0.56378347", "0.560629", "0.55037594", "0.5403486", "0.5398726", "0.5392122", "0.53870124", "0.53802747", "0.5360378", "0.53487736", "0.53305674", "0.53004414", "0.52966267", "0.5278874", "0.5260898", "0.5203...
0.7381544
1
determines whether e is contained in the list
def contains(list, e): for elem in list: if elem == e: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _listContains(self, l, entry):\n for i in range(0, len(l)):\n if l[i] == entry:\n return True\n return False", "def __contains__(self, elem):\n return elem in list(self)", "def is_in(self, e):\n return e in self.vals", "def exist(self,list,a):\r\n\t\t...
[ "0.7634615", "0.76273257", "0.74210596", "0.7318973", "0.6911831", "0.6902312", "0.6896038", "0.6893543", "0.68877155", "0.6887583", "0.6887583", "0.6887583", "0.6887583", "0.68467075", "0.67989737", "0.67858475", "0.6760893", "0.6750885", "0.6750885", "0.6747953", "0.6709403...
0.86201024
0
Reads key argument from stream. If taproot is set to True allows both xonly and sec pubkeys. If taproot is False will raise when finds xonly pubkey.
def read_from(cls, s, taproot: bool = False): first = s.read(1) origin = None if first == b"[": prefix, char = read_until(s, b"]") if char != b"]": raise ArgumentError("Invalid key - missing ]") origin = KeyOrigin.from_string(prefix.decode()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_public_key(f: IO[str]) -> Tuple[str, str, str, str]:\n data = f.read()\n try:\n kind, key, comment = data.split(\" \")\n if kind.startswith(\"ssh-\") and comment:\n base64.b64decode(key)\n return (kind, key, comment, data)\n except ValueError:\n pass\n\n...
[ "0.56285834", "0.55702406", "0.53513366", "0.5279402", "0.5259866", "0.5255114", "0.5239621", "0.51662034", "0.5072828", "0.506069", "0.5044834", "0.50187093", "0.5018378", "0.50177085", "0.5006491", "0.5005154", "0.49883592", "0.49864075", "0.49633726", "0.49325275", "0.4927...
0.5818086
0
Takes a DataFrame of trips from the 2018 data and returns each pair of adjacent stops for each trip separately in a DataFrame
def create_adjacent_stop_pairs(trips): stop_pairs = [] sorted_trips = trips.sort_values( ['TRIPID', 'PROGRNUMBER']).reset_index(drop=True) # For each trip match up pairs of adjacent stops and calculate how long it # took to travel between them for trip_id in sorted_trips['TRIPID'].unique(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_route(df):\n L = df.shape[0]\n for i in xrange(L):\n # pickup location for ride i\n s = df.iloc[i]\n slat = s.start_lat\n slng = s.start_lng\n for j in xrange(L):\n # dropoff location for ride j\n e = df.iloc[j]\n elat = e.end_la...
[ "0.6523139", "0.6011368", "0.595904", "0.59246486", "0.5850738", "0.5599461", "0.55713487", "0.55518585", "0.5506855", "0.54890525", "0.54739106", "0.54369557", "0.5428388", "0.5389967", "0.53362334", "0.52728707", "0.52426255", "0.52406186", "0.5239904", "0.5235966", "0.5168...
0.80070883
0
The 2021 Dublin Bus data uses Stop IDs instead of the actual stop numbers presented to the public. This method tries to extract the stop number from the stop name and if this fails it tries to extract it from the ID instead. Args
def parse_stop_num(stop_name, stop_id): try: stop_num = int(stop_name.split(" ")[-1]) except ValueError: # stop number isn't in the name # try parse out of ID instead stop_num = int(stop_id.split("DB")[-1]) return stop_num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stop_info(stops):\n\tapi_url = 'http://webservices.nextbus.com/service/publicXMLFeed?command=predictions&a=sf-muni&stopId='\n\t\"\"\"Stop_dict = {bus_name:'38',\n\t\t\t\t\tminutes: 7,\n\t\t\t\t\tstop_location: 'Geary & Leavenworth'}\"\"\"\n\tfor stop in stops:\n\t\turl = api_url + str(stop)\n\treturn url",...
[ "0.64669365", "0.63549644", "0.596333", "0.5937404", "0.59302485", "0.5919747", "0.58867526", "0.5499612", "0.5350796", "0.53506696", "0.5263319", "0.52620965", "0.5257072", "0.52069986", "0.5181121", "0.5169889", "0.5144572", "0.51275903", "0.51251304", "0.5105254", "0.50970...
0.77977896
0
Test main call to read_configs() which returns both config and auth
def test_read_valid_configs(self): args = argparse.Namespace(server=None, force=False) with open(self._config) as config_f: with open(self._auth) as auth_config_f: (config_data, auth_tuple) = imageroller.main.read_configs( args, config_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mocked_read_config():\n # login, passwd, DEFAULT_RECIPIENT, PROVIDER, CUSTOM_PROVIDER_URLS\n data = (\"03141592653\", \"MySecr3t\", None, \"yesss\", None)\n with mock.patch(\"YesssSMS.CLI.CLI.read_config_files\", return_value=data):\n yield", "def test_get_configs():\n\n configs = applicat...
[ "0.72133034", "0.7069429", "0.69918865", "0.6849532", "0.6826713", "0.68017393", "0.6780544", "0.67106605", "0.666702", "0.6646942", "0.658743", "0.65762496", "0.65616256", "0.6561188", "0.6552452", "0.6545206", "0.6519424", "0.6517546", "0.64698666", "0.64427567", "0.6424743...
0.7720984
0
Test config with no [DEFAULT] section Subsequently, the ConcurrentWorkers will not be defined
def test_no_default(self): with self.assertRaises(ConfigError) as cm: imageroller.main.read_config( self._cmd_args, imageroller.test.get_config_parser(self._no_default)) # ConcurrentWorkers is the first value that is checked self.assertEqual(str(cm.exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_workers(self):\n with self.assertRaises(ConfigError) as cm:\n imageroller.main.read_config(\n self._cmd_args,\n imageroller.test.get_config_parser(self._no_workers))\n self.assertEqual(str(cm.exception),\n \"Config must cont...
[ "0.73370737", "0.66671884", "0.6563818", "0.6148214", "0.61259454", "0.608149", "0.60612524", "0.60542786", "0.60366905", "0.5996603", "0.5980028", "0.58762586", "0.5820683", "0.5814761", "0.5786347", "0.5779095", "0.5773222", "0.57456243", "0.5742357", "0.5733493", "0.573233...
0.73977304
0
Test config with no ConcurrentWorkers key
def test_no_workers(self): with self.assertRaises(ConfigError) as cm: imageroller.main.read_config( self._cmd_args, imageroller.test.get_config_parser(self._no_workers)) self.assertEqual(str(cm.exception), "Config must contain Concurre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_default(self):\n with self.assertRaises(ConfigError) as cm:\n imageroller.main.read_config(\n self._cmd_args,\n imageroller.test.get_config_parser(self._no_default))\n # ConcurrentWorkers is the first value that is checked\n self.assertEqual...
[ "0.6455813", "0.63520235", "0.6315349", "0.62566775", "0.61732334", "0.6085617", "0.6007297", "0.5992999", "0.59211934", "0.5902918", "0.5858132", "0.58177274", "0.5772593", "0.57646906", "0.5764301", "0.5741749", "0.5734454", "0.57286626", "0.5714003", "0.56720275", "0.56714...
0.71596634
0
Test config with no server sections
def test_no_server(self): with self.assertRaises(ConfigError) as cm: imageroller.main.read_config( self._cmd_args, imageroller.test.get_config_parser(self._no_server)) self.assertEqual(str(cm.exception), "You must configure at least on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testFakeLongHandConfigurables(self):\n config = self.getBaseConfiguration()\n # The following should be ignored by the configure step\n config.Webtools.section_('foo')\n config.Webtools.foo.bar = 'baz'\n config.Webtools.section_('stuff')\n config.Webtools.stuff = 'thin...
[ "0.6984975", "0.6867742", "0.6857621", "0.6822114", "0.6787389", "0.6764674", "0.6752837", "0.6752573", "0.6739228", "0.6716617", "0.6699268", "0.66115296", "0.657829", "0.6577581", "0.6568253", "0.65422946", "0.65405506", "0.6527393", "0.6502301", "0.6496824", "0.64896876", ...
0.75707746
0
Test config with no server sections cmdline Server is specified on the command line that is not configured
def test_no_server_cmdline(self): invalid_server = "invalid.example.com" self._cmd_args.server = invalid_server with self.assertRaises(ConfigError) as cm: imageroller.main.read_config( self._cmd_args, imageroller.test.get_config_parser(self._no_server)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_server_valid_cmdline(self):\n self._cmd_args.server = CONFIG_DATA[\"TestServerFQDN\"]\n config_data = imageroller.main.read_config(\n self._cmd_args,\n imageroller.test.get_config_parser(self._server_valid_minimal))\n # pylint: disable=not-an-iterable\n fo...
[ "0.8029185", "0.7515778", "0.6822477", "0.66795325", "0.6484712", "0.6426824", "0.64207196", "0.6408803", "0.63423187", "0.6321582", "0.62730473", "0.6272898", "0.6269597", "0.6138822", "0.6135977", "0.61351365", "0.6131426", "0.6088072", "0.6052249", "0.60412127", "0.6032735...
0.8195387
0