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
Get all components that are an instance of ``component_type``.
def get_components_by_type( self, component_type: Union[type, Tuple[type, ...]] ) -> List[Any]: return [c for c in self._components if isinstance(c, component_type)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_components_by_type(\n self, component_type: Union[type, Tuple[type, ...]]\n ) -> List[Any]:\n return self._manager.get_components_by_type(component_type)", "def get_components(self, filter_type=None):\n\n if filter_type is None:\n out = self.components\n elif isi...
[ "0.8547184", "0.6889929", "0.61937904", "0.6006221", "0.59004545", "0.5866749", "0.5784385", "0.57724464", "0.57717794", "0.5745258", "0.57174027", "0.5656232", "0.5640331", "0.5635853", "0.5634207", "0.5617102", "0.5617102", "0.5615041", "0.5579383", "0.5579383", "0.5561703"...
0.8519839
1
Get the component with name ``name``. Names are guaranteed to be unique.
def get_component(self, name: str) -> Any: for c in self._components: if c.name == name: return c raise ValueError(f"No component found with name {name}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_component(self, name):\n for cmpt in self.components:\n if cmpt['name'] == name:\n return cmpt", "def get_component(self, name: str) -> Any:\n return self._manager.get_component(name)", "def get(name):\r\n return componentManager.components[name]", "def comp...
[ "0.8581954", "0.8132362", "0.8047409", "0.75000876", "0.6909813", "0.67308456", "0.65872496", "0.6536908", "0.6505384", "0.6497451", "0.64877367", "0.64358634", "0.64024574", "0.63259006", "0.62867415", "0.62573177", "0.6255165", "0.62408423", "0.62342554", "0.6208173", "0.62...
0.8775755
0
Get a mapping of component names to components held by the manager. Returns Dict[str, Any] A mapping of component names to components.
def list_components(self) -> Dict[str, Any]: return {c.name: c for c in self._components}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_components(self) -> Dict[str, Any]:\n return self._manager.list_components()", "def _getComponentsInfo(self):\n result = {}\n et = ElementTree()\n components = self.agentCompleteConfig.listComponents_() + \\\n self.agentCompleteConfig.listWebapps_()\n ...
[ "0.75031936", "0.7189879", "0.67731893", "0.6669654", "0.6528711", "0.6451407", "0.6451407", "0.6361447", "0.6353952", "0.6353952", "0.6349827", "0.63444376", "0.62123674", "0.6171588", "0.6085922", "0.60758775", "0.6042098", "0.60234123", "0.60161865", "0.59968275", "0.59941...
0.7947298
0
Separately configure and set up the managers and components held by the component manager, in that order. The setup process involves applying default configurations and then calling the manager or component's setup method. This can result in new components as a side effect of setup because components themselves have ac...
def setup_components(self, builder: "Builder"): self._setup_components(builder, self._managers + self._components)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_component(self):\n self.conf, self.context = self._init_component()\n self.initialize()", "def setup(self, manager):\n self._manager = manager\n self._configured = True", "def _configure(self):\n pass", "def _configure(self):\n Component._configure(self)\n s...
[ "0.7187612", "0.6177336", "0.6071428", "0.60488313", "0.60485494", "0.60239357", "0.59740335", "0.5972695", "0.59304833", "0.5877998", "0.5877998", "0.5877998", "0.5877998", "0.5877996", "0.5876117", "0.5864202", "0.582577", "0.582577", "0.57516897", "0.57322896", "0.5726736"...
0.7832467
0
Get the component that has ``name`` if presently held by the component manager. Names are guaranteed to be unique.
def get_component(self, name: str) -> Any: return self._manager.get_component(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_component(self, name: str) -> Any:\n for c in self._components:\n if c.name == name:\n return c\n raise ValueError(f\"No component found with name {name}\")", "def get_component(self, name):\n for cmpt in self.components:\n if cmpt['name'] == name...
[ "0.8732072", "0.86204886", "0.81911695", "0.7890518", "0.7057693", "0.64624846", "0.63916045", "0.62333816", "0.6191701", "0.61659276", "0.6148998", "0.6137814", "0.6137657", "0.61212516", "0.61112803", "0.6078761", "0.6061714", "0.60613793", "0.6044957", "0.6036776", "0.6018...
0.8089962
3
Get all components that are an instance of ``component_type``.
def get_components_by_type( self, component_type: Union[type, Tuple[type, ...]] ) -> List[Any]: return self._manager.get_components_by_type(component_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_components_by_type(\n self, component_type: Union[type, Tuple[type, ...]]\n ) -> List[Any]:\n return [c for c in self._components if isinstance(c, component_type)]", "def get_components(self, filter_type=None):\n\n if filter_type is None:\n out = self.components\n ...
[ "0.8520174", "0.6889397", "0.618709", "0.59998345", "0.5893793", "0.58591384", "0.57775843", "0.5769797", "0.5767334", "0.5746458", "0.57118094", "0.56562984", "0.56372815", "0.5633266", "0.5631094", "0.56097656", "0.56097656", "0.5608077", "0.5572066", "0.5572066", "0.556140...
0.8547882
0
Get a mapping of component names to components held by the manager. Returns Dict[str, Any] A dictionary mapping component names to components.
def list_components(self) -> Dict[str, Any]: return self._manager.list_components()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_components(self) -> Dict[str, Any]:\n return {c.name: c for c in self._components}", "def _getComponentsInfo(self):\n result = {}\n et = ElementTree()\n components = self.agentCompleteConfig.listComponents_() + \\\n self.agentCompleteConfig.listWebapps_()\...
[ "0.79906577", "0.7245051", "0.6733757", "0.66009647", "0.6538484", "0.63692576", "0.63692576", "0.6338896", "0.6323031", "0.63061506", "0.6275394", "0.626935", "0.626935", "0.6257535", "0.60413235", "0.60004747", "0.5986872", "0.5979982", "0.5975458", "0.59395707", "0.5929724...
0.747328
1
\ creates gaussian kernel with side length l and a sigma of sig
def gkern(l=5, sig=1.): ax = np.linspace(-(l - 1) / 2., (l - 1) / 2., l) xx, yy = np.meshgrid(ax, ax) kernel = np.exp(-0.5 * (np.square(xx) + np.square(yy)) / np.square(sig)) return kernel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gkern(l=5, sig=1.):\n\n ax = np.arange(-l // 2 + 1., l // 2 + 1.)\n xx, yy = np.meshgrid(ax, ax)\n\n kernel = np.exp(-(xx**2 + yy**2) / (2. * sig**2))\n\n return kernel / np.sum(kernel)", "def gkern(l, sig=1.):\n\n ax = np.linspace(-(l - 1) / 2., (l - 1) / 2., l)\n xx, yy = np.meshgrid(ax, ...
[ "0.7510109", "0.750365", "0.74863845", "0.7277165", "0.7234427", "0.7157976", "0.7145621", "0.7110056", "0.7061145", "0.70183206", "0.69730043", "0.69548696", "0.6933574", "0.6907124", "0.6884259", "0.6877862", "0.6862947", "0.68579936", "0.6832131", "0.6814453", "0.67858434"...
0.76391137
0
Computes the histogram of the input image
def compute_histogram(self, image): hist = [0] * 256 x, y = image.shape[:2] #print(image.shape) for i in range(x): for j in range(y): hist[image[i, j]] += 1 return hist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hist(img):\n bottom_half = img[img.shape[0]//2:,:] # 0:img.shape[0]//2 is the top half\n histogram = bottom_half.sum(axis=0) \n \n return histogram", "def compute_histogram(self, image):\n hist = [0] * 256\n [h, w] = image.shape\n print(h,w)\n i = 0\n while i < ...
[ "0.8064423", "0.8042533", "0.8037536", "0.7930632", "0.76470864", "0.7604351", "0.75007343", "0.73157203", "0.7244618", "0.71898323", "0.7063043", "0.6988698", "0.69718844", "0.69492954", "0.6931104", "0.6850683", "0.6834464", "0.6798194", "0.6795921", "0.6792963", "0.6772005...
0.82736444
0
analyses a histogram it to find the optimal threshold value assuming a bimodal histogram takes as input
def find_optimal_threshold(self, hist): k = 256 threshold = int(k / 2) lastexpected1 = lastexpected2 = 0 while True: expected1 = expected2 = 0 t_exp1 = sum(hist[:threshold]) t_exp2 = sum(hist[threshold:]) for i in range(threshold): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_optimal_threshold(self, hist):\n\n # print(\"number of pixels using sum: \", sum(hist))\n probability = np.array((1/sum(hist))*hist)\n expected_value = probability*np.array(range(256))\n # print(\"probability: \\n\", probability)\n # print(\"expected_value: \\n\", expect...
[ "0.76285255", "0.7466329", "0.70402104", "0.69199985", "0.68791974", "0.6473372", "0.6381232", "0.63574517", "0.6347338", "0.6333977", "0.6308756", "0.63060373", "0.62337613", "0.6220502", "0.6215672", "0.6160417", "0.6128299", "0.611688", "0.60851824", "0.60622996", "0.60540...
0.6990649
3
Comptues the binary image of the the input image based on histogram analysis and thresholding take as input
def binarize(self, image, threshold): bin_img = image.copy() for i in range(image.shape[0]): for j in range(image.shape[1]): if image[i, j] >= threshold: bin_img[i, j] = 0 else: bin_img[i, j] = 255 return bin_img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binarize(self, image, threshold):\n\n bin_img = image.copy()\n [h, w] = bin_img.shape\n opt_threshold = threshold\n print(opt_threshold)\n for row in range(h):\n for col in range(w):\n if bin_img[row, col] > opt_threshold: #greater than threshld whit...
[ "0.7681446", "0.727308", "0.7155279", "0.70369035", "0.6960089", "0.6878597", "0.6873943", "0.6869752", "0.6862886", "0.68430334", "0.68059856", "0.67681766", "0.67679167", "0.6710474", "0.66879267", "0.6674513", "0.66720676", "0.666158", "0.6618548", "0.6603418", "0.6565325"...
0.73140323
1
Retrieves next url from request
def get_next_url(request, redirect_field_name): next_url = request.GET.get(redirect_field_name) if next_url: kwargs = {'url': next_url, 'require_https': request.is_secure()} hosts = [request.get_host()] kwargs['allowed_hosts'] = hosts if url_has_allowed_host_and_scheme(**kwargs)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_url(request):\n next = request.REQUEST.get(\"next\", \"\")\n host = request.get_host()\n return next if next and is_safe_url(next, host=host) else None", "def _get_next(request):\r\n next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', None)))\r\n if no...
[ "0.83763486", "0.8341553", "0.82828504", "0.801289", "0.750873", "0.73998064", "0.7358548", "0.71123296", "0.70690924", "0.70580965", "0.69295985", "0.6869535", "0.68539375", "0.67664903", "0.67437416", "0.6702806", "0.66799146", "0.666955", "0.6664403", "0.657624", "0.655812...
0.7040338
10
Cosine decay schedule with warm up period.
def cosine_decay_with_warmup(global_step, learning_rate_base, total_steps, warmup_learning_rate=0.0, warmup_steps=0, hold_base_rate_steps=0): if total_steps < warmup_steps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule(epoch):\n return alpha / (1 + (decay_rate * epoch))", "def cosine_decay(base_lr, max_iteration, cur_step):\n return base_lr * (math.cos( (7*math.pi*cur_step) / (16*max_iteration) ))", "def get_cosine_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, num_cycles=.5, las...
[ "0.6320161", "0.62945265", "0.6014468", "0.6014468", "0.5992535", "0.5947948", "0.594646", "0.59023297", "0.5854784", "0.58509827", "0.5842494", "0.582645", "0.5814702", "0.57450205", "0.5581755", "0.550415", "0.5425403", "0.5404061", "0.5401594", "0.5377699", "0.53299034", ...
0.5282483
22
Callable to compute the learning rate.
def eager_decay_rate(): learning_rate = 0.5 * learning_rate_base * (1 + tf.cos( np.pi * (tf.cast(global_step, tf.float32) - warmup_steps - hold_base_rate_steps ) / float(total_steps - warmup_steps - hold_base_rate_steps))) if hold_base_rate_steps > 0: lea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr", "def __call__(self, epoch):\n # Compute the new dynamic learning rate, log in onto TensorBoard and\n # return the result for the training process\n learning_rate = self.schedule(epoch)\n ...
[ "0.8016885", "0.8015723", "0.7786947", "0.77867407", "0.7728448", "0.7575189", "0.7575189", "0.7390784", "0.7385804", "0.7383413", "0.7356881", "0.7334096", "0.73053694", "0.72900087", "0.71948165", "0.70886856", "0.7037042", "0.69462264", "0.69425225", "0.69425225", "0.68872...
0.6100761
65
Append new animation. If \p _widget exists in animations, then it target will be changed
def _addLinearAnimation(self, _widget, _target): self._linear_animations[_widget] = _target
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addPulseAnimation(self, _widget, _target):\n self._pulse_animations[_widget] = _target", "def add_animation(self, animation, key):\n\t\tif animation.from_value == animation.to_value:\n\t\t\treturn\n\t\tanimation.attribute = key\n\t\tanimation.layer = self\n\t\tself.animations[key] = animation", "de...
[ "0.7235232", "0.640118", "0.60980463", "0.5986769", "0.5909382", "0.57442415", "0.5643073", "0.5543253", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5395823", "0.5262023", "0.52438366", ...
0.7617919
0
Append new animation. If \p _widget exists in animations, then it target will be changed
def _addPulseAnimation(self, _widget, _target): self._pulse_animations[_widget] = _target
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addLinearAnimation(self, _widget, _target):\n self._linear_animations[_widget] = _target", "def add_animation(self, animation, key):\n\t\tif animation.from_value == animation.to_value:\n\t\t\treturn\n\t\tanimation.attribute = key\n\t\tanimation.layer = self\n\t\tself.animations[key] = animation", "...
[ "0.7618043", "0.640304", "0.60984266", "0.5988012", "0.591077", "0.5744295", "0.5644169", "0.5541437", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.53966963", "0.526167", "0.5243...
0.7234984
1
Mouse button pressed notification
def mousePressed(self, _evt, _id): _widget = None if _id == ois.MB_Left: _widget = self._mouseLeft elif _id == ois.MB_Right: _widget = self._mouseRight elif _id == ois.MB_Middle: _widget = self._mouseMiddle if _widget is not N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_mouse_press(self, x, y, button):\n\n pass", "def ev_mousebuttondown(self, event: MouseButtonDown) -> None:", "def handle_mouse_press(self, event):", "def mouse_press_event(self, x: int, y: int, button: int):\n pass", "def on_mouse_press(self, x, y, button, key_modifiers):\r\n pa...
[ "0.8257931", "0.79961336", "0.7979811", "0.79471374", "0.7869575", "0.77890575", "0.7698362", "0.7680871", "0.7555324", "0.7444486", "0.7414548", "0.73654586", "0.73654586", "0.7336567", "0.7282599", "0.7262663", "0.7219916", "0.72072995", "0.7194889", "0.7184248", "0.7181684...
0.6422405
85
Mouse button released notification
def mouseReleased(self, _evt, _id): _widget = None if _id == ois.MB_Left: _widget = self._mouseLeft elif _id == ois.MB_Right: _widget = self._mouseRight elif _id == ois.MB_Middle: _widget = self._mouseMiddle if _widget is not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_mouse_release(self, x, y, button):\n pass", "def mouse_release_event(self, x: int, y: int, button: int):\n pass", "def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass", "def button_release_event(self, widget, event):\n x, y = event.x, event.y\n\n # x, y...
[ "0.84220487", "0.83658963", "0.81159884", "0.775565", "0.76365525", "0.7635038", "0.74916583", "0.74270487", "0.738527", "0.737185", "0.7367928", "0.7359813", "0.73497945", "0.7341008", "0.7338642", "0.7246347", "0.72372645", "0.72236484", "0.71101356", "0.7078123", "0.707812...
0.6166877
89
Switch between enabled and disabled states
def toggle(self): if self.is_enabled: self.disable() else: self.enable()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_disabled_switch(self, disabled):\n self.disabled = disabled", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnabled(*args):", "def setEnab...
[ "0.7548925", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.7019905", "0.6845152", "0.6814877", "0.6768934", "0.6768934", "0.6743892", "0.6730558", "0.6703138", "0.67011505", "0.6673747", ...
0.69646096
12
Updates input icons relative to mouse state
def _updateOnMouseState(self, state): x = state.X.abs y = state.Y.abs mscale = self.mouse_icon.getScale() if (x + mscale[0] + self.mouse_offset) > render_engine.Window.width: x = x - mscale[0] - 10 else: x += self.mouse_offset ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.mousePos = pygame.mouse.get_pos()\n self.update_button_hover_status()", "def update_button_hover_status(self):\n for button in self.playing_buttons:\n button.update(self.mousePos)", "def update_reset_button(self):\r\n if self.board.hovered_tiles a...
[ "0.63612306", "0.6020158", "0.5917613", "0.5873303", "0.5816151", "0.5782121", "0.57058483", "0.5668941", "0.56663585", "0.56530684", "0.5630077", "0.55906516", "0.5553169", "0.5495981", "0.54906726", "0.5464941", "0.5448922", "0.54335225", "0.5425156", "0.54172546", "0.53634...
0.6588073
0
Mouse button pressed notification
def mousePressed(self, _evt, _id): if not self.is_enabled: return False self.mouse_icon.mousePressed(_evt, _id) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_mouse_press(self, x, y, button):\n\n pass", "def ev_mousebuttondown(self, event: MouseButtonDown) -> None:", "def handle_mouse_press(self, event):", "def mouse_press_event(self, x: int, y: int, button: int):\n pass", "def on_mouse_press(self, x, y, button, key_modifiers):\r\n pa...
[ "0.8257931", "0.79961336", "0.7979811", "0.79471374", "0.7869575", "0.77890575", "0.7698362", "0.7680871", "0.7555324", "0.7444486", "0.7414548", "0.73654586", "0.73654586", "0.7336567", "0.7282599", "0.7262663", "0.7219916", "0.72072995", "0.7194889", "0.7184248", "0.7181684...
0.70297575
31
Mouse button released notification
def mouseReleased(self, _evt, _id): if not self.is_enabled: return False self.mouse_icon.mouseReleased(_evt, _id) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_mouse_release(self, x, y, button):\n pass", "def mouse_release_event(self, x: int, y: int, button: int):\n pass", "def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass", "def button_release_event(self, widget, event):\n x, y = event.x, event.y\n\n # x, y...
[ "0.84220487", "0.83658963", "0.81159884", "0.775565", "0.76365525", "0.7635038", "0.74916583", "0.74270487", "0.738527", "0.737185", "0.7367928", "0.7359813", "0.73497945", "0.7341008", "0.7338642", "0.7246347", "0.72372645", "0.72236484", "0.71101356", "0.7078123", "0.707812...
0.6976709
26
Initializes a MOSAIC segmentation head.
def __init__( self, num_classes: int, decoder_input_levels: Optional[List[str]] = None, decoder_stage_merge_styles: Optional[List[str]] = None, decoder_filters: Optional[List[int]] = None, decoder_projected_filters: Optional[List[int]] = None, encoder_end_level: Optional[int] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n self._mh = MasterHead.get_head()", "def __init__(self, backboneNet, projection_head) -> None:\n super(SimCLR, self).__init__()\n self.Net = backboneNet\n self.projection_head = projection_head", "def initialise(self):\n # Can take quite a lot of time d...
[ "0.63423765", "0.6104683", "0.60890955", "0.5920527", "0.5805246", "0.57884365", "0.5780198", "0.5758982", "0.57516754", "0.5741528", "0.56969655", "0.5690647", "0.5684974", "0.56785005", "0.5676265", "0.56380767", "0.56315213", "0.5619772", "0.56066364", "0.5605493", "0.5593...
0.0
-1
Transform inputs to outputs.
def transform(self): self.validate_ports() # TODO: Find a more reusable way of enforcing this behavior. if self.distance.variable.ndim != 1: raise ValueError("`distance` must be a vector.") if self.equivalence.variable.ndim != 1: raise ValueError("`equivalence` ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputs(self, inputs):\n return inputs", "def out(self, inputs):", "def _transform_inputs(self, inputs):\n\n if self.input_transform == 'resize_concat':\n inputs = [inputs[i] for i in self.in_index]\n upsampled_inputs = [\n resize(\n inp...
[ "0.7758695", "0.7370227", "0.6850674", "0.6759104", "0.6725636", "0.6614872", "0.6614872", "0.6614872", "0.6522579", "0.6516416", "0.6495349", "0.6469215", "0.642536", "0.641889", "0.63701034", "0.63644946", "0.6326372", "0.6318115", "0.6252453", "0.62274414", "0.61965454", ...
0.0
-1
Transform inputs to outputs.
def transform(self): self.validate_ports() # TODO: Find a more reusable way of enforcing this behavior. if self.cost_sim.variable.ndim != 1: raise ValueError("`cost_sim` must be a vector.") if self.cost_diff.variable.ndim != 1: raise ValueError("`cost_diff` must...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputs(self, inputs):\n return inputs", "def out(self, inputs):", "def _transform_inputs(self, inputs):\n\n if self.input_transform == 'resize_concat':\n inputs = [inputs[i] for i in self.in_index]\n upsampled_inputs = [\n resize(\n inp...
[ "0.7758695", "0.7370227", "0.6850674", "0.6759104", "0.6725636", "0.6614872", "0.6614872", "0.6614872", "0.6522579", "0.6516416", "0.6495349", "0.6469215", "0.642536", "0.641889", "0.63701034", "0.63644946", "0.6326372", "0.6318115", "0.6252453", "0.62274414", "0.61965454", ...
0.0
-1
Transform inputs to outputs.
def transform(self): self.validate_ports() # TODO: Find a more reusable way of enforcing this behavior. if self.cost_sim.variable.ndim != 1: raise ValueError("`cost_sim` must be a vector.") if self.cost_diff.variable.ndim != 1: raise ValueError("`cost_diff` must...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputs(self, inputs):\n return inputs", "def out(self, inputs):", "def _transform_inputs(self, inputs):\n\n if self.input_transform == 'resize_concat':\n inputs = [inputs[i] for i in self.in_index]\n upsampled_inputs = [\n resize(\n inp...
[ "0.77584934", "0.73698086", "0.68523467", "0.6758871", "0.67265445", "0.6616303", "0.6616303", "0.6616303", "0.65238136", "0.65147865", "0.64958227", "0.64674926", "0.64270216", "0.6421225", "0.63700414", "0.6367071", "0.63268214", "0.63184077", "0.6252848", "0.6228795", "0.6...
0.0
-1
This funtion should perform the job of projecting the input pointcloud onto the frame of an image captured by a camera with camera matrix as given, of dimensions as given, in pixels. points is an 3 x N array where the ith entry is an (x, y, z) point in 3D space, in the reference frame of the depth camera. This correspo...
def project_points(points, cam_matrix, trans, rot): # STEP 1: Transform pointcloud into new reference frame. points = np.dot(rot, points) + trans[:, None] # STEP 2: Project new pointcloud onto image frame using K matrix. # gives a 3 x N array of image plane coordinates in homogenous coordinates. h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(points, camera_params, theta):\n \"\"\"\n Function takes input of 3d_points, transformations and Convert 3-D points to 2-D by projecting onto images. \n Input:\n points: 3D points in world frame\n camera_params: parameters of camera corrosponding to the point\n theta: Need...
[ "0.75861025", "0.73979294", "0.73724365", "0.70940655", "0.7059192", "0.7011868", "0.69861317", "0.6886492", "0.685968", "0.6813133", "0.6795302", "0.6780843", "0.6771063", "0.676563", "0.6705942", "0.66217476", "0.65333843", "0.6509686", "0.64969933", "0.6453741", "0.6448303...
0.7957179
0
Attempts to purchase all goods listed in the dict order, depositing them in the Player's cargo holds. Does not care about max cargo. dryRun simply checks if the purchase is possible. remaining controls if the order should be 100% purchased (True), or only purchase goods the player lacks Returns False if some goods are ...
def buyCargo(self, order, dryRun=False, remaining=True): ply = self.window.playerShip shop = self.planet.goods toBuy = order.copy() for mat in toBuy: if remaining and mat in ply.cargo: toBuy[mat] -= ply.cargo[mat].quantity if toBuy[mat] > 0: if mat not in shop: return False if shop[mat]*toBuy[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete_purchase(self, customer_credit=0):\r\n \r\n #take the products first, then tell customer how many tickets to take\r\n #requires IChat interface to be passed to tell customers how many tickets to take\r\n \r\n #switch to list view in the collection window\r\n print...
[ "0.5479375", "0.53681403", "0.5336852", "0.5133763", "0.51209956", "0.50936574", "0.5068974", "0.5063557", "0.4996775", "0.4974593", "0.49507624", "0.494863", "0.4935163", "0.49151012", "0.49076858", "0.4898226", "0.4866557", "0.48556313", "0.48369843", "0.48305112", "0.48296...
0.70759
0
Initialize with a QPrinter object and a list of pages. pageList may be a list of twotuples (num, page). Otherwise, the pages are numbered from 1 in the progress message. The pages are copied.
def __init__(self, printer, pageList, parent=None): super().__init__(parent) self.printer = printer self.setPageList(pageList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPageList(self, pageList):\n self.pageList = []\n for n, page in enumerate(pageList, 1):\n if isinstance(page, tuple):\n pageNum, page = page\n else:\n pageNum = n\n page = page.copy()\n # set zoom to 1.0 so computations ...
[ "0.6433763", "0.6421175", "0.5657116", "0.5523885", "0.5351193", "0.5295668", "0.52508706", "0.52336335", "0.5163632", "0.5067127", "0.5064911", "0.50349927", "0.500849", "0.49356413", "0.4856026", "0.4848449", "0.48073077", "0.48051938", "0.48050612", "0.48048058", "0.479167...
0.7309939
0
Set the pagelist to print. pageList may be a list of twotuples (num, page). Otherwise, the pages are numbered from 1 in the progress message. The pages are copied.
def setPageList(self, pageList): self.pageList = [] for n, page in enumerate(pageList, 1): if isinstance(page, tuple): pageNum, page = page else: pageNum = n page = page.copy() # set zoom to 1.0 so computations based on geom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPageSequence(self, pageSequenceList):\r\n\r\n for index in range(self.pageCount() - 1, -1, -1):\r\n page = self.page(index)\r\n if page:\r\n self.removePage(page)\r\n\r\n count = 0\r\n for pageTitle in pageSequenceList:\r\n self.insertPage...
[ "0.661028", "0.64478004", "0.5916455", "0.56009513", "0.5516022", "0.5461271", "0.54369324", "0.52646035", "0.5221855", "0.51948494", "0.51564723", "0.5154594", "0.503851", "0.5032567", "0.49833974", "0.49527058", "0.4946429", "0.49033383", "0.49002624", "0.49002624", "0.4896...
0.7608234
0
Paint the pages to the printer in the background.
def work(self): p = self.printer p.setFullPage(True) painter = QPainter(p) for n, (num, page) in enumerate(self.pageList): if self.isInterruptionRequested(): self.aborted = True return p.abort() self.progress.emit(num, n+1, len(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_page(page, stream):\n bleed = {\n side: page.style[f'bleed_{side}'].value\n for side in ('top', 'right', 'bottom', 'left')}\n marks = page.style['marks']\n stacking_context = StackingContext.from_page(page)\n draw_background(\n stream, stacking_context.box.background, clip...
[ "0.6472516", "0.6322351", "0.6206114", "0.61876047", "0.61129534", "0.6107652", "0.60719824", "0.60593873", "0.59743327", "0.59252787", "0.5870063", "0.58362466", "0.5776248", "0.57747906", "0.575061", "0.5728778", "0.5693118", "0.5666412", "0.5624035", "0.56164974", "0.55977...
0.718377
0
Initializes ourselves with the print job and optional parent widget.
def __init__(self, job, parent=None): super().__init__(parent) self._job = job job.progress.connect(self.showProgress) job.finished.connect(self.jobFinished) self.canceled.connect(job.requestInterruption) self.setMinimumDuration(0) self.setRange(0, len(job.pageLis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, printer, parent=None):\n QtGui.QWidget.__init__(self, printer, parent)", "def __init__(self, printer, pageList, parent=None):\n super().__init__(parent)\n self.printer = printer\n self.setPageList(pageList)", "def __init__(self, job):\n self.job = job\n\n ...
[ "0.7487978", "0.67818165", "0.67569965", "0.64124125", "0.6201404", "0.6139698", "0.5940359", "0.5934324", "0.59159744", "0.5873766", "0.5867913", "0.58311474", "0.58015513", "0.5784232", "0.5742336", "0.57028717", "0.57011944", "0.5694068", "0.5670847", "0.56562907", "0.5598...
0.7860893
0
Called by the job when printing a page.
def showProgress(self, page, num, total): self.setValue(num) self.setLabelText("Printing page {page} ({num} of {total})...".format( page=page, num=num, total=total))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work(self):\n p = self.printer\n p.setFullPage(True)\n painter = QPainter(p)\n for n, (num, page) in enumerate(self.pageList):\n if self.isInterruptionRequested():\n self.aborted = True\n return p.abort()\n self.progress.emit(num, ...
[ "0.66130775", "0.6179133", "0.60483813", "0.59712577", "0.5961468", "0.58975935", "0.58974516", "0.58792794", "0.58685595", "0.5856823", "0.585318", "0.58435875", "0.5823067", "0.5815858", "0.57982695", "0.5784894", "0.5781572", "0.57630765", "0.5756924", "0.57515657", "0.574...
0.5346919
62
Called when the print job has finished.
def jobFinished(self): if not self._job.result and not self._job.aborted: self.showErrorMessage() del self._job self.deleteLater()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finished(self):\n\t\telog(\"finished\")", "def finished(self):\n pass", "def end(self):\n self.my_print(\"\\t[DONE]\", msg_types.INFO)\n self.in_progress = False", "def finalize(self):\n sys.stderr.write(f\"{self._message} finished after {(time.time()-self._startTime):.1f}s \"...
[ "0.68025583", "0.6737423", "0.668845", "0.6573926", "0.6573926", "0.6492718", "0.64637226", "0.64432174", "0.640725", "0.638964", "0.638964", "0.63772255", "0.6374147", "0.6329077", "0.6324893", "0.62843454", "0.6235471", "0.6216052", "0.61912054", "0.61813414", "0.61813414",...
0.6165697
26
Reimplement to show a different or translated error message.
def showErrorMessage(self): QMessageBox.warning(self.parent(), "Printing Error", "Could not send the document to the printer.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_error(self, error):\n if (error == \"\"):\n self.ui.errorLabel.setText(\"\")\n else:\n self.ui.errorLabel.setText(\"<span style=\\\"font-weight:600; color:#ff0000;\\\">{0}</span>\".format(error))", "def error(self, message=None, show_help=True):", "def __str__(self)...
[ "0.7121053", "0.7120864", "0.70434797", "0.70387185", "0.7025241", "0.69732416", "0.6881497", "0.6874057", "0.67731375", "0.67476714", "0.67366815", "0.67256993", "0.6724372", "0.67027223", "0.66665125", "0.66665125", "0.66665125", "0.6626099", "0.6606675", "0.65979713", "0.6...
0.0
-1
This method will enable delivery confirmations and schedule the first message to be sent to RabbitMQ
def start_publishing(self): print(f"{self._connection_param}: Issuing consumer related RPC commands") # self._channel.confirm_delivery(self.on_delivery_confirmation) self.schedule_next_message(self.SLOW_SEND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_for_delivery(self, by=None):", "def prepare_for_delivery(self, by=None):", "def prepare_for_delivery(self, by=None):", "def keystone_amq(self):\n\n connection = pika.BlockingConnection(pika.ConnectionParameters(\n host=self.rabbit_host,\n ...
[ "0.6132878", "0.6132878", "0.6132878", "0.6066696", "0.6043291", "0.59991413", "0.59169674", "0.58299065", "0.5776203", "0.5776203", "0.5776203", "0.5642102", "0.56042206", "0.55661607", "0.55595404", "0.5532968", "0.5508831", "0.5474107", "0.5426646", "0.54043806", "0.540246...
0.631214
0
Run the example code by connecting and then starting the IOLoop.
def run(self): while not self._stopping: try: self._connection = self.connect() self._connection.ioloop.start() except KeyboardInterrupt: self.stop() if (self._connection is not None and not self._connection.is_closed): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\t\t\n\t\tself.connect(self.config[\"server\"])", "def run(self):\n ioloop.IOLoop.current().start()", "def run(self):\n self._connection = self.connect()\n self._connection.ioloop.start()", "def run(self):\n self._connection = self.connect()\n self._connecti...
[ "0.71295154", "0.7125487", "0.67547613", "0.67547613", "0.64287305", "0.6411501", "0.6342234", "0.62999034", "0.6210394", "0.6209313", "0.6195795", "0.6136957", "0.6037674", "0.60373646", "0.5997868", "0.59889257", "0.59690315", "0.59501374", "0.5940903", "0.59373194", "0.590...
0.0
-1
r""" Computes the chisquare value of the sample data Notes
def _chisquare_value(self): x2 = np.sum((np.absolute(self.observed - self.expected) - (0.5 * self.continuity_correction)) ** 2 / self.expected) return x2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(real_data, synthetic_data):\n f_obs, f_exp = get_frequencies(real_data, synthetic_data)\n if len(f_obs) == len(f_exp) == 1:\n pvalue = 1.0\n else:\n _, pvalue = chisquare(f_obs, f_exp)\n\n return pvalue", "def calculate_chi_squared(self):\n chi...
[ "0.6880414", "0.6825153", "0.65589476", "0.63346523", "0.61934537", "0.6188989", "0.61722326", "0.61393964", "0.6095299", "0.6072217", "0.6061504", "0.60480016", "0.6028417", "0.600268", "0.59922135", "0.5937898", "0.59304774", "0.59027916", "0.588849", "0.5888303", "0.588665...
0.760204
0
r""" Finds the pvalue of the chisquare statistic. Notes
def _p_value(self): pval = chi2.sf(self.chi_square, self.degrees_of_freedom) return pval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chisquare_value(self):\n x2 = np.sum((np.absolute(self.observed - self.expected) - (0.5 * self.continuity_correction)) ** 2 /\n self.expected)\n\n return x2", "def _p_value(self):\n p_value = chi2.sf(self.test_statistic, 2)\n\n return p_value", "def compute(r...
[ "0.7833191", "0.7402887", "0.71125257", "0.6845936", "0.6587544", "0.64726514", "0.64485335", "0.6297365", "0.6246761", "0.61838526", "0.61333144", "0.60871804", "0.60848254", "0.60680485", "0.6063416", "0.60562605", "0.59842485", "0.59655535", "0.59315586", "0.59314376", "0....
0.752004
1
r""" Calculates the associated pvalue of the JarqueBera test statistic. Returns
def _p_value(self): p_value = chi2.sf(self.test_statistic, 2) return p_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_pvalue(self):\n # Run permutation test\n self.PermutationTest()\n # TS obtained from the original B,T samples\n self.compute_obs_TS()\n \n # Mean and std of the TS distribution\n self.mu = np.mean(self.TS_tilde)\n self.sigma = np.std(s...
[ "0.70886576", "0.694674", "0.6699759", "0.644185", "0.6402931", "0.63444334", "0.63201535", "0.62870866", "0.6217986", "0.6188519", "0.6146519", "0.60959625", "0.60770345", "0.596563", "0.5965262", "0.5932051", "0.5872446", "0.58646697", "0.5859925", "0.5857311", "0.5773147",...
0.6830935
2
Checks if id resembles a valid Mathetical Reviews identifier.
def is_valid(key): return key[0:2] == "MR" and key[2:].isdigit() and len(key) in [9, 10]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_id(self, id):", "def validate_tileset_id(tileset_id):\n pattern = r\"^[a-z0-9-_]{1,32}\\.[a-z0-9-_]{1,32}$\"\n\n return re.match(pattern, tileset_id, flags=re.IGNORECASE)", "def isValid(t_id):\n\tstr_id=str(t_id).strip()\n\treturn str_id.isdigit()", "def is_id_valid(id_code: str) -> bool:\n ...
[ "0.6459849", "0.6432315", "0.64162076", "0.63578707", "0.63142574", "0.6200492", "0.6198464", "0.61865556", "0.61574614", "0.60886556", "0.6026036", "0.5946656", "0.5944451", "0.5895949", "0.58748007", "0.58158374", "0.58156914", "0.57306147", "0.5724628", "0.56132466", "0.56...
0.0
-1
BibTeX comment explaining error
def bibtex(self): return "@comment{%(id)s: %(message)s}" % \ {'id': self.id, 'message': self.message}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment():", "def test_doc_with_comments():\n doc = CoNLL.conll2doc(input_str=RUSSIAN_SAMPLE)\n check_russian_doc(doc)", "def comment(self, content):\n pass", "def should_add_pr_comment(self):\n pass", "def test_issue_edit_comment_deprecated(self):\n pass", "def docstri...
[ "0.74034363", "0.6712097", "0.66532767", "0.63367194", "0.619787", "0.61909366", "0.60946673", "0.60149664", "0.59592676", "0.58991164", "0.5883395", "0.58689094", "0.5825342", "0.58130735", "0.5804278", "0.57896906", "0.57857484", "0.5733003", "0.57277036", "0.57164663", "0....
0.6803446
1
Returns a list of references, corresponding to elts of id_list
def mr2bib(id_list): d = mr2bib_dict(id_list) l = [] for id in id_list: try: l.append(d[id]) except: l.append(ReferenceErrorInfo("Not found", id)) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def references_list( self, theWeaver ):\n return [ (c.name, c.seq) \n for c in theWeaver.reference_style.chunkReferencedBy( self ) ]", "def rel_id_list(rel_list):\n\n rel_ids = []\n for i in range(0, len(rel_list)):\n rel_id = rel_list[i][\"id\"]\n rel_ids.append(rel_id)\n ...
[ "0.7039898", "0.7037073", "0.6797277", "0.6761492", "0.6631267", "0.66233087", "0.6622398", "0.6528245", "0.65259904", "0.6512491", "0.6483046", "0.64315706", "0.63510597", "0.62785524", "0.6199104", "0.619206", "0.6191878", "0.6140649", "0.6140649", "0.61350185", "0.61265624...
0.5944738
29
Corrects the BibTeX key because the MR API cannot get its act together
def correct_key(goodkey,code): db = pybtex.database.parse_string(code,"bibtex") keys = [key for key in db.entries.keys()] badkey = keys[0] return code.replace(badkey,goodkey)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mr_request(key):\n\n # reconstructing the BibTeX code block\n inCodeBlock = False\n code = \"\"\n\n # make the request\n payload = {\"fn\": 130, \"fmt\": \"bibtex\", \"pg1\": \"MR\", \"s1\": key}\n r = requests.get(path, params=payload)\n\n # 401 means not authenticated\n if r.status_code == 401:\n ...
[ "0.61262125", "0.60784906", "0.58044267", "0.5669483", "0.5512459", "0.549996", "0.546403", "0.5428998", "0.54042065", "0.5403589", "0.53428215", "0.52821094", "0.52698106", "0.52677447", "0.52602893", "0.52487", "0.5242598", "0.52408123", "0.5232014", "0.51742405", "0.515405...
0.71422005
0
Sends a request to the Mathematical Reviews API
def mr_request(key): # reconstructing the BibTeX code block inCodeBlock = False code = "" # make the request payload = {"fn": 130, "fmt": "bibtex", "pg1": "MR", "s1": key} r = requests.get(path, params=payload) # 401 means not authenticated if r.status_code == 401: raise AuthenticationException()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_license_recommender(url, payload):\n response = requests.post(url, data=payload)\n print(response.status_code)\n print(response.text)", "async def req(self, *, m = \"GET\", u = \"\", t = \"j\", r = None, f = None,\n d = {}, **data):\n m = m.upper()\n if d == {} an...
[ "0.61218435", "0.5576535", "0.55509704", "0.55009675", "0.5494504", "0.5473101", "0.54638946", "0.5391383", "0.53691244", "0.5267628", "0.5234801", "0.52088183", "0.5193367", "0.5190489", "0.51851815", "0.51851815", "0.5173972", "0.5172459", "0.51695144", "0.5167495", "0.5166...
0.4989358
46
Fetches citations for keys in key_list into a dictionary indexed by key
def mr2bib_dict(key_list): keys = [] d = {} # validate keys for key in key_list: if is_valid(key): keys.append(key) else: d[key] = ReferenceErrorInfo("Invalid Mathematical Reviews identifier", key) if len(keys) == 0: return d # make the api call entries = {} for key in keys: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_citations_ids_map(id_list):\n create_unverified_context()\n logging.debug('============== IN get_citations_ids_map: ================')\n logging.debug('============== ID LIST: ================')\n logging.debug(id_list)\n linked = {}\n for i in range(0, len(id_list)):\n handle = En...
[ "0.63553035", "0.6239225", "0.6104354", "0.6002555", "0.58264047", "0.5761537", "0.5651292", "0.5648888", "0.5609229", "0.5563336", "0.5560674", "0.5547645", "0.55174834", "0.5494095", "0.5494074", "0.5486462", "0.5401576", "0.53930855", "0.5387903", "0.53725374", "0.53647405...
0.62833595
1
Produce output and error messages
def run(self): try: bib = mr2bib(self.args.id) except HTTPError as error: raise FatalError("HTTP Connection Error: {0}".format(error.getcode())) self.create_output(bib) self.code = self.tally_errors(bib)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self, msg):", "def create_output(self, messages):", "def output_error(text):\n if conf.eval_output:\n info_dict = {'type':'error', 'text' : text}\n output_result_eval(info_dict)\n else:\n output_result('[ERROR] ' + text)", "def write_output(self):", "def _output(self, ...
[ "0.74492913", "0.7304722", "0.6676063", "0.6611423", "0.65172976", "0.6450008", "0.6367455", "0.6312982", "0.6241445", "0.62138563", "0.62100923", "0.62058467", "0.6178186", "0.6165659", "0.6138401", "0.6110624", "0.6110281", "0.6101742", "0.60865426", "0.6075113", "0.6035412...
0.0
-1
Format the output and error messages
def create_output(self, bib): for b in bib: if isinstance(b, ReferenceErrorInfo): self.error_count += 1 if self.args.comments: self.output.append(b.bibtex()) if not self.args.quiet: self.messages.append(str(b)) else: self.output.append(b.bibtex())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self, msg):", "def create_output(self, messages):", "def __output(self,msg,status):\n status = int(status)\n if status:\n print \"%s-----------\\033[1;37;42m%s\\033[0m\" % (format(msg,\"<15\"),\"OK\")\n else:\n print \"%s***********\\033[1;37;41m%s\\033[0m\...
[ "0.6797996", "0.67937696", "0.6665162", "0.6554844", "0.6467793", "0.6451013", "0.641069", "0.6391255", "0.63800806", "0.637965", "0.63150275", "0.62728184", "0.62487245", "0.62406886", "0.62218165", "0.61880296", "0.6166915", "0.61528933", "0.61156625", "0.6094442", "0.60939...
0.0
-1
print messages to stderr
def print_messages(self): if self.messages: self.messages.append("") sys.stderr.write(os.linesep.join(self.messages))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printerr(msg):\n print(msg, file=sys.stderr)", "def eprint(errmsg):\n print(errmsg, file=STDERR)", "def print_err(msg):\n print(msg, file=sys.stderr)", "def printerr(message):\n sys.stderr.write('{}\\n'.format(message))\n sys.stderr.flush()", "def print_to_stderr(msg):\n sys.stderr.wr...
[ "0.81713575", "0.81406593", "0.8059296", "0.7857656", "0.77511865", "0.7741248", "0.77343106", "0.7730823", "0.7613591", "0.75765413", "0.75504214", "0.75362325", "0.75361323", "0.743849", "0.74344194", "0.7411151", "0.7405998", "0.73897713", "0.73611903", "0.73316664", "0.73...
0.76047915
9
Run the command line interface
def main(args=None): cli = Cli(args) try: cli.run() except FatalError as err: sys.stderr.write(err.args[0] + os.linesep) return 2 cli.print_output() cli.print_messages() return cli.code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def cli():\n pass", "def cli():\r\n pass", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", ...
[ "0.82951665", "0.7872211", "0.7813792", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", "0.77932256", ...
0.0
-1
Given the rates, add noise based on numreg
def add_white_noise(rates, numreg): rtemp = rates.copy().getA() sdrates = np.sqrt(rtemp * (1 - rtemp) / numreg) + 1e-10 noise = np.random.normal(0, sdrates) rtemp += noise return np.matrix(rtemp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(self, freq: int, /) -> None:", "def add_uniform_noise(rates, percent):\n raise 0 < percent < 1 or AssertionError\n rtemp = rates.copy().getA()\n noise = np.random.uniform(1 - percent, 1 + percent, np.shape(rtemp))\n rtemp = rtemp * noise\n return np.matrix(rtemp)", "def add_noise(self,...
[ "0.68984324", "0.6839585", "0.67851245", "0.6750113", "0.66716886", "0.66040987", "0.64807314", "0.63987464", "0.6348617", "0.6240534", "0.62197", "0.6102634", "0.60901725", "0.60885996", "0.60824186", "0.6081778", "0.6057069", "0.6057069", "0.6010699", "0.6005882", "0.600388...
0.8146284
0
Given the rates, sample new rate uniformly between ((1percent)rates, (1+percent)rates)
def add_uniform_noise(rates, percent): raise 0 < percent < 1 or AssertionError rtemp = rates.copy().getA() noise = np.random.uniform(1 - percent, 1 + percent, np.shape(rtemp)) rtemp = rtemp * noise return np.matrix(rtemp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_rate(self):\r\n interval = self.data.iloc[2, 0] - self.data.iloc[1, 0]\r\n self.rate = int(1 / interval)", "def mutate(chrom, rate=100):\n for i in range(len(chrom)):\n chance = randint(0, 100)\n if chance <= rate:\n chrom[i] = randint(0, 13)\n return chrom",...
[ "0.6379363", "0.6271895", "0.6191277", "0.61757326", "0.615608", "0.6149897", "0.6067622", "0.6067622", "0.59839284", "0.5963225", "0.59294873", "0.59209937", "0.5910566", "0.5888665", "0.58422065", "0.58108896", "0.5792376", "0.573272", "0.57085705", "0.5676844", "0.5660222"...
0.687847
0
This function runs the estimation procedure for the first time slice for given number of demes and repeats the process reps number of times. The values of mean pop size and mig rates is preset but will be changed in future versions. The third parameter here controls the noise amount in the estimates of coalescent inten...
def run_Over_Grid(numdemes = 2, reps = 10, numreg = 100, t = 1000): Nmean = 2000 Nsd = 100 migMean = 0.0001 migsd = 1e-06 ndc2 = numdemes * (numdemes - 1) / 2 rows = ndc2 + numdemes + 1 I = np.matrix(np.eye(rows)) Ck = I[0:rows - 1, :] Dk = I[rows - 1, :] output = [] for r in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(\n self,\n repetitions,\n nChains=3,\n burnIn=100,\n thin=1,\n convergenceCriteria=0.8,\n variables_of_interest=None,\n DEpairs=2,\n adaptationRate=\"auto\",\n eps=5e-2,\n mConvergence=True,\n mAccept=True,\n ):\n\n ...
[ "0.5957784", "0.59119064", "0.5818777", "0.57929796", "0.5779033", "0.57222825", "0.5718269", "0.566151", "0.5655278", "0.5591914", "0.5582998", "0.5532946", "0.5525634", "0.55158126", "0.5478543", "0.5461477", "0.54515594", "0.544741", "0.5431594", "0.54281795", "0.5378584",...
0.6416229
0
This function runs the estimation procedure given the population sizes, mig rates, times, pop history. numreg controls the noise in the estimate of coal rates, and reps repeats the procedure multiple times.
def run_for_parms(Ns, ms, ts, popmaps, numreg, reps, compError = False, coal_error_threshold = 0.0001): true_parms = [] for i in xrange(len(Ns)): if len(Ns[i]) > 1: true_parms.append(np.array(Ns[i] + ms[i])) else: true_parms.append(np.array(Ns[i])) true_rates = mig.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_Over_Grid(numdemes = 2, reps = 10, numreg = 100, t = 1000):\n Nmean = 2000\n Nsd = 100\n migMean = 0.0001\n migsd = 1e-06\n ndc2 = numdemes * (numdemes - 1) / 2\n rows = ndc2 + numdemes + 1\n I = np.matrix(np.eye(rows))\n Ck = I[0:rows - 1, :]\n Dk = I[rows - 1, :]\n output = ...
[ "0.60618323", "0.5813044", "0.5810141", "0.57176125", "0.5648661", "0.5644182", "0.56422013", "0.56303495", "0.55385774", "0.55132926", "0.5510663", "0.5444651", "0.5410555", "0.5394634", "0.53916115", "0.52761513", "0.5269184", "0.5255094", "0.5233879", "0.52309513", "0.5229...
0.5761889
3
Given the true and the estimated parameter values this function computes the error in the parameter estimates. The order controls the norm used, by default its the maximum so sup norm
def compute_error(true, estimate, order = np.inf): print true print estimate errs = [] for i in xrange(len(true)): estError = abs(true[i] - estimate[i]) for j in xrange(len(true[i])): if true[i][j] != 0: estError[j] = estError[j] / true[i][j] errs.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_error(self, params):\n return self.endog - self.predict(params)", "def OF1_CalcErrorEstimation(param_list, args):\n #return (sum( \\\n #( OF1_SumOfGauss(param_list, classNum, g_lvls) - histogram ) ** 2) / g_lvls.size) + \\\n #(abs(sum(param_list[:classNum]) - 1) * o)\n return (...
[ "0.5976348", "0.5961685", "0.59206486", "0.59203446", "0.58393806", "0.58081555", "0.5629805", "0.561695", "0.5568433", "0.55431527", "0.5517937", "0.5446575", "0.54422283", "0.5426394", "0.54178244", "0.54091245", "0.54078066", "0.53778136", "0.5358041", "0.53563577", "0.531...
0.6888212
0
This function processes the timestring from PSMC and converts this to list of time slice lengths
def process_time_string(timestr): timestr = timestr.strip() toks = timestr.split('+') timeslices = [] for t in toks: tm = t.strip() mobj = re.search('\\*', tm) if mobj == None: timeslices += [int(tm)] else: tms = tm.split('*') timeslice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_times(time_str):\n warnings = []\n days, interval = time_str.split(',')\n assert int(days) == float(days)\n days = int(days)\n assert int(interval) == float(interval)\n interval = int(interval)\n if interval < 3:\n warnings.append('Minimum interval is 3 hours')\n if days > ...
[ "0.60004324", "0.5779885", "0.56531847", "0.5637275", "0.5626897", "0.5624664", "0.55409265", "0.5522083", "0.54359984", "0.5405842", "0.53607774", "0.5295241", "0.5267315", "0.526679", "0.524625", "0.52031076", "0.5193402", "0.5178458", "0.5174391", "0.5154917", "0.51378095"...
0.7197089
0
The coalescence matrix C as a vectorization of the upper triangular matrix and npop, the number of demes.
def mkCoalMatrix(C, npop): C = np.array(C).flatten() M = np.zeros((npop, npop)) cnt = 0 for i in range(npop): for j in range(i, npop): M[i, j] = C[cnt] if i != j: M[j, i] = M[i, j] cnt += 1 return M
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_C(n_c,CV_matrix):\n C = np.zeros((n_c, n_c), dtype=np.float32)\n for i in range(3):\n C += np.asfortranarray(CV_matrix[:, :, i]) @ np.asfortranarray(CV_matrix[:, :, np.mod(i + 2, 3)].T)\n C = (C != 0).astype(np.int32)\n return C", "def Cijkl(C):\n c = np.zeros(shape=(3, 3, 3, 3))\n ...
[ "0.69439816", "0.65459836", "0.6285086", "0.6249481", "0.6161368", "0.6148797", "0.6126897", "0.61106193", "0.60805976", "0.60785055", "0.60363877", "0.5989471", "0.59715444", "0.59453815", "0.5887798", "0.58766955", "0.5835838", "0.57483953", "0.57132053", "0.56960946", "0.5...
0.73259985
0
Initialization function of the class.
def __init__(self, popScaling, ratefile, timeStr, ignoreLast = False, logVal = True, verbose = False, varfile=''): self.verbose = verbose self.estimatedParms = None self.modified = False self.obsRates = [] self.logVal = logVal self.varGiven = False self.withinvar ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def initialize(self):\r\n pa...
[ "0.8625162", "0.8625162", "0.8625162", "0.8625162", "0.8625162", "0.8625162", "0.8625162", "0.8625162", "0.8624172", "0.8624172", "0.861785", "0.858561", "0.858561", "0.858561", "0.858561", "0.858561", "0.85630506", "0.85348904", "0.850922", "0.85069793", "0.8446883", "0.83...
0.0
-1
The rates obtained from PSMC are the prob of coal in that timeslice, not the prob of coal in that timeslice AND not coalescing in any other timeslice. We need the conditional probability of coal in that timeslice given lines have not coalesced in any of the previous timeslices. This function converts the PSMC values in...
def modify_rates(self): if self.modified: print 'Already Modified Probabilities' elif self.varGiven: print 'You must enter the conditional coalescent probabilties if you want to supply variance of' print 'the coalescent probabilities. Required since we cannot compute ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proba(c_pred,m_pred,f_pred, dataset):\n p = np.zeros(10)\n if dataset == 'cifar10':\n for i in range(10):\n if i <4:\n if i <2:\n p[i] = c_pred[0]*(m_pred[0]/(m_pred[0]+m_pred[1]))*(f_pred[i]/np.sum(f_pred[0:2]))\n elif i <4:\n ...
[ "0.5494266", "0.543836", "0.539172", "0.5361028", "0.5348872", "0.53372526", "0.53356594", "0.53264946", "0.5319149", "0.5312941", "0.52899146", "0.5248596", "0.5166682", "0.51662475", "0.5162503", "0.5162355", "0.5160059", "0.51591235", "0.51554865", "0.51400554", "0.5133518...
0.5660929
0
This function collapses the time slices and the coalescent prbabilities using the time string
def collapse_using_timeStr(self): if self.modified == True: raise Exception('Probabilities already modified.\nCollapsing after modification will lead to incorrect results.') timeUnits = np.array(process_time_string(self.timeStr)) if len(self.timeslices) + 1 == np.sum(timeUnits): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_time_slices(time_slices, apt_no, exp_no):\n # Removing the extraneous time slices\n if apt_no == '102A' and exp_no == '3':\n discard_ts = time_slices[\n (time_slices.phase == 'Not Found') & (time_slices.magnitude < 100)]\n time_slices = time_slices.ix[time_slices.index - d...
[ "0.58654743", "0.557243", "0.54334253", "0.5312071", "0.53107566", "0.5259074", "0.5191302", "0.5137161", "0.5035805", "0.49849787", "0.49590302", "0.49435392", "0.4941344", "0.48714745", "0.48218355", "0.48059455", "0.47934845", "0.47744334", "0.47464475", "0.47226936", "0.4...
0.5932365
0
This function estimates the pop and mig in each timeslice and returns it. If useMigration, the threshold is the migration threshold, if not the threshold is the coal rate threshold
def estimate_sim_run(self, merge_threshold = 0.01, useMigration = False, DFO = False, window = 0, hack = False): if DFO: self.estimatedParms = mig.comp_N_m(self.obsRates, self.timeslices, merge_threshold, useMigration, self.logVal, self.verbose) else: self.estimatedParms = mig.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calibrate_threshold(test_graphs):\r\n best_threshold = None\r\n best_result = None\r\n for threhold in range(1, 50):\r\n cur_res = evaluate_argument_mention(test_graphs, threhold)\r\n if (best_result is None) or (cur_res > best_result):\r\n best_result = cur_res\r\n ...
[ "0.5396551", "0.53875744", "0.5384712", "0.5273905", "0.5241481", "0.5240214", "0.5207714", "0.5183504", "0.51663357", "0.5130545", "0.5121495", "0.51151496", "0.5078505", "0.50698006", "0.50516546", "0.49774256", "0.49666265", "0.49366865", "0.49147338", "0.48900405", "0.486...
0.49437875
17
Authenticate a request. Returns a `User` if a valid token has been supplied using HTTP Basic authentication. Otherwise returns `None`.
def authenticate(self, request): auth = get_authorization_header(request).split() if not auth or auth[0].lower() != b"basic": return None if len(auth) == 1: raise AuthenticationFailed( "Invalid Basic authorization header. No credentials provided." ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def authenticate(self, request):\n\n if \"Authorization\" not in request.headers:\n return\n\n auth = request.headers[\"Authorization\"]\n\n scheme, token = auth.split()\n if scheme.lower() != 'bearer':\n raise AuthenticationError(\n \"Please u...
[ "0.7748496", "0.7482971", "0.7319348", "0.7214823", "0.69572836", "0.69473755", "0.6900045", "0.68219066", "0.6816961", "0.68142855", "0.6797234", "0.6780275", "0.6769279", "0.67666936", "0.6727957", "0.6711529", "0.66963404", "0.66865516", "0.6681249", "0.6672814", "0.667254...
0.791987
0
Do not enforce CSRF.
def enforce_csrf(self, request): return # To not perform the csrf check previously happening
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_csrf_validation(event):\n if event.request.method == 'POST':\n token = event.request.POST.get('_csrf')\n if token is None or token != event.request.session.get_csrf_token():\n headers = forget(event.request) # force a log out\n raise HTTPForbidden('CSRF token is missi...
[ "0.77730787", "0.71921813", "0.6985222", "0.68456197", "0.6827762", "0.68134195", "0.6702927", "0.66973877", "0.66799164", "0.66241884", "0.6571412", "0.6558275", "0.65252817", "0.646873", "0.645416", "0.63729364", "0.63329005", "0.6296769", "0.6245508", "0.6245508", "0.62453...
0.85253215
0
Register callback for the end of process. Please note that this method is called by other threads.
def register_callback(self, pid, callback): self.__cond.acquire() unhandled_rc = None if pid in self.__unhandled: unhandled_rc = self.__unhandled[pid] del self.__unhandled[pid] else: assert not pid in self.__callbacks self.__callbacks[pid] = callback if len(self.__callbacks...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processEnded(self, reason):\n self._processEnded = True\n if self.onProcessEnd:\n d, self.onProcessEnd = self.onProcessEnd, None\n d.callback(None)", "def set_finish_callback( callback ):", "def set_finish_callback( callback ):", "def on_close(self, callback):\n ...
[ "0.6814906", "0.6735387", "0.6735387", "0.64096254", "0.6239561", "0.62294984", "0.618629", "0.61696166", "0.61466694", "0.6146446", "0.6128145", "0.6107708", "0.60805905", "0.60070384", "0.5991", "0.5989766", "0.5917135", "0.589538", "0.5890868", "0.5878869", "0.5878317", ...
0.5892839
18
Lists all files below the given folder that match the pattern.
def _list_files(folder, pattern): for root, folders, files in os.walk(folder): for filename in files: if fnmatch.fnmatch(filename, pattern): yield os.path.join(root, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_and_filter(self, pattern, root_path):\n for path, dirs, files in os.walk(os.path.abspath(root_path)):\n for filename in fnmatch.filter(files, pattern):\n yield os.path.join(path, filename)", "def find(pattern):\n files = config.index.files(path_glob=\"*%s*\" % pattern)\n print_files...
[ "0.77849257", "0.7500726", "0.74775934", "0.7411119", "0.74076384", "0.7355792", "0.7233464", "0.71732324", "0.71499306", "0.71378464", "0.71049553", "0.70946896", "0.6977931", "0.69686073", "0.6965376", "0.6960672", "0.69308126", "0.69025075", "0.68708056", "0.6868468", "0.6...
0.81099135
1
Recursively collects a list of dirs that contain a file matching the given suffix. This works by listing the contents of directories and finding directories that have `_test.py` files.
def _collect_dirs( start_dir, blacklist=set(['conftest.py', 'noxfile.py', 'lib', 'third_party']), suffix='_test.py', recurse_further=False): # Collect all the directories that have tests in them. for parent, subdirs, files in os.walk(start_dir): if './.' in parent: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_files(suffix, path):\n\n \n result = []\n try:\n \n for file in os.listdir(path): \n if os.path.isfile(os.path.join(path,file)) and file.endswith(suffix): \n result.append(os.path.join(path,file))\n if os.path.isdir(os.path.join...
[ "0.7738707", "0.7725894", "0.75248116", "0.7505463", "0.74473727", "0.74190205", "0.7297259", "0.72701323", "0.72310036", "0.719575", "0.7136064", "0.7136064", "0.7117636", "0.69994664", "0.69969666", "0.6824205", "0.680646", "0.6803683", "0.6758053", "0.67387193", "0.6708413...
0.7264011
8
Returns a list of files changed for this pull request / push. If running on a public CI like Travis or Circle this is used to only run tests/lint for changed files.
def _get_changed_files(): if not ci_diff_helper: return None try: config = ci_diff_helper.get_config() except OSError: # Not on CI. return None changed_files = ci_diff_helper.get_changed_files('HEAD', config.base) changed_files = set([ './{}'.format(filename) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_changed_files():\n upstream = \"origin/master\"\n local_commit = subprocess.check_output(\n \"git rev-list HEAD ^{} -- 2>/dev/null | tail -1\".format(upstream),\n shell=True).strip().decode()\n diff_base = subprocess.check_output(\n ['git', 'rev-parse', local_commit +\n ...
[ "0.76511127", "0.7632489", "0.73521656", "0.71647716", "0.70889413", "0.70419586", "0.7040667", "0.6961542", "0.69610536", "0.67889297", "0.66707456", "0.66461307", "0.6640469", "0.6635299", "0.651519", "0.6512538", "0.65028757", "0.64318836", "0.6417526", "0.6387403", "0.638...
0.78147644
0
Filers the list of sample directories to only include directories that contain files in the list of changed files.
def _filter_samples(sample_dirs, changed_files): result = [] for sample_dir in sample_dirs: for changed_file in changed_files: if changed_file.startswith(sample_dir): result.append(sample_dir) return list(set(result))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_files(self):\n expected = [\n (\"/subdir1/fichier1\", False),\n (\"/subdir1/fichier4\", False),\n (\"/subdir1/subsubdir1\", False),\n ]\n files = [\n (\"/subdir1/fichier1\", False),\n (\"/subdir2/fichier2\", False),\n ...
[ "0.638365", "0.6379942", "0.6214398", "0.61015475", "0.6089934", "0.6049182", "0.5995398", "0.5965479", "0.5943096", "0.5874663", "0.58680815", "0.5832992", "0.5808962", "0.5801182", "0.57878786", "0.57864714", "0.5781348", "0.5780594", "0.57367", "0.57249534", "0.5714945", ...
0.80027604
0
Determines all import names that should be considered "local". This is used when running the linter to insure that import order is properly checked.
def _determine_local_import_names(start_dir): file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)] return [ basename for basename, extension in file_ext_pairs if extension == '.py' or os.path.isdir( os.path.join(start_dir, basename)) and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_local_methods(self):\n package_foo = determine_package(LocalClass().foo_method)\n package_bar = determine_package(LocalClass().bar_method)\n assert package_foo == package_bar", "def is_local(self) -> bool:\n if not self.source:\n return False\n\n if s...
[ "0.5883926", "0.58062863", "0.57493323", "0.57031", "0.56781274", "0.56347144", "0.5598635", "0.5551292", "0.5530518", "0.5508783", "0.55060405", "0.5462658", "0.5400261", "0.5390425", "0.53739977", "0.5363772", "0.53556126", "0.53410673", "0.5327128", "0.5322422", "0.5312975...
0.7432707
0
Installs the App Engine SDK, if needed.
def _setup_appengine_sdk(session): session.env['GAE_SDK_PATH'] = os.path.join(_GAE_ROOT, 'google_appengine') session.run('gcp-devrel-py-tools', 'download-appengine-sdk', _GAE_ROOT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_env():\r\n\r\n # Try to import the appengine code from the system path.\r\n try:\r\n from google.appengine.api import apiproxy_stub_map\r\n except ImportError:\r\n for k in [k for k in sys.modules if k.startswith('google')]:\r\n del sys.modules[k]\r\n\r\n # Not on...
[ "0.7231505", "0.68327713", "0.6396035", "0.61375856", "0.5877419", "0.58420604", "0.5788967", "0.57099634", "0.5672816", "0.56718606", "0.55840725", "0.55813754", "0.5555057", "0.55090976", "0.5480833", "0.54060125", "0.53963965", "0.53802866", "0.5351276", "0.531847", "0.529...
0.7749325
0
Runs py.test for a particular sample.
def _session_tests(session, sample, post_install=None): session.install('-r', 'testing/requirements.txt') session.chdir(sample) if os.path.exists('requirements.txt'): session.install('-r', 'requirements.txt') if post_install: post_install(session) session.run( 'pytest', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test(test_name):\n\n print 'Running %s_test...' % test_name\n os.system('./test_%s.py' % test_name)\n print", "def run_sample(smp: sample.Sample,\n run_dir: Text,\n summary_file: Optional[Text] = None,\n generate_sample_ns: Optional[int] = None):\n start = ti...
[ "0.65195566", "0.65083474", "0.6489226", "0.64708185", "0.64350784", "0.6390061", "0.6293161", "0.622205", "0.6087137", "0.60797745", "0.60169667", "0.5991668", "0.5964952", "0.5960034", "0.59463376", "0.59389555", "0.59370387", "0.59229195", "0.59209305", "0.5916534", "0.590...
0.0
-1
Runs py.test for an App Engine standard sample.
def gae(session, sample): # Create a lib directory if needed, otherwise the App Engine vendor library # will complain. if not os.path.isdir(os.path.join(sample, 'lib')): os.mkdir(os.path.join(sample, 'lib')) _session_tests(session, sample, _setup_appengine_sdk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_example_runs(self):\n run_example(\n verbose=False,\n testapp=self.testapp,\n )", "def test_app():\n pass", "def test_script(self) -> None:\n main()", "def testapp():\n from space_rocks import main\n app = main({})\n from webtest...
[ "0.7205402", "0.68938684", "0.67903644", "0.6781952", "0.67707103", "0.6763475", "0.67430496", "0.655691", "0.65498453", "0.6525648", "0.65029895", "0.64756703", "0.64599717", "0.6407252", "0.6398116", "0.63732797", "0.6361551", "0.6361551", "0.63599926", "0.63555795", "0.635...
0.6342977
35
Runs py.test for a sample using Python 2.7
def py27(session, sample): _session_tests(session, sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self):\n for arch, python in self.python:\n self.run(f\"{python} -m pytest\")", "def __test__():\n#-------------------------------------------------------------------------------\n import pylib.tester as tester\n return 0", "def task_test(argv):\n run_tests(\"python2\", argv...
[ "0.7058874", "0.6976574", "0.6928872", "0.6905923", "0.6731107", "0.6696117", "0.66346335", "0.6633901", "0.66220474", "0.66138864", "0.6605148", "0.66025674", "0.65968716", "0.65968716", "0.65968716", "0.65968716", "0.65968716", "0.65968716", "0.65968716", "0.65968716", "0.6...
0.6479492
43
Runs py.test for a sample using Python 3.6
def py36(session, sample): _session_tests(session, sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self):\n for arch, python in self.python:\n self.run(f\"{python} -m pytest\")", "def task_test(argv):\n run_tests(\"python2\", argv)\n run_tests(\"python3\", argv)", "def test(session) -> None:\n session.install(\".[test]\")\n session.run(\"pytest\", \"-n\", \"auto\", *se...
[ "0.7342706", "0.6932851", "0.6911395", "0.68314606", "0.68234855", "0.68161607", "0.6808515", "0.6803258", "0.68006325", "0.677856", "0.6720968", "0.6645903", "0.66170406", "0.66076094", "0.65739256", "0.6571476", "0.6559418", "0.65576935", "0.6549422", "0.65449774", "0.65419...
0.0
-1
Runs flake8 on the sample.
def lint(session, sample): session.install('flake8', 'flake8-import-order') local_names = _determine_local_import_names(sample) args = FLAKE8_COMMON_ARGS + [ '--application-import-names', ','.join(local_names), '.'] session.chdir(sample) session.run('flake8', *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flake8():\n call([\"flake8\"])", "def flake8(context):\n exec_cmd = \"flake8 .\"\n run_cmd(context, exec_cmd)", "def flake8(ctx):\n ctx.run(f\"{VENV_PREFIX} flake8 --config=setup.cfg\")", "def test_flake8(self):\n result = subprocess.run(['flake8', self.module.__file__])\n self....
[ "0.8096764", "0.8072783", "0.7843559", "0.73988837", "0.7372284", "0.734738", "0.73003185", "0.7064382", "0.7043746", "0.6899092", "0.6883284", "0.6800674", "0.6674673", "0.64521545", "0.6429033", "0.6402412", "0.63903666", "0.63484365", "0.6312585", "0.63042206", "0.62754524...
0.70643854
7
Lists all sample directories that do not have tests.
def missing_tests(session): print('The following samples do not have tests:') for sample in set(ALL_SAMPLE_DIRECTORIES) - set(ALL_TESTED_SAMPLES): print('* {}'.format(sample))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_list_emptydirs(load):\n # TODO - implement this\n _init()\n\n return []", "def test_matlab_install_dir_absent(self):\n directories = (\"/\", \"/tmp\")\n for dirname in directories:\n with self.subTest(dirname=dirname):\n self.assertNotIn(\"matlab-install\...
[ "0.66200477", "0.65644187", "0.6472452", "0.64620155", "0.63552594", "0.6348389", "0.6269922", "0.6265887", "0.6258353", "0.6112326", "0.6103435", "0.61029524", "0.610135", "0.60616046", "0.6050831", "0.595446", "0.5950891", "0.5949775", "0.594931", "0.5892177", "0.5882108", ...
0.79405457
0
(Re)generates the readme for a sample.
def readmegen(session, sample): session.install('jinja2', 'pyyaml') if os.path.exists(os.path.join(sample, 'requirements.txt')): session.install('-r', os.path.join(sample, 'requirements.txt')) in_file = os.path.join(sample, 'README.rst.in') session.run('python', 'scripts/readme-gen/readme_gen....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readme_md(cls):\n\n template = Helpers.File(Settings.readme_me_template).read()\n\n template = Helpers.Regex(\n template, r\"%%version%%\", replace_with=Settings.version\n ).replace()\n template = Helpers.Regex(\n template, r\"%%lenHosts%%\", replace_with=forma...
[ "0.7287029", "0.7018073", "0.6953501", "0.6933401", "0.6853328", "0.6802791", "0.6781446", "0.6738891", "0.6733868", "0.6717046", "0.66753453", "0.66342485", "0.6618257", "0.64765066", "0.644934", "0.6441836", "0.6415977", "0.63786113", "0.63530713", "0.63517934", "0.62726355...
0.80653775
0
Checks for out of date requirements and optionally updates them. This is intentionally not parametric, as it's desired to never have two samples with differing versions of dependencies.
def check_requirements(session): session.install('-r', 'testing/requirements.txt') if 'update' in session.posargs: command = 'update-requirements' else: command = 'check-requirements' reqfiles = list(_list_files('.', 'requirements*.txt')) for reqfile in reqfiles: session.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_and_dependency_not_removed_caused_required_by_another_item(self):\n assert self.DEPENDENCY_PUBLIC_ID in self.load_config().protocols\n # do not add dependencies for the package\n\n with self.with_oef_installed(), self.with_config_update(), patch(\n \"aea.cli.add._ad...
[ "0.68966734", "0.66854733", "0.6329505", "0.6213713", "0.6208097", "0.6180045", "0.6092911", "0.60761565", "0.6075853", "0.6070879", "0.60444874", "0.6042945", "0.6040614", "0.6025732", "0.5970172", "0.5963672", "0.5960131", "0.5874549", "0.58727145", "0.58643824", "0.5860373...
0.62337804
3
Returns a paranoid_pb2.TestResultsEntry protobuf ready for the checks. The created paranoid_pb2.TestResultsEntry is appropriate to be used on tests and have the paranoid_pb2.TestResultsEntry.result filled by the Check function (i.e., set as weak or not).
def _CreateTestResult(self) -> paranoid_pb2.TestResultsEntry: if self.severity is None: raise KeyError("Please specify self.severity for %s." % self.check_name) return paranoid_pb2.TestResultsEntry( severity=self.severity, test_name=self.check_name, result=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_verifier_result(self):\n stat = self.get_verifier_result(self.verification_id)\n try:\n num_executed = stat['num_tests'] - stat['num_skipped']\n try:\n self.result = 100 * stat['num_success'] / num_executed\n except ZeroDivisionError:\n ...
[ "0.5186231", "0.5027672", "0.48830792", "0.4770407", "0.46957067", "0.46849295", "0.46664384", "0.46516448", "0.46486202", "0.4532336", "0.4530844", "0.4512337", "0.44765168", "0.43914053", "0.43779433", "0.43736914", "0.43657622", "0.4348417", "0.43343168", "0.43205202", "0....
0.7242101
0
Runs the check among the artifacts (keys/signatures).
def Check(self, artifacts: list[T]) -> bool: raise NotImplementedError("Subclass didn't implement Check method.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_and_check(self, *args, **kwargs) -> None:\n raise NotImplementedError", "def check(self):\n json = JsonBackend(\"../src/builder/projects.json\")\n json.load()\n\n TM_ITSELF = 1\n expected_files = TM_ITSELF + sum(p.downloadable is True\n ...
[ "0.62986624", "0.6155824", "0.61118424", "0.60989845", "0.6006719", "0.58963877", "0.5836908", "0.5789669", "0.57740337", "0.5756412", "0.57358384", "0.57111585", "0.5706886", "0.5692724", "0.5689134", "0.56786627", "0.5625611", "0.56218255", "0.5619318", "0.5589858", "0.5575...
0.599099
5
Create a new 'SubstitutionField'. By default, the pattern and replacement string are empty.
def __init__(self, name, **properties): # Initialize the base class. apply(qm.fields.TextField.__init__, (self, name, ";"), properties)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, field, derived_field = None):\r\n super(TextSubstituteNode, self).__init__()\r\n\r\n self.field = field\r\n self.derived_field = derived_field\r\n self.substitutions = []", "def __init__(self, name, **properties):\n # Initialize the base class.\n fields = [Uni...
[ "0.6972568", "0.62130094", "0.58522135", "0.5740111", "0.5510787", "0.5459242", "0.5442237", "0.54280025", "0.5401875", "0.5387175", "0.5350919", "0.5333425", "0.5201174", "0.51596874", "0.51431245", "0.5138764", "0.51243883", "0.5123259", "0.50846165", "0.5082066", "0.507800...
0.4489429
67
Split a value of this field into the pattern and replacement string. 'value' A value for this field. returns A pair '(pattern, replacement_string)'.
def SplitValue(self, value): # Be lenient about an empty string. if value == "": return ("", "") # Break it in half. elements = string.split(value, ";", 1) # Unescape semicolons in both halves. elements = map(lambda e: string.replace(e, r"\;", ";"), elements)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _splitValue(self, value):\n m = ConfigParser.varRe.match(value)\n if m == None:\n raise Exception(self.fh.name + \":\" + str(self.lineNum) + \": bug, can't split line \")\n (beforeRef, junk, varName, afterRef) = m.groups()\n return (beforeRef, varName, afterRef)", "def ...
[ "0.662261", "0.5876804", "0.5876804", "0.58283037", "0.5570239", "0.5308981", "0.5277081", "0.5173776", "0.50996935", "0.50890404", "0.50848806", "0.50799507", "0.50650334", "0.49815592", "0.49710035", "0.49443537", "0.49404633", "0.49323875", "0.49291474", "0.49177104", "0.4...
0.5772989
5
Construct the environment for executing the target program.
def MakeEnvironment(self, context): # Start with any environment variables that are already present # in the environment. environment = os.environ.copy() # Copy context variables into the environment. for key, value in context.items(): name = "QMV_" + key ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_python_environment(self):\n # build command for creating the python environment\n cmd_args = {\n 'exe': self.env_executable,\n 'cmds': \" \".join(self.env_commands),\n 'flags': \" \".join(self.env_flags),\n 'args': \" \".join(self.env_arguments),\...
[ "0.6865318", "0.67876095", "0.66827077", "0.6655347", "0.65665376", "0.64506286", "0.64132625", "0.6385014", "0.62479043", "0.62209445", "0.6211236", "0.62018836", "0.61966336", "0.6103375", "0.6073248", "0.60442287", "0.60428226", "0.6014583", "0.60005015", "0.59970814", "0....
0.6132058
13
Run the 'program'. 'program' The path to the program to run. 'arguments' A list of the arguments to the program. This list must contain a first argument corresponding to 'argv[0]'. 'stdin' Content of standard input for the program. 'context' A 'Context' giving runtime parameters to the test. 'result' A 'Result' object....
def RunProgram(self, program, arguments, stdin, context, result): # Construct the environment. environment = self.MakeEnvironment(context) e_stdin = stdin c = {} for pair in context.items(): c[pair[0]] = pair[1] for substitution in c.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunProgram(self, program, arguments, context, result):\n\n # Construct the environment.\n environment = self.MakeEnvironment(context)\n e_stdin = self.stdin\n c = {}\n for pair in context.items():\n c[pair[0]] = pair[1]\n for substitution in c.keys():\n ...
[ "0.69363123", "0.63061756", "0.6056023", "0.5911862", "0.5623276", "0.55638814", "0.5554909", "0.5461146", "0.5455719", "0.545486", "0.5423107", "0.54222107", "0.5385501", "0.53396916", "0.5325689", "0.5288438", "0.52590066", "0.52466375", "0.5239515", "0.52368325", "0.523618...
0.7962142
0
Initialization parameters 'context' A 'Context' giving runtime parameters to the test.
def __init__(self, context): # RunServiceBase.__init__() self.__context = context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_with_context(self, context):\n pass", "def initialize(self, context):\n raise NotImplementedError", "def initialize(self, context):\n pass", "def initialize(self, context):\n pass", "def initialize(self, context):\n pass", "def initialize(self, context):\r\n ...
[ "0.76711184", "0.73903596", "0.7277065", "0.7277065", "0.7277065", "0.721566", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "0.70873374", "...
0.6184149
45
Restore a database from a backup file. 'database' A database specification. 'backupfile' A backup file name. 'arguments' A list of the arguments to the GBAK without backup file name and database location. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modif...
def RestoreDatabase(self, database, backupfile, arguments, result): self.RunProgram("\""+self.__context["gbak_path"]+"\"", [ self.__context["gbak_path"] ] + [ "-C ", backupfile ] + arguments + [ database ], "", self.__context, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_backup(self):\n print \"Restoring backup for database: %s\" % self.database['NAME']\n # Fetch the latest backup if filepath not specified\n if not self.filepath:\n print \" Finding latest backup\"\n filepaths = self.storage.list_directory()\n filep...
[ "0.64738756", "0.6441385", "0.6043816", "0.59941", "0.59136015", "0.5861948", "0.5844177", "0.5674559", "0.5635281", "0.5470779", "0.54675585", "0.52948487", "0.5271796", "0.52364796", "0.51926756", "0.5166014", "0.5152477", "0.5145427", "0.508932", "0.5002277", "0.49899507",...
0.8807153
0
Run an ISQL script. 'database' A database specification. 'script' An ISQL script. 'arguments' A list of the arguments to the ISQL without database location. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outcomes other th...
def RunScript(self, database, script, arguments, result): self.RunProgram("\""+self.__context["isql_path"]+"\"", [ self.__context["isql_path"] ] + [ database ] + arguments, script, self.__context, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Run(self, context, result):\n\n # Was the program not specified?\n\n self.program = context[\"isql_path\"]\n\n if context.has_key(\"database_path\"):\n database = context[\"database_path\"]\n else:\n database = \"\"\n self.RunProgram(self.program,\n\t\t\...
[ "0.63101566", "0.6261756", "0.59878993", "0.57192934", "0.56583416", "0.5588258", "0.5548203", "0.554179", "0.54586357", "0.5448663", "0.5403661", "0.5383299", "0.534008", "0.53358716", "0.52607375", "0.52274305", "0.5176673", "0.51720655", "0.5166656", "0.51541513", "0.51159...
0.8646154
0
Run an ISQL script. 'script' An (optional) GSEC script. 'arguments' A list of the arguments to the GSEC without ISC4 database location and sysdba username and password. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outco...
def RunGsec(self, script, arguments, result): try: self.RunProgram("\""+self.__context["gsec_path"]+"\"", [ self.__context["gsec_path"], "-database", self.__context["server_location"]+ self.__context["isc4_path"], "-user", "SYSDBA", "-password", "masterkey" ]+arguments, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunScript(self, database, script, arguments, result):\n\n self.RunProgram(\"\\\"\"+self.__context[\"isql_path\"]+\"\\\"\",\n [ self.__context[\"isql_path\"] ] + [ database ] + arguments,\n script, self.__context, result)", "def execute_script(self, script,...
[ "0.7854742", "0.61550087", "0.59776443", "0.5792648", "0.5619949", "0.55894285", "0.55582255", "0.5536295", "0.54101485", "0.536589", "0.5349416", "0.53441995", "0.5326733", "0.53031874", "0.5293181", "0.529026", "0.52394783", "0.5232753", "0.5228306", "0.521149", "0.52065", ...
0.68645024
1
Construct the environment for executing the target program.
def MakeEnvironment(self, context): # Start with any environment variables that are already present # in the environment. environment = os.environ.copy() # Copy context variables into the environment. for key, value in context.items(): name = "QMV_" + key ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_python_environment(self):\n # build command for creating the python environment\n cmd_args = {\n 'exe': self.env_executable,\n 'cmds': \" \".join(self.env_commands),\n 'flags': \" \".join(self.env_flags),\n 'args': \" \".join(self.env_arguments),\...
[ "0.6866149", "0.67887974", "0.6682207", "0.665503", "0.6565945", "0.6451024", "0.64138275", "0.6385889", "0.62477255", "0.6221224", "0.62101907", "0.62013006", "0.6196314", "0.6132033", "0.610246", "0.60736305", "0.6043668", "0.60429454", "0.6000888", "0.5997547", "0.5982757"...
0.60146767
18
Run the 'program'. 'program' The path to the program to run. 'arguments' A list of the arguments to the program. This list must contain a first argument corresponding to 'argv[0]'. 'context' A 'Context' giving runtime parameters to the test. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method...
def RunProgram(self, program, arguments, context, result): # Construct the environment. environment = self.MakeEnvironment(context) e_stdin = self.stdin c = {} for pair in context.items(): c[pair[0]] = pair[1] for substitution in c.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunProgram(self, program, arguments, stdin, context, result):\n\n # Construct the environment.\n environment = self.MakeEnvironment(context)\n e_stdin = stdin\n c = {}\n for pair in context.items():\n c[pair[0]] = pair[1]\n for substitution in c.keys():\...
[ "0.77603376", "0.6088054", "0.60775167", "0.58894455", "0.5795883", "0.57625437", "0.5644391", "0.5612917", "0.5577483", "0.54712975", "0.54391956", "0.5397551", "0.5342152", "0.53416663", "0.53210723", "0.5283056", "0.5247545", "0.5224499", "0.51938117", "0.51841336", "0.516...
0.69340014
1
Split a value of this field into the pattern and replacement string. 'value' A value for this field. returns A pair '(pattern, replacement_string)'.
def SplitValue(self, value): # Be lenient about an empty string. if value == "": return ("", "") # Break it in half. elements = string.split(value, ";", 1) # Unescape semicolons in both halves. elements = map(lambda e: string.replace(e, r"\;", ";"), elements)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _splitValue(self, value):\n m = ConfigParser.varRe.match(value)\n if m == None:\n raise Exception(self.fh.name + \":\" + str(self.lineNum) + \": bug, can't split line \")\n (beforeRef, junk, varName, afterRef) = m.groups()\n return (beforeRef, varName, afterRef)", "def ...
[ "0.6626543", "0.5880005", "0.5880005", "0.5834636", "0.5569926", "0.530701", "0.5272915", "0.51757324", "0.5105574", "0.5092262", "0.50849164", "0.50815874", "0.5064315", "0.49831337", "0.49724522", "0.49412143", "0.49400538", "0.4932219", "0.49313912", "0.4915455", "0.490361...
0.5778173
4
Perform substitutions on a body of text. returns The string 'text', processed with the substitutions configured for this test instance.
def __PerformSubstitutions(self, text): for substitution in self.substitutions: pattern, replacement = self.SplitValue(substitution) text = re.compile(pattern,re.M).sub(replacement, text) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess(self, text):\r\n return text", "def preprocess(self, text):\r\n return text", "def post_process_text(self, text):\n\t\treturn text", "def substitution(plainText, key):\n return plainText", "def apply(self, text):", "def applyRegularExpressions(strText, substitutionPatternLi...
[ "0.65611976", "0.6435312", "0.6424799", "0.6276254", "0.6202044", "0.61083364", "0.6037628", "0.6034791", "0.59750575", "0.57668275", "0.5727748", "0.57236975", "0.5721389", "0.5685642", "0.56766623", "0.5662096", "0.5638508", "0.56205267", "0.5587311", "0.55449075", "0.55417...
0.7525169
0
Run the test. 'context' A 'Context' giving runtime parameters to the test. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outcomes other than 'Result.PASS' or to add annotations.
def Run(self, context, result): # Was the program not specified? self.program = context["isql_path"] if context.has_key("database_path"): database = context["database_path"] else: database = "" self.RunProgram(self.program, [ self.program , database ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, context):\n TestStepBase.run(self, context)\n\n if self._device is None:\n self._raise_config_exception(\"%s is not specified in the bench configuration\" % self._pars.device,\n AcsConfigException.INVALID_BENCH_CONFIG)\n\n # Inse...
[ "0.6657738", "0.65140593", "0.6481782", "0.6363065", "0.62938815", "0.6101981", "0.60296535", "0.6014694", "0.5991694", "0.5981408", "0.59577173", "0.59577173", "0.59303653", "0.5891765", "0.58808815", "0.5873598", "0.5869656", "0.5845078", "0.57987034", "0.57243335", "0.5679...
0.5427483
37
Returns the sum of each individual digit in a given integer n
def sum_of_digits(n): return sum(int(c) for c in str(n))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digitSum ( n ) :\n return sum ( map ( int , str ( n ) ) )", "def digit_sum(n):\n\treturn sum(int(c) for c in str(n))", "def digit_sum(n):\n sum_of_digits = 0\n for c in str(n):\n sum_of_digits += int(c)\n return sum_of_digits", "def digit_sum(n):\n s = 0\n while n:\n s += n ...
[ "0.8983617", "0.896262", "0.88677377", "0.8782588", "0.87734056", "0.8756498", "0.85132176", "0.84619224", "0.83623177", "0.83091414", "0.82763064", "0.8267195", "0.8232159", "0.80869514", "0.80285734", "0.7945917", "0.7804985", "0.77949435", "0.77158666", "0.7711733", "0.762...
0.8821321
3
Compute softmax values for each sets of scores in x.
def softmax(x): # Compute and return softmax(x) denom = sum(np.exp(x)) return [ np.exp(xi)/denom for xi in x ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7800231", "0.776332", "0.7762483", "0.77600384", "0.76607925", "0.76607925", "0.76607925", "0.76607925", "0.7585753", "0.7432371", "0.7409777", "0.73932534", "0.7360278", "0.72708684", "0.7263948", "0.7262435", "0.7257905", "0.7231808", "0.72159433", "0.7203519", "0.720315...
0.731833
13
Return the nr_terms most frequent terms in article
def common_terms(self, nr_terms=20): tokens = analysis.extra_tokenize(self.fulltext) all_to_remove = stopwords + punct + WORDS_FOR_REMOVAL coretokens = [t.lower() for t in tokens if t.lower() not in all_to_remove] fd = FreqDist(coretokens) return fd.most_common(nr_terms)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumberTerms(content): \n return Counter(getTerms(content))", "def most_frequent(corpus):\n fd = nltk.FreqDist(corpus)\n return fd.most_common(10)", "def get_num_terms(self, documents=None):\n terms = []\n if documents == None:\n docs = self.vocab\n else:\n ...
[ "0.7059205", "0.7044106", "0.6974766", "0.69031334", "0.6797572", "0.6758672", "0.674704", "0.6637728", "0.656225", "0.6542295", "0.6528525", "0.6483165", "0.6466837", "0.64654", "0.644185", "0.641473", "0.6407708", "0.6399931", "0.6389089", "0.6380951", "0.6369813", "0.635...
0.6191852
37
Get articles for a gives news source
def for_source(source, articles=None): if not articles: articles = load_articles(nl.read_data()) source_arts = [a for a in articles if a.source == source] for art in source_arts: yield art
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listsources():\n\tmain_url = \" https://newsapi.org/v2/sources?apiKey=5f81b593f35d42a8980313250c03d7e7\"\n\n\t# fetching data in json format \n\topen_source = requests.get(main_url).json() \n\n\t# getting all articles in a string sources\n\tsource = open_source[\"sources\"] \n\n\t# empty list which will \n\t# ...
[ "0.7267898", "0.69831485", "0.6910983", "0.6892911", "0.68473136", "0.67912644", "0.6780562", "0.6722617", "0.6709383", "0.6705438", "0.66801316", "0.663876", "0.6628921", "0.6584156", "0.6563533", "0.65245885", "0.6516218", "0.65005183", "0.6477813", "0.64497817", "0.6429842...
0.710921
1
Huber function. An analytic function that is quadratic around its minimum n and linear in its tails. Its minimum is at offset. Quadratic between offsetdelta and offset + delta and linear outside.
def huber(x, offset, delta): i = np.abs(x - offset) < delta return (x-offset)**2/2 * i + (1 - i)*delta*(np.abs(x-offset) - delta/2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beeston_barlow_root1(a, p, U, d):\n return ((-U*p - U + a*p + d*p -\n np.sqrt(U**2*p**2 + 2*U**2*p + U**2 + 2*U*a*p**2 + 2*U*a*p -\n 2*U*d*p**2 - 2*U*d*p + a**2*p**2 + 2*a*d*p**2 + d**2*p**2))/(2*p*(p + 1)))", "def trapezium_rule(f, m, x, a, b, n):\n h = (b-a)/float(n)\n...
[ "0.5800495", "0.57387626", "0.56889313", "0.56861275", "0.56719846", "0.5661993", "0.5647246", "0.56123304", "0.56039697", "0.55897033", "0.55779684", "0.556688", "0.5564874", "0.5559421", "0.55498475", "0.5544323", "0.55239946", "0.55232066", "0.5518701", "0.5500929", "0.549...
0.71997106
0
Numerically stable computation of Shannon's entropy for probability distributions with zerovalued elements.
def entropy(p: torch.Tensor): nz = (p > 0).to(p.device) eps = torch.finfo(p.dtype).eps p_stable = p.clone().clamp(min=eps, max=1 - eps) out = torch.where( nz, p_stable * torch.log(p_stable), torch.tensor(0.0, device=p.device, dtype=torch.float), ) return -(out).sum(-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(x):\n nz = np.nonzero(x)[0]\n return -np.sum(x[nz]*np.log2(x[nz]))", "def shannon_entropy(probs):\n return -(\n math.sum([px * math.log2(px) if px != 0 and not (np.isclose(px, 0)) else 0 for px in probs])\n )", "def entropy(P):\n P_nan = P.copy()\n P_nan[P_nan == 0] = np.na...
[ "0.78719157", "0.77639353", "0.7700689", "0.75903934", "0.7586108", "0.7534621", "0.7498757", "0.74172634", "0.7378696", "0.7348129", "0.7309863", "0.7278837", "0.7269413", "0.72656107", "0.72442186", "0.72422546", "0.72418517", "0.72395533", "0.71693814", "0.71460384", "0.70...
0.73763674
9
Puts User Matches in view, in order by rank ( of matching skills)
def get_context_data(self, **kwargs): context = super(ProjectView, self).get_context_data(**kwargs) # only load if self.request.user == founder if self.request.user.id is self.get_object().founder.id: context['match_list'] = Match.objects.filter(project=self.object.id).order_by('-ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter_matches_score(match_list):\n for match in match_list:\n view.show(\"{} vs {}\".format(match.player_blanc.player_first_name,\n match.player_black.player_first_name))\n score_blanc = enter_player_score(match.player_blanc)\n match.score_blanc = scor...
[ "0.6061785", "0.59745973", "0.5851773", "0.5811785", "0.5756262", "0.5733067", "0.57015556", "0.5699974", "0.5658713", "0.5638683", "0.5615457", "0.56053066", "0.55809283", "0.5551806", "0.549049", "0.54823655", "0.5481128", "0.5471227", "0.54675686", "0.546725", "0.5450787",...
0.496989
99