query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
homepage for a user after they've logged in
def user_home(request): # crop = Crop.objects.get(user=request.user) return render(request, 'user_home.html', locals())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage():\n if g.user:\n return redirect(f\"/user/{g.user.id}\")\n else:\n return redirect(\"/landing\")", "def index(self):\n\n # try and pull the user's data\n user = get_active_user_data()\n\n if not user:\n # they are not logged in give them the login...
[ "0.81222904", "0.7832682", "0.75567484", "0.75296766", "0.7426215", "0.742084", "0.74105", "0.7408028", "0.7394464", "0.73910797", "0.7343856", "0.7277008", "0.72597903", "0.72444713", "0.7223275", "0.7219461", "0.7183288", "0.7182784", "0.71827203", "0.71667844", "0.71570003...
0.69481254
38
Obtient la Tactic de chaque robot et fait progresser la FSM.
def exec(self): for player_id in range(0, 6): ai_command = self.info_manager.get_player_tactic(player_id).exec() self.info_manager.set_player_next_action(player_id, ai_command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move2goal(self):\n vel_msg = Twist()\n\n # Linear velocity in the x-axis.\n vel_msg.linear.x = 0.4 # m/s\n vel_msg.linear.y = 0\n vel_msg.linear.z = 0\n\n # Angular velocity in the z-axis.\n vel_msg.angular.x = 0\n vel_msg.angular.y = 0\n vel_msg.a...
[ "0.65182215", "0.62783974", "0.62494963", "0.62122065", "0.6137736", "0.6120038", "0.60663146", "0.6011599", "0.59987426", "0.59779406", "0.5975645", "0.59697425", "0.59690607", "0.59598845", "0.5932181", "0.59319246", "0.5931754", "0.5907128", "0.5897831", "0.58944696", "0.5...
0.0
-1
Construct a new NAdam / Adam / AdamW / NAdamW optimizer.
def __init__( self, learning_rate=None, beta1=0.9, beta2=0.999, epsilon=1e-8, adamw_weight_decay=0.0, l2_weight_decay=0.0, use_nesterov=False, use_bias_correction=True, constant_fraction=1.0, warmup_fraction=0.0, min_learning_rate_mult=1.0, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_optimizer(net,alpha):\n optimizer = chainer.optimizers.Adam(alpha=alpha)\n optimizer.setup(net)\n return optimizer", "def build_optimizer(model: nn.Module, args: Namespace) -> Optimizer:\n params = [{'params': model.parameters(), 'lr': args.init_lr, 'weight_decay': 0}]\n\n return ...
[ "0.6872795", "0.68105716", "0.68094224", "0.6398735", "0.6390516", "0.6375885", "0.6327188", "0.62951666", "0.62668395", "0.6203197", "0.6187571", "0.61425275", "0.6135006", "0.6104655", "0.60901296", "0.60718906", "0.60455495", "0.6041876", "0.60281724", "0.59510404", "0.593...
0.59131265
21
Get a OptimizerDef for the given configuration and training_steps.
def optimizer_for_idx(idx, training_steps): config = common.get_optimizer_config(idx) config['training_steps'] = training_steps return NAdamWCosineDecay(**config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_optimizer(\n batch_size: int,\n steps_per_epoch: int,\n lr_name: Text = defaults.LR_NAME_DEFAULT,\n optimizer_name: Text = defaults.OP_NAME_DEFAULT,\n lr_params: Dict[Text, Any] = defaults.LR_CONFIG_DEFAULT,\n optimizer_params: Dict[Text, Any] = defaults.OP_CONFIG_DEFAULT,\n) -> tf.keras...
[ "0.56548405", "0.5534678", "0.5419", "0.53470206", "0.53421885", "0.5340555", "0.53079665", "0.511747", "0.50874454", "0.50743484", "0.5059995", "0.5049988", "0.50252277", "0.5016428", "0.50158036", "0.49935558", "0.498744", "0.49774894", "0.49573946", "0.49332434", "0.491900...
0.5022623
13
Continuously read lines from the given file, note that the file will have to be reopend and read from again if the application writing to the file stops and reopens the file for writing.
def tail(self, file): line='' while self.running: tmp = file.readline() if tmp: line += tmp if line.endswith("\n"): yield line line = '' else: time.sleep(0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_lines(self, file_path, empty_lines=False, signal_ready=True):\n file_handler, file_id = self._get_file(file_path)\n file_handler.seek(0, os.SEEK_END)\n\n if signal_ready:\n self.signal_ready()\n\n while self.thread_server.is_alive():\n line = six.text_type...
[ "0.6835908", "0.68097013", "0.63850206", "0.63652855", "0.6350695", "0.63241774", "0.62548393", "0.6244439", "0.6220739", "0.6167783", "0.6144125", "0.6113636", "0.6090018", "0.6064431", "0.6017879", "0.5972722", "0.5907144", "0.5901055", "0.5857637", "0.58532095", "0.5850574...
0.6530146
2
Start the thread running
def run(self): for line in self.tail(self.opened_file): self.log_line.emit(line.strip('\n'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n \n self.thread.start()\n self.state = \"running\"", "def start(self):\n self.thread.start()", "def start_thread(self):\n self.stop_thread()\n self.running = True\n self.run_thread = threading.Thread(target=self.run, daemon=True)\n self....
[ "0.84637225", "0.8462581", "0.8356644", "0.8344301", "0.8142931", "0.8071529", "0.8020542", "0.7930717", "0.7900409", "0.77552056", "0.7620005", "0.7588421", "0.75637186", "0.7521533", "0.74996144", "0.74370766", "0.7424744", "0.7424744", "0.7391063", "0.73651403", "0.7357051...
0.0
-1
Begins the alien and defines its initial postition.
def __init__(self, ai_settings, screen): super(Alien, self).__init__() self.screen = screen self.ai_settings = ai_settings # Loads the alien's image and defines its rect attribute self.image = pygame.image.load('images/alien.bmp') self.rect = self.image.get_rect() # Begins each new alien close to th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin(self):\n pass", "def initiate(self, DNA, Pol, Hel):", "def begin_auto_resting(self):\n self.state = 'autoresting'\n self.index = 1\n self.x_vel = self.y_vel = 0\n self.move_timer = self.current_time", "def enter(self):\n # lets not immediately run the anima...
[ "0.587834", "0.57635504", "0.5745311", "0.56670755", "0.55616534", "0.5551754", "0.552442", "0.5503704", "0.54616594", "0.5354884", "0.5354872", "0.5354763", "0.53459424", "0.5313377", "0.5265768", "0.5263633", "0.5236484", "0.5232484", "0.52293867", "0.52149266", "0.5199032"...
0.52787346
14
Draws the alien on its current position.
def blitme(self): self.screen.blit(self.image, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw():\n screen.fill((0, 0, 0))\n alien.draw()", "def draw_a(self):\r\n pen.down()\r\n pen.left(90)\r\n pen.forward(40)\r\n pen.right(90)\r\n pen.forward(40)\r\n pen.right(90)\r\n pen.forward(40)\r\n pen.up()\r\n pen.back(20)\r\n pen....
[ "0.7508646", "0.73021597", "0.71425086", "0.70783895", "0.7015024", "0.7002362", "0.7001692", "0.6818366", "0.6578184", "0.6490179", "0.64296824", "0.638066", "0.6345341", "0.6289084", "0.6260745", "0.62555075", "0.62202793", "0.6213915", "0.6207679", "0.6192816", "0.61897635...
0.0
-1
Returns True is the alien is in the scree's edge.
def check_edges(self): screen_rect = self.screen.get_rect() if self.rect.right >= screen_rect.right: return True elif self.rect.left <= 0: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isEdge(self,x,y):\n\t\treturn y in self._dict[x]", "def isEdge(self,x,y):\n\t\treturn y in self._dictOut[x]", "def containsEdge(self, e):\n return any(e.nvt in [self.vertices[i-2], self.vertices[i]] and self.vertices[i-1] == e.pvt for i in range(len(self.vertices)))", "def __contains__(self, edge)...
[ "0.67390007", "0.6689531", "0.66346663", "0.65844536", "0.6580659", "0.6557901", "0.65327895", "0.64890575", "0.6484122", "0.6412592", "0.6396653", "0.63721454", "0.63186455", "0.6302562", "0.6260699", "0.6248611", "0.6222273", "0.6212628", "0.6211989", "0.620916", "0.6201092...
0.59922844
36
Moves the alien to the right or left.
def update(self): self.x += (self.ai_settings.alien_speed_factor * self.ai_settings.fleet_direction) self.rect.x = self.x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self):\n self.move(1,0)", "def go_right(self):\n self.change_x = 6\n self.direction = \"R\"", "def move_right(self):\n if self.change_valid(dx=1):\n self.x += 1", "def turn_right(self):\n temp = self.direction[0]\n self.direction[0] = -self.direc...
[ "0.7879658", "0.74682367", "0.728294", "0.7279964", "0.7238093", "0.7197162", "0.7197162", "0.7176678", "0.71191716", "0.7107606", "0.7102793", "0.7050394", "0.7011423", "0.70082074", "0.6980706", "0.6903258", "0.68720716", "0.6852404", "0.6848053", "0.6828298", "0.67738813",...
0.0
-1
Per period utility function
def utility(consumption_vector, gamma): if gamma == 1: U = np.log(consumption_vector) else: U = (consumption_vector ** (1 - gamma)) / (1 - gamma) return U
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def period(self) -> int:", "def periodCheck(data):", "def period(self, value: int, /) -> None:", "def define_period():\n\n def_period = {'lt': 5820, # 97 minutes\n 'lon': 6240, # 104 minutes\n 'angle': 5820}\n\n return def_period", "def _calculate_period(vals):\n\t...
[ "0.79746", "0.7556614", "0.7253997", "0.65491265", "0.6545026", "0.6387055", "0.63736975", "0.6269186", "0.61849684", "0.6146609", "0.6124873", "0.6111358", "0.61068165", "0.6098242", "0.6062583", "0.59767157", "0.5947993", "0.59476095", "0.5931257", "0.59171796", "0.5906297"...
0.0
-1
Return stats for all stored urls, including age and hit count
def stats(): return jsonify(shorten.get_stats(get_db(), app.config['MINI_URL_BASE']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetStats(self):\r\n\t\tArg1 = self.href\r\n\t\treturn self._execute('GetStats', payload=locals(), response_object=None)", "def get_statistics(self):\n statistics = {\n 'entry': 0,\n 'bandwidth': 0,\n 'exit': 0,\n 'pages': 0\n }\n downloads = st...
[ "0.6812998", "0.678329", "0.6618755", "0.64406484", "0.6318793", "0.63116807", "0.6304703", "0.62987965", "0.6284246", "0.62530524", "0.6160197", "0.61364985", "0.61012554", "0.60908496", "0.6088024", "0.6030725", "0.59980816", "0.5970426", "0.59362936", "0.5923684", "0.58960...
0.60651094
15
Plot population size as a function of time for each deme in the graph.
def size_history( graph: demes.Graph, ax: matplotlib.axes.Axes = None, inf_ratio: float = 0.1, inf_label: bool = False, invert_x: bool = False, annotate_epochs: bool = False, colours: utils.ColourOrColourMapping = None, log_time: bool = False, log_size: bool = False, title: str =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GraphTimeVsSize(data, args, cmd):\n p = data[args][cmd]\n vers = sorted(p)\n sizes = sorted(p[vers[0]])\n for ver in vers:\n times = [p[ver][size][0] for size in sizes]\n plt.plot(sizes, times, label=ver)\n ax = plt.gca()\n if cmd == 'delta':\n ax.yaxis.set_major_locator(MultipleLocator(60))\n ...
[ "0.6297834", "0.61414975", "0.6136835", "0.6074017", "0.60201573", "0.5937706", "0.5821276", "0.57505625", "0.57206315", "0.5704849", "0.5693089", "0.56632227", "0.5652069", "0.5646763", "0.5641537", "0.560283", "0.5573585", "0.5535666", "0.55110645", "0.54786867", "0.5442298...
0.0
-1
Find by primary key.
def find(self, id): return self._select_one(''' select * from {table} where {primary_key} = %s '''.format(table=self.__class__._table, primary_key=self.__class__._primary_key), [id])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, primary_key):\n sql = '{} WHERE {} = %s'.format(self._select(), self.PRIMARY_KEY)\n cursor = yield self._pool.execute(sql, [primary_key])\n result = cursor.fetchmany(1)\n return self.convert_result_to_object(result)", "async def find_by_id(self, _id: int) -> Record:\n ...
[ "0.8381468", "0.76889473", "0.76515317", "0.7415496", "0.7158401", "0.7099071", "0.7044322", "0.7039672", "0.6811109", "0.6696825", "0.66701585", "0.6627701", "0.6615898", "0.65716875", "0.65695727", "0.6552014", "0.6518707", "0.64597976", "0.64076394", "0.64000124", "0.63941...
0.7143446
5
Initialization of the attributes.
def __init__(self, address_name, logger): # keep a reference to the common logger self.logger = logger # attributes self.address_name = address_name self._state = AddressStates.UNKNOWN self.remote_time = 0 self.local_time = 0 self.processes = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_attrs(self):\n raise NotImplementedError", "def _init_attributes(self):\n self.attr = {\n 'name': None,\n 'tags': [],\n 'openHours': None,\n 'type': None,\n 'parent': None,\n 'locationId': None,\n 'bannerAbbreviat...
[ "0.85431945", "0.82513285", "0.7581295", "0.7557976", "0.75490177", "0.7533591", "0.7438523", "0.73479736", "0.733841", "0.7301527", "0.72799546", "0.7268253", "0.7224906", "0.7224906", "0.7192972", "0.71733683", "0.71668434", "0.7158894", "0.70884913", "0.7027825", "0.702172...
0.0
-1
Property for the 'state' attribute.
def state(self): return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self) -> \"StateEnum\":\n return StateEnum.from_value(self._attrs.get(\"state\"))", "def state(self) -> \"StatusState\":\n return StatusState.from_value(self._attrs.get(\"state\"))", "def state(self, state: \"str\"):\n if isinstance(state, Enum):\n self._attrs[\"state\...
[ "0.78809613", "0.7727035", "0.77251655", "0.77194494", "0.77194494", "0.75788736", "0.75365645", "0.7527081", "0.7366093", "0.7366093", "0.7334735", "0.73292303", "0.73292303", "0.73172617", "0.72892934", "0.7278215", "0.7278215", "0.7278215", "0.7274344", "0.7274344", "0.727...
0.0
-1
Return a serializable form of the AddressStatus.
def serial(self): return {'address_name': self.address_name, 'statecode': self.state, 'statename': self.state_string(), 'remote_time': capped_int(self.remote_time), 'local_time': capped_int(self.local_time), 'loading': self.loading(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_string(self):\n return AddressStates._to_string(self.state)", "def get_receipt_address_status(self):\n return self.get_document_status_choice(self.receipt_address_status)", "def status(self):\n return status_dict[self._get_property_(self.STATUS).upper()]", "def summary(self):\n...
[ "0.65376735", "0.6407179", "0.6125908", "0.61190885", "0.6088738", "0.5990919", "0.5974651", "0.59298563", "0.590801", "0.590526", "0.58993244", "0.5894258", "0.58879745", "0.5871039", "0.5828656", "0.5824285", "0.5814415", "0.5784133", "0.5779725", "0.5777793", "0.57745993",...
0.5553306
48
Return the application state as a string.
def state_string(self): return AddressStates._to_string(self.state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stateString(self):\n return self._mdp.stateString(self._cur_state);", "def state(self):\n\n\t\treturn str(self)", "def state(self):\n return str(self)", "def state(self):\r\n return str(self)", "def state(self) -> str:", "def application_state(self) -> Optional[str]:\n ret...
[ "0.78867906", "0.7547796", "0.7517714", "0.74153733", "0.7372526", "0.7339068", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.73365414", "0.7271128", "0.7271128", "0...
0.7158514
44
Return True if the Supvisors instance is in isolation.
def in_isolation(self): return self.state in [AddressStates.ISOLATING, AddressStates.ISOLATED]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singularity_exists(self):\n instances = Client.instances(quiet=self.quiet)\n for instance in instances:\n if self.pid in instance.name:\n return True\n return False", "def isup(self):\n if self.cloudserver:\n # print self.cloudserver.status\n ...
[ "0.6635373", "0.6507393", "0.64624596", "0.64520085", "0.6421391", "0.64169216", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", "0.64154315", ...
0.0
-1
Update the last times attributes of the AddressStatus and of all the processes running on it.
def update_times(self, remote_time, local_time): self.remote_time = remote_time self.local_time = local_time for process in self.processes.values(): process.update_times(self.address_name, remote_time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _UpdateProcessingStatus(self, pid, process_status, used_memory):", "def update_status(self):\n\n # Memory information can be found in status and statm /proc/PID files\n # status file VmRSS equivalent to top's RES column\n # statm disagrees with status VmRSS, I think it may not include\n ...
[ "0.63074714", "0.61598605", "0.5967854", "0.587815", "0.5851434", "0.5803371", "0.57687116", "0.5440648", "0.5423083", "0.5397243", "0.5386455", "0.5369842", "0.5331419", "0.5302193", "0.52979624", "0.5289811", "0.52506447", "0.5244542", "0.52427137", "0.5232442", "0.5212697"...
0.6196417
1
Check that the state transition is valid.
def check_transition(self, new_state): return new_state in self._Transitions[self.state]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_transition_sanity(self):\n for trans in crest.get_all_transitions(self.model):\n assert trans._name is not None, f\"There is a transition in {trans._parent._name} ({trans._parent.__class__.__name__}) whose name is 'None'\"\n assert trans._name != \"\", f\"There is a transitio...
[ "0.7781572", "0.76222646", "0.7428737", "0.7234154", "0.71804106", "0.71731484", "0.71228576", "0.70903534", "0.6999822", "0.685391", "0.6806832", "0.6755866", "0.67439497", "0.674357", "0.6709216", "0.67011845", "0.666854", "0.6649904", "0.66231894", "0.6604144", "0.6574667"...
0.74631035
2
Add a new process to the process list.
def add_process(self, process): self.processes[process.namespec()] = process
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_process(self):\n process_id = str(self.processBox.currentText())\n\n arguments = {}\n\n for row in range(0, self.processTableWidget.rowCount()):\n p_id = \"\"\n val = None\n\n if self.processTableWidget.item(row, 0):\n p_id = self.process...
[ "0.76126385", "0.7507758", "0.7315577", "0.72722274", "0.72574365", "0.71727246", "0.68514043", "0.6843939", "0.6840627", "0.6770633", "0.6737064", "0.67065763", "0.6432417", "0.6367946", "0.63575804", "0.6237238", "0.61873573", "0.61138415", "0.61019224", "0.6021345", "0.601...
0.83901864
0
Return the process running on the address. Here, 'running' means that the process state is in Supervisor RUNNING_STATES.
def running_processes(self): return [process for process in self.processes.values() if process.running_on(self.address_name)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running(self):\n info = self.info()\n return info['running']", "def is_process_running(name):\n if not hasattr(is_process_running, \"proc\"):\n is_process_running.proc = None # it doesn't exist yet, so init it\n\n if is_process_running.proc:\n if is_process_running.proc.i...
[ "0.61827284", "0.605477", "0.5984106", "0.59605074", "0.5830705", "0.5814387", "0.57667416", "0.57487637", "0.57090694", "0.5694411", "0.5676516", "0.5661446", "0.5649374", "0.5617451", "0.56060237", "0.55911523", "0.55796784", "0.5576243", "0.55739254", "0.55647177", "0.5558...
0.6297126
0
Return the process running on the address and having a pid. Different from running_processes_on because it excludes the states STARTING and BACKOFF
def pid_processes(self): return [(process.namespec(), process.infos[self.address_name]['pid']) for process in self.processes.values() if process.pid_running_on(self.address_name)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_process(self, pid):\n return self.processes.get(pid, None)", "def running_processes(self):\n return [process for process in self.processes.values()\n if process.running_on(self.address_name)]", "def get_process_pid(robot_name):\n\n try:\n result = check_output(['p...
[ "0.7015587", "0.670613", "0.6585871", "0.6583493", "0.64844155", "0.64499414", "0.6438885", "0.64362067", "0.6434716", "0.63813657", "0.63745505", "0.63590276", "0.63359684", "0.6330875", "0.63202155", "0.62983465", "0.62884915", "0.62884915", "0.6279087", "0.62753826", "0.62...
0.70801574
0
Return the loading of the address, by summing the declared loading of the processes running on that address
def loading(self): loading = sum(process.rules.expected_loading for process in self.running_processes()) self.logger.debug('address={} loading={}'. format(self.address_name, loading)) return loading
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_load(self):\n nn = [p.n for p in self._procs]\n return sum(nn), min(nn)", "def get_load_data():\n proc_stat = open(\"/proc/stat\", \"r\")\n ret = []\n #times_since_startup = proc_stat.readline().strip().split()[1:]\n for line in proc_stat:\n line_split = line.strip()....
[ "0.62994903", "0.5876818", "0.577103", "0.5671219", "0.56705534", "0.56662524", "0.55867136", "0.55307513", "0.54727614", "0.5392582", "0.5365475", "0.533915", "0.5335333", "0.5271789", "0.52094007", "0.5200593", "0.519389", "0.5176355", "0.51122624", "0.51087445", "0.5093616...
0.7182065
0
Log that an object has been successfully changed. The default implementation creates an admin LogEntry object.
def history_log(self, user, action=CHANGE, message=''): LogEntry.objects.log_action( user_id=user.pk, content_type_id=ContentType.objects.get_for_model(self).pk, object_id=self.pk, object_repr=force_text(self), action_flag=action, change_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_change(request, object, message):\n from django.contrib.admin.models import LogEntry, CHANGE\n from django.contrib.contenttypes.models import ContentType\n from django.utils.encoding import force_unicode\n\n LogEntry.objects.log_action(\n user_id=request.user.pk,\n content_type_id...
[ "0.70133215", "0.69674075", "0.6594732", "0.6459646", "0.62252766", "0.61523455", "0.5846429", "0.58451456", "0.57111967", "0.5708252", "0.568097", "0.56665975", "0.5649899", "0.56148577", "0.55948657", "0.5571661", "0.5556302", "0.5527434", "0.5515551", "0.5488312", "0.54780...
0.5314031
33
Returns two lists with the ids of grec_seq_rec and seq_reserva
def get_seq_lists(dataframe_bookings): seq_rec = dataframe_bookings.select('operative_incoming').collect() seq_reserva = dataframe_bookings.select('booking_id').collect() seq_rec = [val[0] for val in list(seq_rec)] seq_reserva = [val[0] for val in list(seq_reserva)] return seq_rec, seq_reserva
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seq_xref_ids(entry):\n\n xref_ids = []\n exon_data = exons(entry)\n for ids in xref_data(entry).values():\n for exon in exon_data:\n for xref_id in ids:\n key = \"{xref_id}-{gene_id}-{chr}:{start}..{stop}\".format(\n xref_id=xref_id,\n ...
[ "0.6269399", "0.61774325", "0.60897326", "0.5778329", "0.5776383", "0.5763285", "0.5730644", "0.5721721", "0.57183284", "0.568632", "0.5685907", "0.56623137", "0.55932146", "0.5542651", "0.5516142", "0.5515765", "0.5473292", "0.5469163", "0.54488885", "0.5432289", "0.5427406"...
0.6646673
0
It calculates the subquery for the field Tax_Sales_Transfer_pricing
def sub_tax_sales_transfer_pricing(manager, df_fields, seq_recs, seq_reservas): # df_hotel = manager.get_dataframe(tables['dwc_bok_t_canco_hotel']) # df_circuit = manager.get_dataframe(tables['dwc_bok_t_canco_hotel_circuit']) # df_other = manager.get_dataframe(tables['dwc_bok_t_canco_other']) # df_trans...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_tax_cost_transfer_pricing(manager, df_fields, seq_recs, seq_reservas):\n # df_hotel = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel\"])\n # df_circuit = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel_circuit\"])\n # df_other = manager.get_dataframe(tables[\"dwc_bok_t_canco_other\"])\n...
[ "0.6498725", "0.637397", "0.63043004", "0.62905616", "0.6242464", "0.59541345", "0.5881588", "0.5839122", "0.5801799", "0.57798594", "0.5711908", "0.5685891", "0.5622643", "0.55404156", "0.5537151", "0.5537049", "0.5476859", "0.5469033", "0.5468134", "0.5453045", "0.54431385"...
0.66625917
0
It calculates the subquery for the field Transfer_pricing
def sub_transfer_pricing(manager, df_fields, seq_recs, seq_reservas): # df_hotel = manager.get_dataframe(tables["dwc_bok_t_canco_hotel"]) # df_circuit = manager.get_dataframe(tables["dwc_bok_t_canco_hotel_circuit"]) # df_other = manager.get_dataframe(tables["dwc_bok_t_canco_other"]) # df_transfer = mana...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_tax_cost_transfer_pricing(manager, df_fields, seq_recs, seq_reservas):\n # df_hotel = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel\"])\n # df_circuit = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel_circuit\"])\n # df_other = manager.get_dataframe(tables[\"dwc_bok_t_canco_other\"])\n...
[ "0.66143847", "0.65671605", "0.6538647", "0.64082414", "0.58227384", "0.57171154", "0.5707997", "0.57049704", "0.56700575", "0.56570375", "0.5582287", "0.55250686", "0.5522433", "0.55135524", "0.5483422", "0.5448324", "0.5421551", "0.5415142", "0.5378908", "0.5364118", "0.533...
0.65184456
3
It calculates the subquery for the field Tax_Cost_Transfer_pricing
def sub_tax_cost_transfer_pricing(manager, df_fields, seq_recs, seq_reservas): # df_hotel = manager.get_dataframe(tables["dwc_bok_t_canco_hotel"]) # df_circuit = manager.get_dataframe(tables["dwc_bok_t_canco_hotel_circuit"]) # df_other = manager.get_dataframe(tables["dwc_bok_t_canco_other"]) # df_transf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_tax_cost_transfer_pricing_eur(manager, df_fields, seq_recs, seq_reservas):\n # df_hotel = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel\"])\n # df_circuit = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel_circuit\"])\n # df_other = manager.get_dataframe(tables[\"dwc_bok_t_canco_other\"...
[ "0.65499413", "0.6401581", "0.62985355", "0.6264737", "0.6263573", "0.6209262", "0.5951682", "0.59322137", "0.5912796", "0.58500355", "0.5839168", "0.5828151", "0.57621986", "0.56807303", "0.5652692", "0.5645219", "0.5632515", "0.5612633", "0.55991054", "0.5577054", "0.556269...
0.6695558
0
It calculates the subquery for the field Tax_Transfer_pricing_EUR
def sub_tax_transfer_pricing_eur(manager, df_fields, seq_recs, seq_reservas): # df_hotel = manager.get_dataframe(tables["dwc_bok_t_canco_hotel"]) # df_circuit = manager.get_dataframe(tables["dwc_bok_t_canco_hotel_circuit"]) # df_other = manager.get_dataframe(tables["dwc_bok_t_canco_other"]) # df_transfe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_tax_cost_transfer_pricing_eur(manager, df_fields, seq_recs, seq_reservas):\n # df_hotel = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel\"])\n # df_circuit = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel_circuit\"])\n # df_other = manager.get_dataframe(tables[\"dwc_bok_t_canco_other\"...
[ "0.65058285", "0.6245366", "0.62209433", "0.60142535", "0.601361", "0.588141", "0.5866098", "0.5865709", "0.5844462", "0.5841258", "0.5803155", "0.5662047", "0.56258506", "0.5612775", "0.5599036", "0.55835426", "0.556036", "0.5547852", "0.5484853", "0.5466989", "0.545998", ...
0.6462657
1
It calculates the subquery for the field Tax_Cost_Transfer_pricing_EUR
def sub_tax_cost_transfer_pricing_eur(manager, df_fields, seq_recs, seq_reservas): # df_hotel = manager.get_dataframe(tables["dwc_bok_t_canco_hotel"]) # df_circuit = manager.get_dataframe(tables["dwc_bok_t_canco_hotel_circuit"]) # df_other = manager.get_dataframe(tables["dwc_bok_t_canco_other"]) # df_tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_tax_cost_transfer_pricing(manager, df_fields, seq_recs, seq_reservas):\n # df_hotel = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel\"])\n # df_circuit = manager.get_dataframe(tables[\"dwc_bok_t_canco_hotel_circuit\"])\n # df_other = manager.get_dataframe(tables[\"dwc_bok_t_canco_other\"])\n...
[ "0.64423364", "0.6376252", "0.6182043", "0.61586916", "0.6076942", "0.6071446", "0.59395057", "0.5931084", "0.586201", "0.5850323", "0.5799269", "0.57859534", "0.5713411", "0.5647553", "0.5607687", "0.5596589", "0.5572917", "0.5561368", "0.5530456", "0.5508553", "0.5498966", ...
0.66247785
0
Run a single epoch of training
def train(model, optimizer, loss_function, loader, device, log_every_n=10): model.train() # Run model in training mode loss_history = [] running_loss = 0. running_loss_history = [] for i, batch in tqdm(enumerate(loader)): optimizer.zero_grad() # Always set gradient to 0 before computin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_one_epoch(self):\n raise NotImplementedError", "def train_one_epoch(self):\n\t\tself.model.train()\n\t\ttrain_loss = 0\n\n\t\tfor batch_idx, data in enumerate(self.data_loader.train_loader):\n\t\t\tInput = data[0].float().to(self.device)\n\t\t\tOutput = data[1].float().to(self.device)\n\n\t\t\ts...
[ "0.82089", "0.7736836", "0.77296716", "0.7690409", "0.7672777", "0.7601996", "0.76006347", "0.75574315", "0.75574315", "0.75574315", "0.75574315", "0.7480733", "0.7478019", "0.74223953", "0.74209774", "0.7369879", "0.73666525", "0.73666525", "0.73537654", "0.72843677", "0.726...
0.0
-1
Evaluate the model on a validation set
def evaluate(model, optimizer, loss_function, loader, device, labels, log_every_n=10): model.eval() batch_wise_true_labels = [] batch_wise_predictions = [] loss_history = [] running_loss = 0. running_loss_history = [] with torch.no_grad(): # Disable gradient computation - required only ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n self.set_model_mode('eval')\n self.evaluator.reset()\n losses = MetricMeter()\n\n print('Do evaluation on {} set'.format('valid set'))\n data_loader = self.val_loader\n assert data_loader is not None\n for batch_idx, batch in enumerate(data_loa...
[ "0.7376902", "0.68664986", "0.6861883", "0.6753435", "0.66626984", "0.6649241", "0.6634646", "0.6592691", "0.65147567", "0.6488397", "0.642826", "0.63554084", "0.63379616", "0.6291245", "0.62727004", "0.62590766", "0.6258152", "0.62362754", "0.6216052", "0.61982185", "0.61916...
0.0
-1
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_system(self): xd, xa, u, ODEeq, Aeq, states, algebraics, inputs = self.DAE_system() VV = Function('vfcn', [xa, u], [vertcat(*Aeq)], ['w0', 'u'], ['w']) solver = rootfinder('solver', 'newton', VV) return solver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69306874", "0.6824473", "0.6824473", "0.5993993", "0.5799238", "0.5743481", "0.5707509", "0.56789947", "0.56719893", "0.5662057", "0.56536293", "0.5639711", "0.55976707", "0.55896133", "0.5583953", "0.5581527", "0.5541686", "0.5530698", "0.55166656", "0.5509524", "0.550152...
0.55018413
20
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_model(self): xd, xa, u, ODEeq, Aeq, states, algebraics, inputs = self.DAE_model() VV = Function('vfcn', [xa, u], [vertcat(*Aeq)], ['w0', 'u'], ['w']) solver = rootfinder('solver', 'newton', VV) # model = functools.partial(solver, np.zeros(np.shape(xa))) return so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69307363", "0.68243206", "0.68243206", "0.59948397", "0.57976073", "0.5744459", "0.57058465", "0.56784093", "0.56733394", "0.5661514", "0.5653307", "0.5638662", "0.5595214", "0.5589865", "0.55837965", "0.5579946", "0.5539479", "0.5530106", "0.55158114", "0.5508561", "0.550...
0.5479345
26
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_model(self): xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \ = self.DAE_system() dae = {'x': vertcat(xd), 'z': vertcat(xa), 'p': vertcat(u), 'ode': vertcat(*ODEeq), 'alg': vertcat(*Aeq)} opts =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69303405", "0.59939796", "0.57994497", "0.57433486", "0.57079077", "0.5678165", "0.56725657", "0.5661507", "0.56537825", "0.56398034", "0.5597277", "0.55902517", "0.55843586", "0.55814993", "0.55416745", "0.5530678", "0.5516298", "0.5508994", "0.55017346", "0.55017346", "0...
0.68241906
1
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_model(self): xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \ = self.DAE_system() dae = {'x': vertcat(xd), 'z': vertcat(xa), 'p': vertcat(u), 'ode': vertcat(*ODEeq), 'alg': vertcat(*Aeq)} opts =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69318324", "0.59953165", "0.57986635", "0.5745706", "0.57091874", "0.56788397", "0.5672505", "0.566161", "0.5654902", "0.563956", "0.55981153", "0.55905986", "0.55837876", "0.55810785", "0.5542895", "0.5530973", "0.5517672", "0.5509622", "0.5504029", "0.5504029", "0.550402...
0.682522
2
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_model(self): xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \ = self.DAE_system() ODEeq_ = vertcat(*ODEeq) self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot']) dae = {'x': ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n\n dae = {'x': vertcat(xd), 'z': vertcat(xa), 'p': vertcat(u),\n 'ode': vertcat(*ODEeq), 'alg': vertcat(*Aeq)}\n ...
[ "0.6824473", "0.6824473", "0.5993993", "0.5799238", "0.5743481", "0.5707509", "0.56789947", "0.56719893", "0.5662057", "0.56536293", "0.5639711", "0.55976707", "0.55896133", "0.5583953", "0.5581527", "0.5541686", "0.5530698", "0.55166656", "0.5509524", "0.55018413", "0.550184...
0.69306874
0
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_system(self): xd, xa, u, ODEeq, Aeq, states, algebraics, inputs = self.DAE_system() VV = Function('vfcn', [xa, u], [vertcat(*Aeq)], ['w0', 'u'], ['w']) solver = rootfinder('solver', 'newton', VV) return solver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69307363", "0.68243206", "0.68243206", "0.59948397", "0.57976073", "0.5744459", "0.57058465", "0.56784093", "0.56733394", "0.5661514", "0.5653307", "0.5638662", "0.5595214", "0.5589865", "0.55837965", "0.5579946", "0.5539479", "0.5530106", "0.55158114", "0.5508561", "0.549...
0.550293
23
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_system(self): xd, xa, u, ODEeq, Aeq, states, algebraics, inputs = self.DAE_system() VV = Function('vfcn', [xa, u], [vertcat(*Aeq)], ['w0', 'u'], ['w']) solver = rootfinder('solver', 'newton', VV) return solver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69303405", "0.68241906", "0.68241906", "0.59939796", "0.57994497", "0.57433486", "0.57079077", "0.5678165", "0.56725657", "0.5661507", "0.56537825", "0.56398034", "0.5597277", "0.55902517", "0.55843586", "0.55814993", "0.55416745", "0.5530678", "0.5516298", "0.5508994", "0...
0.55017346
21
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_system(self): xd, xa, u, ODEeq, Aeq, states, algebraics, inputs = self.DAE_system() VV = Function('vfcn', [xa, u], [vertcat(*Aeq)], ['w0', 'u'], ['w']) solver = rootfinder('solver', 'newton', VV)#, {'error_on_fail':False}) return solver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69318324", "0.682522", "0.682522", "0.59953165", "0.57986635", "0.57091874", "0.56788397", "0.5672505", "0.566161", "0.5654902", "0.563956", "0.55981153", "0.55905986", "0.55837876", "0.55810785", "0.5542895", "0.5530973", "0.5517672", "0.5509622", "0.5504029", "0.5504029"...
0.5745706
5
This function constructs the integrator to be suitable with casadi environment, for the equations of the model and the objective function with variable time step.
def integrator_system(self): xd, xa, u, ODEeq, Aeq, states, algebraics, inputs = self.DAE_system() VV = Function('vfcn', [xa, u], [vertcat(*Aeq)], ['w0', 'u'], ['w']) solver = rootfinder('solver', 'newton', VV) return solver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrator_model(self):\n\n xd, xa, u, uncertainty, ODEeq, Aeq, u_min, u_max, states, algebraics, inputs, nd, na, nu, nmp, modparval \\\n = self.DAE_system()\n ODEeq_ = vertcat(*ODEeq)\n\n self.ODEeq = Function('f', [xd, u], [vertcat(*ODEeq)], ['x0', 'p'], ['xdot'])\n\n d...
[ "0.69306874", "0.6824473", "0.6824473", "0.5993993", "0.5799238", "0.5743481", "0.5707509", "0.56789947", "0.56719893", "0.5662057", "0.56536293", "0.5639711", "0.55976707", "0.55896133", "0.5583953", "0.5581527", "0.5541686", "0.5530698", "0.55166656", "0.5509524", "0.550152...
0.55018413
22
Assert that inference works without warnings or errors.
def assert_ok(model, *args, **kwargs): pyro.get_param_store().clear() kernel = infer.NUTS(model) mcmc = infer.MCMC(kernel, num_samples=2, warmup_steps=2) mcmc.run(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_advance_ast_avaliable():\n assert _test_advanced_ast_presence()", "def test_active_inference_SPM_1b(self):", "def inference(model, data, diagnostics, seed, extra_fitting_args):\n pass", "def test_no_coercion():\n\n @type_checked(coerce=False)\n def _run_test(something:str): pass\n\n w...
[ "0.6586008", "0.6114658", "0.6114165", "0.60875183", "0.6073362", "0.60102546", "0.5987372", "0.5982912", "0.58770275", "0.5850032", "0.5844257", "0.58348143", "0.5827149", "0.58189166", "0.5785292", "0.5770235", "0.57519215", "0.57359266", "0.5735409", "0.57095784", "0.56565...
0.5215149
71
Given a thresholded image of the scene (ideally, the first frame),
def get_rectangles_mask(self, thresh: np.ndarray) -> np.ndarray: contours = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)[0] mask = np.zeros(thresh.shape, np.uint8) good_contours = sorted( [cnt for cnt in contours if 100000 < cv.contourArea(cnt) < 200000], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(self):\n self.frame = cv.adaptiveThreshold(self.frame, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY_INV, self.thresh, 2)", "def thresholdImage(frame, binarizationThreshold=30):\n return cv2.threshold(frame, binarizationThreshold, 255, cv2.THRESH_BINARY)[1]", "def threshold(img, ...
[ "0.6743112", "0.65433484", "0.6437061", "0.63945776", "0.6316842", "0.628868", "0.62694985", "0.62595356", "0.6242952", "0.62253326", "0.6183402", "0.61699784", "0.61520195", "0.61465746", "0.61196035", "0.60966796", "0.60767764", "0.606645", "0.6040267", "0.6039766", "0.6038...
0.0
-1
Sort the 4 corners clockwise of a rectangle so that the topleft corner is the first one.
def sort_corners(self, corners: np.ndarray): center = np.sum(corners, axis=0) / 4 sorted_corners = sorted( corners, key=lambda p: math.atan2(p[0][0] - center[0][0], p[0][1] - center[0][1]), reverse=True, ) return np.roll(sorted_corners, 1, axis=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_corners(corners):\n col_sorted = corners[np.argsort(corners[:, 1])] # sort on the value in column\n\n # sort on the value in rows. a, b are the indexes\n a = np.argsort(col_sorted[:2, 0])\n b = np.argsort(col_sorted[2:, 0]) + 2\n\n return col_sorted[np.hstack((a, b))]", "def order_rect(pt...
[ "0.6854596", "0.66109776", "0.6415772", "0.63892233", "0.62674105", "0.62512946", "0.6234069", "0.6007216", "0.6000448", "0.59593153", "0.5874499", "0.58601785", "0.58035123", "0.57796407", "0.5720378", "0.5702618", "0.5701921", "0.5618068", "0.56109095", "0.5608352", "0.5567...
0.7108666
0
Given a thresholded image of the scene and a mask representing the two known rectangles, return the corners of those rectangles (8 in total) with subpixel accuracy. The corners returned are already sorted.
def get_desk_wall_corners( self, thresh: np.ndarray ) -> Tuple[np.ndarray, np.ndarray]: mask = self.get_rectangles_mask(thresh) assert thresh.shape[:2] == mask.shape[:2] corners = cv.goodFeaturesToTrack( thresh, maxCorners=8, qualityLevel=0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_corners(image):\n\n corners = []\n\n for side in range(4):\n corners.append(_find_corner(image, side))\n return corners", "def get_rectangles_mask(self, thresh: np.ndarray) -> np.ndarray:\r\n contours = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)[0]\r\n ma...
[ "0.6949092", "0.69425696", "0.68686926", "0.67287797", "0.64953494", "0.6441506", "0.6436643", "0.6417351", "0.64081156", "0.64081156", "0.6387981", "0.6385469", "0.6330147", "0.63082325", "0.6270925", "0.62597865", "0.62439096", "0.62070817", "0.618108", "0.61800426", "0.617...
0.66609186
4
Given 4 sorted corners, compute the homography between the corners and the rectangle's ground truth and return the information on the mapped plane. In other words, this function returns information on a plane (in particular, the desk's or wall's). The plane's origin is in the topleft corner of the rectangle, and the no...
def get_H_R_t(self, corners: np.ndarray) -> Plane: H = cv.findHomography(self.inner_rectangle, corners)[0] result = self.K_inv @ H result /= cv.norm(result[:, 1]) r0, r1, t = np.hsplit(result, 3) r2 = np.cross(r0.T, r1.T).T _, u, vt = cv.SVDecomp(np.hstack([r0, r1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_plane(self):\n verticies = [\n # main plane - note that the mainplane is scaled so the mat_plane\n # matrix will it transform to the correct coordinates\n -self.i_border[0]/self._scaling[0], self.i_border[1]/self._scaling[1],\n -self.i...
[ "0.58668405", "0.58515084", "0.5808322", "0.5808322", "0.5799701", "0.5799701", "0.5593243", "0.55419457", "0.5481281", "0.5459112", "0.54404145", "0.5418466", "0.541714", "0.53940755", "0.53733194", "0.5373061", "0.5357221", "0.5352762", "0.5341513", "0.53396374", "0.5331517...
0.6981937
0
Given the corners of the rectangles on the wall and on the desk, return the coordinates for a tight bounding box of the area between the two rectangles.
def get_extreme_points( self, wall_corners: np.ndarray, desk_corners: np.ndarray ) -> ExtremePoints: ymin_wall = int(np.min(wall_corners[:, :, 1])) ymax_wall = int(np.max(wall_corners[:, :, 1])) ymin_desk = int(np.min(desk_corners[:, :, 1])) ymax_desk = int(np.max(desk_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_bboxes_on_rect_edge(bboxes, left, bottom, right, top):\n bboxes_left = _find_bboxes_in_rect(bboxes, left, bottom, left, top)\n bboxes_right = _find_bboxes_in_rect(bboxes, right, bottom, right, top)\n bboxes_top = _find_bboxes_in_rect(bboxes, left, top, right, top)\n bboxes_bottom = _find_bbox...
[ "0.6642179", "0.65772635", "0.6567798", "0.654517", "0.6451509", "0.64079404", "0.638755", "0.631571", "0.63061756", "0.62954104", "0.627549", "0.6271331", "0.6248824", "0.62457526", "0.6232513", "0.6218351", "0.620274", "0.62003404", "0.61986816", "0.6196619", "0.6195557", ...
0.0
-1
Given an image and a rectangle defining a region, return the laser points in that region. In case we are considering the wall or the desk, require at least 30 points for better accuracy.
def get_laser_points_in_region( self, image: np.ndarray, region: Rectangle, is_obj: bool = False, ) -> Optional[np.ndarray]: top_left = region.top_left bottom_right = region.bottom_right region_image = image[top_left.y : bottom_right.y, top_left.x : bottom_right.x] imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_laser_points(\r\n self,\r\n original_image: np.ndarray,\r\n image: np.ndarray,\r\n extreme_points: ExtremePoints,\r\n ) -> Tuple[\r\n Optional[np.ndarray],\r\n Optional[np.ndarray],\r\n Optional[np.ndarray],\r\n Optional[np.ndarray],\r\n ]:\r\n ...
[ "0.6679829", "0.634663", "0.62997025", "0.6223093", "0.621849", "0.6095733", "0.60441035", "0.59959286", "0.59956324", "0.5957144", "0.59263897", "0.5916754", "0.5900934", "0.587384", "0.58581173", "0.5833918", "0.5820731", "0.58049595", "0.5782126", "0.5764281", "0.575516", ...
0.7383569
0
Given a region of an image and a point, offset the region by that point.
def offset_points(self, points: np.ndarray, offset: Point) -> np.ndarray: points[:, :, 0] += offset.x points[:, :, 1] += offset.y return points
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset(img, y_s, y_e, x_s, x_e):\n if y_s < 0:\n y_s = 0\n if y_e > img.shape[0]:\n y_e = img.shape[0]\n if x_s < 0:\n x_s = 0\n if x_e > img.shape[1]:\n x_e = img.shape[1]\n new_img = img[y_s:y_e, x_s:x_e]\n return new_img", "def translate_point(point, y_offset=...
[ "0.67617077", "0.6400637", "0.6341007", "0.6277429", "0.6178488", "0.6159662", "0.59187955", "0.5902416", "0.5882912", "0.58361304", "0.5823998", "0.5792503", "0.5726029", "0.5705936", "0.5686741", "0.5674328", "0.55382186", "0.5523029", "0.55119634", "0.54766566", "0.5442412...
0.5824192
10
Given some points, convert them to homogeneous coordinates, i.e. add a trailing [1].
def make_homogeneous(self, points: np.ndarray) -> np.ndarray: return np.hstack((points[:, 0], np.ones(points.shape[0]).reshape(-1, 1),))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_homogeneous(points):\n return np.hstack((points, np.ones((points.shape[0], 1))))", "def apply(self, points):\n pshape = numpy.shape(points)\n homogeneous = 1\n if len(pshape) == 1:\n if pshape[0] == 3:\n points = numpy.array(numpy.concatenate((points, nu...
[ "0.6712065", "0.664639", "0.625883", "0.625883", "0.6245449", "0.6173878", "0.6092858", "0.6045913", "0.5934989", "0.59325945", "0.59301716", "0.5921763", "0.5899959", "0.5861943", "0.5852588", "0.581696", "0.5782078", "0.57674307", "0.5756495", "0.5741904", "0.56922007", "...
0.6574593
2
Use the DBSCAN clustering algorithm in order to remove possible outliers from the points detected as laser in the object. We are basically enforcing continuity in the laser line on the object, i.e. looking for a dense cluster of pixels. Interesting points are the ones whose label is not 1, i.e. the ones belonging to a ...
def remove_obj_outliers(self, points: np.ndarray) -> Optional[np.ndarray]: dbscan_result = self.dbscan.fit(points[:, 0]) mask = dbscan_result.labels_ != -1 return np.expand_dims(points[:, 0][mask], axis=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DBSCAN(M, eps, min_points):\n colors = ['r', 'g', 'b', 'y', 'c', 'm'] # tablica kolorow - inny kolor dla kazdego clustera\n checked = np.zeros(M.shape[\n 0]) # tablica sprawdzonych punktow wypelniona zerami jesli punkt zostal sprawdzony zmieniana jest wartosc na 1print(checked...
[ "0.6458574", "0.62219197", "0.6213678", "0.61207443", "0.6074292", "0.6022414", "0.5965475", "0.5942092", "0.5927346", "0.5881949", "0.57391447", "0.5729232", "0.56970525", "0.5679967", "0.5674256", "0.5669259", "0.5664249", "0.5654197", "0.56165564", "0.5572699", "0.555027",...
0.6430791
1
Given an image and a list of coordinates of shape (n_points, 1, 2), return the RGB colors of those coordinates in the (0...1) range. Notice that OpenCV uses BGR instead of RGB by default, thus we need to flip the columns.
def get_colors(self, image: np.ndarray, coordinates: np.ndarray) -> np.ndarray: x = coordinates.squeeze(1) return np.flip(image[x[:, 1], x[:, 0]].astype(np.float64) / 255.0, axis=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_image(img):\n xs = [] # positions\n ys = [] # colors\n for row_i in range(img.shape[0]):\n for col_i in range(img.shape[1]):\n xs.append([row_i, col_i])\n ys.append(img[row_i, col_i])\n \n xs = np.array(xs)\n ys = np.array(ys)\n return xs, ys", ...
[ "0.6468485", "0.6468485", "0.6345939", "0.62494427", "0.61467564", "0.61461294", "0.59144837", "0.59094536", "0.58901876", "0.5879799", "0.58757746", "0.58628285", "0.5841417", "0.5825361", "0.58153236", "0.5774531", "0.57576954", "0.5743293", "0.57418716", "0.5741592", "0.57...
0.702163
0
Given the interesting region of an image, containing the wall and desk planes
def get_laser_points( self, original_image: np.ndarray, image: np.ndarray, extreme_points: ExtremePoints, ) -> Tuple[ Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray], ]: height, width = imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_plane(img_plane):\n img_plane = despeckle_by_opening(img_plane)\n img_plane = pseudo_flatfield(img_plane)\n return img_plane", "def vision(image):\n vis_map = resize(image, alpha, beta)\n print(\"Resized map from the blue mask\")\n\n world = rotate(vis_map)\n\n plt.figure()\n p...
[ "0.65809894", "0.6464048", "0.6390743", "0.63287824", "0.62113917", "0.62051076", "0.617314", "0.61421067", "0.6071303", "0.59273034", "0.5899224", "0.58911043", "0.5882506", "0.5850462", "0.58404744", "0.5821716", "0.5817986", "0.5805731", "0.5789838", "0.5780241", "0.577984...
0.0
-1
Given points in the 3D world, save the PLY file representing the point cloud. This function saves both the original file and a version to which an outlier removal process has been applied.
def save_3d_render( self, points: List[np.ndarray], colors: List[np.ndarray] ) -> None: pcd = o3d.geometry.PointCloud() pcd.points = o3d.utility.Vector3dVector(np.vstack(points).astype(np.float64)) pcd.colors = o3d.utility.Vector3dVector(np.vstack(colors)) if self.debug...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n if len(self.interpolated_points) > 0:\n red, green, blue = zip(*self.interpolated_points)\n red = [np.asscalar(x) for x in red]\n green = [np.asscalar(x) for x in green]\n blue = [np.asscalar(x) for x in blue]\n output_type =...
[ "0.6294344", "0.62656236", "0.60348487", "0.5977392", "0.5924391", "0.58835065", "0.58382964", "0.5795747", "0.5772745", "0.5762645", "0.5722541", "0.5684895", "0.56516", "0.5644123", "0.56439006", "0.5636157", "0.56341565", "0.56338894", "0.5624714", "0.56098646", "0.5586971...
0.639831
0
Read a frame from the cap. Return None if there is no frame left.
def read_frame(self, cap) -> Optional[np.ndarray]: frame_raw = cap.read()[1] if frame_raw is None: cv.destroyAllWindows() return None return cv.undistort(frame_raw, self.K, self.dist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):\n\n # if self.deque and self.online:\n if self.online:\n # Grab latest frame\n if self.enable_camera_reader_thread:\n frame = self.deque[-1]\n else:\n _, frame = self.cap.read()\n return frame\n else:\n ...
[ "0.7615841", "0.7613714", "0.7210717", "0.7086903", "0.7004125", "0.69384205", "0.68672734", "0.68494064", "0.6765152", "0.6765152", "0.67489", "0.67320615", "0.67314106", "0.6676311", "0.664866", "0.6638468", "0.661803", "0.6612942", "0.6570604", "0.6548034", "0.6513184", ...
0.67918265
8
Given a plane represented by its origin and a normal and a list of rays, compute the intersections between the plane and the rays.
def compute_intersections( self, plane: Plane, directions: List[np.ndarray] ) -> List[np.ndarray]: return [ line_plane_intersection( plane_origin=plane.origin, plane_normal=plane.normal, line_direction=direction, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self, ray):\n theta = 45\n H = 512\n W = 512\n A = self.origin\n B = Point(W, A.y, A.z)\n C = Point(B.x, (int)(H * math.sin(theta * math.pi / 180)), (int)(H * math.cos(math.pi * theta / 180)))\n D = Point(A.x, (int)(H * math.sin(theta * math.pi / 180)...
[ "0.7197938", "0.6904024", "0.6653329", "0.6607719", "0.65378755", "0.6519269", "0.6485377", "0.6441739", "0.6334094", "0.6284775", "0.6276811", "0.6276351", "0.6261968", "0.62611717", "0.62223566", "0.6186185", "0.61805207", "0.6166154", "0.60925084", "0.60659647", "0.6016266...
0.7335776
0
Build command string from parameters passed to object. Usage of paramter h in options is going to be ignored.
def build_command_string(self): if self._regex_helper.search_compiled(W._re_h, self.options): if self._regex_helper.group("SOLO"): self.options = self.options.replace('-h', '') else: self.options = self.options.replace('h', '') cmd = "{} {}".f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_command(process):\n cmd = \"{} \".format(process.name)\n for o in process.options.opt_list:\n i = 0\n opt = \"\"\n for el in o: \n if el and el != \"input\" and el != \"output\" and i != 3:\n opt += str(el)\n if opt[-1] != \"=\" and opt[-1...
[ "0.6516497", "0.64271504", "0.6422479", "0.63904124", "0.6238994", "0.6229805", "0.62154454", "0.6114734", "0.6070556", "0.5986263", "0.59837586", "0.5973345", "0.59382427", "0.5915507", "0.5883363", "0.5877054", "0.58658147", "0.58613133", "0.58564746", "0.585302", "0.583697...
0.7719122
0
Put your parsing code here.
def on_new_line(self, line, is_full_line): try: if is_full_line: self._parse_v_option(line) self._parse_general_info(line) self._parse_header(line) except ParsingDone: pass # line has been fully parsed by one of above parse-methods...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse(self):\n pass", "def parse(self):", "def parse(self):\n pass", "def parse(self):\n pass", "def parse(self):\n pass", "def parse(self):\n pass", "def parse(self) -> None:\n pass", "def run(self, parsed):", "def parse(self, input):\n pass", ...
[ "0.7996566", "0.7783249", "0.76065314", "0.76065314", "0.76065314", "0.76065314", "0.7285606", "0.7165976", "0.70817536", "0.7069374", "0.70202744", "0.6931129", "0.6881782", "0.68361986", "0.6675497", "0.6673735", "0.6653678", "0.66311437", "0.65552753", "0.6510659", "0.6476...
0.0
-1
Parse general information in line and update it to GENERAL_INFO dictionary.
def _parse_general_info(self, line): if self._regex_helper.search_compiled(W._re_general_info, line): self.current_ret['GENERAL_INFO'].update({ 'time': datetime.datetime.strptime(self._regex_helper.group("TIME"), '%H:%M:%S').time(), 'uptime': self._regex_helper.group(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_line(self, line):\n fields = line.split('|', 4) # stop splitting after fourth | found\n line_info = {'raw_message': line}\n if len(fields) == 5:\n line_info.update(dict(zip(self._fieldnames, fields)))\n return line_info", "def _parse_general_info_V4X(par, parfil...
[ "0.6655572", "0.65438634", "0.61774", "0.6080733", "0.6014996", "0.59691495", "0.5966504", "0.5905911", "0.58785135", "0.583794", "0.5830027", "0.57280356", "0.5722466", "0.56339806", "0.562032", "0.5615857", "0.5602782", "0.5572568", "0.5570758", "0.5545635", "0.5519029", ...
0.8499883
0
Parse V option output in line and append it to RESULT list.
def _parse_v_option(self, line): if self._regex_helper.search_compiled(W._re_v_option, line): self.current_ret['RESULT'].append(self._regex_helper.group("V_OPTION")) raise ParsingDone
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processOption (self, line) :\n ll = line.split ('=')\n if len (ll) < 2:\n print \"Cannot parse option \" , line\n sys.exit()\n result = (ll[0].strip() , ll[1].strip())\n return result", "def _parse_results(self):\n for line in self.file_dic['output'].s...
[ "0.6423425", "0.5811027", "0.580129", "0.5655842", "0.55434406", "0.533609", "0.53108877", "0.53000253", "0.5271251", "0.5269717", "0.5203191", "0.51964784", "0.5171904", "0.5154556", "0.5100387", "0.5036834", "0.5026639", "0.5026215", "0.5009487", "0.49926525", "0.49875903",...
0.8179622
0
Parse headers and entries in line, create dictionary and append it to RESULT list.
def _parse_header(self, line): if self._regex_helper.search_compiled(W._re_header, line): if not self.headers: for value in re.findall(W._re_header, line): self.headers.append(value[0]) raise ParsingDone else: # Dictiona...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_line(self, line):\n find_result = re.findall(LINE_REGEX, line)\n line_data = {r[0]: r[1] for r in find_result}\n self.process_url(line_data.get('request_to'))\n self.process_status_code(line_data.get('response_status'))", "def process_line(line):\n\n name_comp_list ...
[ "0.66752446", "0.6504577", "0.63924736", "0.6246586", "0.60992664", "0.60275394", "0.59553164", "0.5938524", "0.58829117", "0.58815986", "0.58645564", "0.5864273", "0.5848218", "0.5842252", "0.58342505", "0.58329415", "0.5803412", "0.5788858", "0.57804203", "0.5771522", "0.57...
0.7336327
0
We need to find the halfedge h that is incident to u and is on the face that contains the diagonal uv. To find it, we test every pair of halfedges incident to u and v until we find a pair belonging to the same face.
def referenceEdge(u,v): v1 = u v2 = v e1 = u.getEdge().getPrev() e2 = v.getEdge().getPrev() aux = None #aux is an half-edge incident to u while aux != e1: if aux is None: aux = e1 aux2 = None #aux2 is an half-edge incident to v while aux2 != e2: if aux2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_homography(u, v):\r\n N = u.shape[0]\r\n H = None\r\n\r\n if v.shape[0] is not N:\r\n print('u and v should have the same size')\r\n return None\r\n if N < 4:\r\n print('At least 4 points should be given')\r\n\r\n # TODO: 1.forming A\r\n A = np.zeros((2*N, 8))\r\n ...
[ "0.60242623", "0.5956021", "0.58149", "0.5760208", "0.56859523", "0.5671715", "0.56677574", "0.5637607", "0.5518257", "0.54610336", "0.54298204", "0.5412329", "0.5374091", "0.53719383", "0.53666955", "0.53609663", "0.53559095", "0.5352723", "0.5348312", "0.5332194", "0.531307...
0.62999815
0
FNV1 64bit hash function Implement this, and/or DJB2.
def fnv1(self, key): # hash = 0xff hash = 0xcbf29ce484222325 for n in key.encode(): # print(n) hash = hash ^ n hash = hash * 0x100000001b3 # print(hash) return hash
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fnv1(self, key, seed=0):\n # def fnv1(self, key):\n\n # Your code here\n \"\"\"\n Returns: The FNV-1 hash (64-bit) of a given string. \n \"\"\"\n #Constants : Fails the tests\n # FNV_prime = 1099511628211\n # offset_basis = 14695981039346656037\n\n # #...
[ "0.7850084", "0.72370136", "0.7108986", "0.705044", "0.6990908", "0.691239", "0.67458034", "0.6731104", "0.6608719", "0.6538066", "0.65314394", "0.6447355", "0.6440217", "0.6417119", "0.63966304", "0.6386951", "0.63631225", "0.6338462", "0.6330434", "0.63016164", "0.62938416"...
0.75328153
1
DJB2 32bit hash function Implement this, and/or FNV1.
def djb2(self, key): hash = 5381 for n in key.encode(): # hash = ((hash << 5) + hash) + n hash = hash * 33 + n return hash # return hash & 0xFFFFFFFF
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hash_djb2(self, key):\n # OPTIONAL STRETCH: Research and implement DJB2\n hash_grotto = 5381\n for k in key:\n hash_grotto = ((hash_grotto << 5) + hash_grotto) + ord(k)\n return hash_grotto & 0xFFFFFFFF", "def HashAlgorithm(self) -> _n_7_t_0:", "def get_num_slots(sel...
[ "0.75013524", "0.73342395", "0.6955384", "0.6919217", "0.6897323", "0.6879067", "0.684995", "0.68333465", "0.68108124", "0.6808085", "0.6805619", "0.67863303", "0.6743211", "0.65885407", "0.6543602", "0.65120983", "0.65104103", "0.6497235", "0.6493313", "0.6491135", "0.649005...
0.685876
6
Take an arbitrary key and return a valid integer index between within the storage capacity of the hash table.
def hash_index(self, key): # return self.fnv1(key) % self.capacity return self.djb2(key) % self.capacity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(self, key):\r\n\t\tindex = self._hash_function(key) % self.capacity\r\n\t\treturn index", "def _get_index(self, key):\n return self._hash_function(key) % self.capacity", "def find(self, key: T) -> int:\n\n try:\n # passes check with primary hashing function\n i...
[ "0.82723343", "0.8059556", "0.7425421", "0.7415482", "0.7330069", "0.7317209", "0.7286038", "0.72367275", "0.72197723", "0.7199164", "0.71206874", "0.7113054", "0.71044403", "0.7025496", "0.6955795", "0.690559", "0.6811699", "0.6794608", "0.6751182", "0.6741437", "0.6739836",...
0.7555435
3
Store the value with the given key. Hash collisions should be handled with Linked List Chaining. Implement this.
def put(self, key, value): hi = self.hash_index(key) if self.storage[hi]: current = self.storage[hi] while current.next and current.key != key: current = current.next if current.key == key: current.value = value else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, key, value):\n ha = self.myhash(key)\n if key not in self.hashmap[ha][0]:\n self.hashmap[ha][0].append(key)\n self.hashmap[ha][1].append(value)\n else:\n self.hashmap[ha][1][self.hashmap[ha][0].index(key)] = value", "def put(self, key, value):\n...
[ "0.81106144", "0.80772465", "0.8076398", "0.80682015", "0.8036524", "0.8018422", "0.79838794", "0.7905589", "0.7890816", "0.7876302", "0.78534526", "0.781982", "0.77786344", "0.77710927", "0.77464396", "0.76788867", "0.7675746", "0.7673336", "0.7644221", "0.76339984", "0.7602...
0.8438726
0
Remove the value stored with the given key. Print a warning if the key is not found. Implement this.
def delete(self, key): hi = self.hash_index(key) # if that hi is empty ignore # if self.storage[hi] is None: # print("WARNING: no key") # return current = self.storage[hi] prev = self.storage[hi] while current and current.key != key: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_value(self, key: str) -> None:\n raise NotImplementedError", "def remove(self, key):\n\n index = self._get_hash(key)\n\n if self.table[index] is not None:\n for i, pair in enumerate(self.table[index]):\n if key == pair[0]:\n del self.ta...
[ "0.8015489", "0.7890396", "0.78630865", "0.77276903", "0.7694492", "0.7658495", "0.75991946", "0.7547378", "0.7540013", "0.75382787", "0.7528272", "0.7514823", "0.74924624", "0.74631125", "0.74571407", "0.74240434", "0.7404178", "0.740016", "0.7383215", "0.7339205", "0.731292...
0.0
-1
Retrieve the value stored with the given key. Returns None if the key is not found. Implement this.
def get(self, key): hi = self.hash_index(key) if (self.storage[hi]): if(self.storage[hi].next): current = self.storage[hi] while current.next and current.key != key: current = current.next return current.value el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(self, key):\n index = self._hash_mod(key)\n node = self.storage[index]\n while node is not None:\n if node.key == key:\n return node.value\n node = node.next\n return None", "def get(self, key):\n\n node = self._get_node(key) #...
[ "0.8208157", "0.8203918", "0.8190829", "0.8146119", "0.8118441", "0.8083434", "0.80767083", "0.80651796", "0.7955004", "0.7951158", "0.7878939", "0.787848", "0.7858636", "0.7857246", "0.78159803", "0.78017765", "0.7784482", "0.77715313", "0.77582735", "0.7758255", "0.77547365...
0.79671395
8
Doubles the capacity of the hash table and rehash all key/value pairs. Implement this.
def resize(self, factor=2): self.capacity = round(self.capacity*factor) newarr = [None] * self.capacity for i, v in enumerate(self.storage): while v: hi = self.hash_index(v.key) if newarr[hi]: current = newarr[hi] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rehash(self):\n new_cap = self._get_new_capacity() # Choose not to handle the ValueError thrown by _get_new_capacity()\n new_table = HashTable(new_cap) # Create a new hash table directly\n for i in range(self.size):\n if self.keys[i] is not None: # Only put() when there exist...
[ "0.81800413", "0.80060524", "0.78790945", "0.720138", "0.7163807", "0.7084468", "0.70818853", "0.68698233", "0.68121934", "0.6672545", "0.66696256", "0.6579458", "0.64621586", "0.6386414", "0.62088525", "0.61762494", "0.59902906", "0.5952233", "0.581466", "0.5799071", "0.5767...
0.6915366
7
Write a program that takes as input a BST and an interger k, and returns the k largest elements in the BST in decreasing order.
def find_k_largest_in_bst_recursively(tree, k): def find_k_largest_in_bst_helper(tree): if tree and len(k_largest_elements) < k: # Smart: Recursion iff we don't have K largest elements collected find_k_largest_in_bst_helper(tree.right) if len(k_largest_elements) < k: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findKthLargest(self, nums: List[int], k: int) -> int:\n return sorted(nums)[-k]", "def _get_k_largest(lst, k):\n sorted_lst = sorted([(val, index) for index, val in enumerate(lst)])\n return list(reversed(sorted_lst[-k:]))", "def kth_largest(arr: list, k: int):\n # Do not search if k is lar...
[ "0.7045558", "0.701398", "0.6677336", "0.6673362", "0.66666937", "0.65226465", "0.65028167", "0.646503", "0.6402724", "0.63980407", "0.6357561", "0.6304622", "0.617777", "0.61401814", "0.6116958", "0.6113665", "0.6077666", "0.60618454", "0.60614383", "0.60428995", "0.60170496...
0.8523908
0
Calculate upper percentile MCP cutoff for avoiding Andor saturation Andor begins saturating at ~5000 for 'signal' value. Set percentile cutoff of incident fluence (mcp) to the percentile where Andor reaches 4000, well before saturation. If that is greater than the 99.9th percentile, set percentile cutoff to 99.9 to eli...
def _calculate_percentile_cutoff(run_numbers): mcp_values = [] andor_values = [] for run_number in run_numbers: current_data_path = ''.join([DATA_PATH, 'run', str(run_number), 'allevts.h5']) f = h5py.File(current_data_path, 'r') current_phot = _get_photon_energy(f, run_number) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut_spectrum(input_spectrum, desired_frequency_range):\n channels_ip = []\n for ip in input_spectrum.GetChannels():\n channel_ip = []\n channel_op = []\n for n, i in enumerate(ip):\n if n > desired_frequency_range[0] / input_spectrum.GetResolution() and n < desired_frequen...
[ "0.5653417", "0.5633713", "0.5491142", "0.54786575", "0.54064196", "0.53240645", "0.52246594", "0.52203375", "0.52071315", "0.51993823", "0.5179031", "0.51522595", "0.51460844", "0.51184833", "0.50988865", "0.5083905", "0.5054955", "0.5052072", "0.50464624", "0.50445575", "0....
0.59004277
0
Calculate polynomial to correct slight nonlinearity in MCP response
def do_mcp_nonlinearity_calibration(): no_sample_data_path = ''.join([DATA_PATH, 'run108allevts.h5']) f = h5py.File(no_sample_data_path) phot = _get_photon_energy(f, 108) mcp = np.array(f['Acqiris2']['acq']) andor = np.array(f['Andor']['signal']-f['Andor']['reference']) # Subtract dark signals: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_polynomial():\n degree = numpy.random.choice(range(3, 7))\n x = numpy.linspace(-10, 10, 1000)\n coefficients = numpy.random.chisquare(3, size=degree) + 1\n coefficients *= numpy.random.choice([-1, 1], size=coefficients.shape)\n coefficients *= 0.5\n y = numpy.polyval(coefficients, x)...
[ "0.66424847", "0.65410674", "0.65383047", "0.6523504", "0.6429001", "0.63814205", "0.6350041", "0.6323735", "0.62960255", "0.6285092", "0.6248639", "0.6246817", "0.6244223", "0.6241529", "0.62292457", "0.6215943", "0.6210995", "0.6187557", "0.61658406", "0.6146332", "0.611326...
0.59670556
38
hash file 'filename', return a sha1 object
def hash_file ( filename ): sha1 = hashlib.sha1() with open( filename, 'rb' ) as f: while True: buf = f.read(65536) # read by 64kb buffers size if not buf: break sha1.update(buf) return sha1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_file(filename):\r\n\r\n # make a hash object\r\n h = hashlib.sha1()\r\n\r\n # open file for reading in binary mode\r\n with open(filename,'rb') as file:\r\n\r\n # loop till the end of the file\r\n chunk = 0\r\n while chunk != b'':\r\n # read only 1024 bytes at a time\r\...
[ "0.86476487", "0.8624012", "0.8624012", "0.8598889", "0.85914165", "0.85725063", "0.8362854", "0.82423913", "0.82207185", "0.8157332", "0.81049347", "0.80176985", "0.8006898", "0.7986033", "0.79686046", "0.7901671", "0.7900068", "0.7896424", "0.78734815", "0.77931935", "0.776...
0.85206515
6
Determine the length of the shortest path from start cloud to end cloud while avoiding clouds with value 1. Jumps can be of length 1 or 2, although jumps must be made through the consequtive clouds.
def jumping_on_the_clouds(clouds): index_clouds = [index for index, v in enumerate(clouds) if v == 0] for cloud in index_clouds: if index_clouds.index(cloud) == len(index_clouds) - 1: break if index_clouds[index_clouds.index(cloud) - 1] == cloud - 1 and \ index_clouds[index_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest_path_lengths(self, g, src):\n d = {} # d[v] is upper bound from s to v\n cloud = {} # map reachable v to its d[v] value\n pq = AdaptableHeapPriorityQueue() # vertex v will have key d[v]\n pqlocato...
[ "0.61706465", "0.57521135", "0.5744518", "0.568371", "0.55816853", "0.5577766", "0.55322653", "0.55223036", "0.5512849", "0.55110043", "0.55074567", "0.5502363", "0.54598504", "0.5440564", "0.54400444", "0.54284394", "0.53597796", "0.5335412", "0.5313877", "0.5312186", "0.530...
0.5281062
21
Receives input from stdin, provides output to stdout.
def main(): raw_input() clouds = map(int, raw_input().split(' ')) print jumping_on_the_clouds(clouds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stdin(self):\n pass", "def read_input():\n\n read = sys.stdin.readlines()\n\n text = ''\n for line in read:\n text += line\n\n return text", "def read_stdin():\n return \"\".join(sys.stdin.readlines()).strip()", "def _input(str=''):\n print(str, end='',...
[ "0.699605", "0.6673594", "0.6417195", "0.641211", "0.63803685", "0.63787425", "0.63246727", "0.628672", "0.6164965", "0.6164865", "0.6141185", "0.6102546", "0.6100803", "0.59521854", "0.5943102", "0.58946633", "0.58735377", "0.58601946", "0.5853264", "0.58521783", "0.5836183"...
0.0
-1
Return the widget to give focus to when this plugin's dockwidget is raised on toplevel
def get_focus_widget(self): return self.datatree
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_focus_widget(self):\r\n return self.shell", "def XPGetWidgetWithFocus():\n pass", "def get_focus(self):\n\n self.activateWindow()\n self.setFocus()", "def get_focus_widget(self):\n # TODO - focus on channel list\n# self.combo.lineEdit().selectAll()\n# retu...
[ "0.7704666", "0.7102243", "0.69277894", "0.68596774", "0.6834897", "0.67454267", "0.6497104", "0.64854103", "0.64425933", "0.6428573", "0.6415316", "0.6415316", "0.63931817", "0.63340354", "0.6328461", "0.6324133", "0.630882", "0.6146666", "0.61402094", "0.6127258", "0.606946...
0.67533296
5
Return a list of actions related to plugin
def get_plugin_actions(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActions():\n return getPlugins(IRenamingAction, plugins)", "def get_actions(self):\n return []", "def get_list_of_actions(self):\n return self.actions", "def actions(self):\n return self._action_list", "def actions(self):\n from moztrap.view.lists.actions import action...
[ "0.8130526", "0.76124007", "0.7425578", "0.73972076", "0.72777", "0.7205521", "0.7205521", "0.7205521", "0.7167486", "0.7161599", "0.7116936", "0.7075639", "0.70122087", "0.68798953", "0.67999965", "0.6772967", "0.6758088", "0.67547417", "0.6751595", "0.6751595", "0.67393315"...
0.8701119
1
Action to be performed on first plugin registration
def on_first_registration(self): self.main.tabify_plugins(self.main.help, self) self.dockwidget.hide()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_first_registration(self):\n pass", "def plugin_loaded():\n events.broadcast(\"plugin_loaded\")", "def init():\n g.registerHandler('new', new_hook)\n g.registerHandler('create-node', create_node_hook)\n g.registerHandler('select1', select1_hook)\n g.plugin_signon(__name__)\n retu...
[ "0.7602643", "0.731127", "0.69100946", "0.6785684", "0.67597336", "0.67597336", "0.6756247", "0.6613261", "0.658728", "0.65075296", "0.6474666", "0.64614034", "0.64464325", "0.6428728", "0.6416666", "0.63851625", "0.6381655", "0.63470215", "0.6346777", "0.6321743", "0.6249476...
0.7290536
2
Register plugin in Spyder's main window
def register_plugin(self): self.edit_goto.connect(self.main.editor.load) self.redirect_stdio.connect(self.main.redirect_internalshell_stdio) self.main.add_dockwidget(self) unittesting_act = create_action(self, _("Run unit tests"), icon=get_icon('p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_plugin(self):\n self.create_toggle_view_action()\n\n self.main.add_dockwidget(self)", "def test_addplugin(self):\n app = QApplication(sys.argv)\n data = (np.random.rand(30, 31, 32) * 100).astype(np.int)\n data[15:40, 13:20, 10:18] += 50\n se = seededitorqt.Q...
[ "0.69762045", "0.60747755", "0.58828604", "0.5874758", "0.58635104", "0.57819545", "0.5741525", "0.5716186", "0.5689403", "0.56821126", "0.5669613", "0.56537426", "0.55752265", "0.5545013", "0.55267227", "0.55135757", "0.5477841", "0.546501", "0.5450378", "0.54207486", "0.536...
0.65753347
1
Refresh unit testing widget
def refresh_plugin(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testRefresh(self):\n \n pass", "def test_update(self):\n # this is tested graphically, as it is UI\n pass", "def updateWidget(self):\n pass", "def refresh(self):\n\t\tself.driver.refresh()", "def test_visualisations_perform_visualisation_render_data_refresh_synchronously(...
[ "0.77160954", "0.6853362", "0.6844457", "0.6520042", "0.64972293", "0.6480656", "0.6453007", "0.64422596", "0.6441096", "0.64315104", "0.64105207", "0.640197", "0.63611436", "0.63520265", "0.63520265", "0.6331086", "0.6330639", "0.6268165", "0.6268165", "0.6268165", "0.622601...
0.5928176
32
Perform actions before parent main window is closed
def closing_plugin(self, cancelable=False): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __onclosing(self):\n self.window.destroy()", "def __window_close(self):\n pass", "def onCloseWindow(self, event):\r\n\r\n self.Destroy()", "def close(self):\n self.parent.activate()", "def close(self):\n self.state = False\n self.mainwindow.sendMessage('a')\n ...
[ "0.8200261", "0.8100803", "0.7912978", "0.78707916", "0.78692687", "0.78053725", "0.76622653", "0.7656516", "0.7632609", "0.7623432", "0.76179266", "0.7617525", "0.7596765", "0.75940526", "0.75664365", "0.75600374", "0.7546721", "0.7520903", "0.7520903", "0.7520903", "0.75209...
0.0
-1
Apply configuration file's plugin settings
def apply_plugin_settings(self, options): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_config_file(self):\n self.config_file = self.find_config_file()\n if self.config_file:\n self.apply_config_file(self.config_file)", "def apply_config(filename):\n with open(filename) as config_file:\n config = json.load(config_file)\n for setting, val...
[ "0.67779297", "0.6747643", "0.66346806", "0.6428851", "0.6423092", "0.6381086", "0.63534784", "0.6292545", "0.62646264", "0.6239537", "0.6237905", "0.6227397", "0.6210529", "0.6172642", "0.61720854", "0.6128758", "0.60786307", "0.6069815", "0.60622776", "0.6050749", "0.604386...
0.7636843
0
Used to display the basic/home page for logged in user.
def view_profile(request, user_id=None): requesting_user = request.user if user_id: requested_user = get_object_or_404(User, pk=user_id) else: requested_user = requesting_user profile = Profile.objects.for_user(requested_user) datasets = DataSet.objects.active().filter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n # sets the page to load depending on the type of user\n # if none specified the login screen will be displayed\n pageName = ''\n userType = session.get('UserType', None)\n if userType == None:\n pageName = 'anonHome.jade'\n elif userType == 'Seeker':\n pageName = 'in...
[ "0.8019861", "0.7620225", "0.75773484", "0.7534236", "0.7531676", "0.7529761", "0.7448983", "0.7423995", "0.73834974", "0.72934496", "0.72723556", "0.7247265", "0.72185725", "0.7184802", "0.71762604", "0.71736443", "0.7173331", "0.71588814", "0.71466374", "0.70936805", "0.708...
0.0
-1
Used to allow a user to edit their own profile.
def edit_profile(request): user = request.user profile = Profile.objects.for_user(user) if request.method != 'POST': profile_form = ProfileForm(instance=profile) user_form = UserForm(instance=user) else: profile_form = ProfileForm(request.POST, instance=profile) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_profile(self, name, username, email):\n return self.app.post('/_editProfile', data = dict(\n name = name,\n username = username,\n email = email\n ), follow_redirects = True)", "def edit_user():\n if CURR_USER_KEY in session:\n user = g.user\n...
[ "0.7839375", "0.76361674", "0.75991297", "0.757305", "0.7543597", "0.74999654", "0.7481396", "0.74729866", "0.7393925", "0.73854417", "0.7290376", "0.7259955", "0.7223237", "0.72067004", "0.72060645", "0.7162687", "0.7130685", "0.7072604", "0.7040199", "0.70098627", "0.697346...
0.7651815
1
Write experiment config to file
def save_experiment_config(self): if (self.use_dist and dist.get_rank() == 0) or not self.use_dist: logfile = os.path.join(self.experiment_dir, 'parameters.txt') log_file = open(logfile, 'w') log_file.write('\n') json.dump(self.args.__dict__, log_file, indent=2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, fn):\n with open(fn, 'w') as f:\n self.config.write(f)", "def __write_config(self):\n with open(self.config_file, 'w') as data_file:\n config = {\"ibooks_doc_root\":self.ibooks_doc_root,\n \"library_folder\":self.library_folder,\n \"annota...
[ "0.7415516", "0.73900247", "0.7218968", "0.72177714", "0.71523476", "0.70878863", "0.70843565", "0.7062435", "0.6997892", "0.6982512", "0.6912694", "0.6897209", "0.6897209", "0.6863159", "0.6842561", "0.67937106", "0.6761959", "0.67610425", "0.6752727", "0.67474806", "0.67445...
0.7216942
4
Return three Keras HDF5Matrix instances for the input, groundtruth density map and groundtruth segmentation mask in a compact TrainingSet
def get_matrices(training_set_path): if os.path.isfile(training_set_path): X = HDF5Matrix(training_set_path, 'input/input') y = HDF5Matrix(training_set_path, 'target/target') y_seg = HDF5Matrix(training_set_path, 'seg_map/seg_map') return X, y, y_seg else: raise Exception...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_to_h5():\n # this took about 10 minutes for set1\n for setname in ['set1', 'set2']:\n filename = os.path.join(ltrc_dirname, '{}.h5'.format(setname))\n f = h5py.File(filename, 'w')\n\n for name in ['train', 'valid', 'test']:\n g = f.create_group(name)\n ...
[ "0.60946685", "0.5913993", "0.58595705", "0.5826413", "0.58137065", "0.5807853", "0.5747172", "0.5703104", "0.5692386", "0.56754106", "0.56699955", "0.56411266", "0.56325924", "0.5626313", "0.56190795", "0.5594807", "0.5573859", "0.55735236", "0.5554242", "0.5549842", "0.5542...
0.63189304
0
Generate outputs from a noncompact TrainingSet to use with Keras' 'fit_generator' function. If 'n_crops' is nonzero, the Iterator crops n_crops 20x20 regions from each image before feeding them.
def flow(self, batch_size=32, output='both', crops=0): while True: for dataset in self.input_sets: X = self.training_set['input/'+dataset] y = self.training_set['target/'+dataset] y_seg = self.training_set['seg_map/'+dataset] for i in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_generator(batches, crop_length):\n while True:\n batch_x, batch_y = next(batches)\n batch_crops = np.zeros((batch_x.shape[0], crop_length, crop_length, 3))\n for i in range(batch_x.shape[0]):\n batch_crops[i] = random_crop(batch_x[i], (crop_length, crop_length))\n ...
[ "0.58771247", "0.57928264", "0.57725567", "0.5747757", "0.5570905", "0.5488688", "0.5483506", "0.5471397", "0.5459297", "0.5440349", "0.54253316", "0.54131067", "0.5412875", "0.54017425", "0.5401398", "0.5400203", "0.53945994", "0.5369897", "0.5358676", "0.53234917", "0.53224...
0.6750257
0
generate upstream cherrypick patch files
def generate_patch_files(sha_list: List[str], start_version: int) -> PatchList: upstream_dir = paths.TOOLCHAIN_LLVM_PATH fetch_upstream_once() result = PatchList() for sha in sha_list: if len(sha) < 40: sha = get_full_sha(upstream_dir, sha) file_path = paths.SCRIPTS_DIR / 'pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_genpatch(self, argv):\n #TODO:\n # - Would an optional [<files> ...] argument be useful or is\n # that overkill? E.g. 'p4 genpatch ./...' (I think that that\n # would be very useful.\n # - Could add '-f' option to only warn on 'out of sync'.\n # - Coul...
[ "0.6193804", "0.61185837", "0.60817057", "0.587971", "0.5735855", "0.57174575", "0.5645524", "0.55588645", "0.5523853", "0.5493776", "0.54873055", "0.5407881", "0.53941137", "0.5388479", "0.5378879", "0.53761584", "0.5310182", "0.52620775", "0.52522963", "0.52342397", "0.5227...
0.6612873
0
Use the userprovided CLI arguments to find Rez packages.
def __gather_package_data(arguments): ignore_patterns, packages_path, search_packages_path = _resolve_arguments( arguments.ignore_patterns, arguments.packages_path, arguments.search_packages_path, ) rez_packages = set(arguments.rez_packages) package_finder = registry.get_package...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(args): # noqa; pylint: disable=unused-argument", "def main(args):\n cli = CLI()\n # Check arguments\n cli.parse_arguments(args)", "def main(args):", "def main(args):", "def main():\n licensify(_parse_args())", "def main(args=None):", "def main(args=None):", "def query_cmdline():"...
[ "0.67388576", "0.66946054", "0.6388412", "0.6388412", "0.63570476", "0.62585646", "0.62585646", "0.62556493", "0.6208808", "0.62030077", "0.61873835", "0.61870766", "0.6160379", "0.6157867", "0.6155319", "0.60664207", "0.60664207", "0.60664207", "0.60664207", "0.60664207", "0...
0.0
-1
Print out every package and its status information. This function prints out Packages that were found as "invalid" Packages that were skipped automatically Packages that were ignored explicitly (by the user)
def __report(arguments, _): ignored_packages, other_packages, invalid_packages, skips = __gather_package_data( arguments ) packages, invalids = worker.report( other_packages, maximum_repositories=arguments.maximum_repositories, maximum_rez_packages=arguments.maximum_rez_pack...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_missing(packages, verbose):\n if not packages:\n print(\"## No Rez packages were found.\")\n print(\"No data found\")\n\n return\n\n print(\"## Your command affects these Rez packages.\")\n\n template = \"{package.name}\"\n\n if verbose:\n template = \"{package.na...
[ "0.75528216", "0.734317", "0.70231634", "0.6996778", "0.6639634", "0.65396285", "0.63859266", "0.63610005", "0.6253691", "0.6054543", "0.60348654", "0.5987873", "0.59685683", "0.59673953", "0.59105027", "0.57375103", "0.5688907", "0.56304795", "0.5588385", "0.55742896", "0.55...
0.5926434
14
Execute a plugin command on any package that needs it.
def __run(arguments, command_arguments): # pylint: disable=too-many-locals ignored_packages, other_packages, invalid_packages, skips = __gather_package_data( arguments ) command = registry.get_command(arguments.command) packages, un_ran, invalids = worker.run( functools.partial(comman...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_plugins(group):\n package = sys.modules[__name__]\n\n for (importer, module_name, ispkg) in pkgutil.iter_modules(package.__path__):\n if not ispkg:\n try:\n module = importlib.import_module(package.__name__ + '.' + module_name)\n\n if 'run' not in modu...
[ "0.6978726", "0.6254254", "0.6242243", "0.6231577", "0.5971375", "0.5952955", "0.595294", "0.5947213", "0.5931876", "0.5922034", "0.59098864", "0.5870987", "0.5864653", "0.5852075", "0.58266354", "0.58263", "0.5813188", "0.57689124", "0.5759055", "0.57544816", "0.573416", "...
0.0
-1
Write a cache of GitHub users todisk.
def __make_git_users(arguments): github_user.write_cache( arguments.path, arguments.token, base_url=arguments.base_url, verify=arguments.ssl_no_verify, maximum=arguments.maximum_users, ) print( 'GitHub users were written to "{arguments.path}" successfully.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveCacheFile(self):\n with open(self.cachePath, 'w', encoding='utf-8') as outfile:\n json.dump(self.cacheData, outfile)", "def save_cache(cache_key, version, data):\n\n # Save these results for the next run. Include the version information and nest the user\n # information inside a \"users\" k...
[ "0.65254027", "0.6457006", "0.6325532", "0.6226892", "0.61698765", "0.6146631", "0.6111177", "0.6007813", "0.5938739", "0.59114945", "0.58837384", "0.5855156", "0.57993", "0.5761495", "0.57532364", "0.57507557", "0.5726013", "0.5722801", "0.57184774", "0.57181704", "0.5702436...
0.60137564
7
Get the "userignored" Rez packages.
def _split_the_ignored_packages(packages, patterns): ignored = set() non_ignored = set() for package in packages: for pattern in patterns: if fnmatch.fnmatch(package.name, pattern): ignored.add((package, pattern)) break else: non_igno...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getusersitepackages():\n\tpass", "def packages(self):\n return []", "def user_packages(self, host: (str), user: (str)) -> Any:\n return search_api(\"user_packages\", host, user)", "def get_packages():\n\n packages = find_packages()\n packages = ['{}.{}'.format('uniq', package) for pac...
[ "0.70381504", "0.60557246", "0.6004433", "0.599181", "0.59327734", "0.5899515", "0.5897012", "0.58251196", "0.56858665", "0.5647229", "0.56442803", "0.5642458", "0.56385034", "0.5618204", "0.55391264", "0.5537971", "0.5523503", "0.54886055", "0.54812515", "0.5385388", "0.5347...
0.51812875
39
Convert userprovided data into glob expressions.
def _resolve_arguments(patterns, packages_path, search_packages_path): def _read_patterns(path): try: with open(path, "r") as handler: return set(handler.read().splitlines()) except IOError: return set() ignore_patterns = set() for item in patterns:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_globs(self, build_patterns: Iterable[str]) -> Tuple[str, ...]:", "def glob2re(glob: str) -> str: # pylint: disable=too-many-branches\n index = 0\n size = len(glob)\n results: List[str] = []\n\n while index < size:\n char = glob[index]\n index += 1\n\n if char == \"*\":\n ...
[ "0.64430857", "0.63578635", "0.6261387", "0.60944086", "0.5796563", "0.57915723", "0.56762636", "0.5663169", "0.56547064", "0.5645", "0.56442356", "0.56302255", "0.5625942", "0.56170833", "0.55723745", "0.5567273", "0.550928", "0.5502115", "0.5493355", "0.5465679", "0.5431877...
0.0
-1
Print every package as "ignored".
def _print_ignored(packages): if not packages: print("## No Rez package was set to be ignored") print("No data found") return print("## Every package in this list was explicitly set to ignored by the user") for package, pattern in sorted(packages, key=_get_package_name): p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_missing(packages, verbose):\n if not packages:\n print(\"## No Rez packages were found.\")\n print(\"No data found\")\n\n return\n\n print(\"## Your command affects these Rez packages.\")\n\n template = \"{package.name}\"\n\n if verbose:\n template = \"{package.na...
[ "0.6896404", "0.65300035", "0.64506", "0.6380679", "0.6243997", "0.6215631", "0.6034081", "0.60240585", "0.58716226", "0.5729593", "0.57106125", "0.5704774", "0.56812304", "0.5655815", "0.565425", "0.5575963", "0.5534667", "0.550217", "0.5492941", "0.54724574", "0.547046", ...
0.83495414
0
Print out the errors that were found.
def _print_invalids(invalids, verbose): if not invalids: print("## No Rez package was set as invalid.") print("Nothing is invalid. Which is a good thing!") return print("## Some packages were marked as invalid. Here's why:") template = "{package.name}: {message}" if verbose: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_errors(self):\n\n if self.errors:\n print('Clean error in:')\n for file in self.errors:\n print(' %s' % file)", "def showerrors():\n errorMessages = middleware.ixn.showErrorMessage(silentMode=True)\n if errorMessages:\n print(errorMe...
[ "0.79570866", "0.76505107", "0.7556986", "0.7181456", "0.7115748", "0.70891637", "0.698253", "0.6980931", "0.69472224", "0.6878406", "0.6876207", "0.68568164", "0.6730276", "0.66749024", "0.6658213", "0.6623326", "0.6581947", "0.65270984", "0.6495916", "0.6495916", "0.6464373...
0.6638913
15
Print all Rez packages that should be run on.
def _print_missing(packages, verbose): if not packages: print("## No Rez packages were found.") print("No data found") return print("## Your command affects these Rez packages.") template = "{package.name}" if verbose: template = "{package.name}: {path}" for line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_packages(self):\n for tag, pkg in PACKAGES.iteritems():\n print \"{tag} - {label}\".format(tag=tag, label=pkg['label'])", "def _print_ignored(packages):\n if not packages:\n print(\"## No Rez package was set to be ignored\")\n print(\"No data found\")\n\n return...
[ "0.6903446", "0.6681349", "0.64860743", "0.6483986", "0.64436895", "0.63718176", "0.6362368", "0.62700814", "0.62351704", "0.6204767", "0.6189284", "0.61830366", "0.61695254", "0.6160334", "0.6057463", "0.6053403", "0.6039349", "0.5968796", "0.5965892", "0.5961952", "0.595328...
0.7438773
0
Print the Rez packages that were skipped automatically by this tool. Skipped packages differ from "invalid" packages in that they are "valid Rez packages but just don't need the command run on". Ignored packages are Rez packages that the user explicitly said to not process. Skipped packages are packages that the user m...
def _print_skips(skips, verbose): if not skips: print("## No packages were skipped") print("Every found Rez package can be processed by the command.") return print("## Packages were skipped from running a command. Here's the full list:") template = "{issue.package.name}: {issue.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_ignored(packages):\n if not packages:\n print(\"## No Rez package was set to be ignored\")\n print(\"No data found\")\n\n return\n\n print(\"## Every package in this list was explicitly set to ignored by the user\")\n\n for package, pattern in sorted(packages, key=_get_pack...
[ "0.7548334", "0.75025696", "0.6658978", "0.64952445", "0.59089476", "0.58754075", "0.5860346", "0.5699727", "0.5639692", "0.5637996", "0.5636697", "0.5571671", "0.5533277", "0.55121475", "0.54966754", "0.5486724", "0.5446966", "0.54336095", "0.53756714", "0.53676933", "0.5310...
0.80562556
0