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
Check if production env is activated.
def test_is_production_env(self) -> None: os.environ.update({"NC_MODE": "production"}) is_develop = is_development_env() self.assertFalse(is_develop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_production_environment(self):\n return self.get_current_environment() == Environment.PRODUCTION", "def is_production_mode(self):\n return getattr(self.env, 'mode', None) == 'production'", "def prod(environment):\n return environment == 'live' or environment == 'debug' or environment == ...
[ "0.81930846", "0.81518", "0.8027799", "0.7621694", "0.7604779", "0.7513769", "0.7450725", "0.7421038", "0.70685047", "0.69504565", "0.6856602", "0.68520004", "0.67687356", "0.6757052", "0.6719974", "0.6677296", "0.6666935", "0.6606695", "0.6603931", "0.65954214", "0.65905064"...
0.7997026
3
Check if development env is activated.
def test_is_empty_nc_mode_env(self) -> None: if os.environ.get("NC_MODE", None) is not None: del os.environ["NC_MODE"] is_develop = is_development_env() self.assertFalse(is_develop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_development():\n return os.environ.get('SERVER_SOFTWARE', '').startswith('Development')", "def test_is_development_env(self) -> None:\n os.environ.update({\"NC_MODE\": \"development\"})\n is_develop = is_development_env()\n self.assertTrue(is_develop)", "def get_site_env(self):\n ...
[ "0.8337604", "0.81877184", "0.7692659", "0.7504923", "0.74659204", "0.7465296", "0.7377704", "0.7323249", "0.72394073", "0.72125643", "0.71630734", "0.7148706", "0.70545775", "0.70386916", "0.7021576", "0.69120103", "0.68301886", "0.68271375", "0.6818852", "0.67625374", "0.67...
0.59749204
57
Test release tag building.
def test_release_tag(self) -> None: self.assertEqual("v3.14.15", release_tag())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_release_deployment_run(self):\n pass", "def test_release_tag_for_dev_version(self) -> None:\n self.assertEqual(\"v42.12\", release_tag())", "def test_release_version():\n pkg_vars = {}\n with open(VERSION_FILE) as f:\n exec(f.read(), pkg_vars) # nosec\n project_version =...
[ "0.7284068", "0.70147276", "0.6728345", "0.6709383", "0.66933805", "0.66797566", "0.6608459", "0.64857477", "0.64158696", "0.6389684", "0.6376367", "0.6313048", "0.6291171", "0.6285542", "0.6277399", "0.627431", "0.6255137", "0.6237298", "0.62290806", "0.6162094", "0.6159651"...
0.7737768
0
Test release tag building.
def test_release_tag_for_dev_version(self) -> None: self.assertEqual("v42.12", release_tag())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_release_tag(self) -> None:\n self.assertEqual(\"v3.14.15\", release_tag())", "def test_release_deployment_run(self):\n pass", "def test_release_version():\n pkg_vars = {}\n with open(VERSION_FILE) as f:\n exec(f.read(), pkg_vars) # nosec\n project_version = pkg_vars[\"__...
[ "0.7737768", "0.7284068", "0.6728345", "0.6709383", "0.66933805", "0.66797566", "0.6608459", "0.64857477", "0.64158696", "0.6389684", "0.6376367", "0.6313048", "0.6291171", "0.6285542", "0.6277399", "0.627431", "0.6255137", "0.6237298", "0.62290806", "0.6162094", "0.6159651",...
0.70147276
2
Test release tag building.
def test_release_tag_for_empty(self) -> None: with self.assertRaisesRegexp(ValueError, "Unable to parse version "): release_tag()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_release_tag(self) -> None:\n self.assertEqual(\"v3.14.15\", release_tag())", "def test_release_deployment_run(self):\n pass", "def test_release_tag_for_dev_version(self) -> None:\n self.assertEqual(\"v42.12\", release_tag())", "def test_release_version():\n pkg_vars = {}\n ...
[ "0.7737768", "0.7284068", "0.70147276", "0.6728345", "0.6709383", "0.66933805", "0.66797566", "0.6608459", "0.64857477", "0.6389684", "0.6376367", "0.6313048", "0.6291171", "0.6285542", "0.6277399", "0.627431", "0.6255137", "0.6237298", "0.62290806", "0.6162094", "0.6159651",...
0.64158696
9
Test release tag building.
def test_release_tag_for_invalid_version(self) -> None: with self.assertRaisesRegexp(ValueError, "Unable to parse version foo.bar.ba"): release_tag()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_release_tag(self) -> None:\n self.assertEqual(\"v3.14.15\", release_tag())", "def test_release_deployment_run(self):\n pass", "def test_release_tag_for_dev_version(self) -> None:\n self.assertEqual(\"v42.12\", release_tag())", "def test_release_version():\n pkg_vars = {}\n ...
[ "0.7737768", "0.7284068", "0.70147276", "0.6728345", "0.6709383", "0.66933805", "0.66797566", "0.6608459", "0.64857477", "0.64158696", "0.6389684", "0.6376367", "0.6313048", "0.6291171", "0.6285542", "0.6277399", "0.627431", "0.6255137", "0.6237298", "0.62290806", "0.6162094"...
0.5718554
38
Turn URL into PIL image. Can throw a timout error.
def url2img(url : str, timeout = 1) -> Image: response = requests.get(url, timeout = timeout) return Image.open(BytesIO(response.content))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlToImage(url):\n\n response = requests.get(url)\n image = Image.open(BytesIO(response.content))\n return image", "def _url_to_image(url: str) -> Image.Image:\n assert url.lower().startswith(\"http\"), \"invalid url, must start with http\"\n content = requests.get(url).content\n image = Im...
[ "0.7684103", "0.7520165", "0.74877226", "0.7116487", "0.7027549", "0.7010515", "0.6980545", "0.6932684", "0.68663347", "0.680157", "0.6707649", "0.649833", "0.64743775", "0.64194036", "0.62737274", "0.62376577", "0.62025154", "0.61823267", "0.61713475", "0.61658984", "0.61528...
0.8368085
0
Do not return anything, modify board inplace instead.
def gameOfLife(self, board: List[List[int]]) -> None: self.board = board self.l = len(board) self.w = len(board[0]) status = [[0] * self.w for _ in range(self.l)] for i in range(self.l): for j in range(self.w): status[i][j] = self.statusUpdate(b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applyMove(self, (from_row,from_col), (to_row,to_col)):\n newboard = deepcopy(self)\n piece = newboard.board[from_row][from_col]\n newboard.board[from_row][from_col] = None\n newboard.board[to_row][to_col] = piece\n newboard.toplay = 'BLACK' if self.toplay == 'WHITE' else 'WHI...
[ "0.7664789", "0.70971596", "0.70476234", "0.7024398", "0.69861203", "0.6829364", "0.6778242", "0.6727011", "0.66938925", "0.6692377", "0.6625323", "0.6625323", "0.65893996", "0.6565318", "0.6564258", "0.65587217", "0.6539339", "0.65249294", "0.65223134", "0.6520972", "0.65202...
0.0
-1
Add user if not exists
def AddUser(effective_user, effective_chat): chatId = effective_chat.id chatType = effective_chat.type chatTitle = effective_chat.title userId = effective_user.id if chatId == userId: exists = session.query(User).filter_by(user_id=userId, group_id=None).one_or_none() group_exists = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addUser(User):\n # check if user already exists #\n user_exists = run('id -u %s >/dev/null 2>&1 || echo \"no\"' % (User))\n if user_exists == \"no\":\n sudo('useradd -m -c \"%s\" -s /bin/bash %s' % (agUsers[User], User))\n else:\n print \"[Info] User '%s' already exists on host '%s'\"...
[ "0.7453931", "0.74400806", "0.7315973", "0.72034574", "0.71068114", "0.70417374", "0.7041168", "0.6952933", "0.6949969", "0.6912825", "0.6909413", "0.68748516", "0.68633693", "0.6849981", "0.68408054", "0.6829215", "0.6801972", "0.68012327", "0.68012327", "0.68012327", "0.678...
0.0
-1
Called after the image sticher performs some work.
def post_work(self, frames_rec: int, frames_proc: int, nooo: int): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(self):\n pass", "def process(self, image):", "def do_stuff(self):\n self.create_tourism_raster()", "def post_process(self):\n pass", "def post_process(self):\n pass", "def post_process(self):\n pass", "def post_process(self):\n pass", "def p...
[ "0.7214914", "0.7196402", "0.6725398", "0.6696196", "0.6696196", "0.6696196", "0.6696196", "0.6696196", "0.6660734", "0.65854293", "0.6560694", "0.6550989", "0.65413284", "0.65371954", "0.6455175", "0.63938737", "0.63936543", "0.6379982", "0.6379982", "0.63412863", "0.6324683...
0.0
-1
Goes through and removes all values in frames_rec and frames_proc that are outside of the window
def clean_window(self) -> None: prune_before = time.time() - self.window_size while self.frames_rec: left = self.frames_rec.popleft() if left[1] >= prune_before: self.frames_rec.appendleft(left) break self.sum_frames_rec -= left[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_restriction_details(self):\n\t\n\t\tif getattr(self,'new_seq_win_objs',None):\n\t\t\tfor obj in self.new_seq_win_objs.keys():\n\t\t\t\tself.seqframe.delete(obj)\n\t\t\tself.new_seq_win_objs={}\n\t\t\tself.donepos={}\n\t\t\t#\n\t\t\tfor obj in self.temp_objs.keys():\n\t\t\t\tself.seqframe.delete(obj)\n\t\...
[ "0.6719497", "0.6220488", "0.6218328", "0.59831357", "0.5953131", "0.58991516", "0.58938974", "0.58484584", "0.58360916", "0.57718647", "0.5765755", "0.5718492", "0.56914794", "0.563131", "0.56236684", "0.56055874", "0.55914086", "0.5591337", "0.55780524", "0.5515344", "0.546...
0.7736172
0
Returns True if we have a full window of information available, False otherwise
def have_window(self) -> bool: return ( self._first_enc_at is not None and (time.time() > self._first_enc_at + self.window_size) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(self):\n if self.attributes[AT.GARBAGE]:\n return False\n if get_ticks() < self.attributes[AT.TIME_TO_BE_SHOWN]:\n return False\n return True", "def is_full(self) -> bool:", "def _can_render_now(self):\n # First check that no update events are pendin...
[ "0.6700973", "0.66572267", "0.65650487", "0.65073746", "0.644696", "0.6444967", "0.6371296", "0.63529104", "0.632829", "0.6322513", "0.629695", "0.6292452", "0.6283709", "0.6269726", "0.62444526", "0.62417144", "0.6239692", "0.6218333", "0.6218333", "0.62145", "0.6200358", ...
0.7614796
0
Returns the number of frames received per second and the number of frames processed per second in the current window.
def mean(self) -> typing.Tuple[float, float]: self.clean_window() return ( (self.sum_frames_rec / self.window_size), (self.sum_frames_proc / self.window_size) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_frames(self) -> int:\n return self.num_frames", "def frameTimes(self):\n sr = self.sampleRate\n offset = self.activeOffset\n stride = self.activeStride\n nf = self.numFrames\n t = np.arange(nf) * (stride[0] / sr) + (offset / sr)\n return t", "def F...
[ "0.78337723", "0.7294236", "0.713848", "0.7087923", "0.7029475", "0.7021391", "0.70037943", "0.6973596", "0.6899183", "0.68941", "0.6872302", "0.6869656", "0.6807797", "0.68056464", "0.6759291", "0.6744807", "0.6681289", "0.66297203", "0.66244495", "0.66077125", "0.65771705",...
0.0
-1
Spawns the ffmpeg process
def _spawn_ffmpeg(self) -> None: if self.ffmpeg_proc is not None: raise RuntimeError('_spawn_ffmpeg called when ffmpeg_proc is ' + f'{self.ffmpeg_proc} (not None)') args = ['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', f'{self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self) -> None:\r\n self._spawn_ffmpeg()", "def ffmpeg(*options):\n\tffmpeg_command = [\"ffmpeg\"] + list(options)\n\tprint(\"Calling FFMPEG:\", \" \".join(ffmpeg_command))\n\n\tprocess = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE)\n\t(cout, cerr) = process.communicate()\n\texit_code...
[ "0.80590403", "0.70434517", "0.6731381", "0.6610697", "0.65816295", "0.638432", "0.62684786", "0.61771494", "0.61691076", "0.61160266", "0.60946435", "0.6022187", "0.60099894", "0.5973808", "0.59619623", "0.5928561", "0.59079623", "0.5861136", "0.5848352", "0.582267", "0.5821...
0.81389457
0
Cleans up the ffmpeg process. This will wait for it to terminate
def _cleanup_ffmpeg(self) -> None: self.ffmpeg_proc.communicate() self.ffmpeg_proc = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def async_stop_ffmpeg(self):\n return self.ffmpeg.close()", "def _cleanup_proc(self):\n logger.debug(\"{}: Cleaning up and waiting for process to exit\".format(\n self))\n try:\n self._loop.remove_reader(self....
[ "0.731078", "0.6837441", "0.6784892", "0.6526165", "0.6473467", "0.6470982", "0.632042", "0.63029844", "0.6262408", "0.6260875", "0.61485505", "0.61473036", "0.60400724", "0.60322404", "0.6029492", "0.6027344", "0.6026851", "0.6022948", "0.5987162", "0.59848726", "0.59642464"...
0.86087924
0
Prepares this image sticher to begin. Receive queues may still be added or removed at any time.
def start(self) -> None: self._spawn_ffmpeg()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_images(self):\n\n qt_original_image = self.convert_image_to_QTformat(self.original_image)\n self.send_original_photo_to_gui.emit(qt_original_image)\n\n self.processed_image = self.procces_image(self.original_image)\n qt_processed_image = self.convert_image_to_QTformat(self.p...
[ "0.634032", "0.607448", "0.60480696", "0.6037353", "0.6015708", "0.5867834", "0.5867834", "0.5867834", "0.5867066", "0.58492875", "0.5788658", "0.56946063", "0.5655614", "0.562711", "0.5624617", "0.56243294", "0.5615637", "0.55929005", "0.5559435", "0.5555809", "0.55425805", ...
0.0
-1
Registers the specified queuelike object as something frames can be received from. Must have a get_nowait and empty member.
def register_queue(self, queue) -> None: if queue is None: raise ValueError('queue is None') if not hasattr(queue, 'empty'): raise ValueError(f'queue {queue} is missing empty member') if not hasattr(queue, 'get_nowait'): raise ValueError(f'queue {queue} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_queue_declared(frame):\n start_consuming(frame)", "def example(example_object, queue):\n queue.put(example_object)", "def example(example_object, queue_object):\n queue_object.put(example_object)", "def on_queue_declared(frame):\n channel.basic_consume(handle_delivery, queue='test')", "d...
[ "0.66028094", "0.629318", "0.61060864", "0.597517", "0.580639", "0.5723007", "0.5670818", "0.565421", "0.55929124", "0.5555419", "0.55552125", "0.5430858", "0.5422504", "0.54204226", "0.5383923", "0.5375583", "0.5371588", "0.5342425", "0.5279118", "0.5275986", "0.5268184", ...
0.69833153
0
Removes the given queuelike object from this. Uses the same comparison as list.remove. Raises ValueError if the queue is not currently being used to fetch frames.
def remove_queue(self, queue) -> None: self.receive_queues.remove(queue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self) -> T:\n if not self.is_empty():\n return self._queue.pop()", "def remove_queue(self, queue):\n with self.mutex:\n self.queues.remove(queue)", "def remove(self, index):\n if index < 0 or index >= len(self):\n raise AttributeError(\"i must be...
[ "0.7187264", "0.6991843", "0.69270307", "0.6874676", "0.66540396", "0.65354115", "0.6491751", "0.6465907", "0.64182615", "0.6388193", "0.6382077", "0.63798213", "0.6345612", "0.632236", "0.63211536", "0.6297915", "0.62840116", "0.62811065", "0.6269877", "0.62553895", "0.62484...
0.6955731
2
Checks for items from each of the receive queues and pushes them onto the local memory dict. Returns the number of frames received
def check_queues(self) -> int: nframes = 0 for queue in self.receive_queues: if not queue.empty(): nframes += 1 frame, img_bytes = queue.get_nowait() if frame < self.next_frame: raise ValueError('received frame ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_queues(self):\n\t\t#queues = [get_queue(lane) for lane in self.Vissim_Lanes]\n\t\t\n\t\tqueues = [0. if queue.AttValue('QLen(Current, Last)') is None else queue.AttValue('QLen(Current, Last)') for queue in self.queues_counters]\n\t\treturn queues", "def queue_lengths(self):\r\n out = []\r\n ...
[ "0.58479637", "0.58138037", "0.5686759", "0.55891025", "0.5548044", "0.55331", "0.5531125", "0.55247325", "0.5522078", "0.55212706", "0.55021536", "0.5491394", "0.54898417", "0.5464607", "0.54142845", "0.54142845", "0.54142845", "0.54142845", "0.54142845", "0.54142845", "0.54...
0.7559541
0
Processes the next frame to the ffmpeg process if it is available. Returns True if we processed a frame, False if we did not.
def process_frame(self) -> bool: if self.next_frame not in self.ooo_frames: return False img_bytes = self.ooo_frames.pop(self.next_frame) for kb_start in range(0, len(img_bytes), self.block_size): self.ffmpeg_proc.stdin.write( img_bytes[kb_start:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, frame, metadata):\n self.log.debug(f\"In process() method...\")\n\n # Publishing metadata & frames\n self.publisher.publish((metadata, frame.tobytes(),))\n metadata, frame = self.subscriber.recv()\n\n if \"jpnb_frame_drop\" in metadata:\n del metadata...
[ "0.681551", "0.62653166", "0.62197095", "0.62151057", "0.6016715", "0.5888307", "0.585658", "0.5855879", "0.58241194", "0.57367325", "0.5663488", "0.565733", "0.561935", "0.5575768", "0.55190694", "0.54909426", "0.5479278", "0.547769", "0.54572225", "0.54553086", "0.54294866"...
0.8323678
0
A catchall function to do some work. Returns True if some work was done, False otherwise
def do_work(self): recv = self.check_queues() proc = 1 if self.process_frame() else 0 for perf in self.perfs: perf.post_work(recv, proc, len(self.ooo_frames)) return recv > 0 or proc > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doWork(self) -> bool:\n # grab a job from queur\n self.lock.acquire ()\n jobId = self.nextJob\n self.nextJob = jobId + 1\n self.lock.release ()\n\n # abort if no jobs are left\n if jobId >= len (self.jobs):\n return False\n\n # execute job\n ...
[ "0.6764182", "0.6484873", "0.63052315", "0.6302114", "0.6237362", "0.6228252", "0.6161876", "0.6097608", "0.5983474", "0.5931103", "0.5929668", "0.5917428", "0.5846048", "0.58357775", "0.58357775", "0.58357775", "0.5820937", "0.581694", "0.5782128", "0.57802105", "0.5778865",...
0.5947233
9
redirect to login page
def login(): login_page = Login() login_page.login_main_page()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_redirect(request):\n return HttpResponseRedirect('/login')", "def login():\n return redirect(build_authorize_url())", "def login(request):\n return HttpResponseRedirect('/')", "def login(self) -> redirect:\n\t\tif self.is_authorized:\n\t\t\tflash(\"You are already logged in.\")\n\t\t\tretu...
[ "0.80341816", "0.7834743", "0.7738441", "0.75973696", "0.7556122", "0.7555812", "0.7506934", "0.74773985", "0.7468347", "0.7450045", "0.74444264", "0.743553", "0.7387644", "0.73819023", "0.7376208", "0.73413944", "0.72765326", "0.72681993", "0.7236252", "0.7228724", "0.722632...
0.6780875
90
Register the new user
def registration(): registration_page = Registration() registration_page.registration_main_page()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user():\n pass", "def register_user(self):\n User.add_user(User(self.email.data, self.password.data))", "def register():\n insert_user(json_body())\n try:\n db.session.commit()\n except IntegrityError:\n raise exc.CouldNotCreateEntry()\n\n return jsonify({'messa...
[ "0.8750097", "0.8606665", "0.820681", "0.79145604", "0.7867718", "0.779165", "0.77669674", "0.7759361", "0.77407837", "0.77339166", "0.7713933", "0.7711798", "0.77113533", "0.7702676", "0.7689713", "0.7675305", "0.7671336", "0.7657973", "0.7636853", "0.7630487", "0.7598397", ...
0.0
-1
get the params value
def paramValue(self, key): return self.options[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParam(self, params, name):\n return params.get(name)", "def getParameter(self, name):", "def get_params(self):", "def get_param(self, param):\n return self.params.get(param, None)", "def get(self):\n return self._params", "def getParam(self,param):\n if param in self.params...
[ "0.77904546", "0.7687604", "0.7684831", "0.76296043", "0.75449836", "0.7464194", "0.7336356", "0.7303772", "0.7257967", "0.7243042", "0.71784574", "0.7160648", "0.71456605", "0.71456605", "0.7134405", "0.7133184", "0.7111483", "0.7111483", "0.7111483", "0.7085192", "0.7066033...
0.6697429
46
get the param object
def param(self, *args, **kwargs): return self.options.param(*args,**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParam(self,param):\n if param in self.params.keys():\n return self.params[param]\n else:\n return None", "def get_params(self):", "def get_param(self, param):\n return self.params.get(param, None)", "def param(self):\n return self._param", "def getPa...
[ "0.76784503", "0.7652682", "0.7514661", "0.75113237", "0.7407263", "0.7306728", "0.71759325", "0.7116908", "0.71134484", "0.70567626", "0.7050655", "0.6953516", "0.69525486", "0.6947529", "0.6942389", "0.6929406", "0.6917862", "0.6917862", "0.6917862", "0.6898828", "0.6887106...
0.74724686
4
Helping function to get the color of the dock
def _getDockColor(self, plane): color = (0,0,0) if plane.zAxis != -1: color = self.globalAxis[plane.zAxis].color[0:3] return color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(self):\n return self.container['color']", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def get_color(self):\n self.view.prese...
[ "0.7055499", "0.6641315", "0.6641315", "0.6641315", "0.6641315", "0.662588", "0.6576148", "0.6518216", "0.65073246", "0.65073246", "0.65073246", "0.650731", "0.64849645", "0.6471284", "0.64579517", "0.6433993", "0.6423269", "0.64182955", "0.639525", "0.6385216", "0.63695", ...
0.7151222
0
Helping function to place the docks
def _placeDock(self, dock, pos=None, otherDock=None): if otherDock is not None and pos is not None: self.area.addDock(dock,pos,otherDock) elif pos is not None: self.area.addDock(dock,pos,otherDock) else: self.area.addDock(dock) return dock
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def placeOrder(self, dish):\n # Get a random waiter\n waiter = choice(self.waiters)\n # Place the order, returning the result\n food = waiter.takeOrder(dish, self.chefs)\n return food", "def place_dungeon_items(self):\r\n self.place_entrance()\r\n self.place_exit(...
[ "0.53520143", "0.5322772", "0.5258693", "0.521382", "0.50301754", "0.50091743", "0.5002837", "0.49934033", "0.4981615", "0.49582452", "0.49508584", "0.49172708", "0.49121922", "0.49081165", "0.48742324", "0.48737693", "0.4866753", "0.48548388", "0.48385", "0.48325017", "0.482...
0.4883966
14
Called to return the list of groups to automatically add/remove this connection to/from.
def connection_groups(self, **kwargs): return ["listener-%s" % self.path[1:]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self):\n return []", "def get_groups_connection(self):\n return self.m_connection.groups", "def getGroups(self):\n return [g[0] for g in grp.getgrall()]", "def get_pingroups(self):\n return self.groups[:]", "def getGroups():\r\n return Group.getGroups()", "de...
[ "0.7407197", "0.73968863", "0.7091112", "0.70297974", "0.6961423", "0.68978125", "0.68090963", "0.6806716", "0.6790244", "0.6771468", "0.6655087", "0.6637095", "0.66344905", "0.66344905", "0.66344905", "0.66318434", "0.6562618", "0.6541859", "0.64721674", "0.6461446", "0.6457...
0.7185008
2
Perform things on connection start
def connect(self, message, **kwargs): Group("radio-listeners").add(message.reply_channel) message.reply_channel.send({"accept": True}) # immidiately send events for song status track_name, track_author, track_comment = get_current_track_info() events = [ { 't...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.conn.start()", "def init_connection(self, connection):", "def on_connection_start(self) -> None:\r\n print(\r\n \"Connected with: {}:{}\\n\".format(\r\n self.connection_info[\"host\"], self.connection_info[\"port\"]\r\n )\r\n )",...
[ "0.7554287", "0.75064856", "0.74878454", "0.74447787", "0.73129517", "0.73129517", "0.73129517", "0.73129517", "0.73129517", "0.73129517", "0.73129517", "0.73129517", "0.7308945", "0.72731483", "0.72653943", "0.72329885", "0.72232544", "0.71871233", "0.71843165", "0.7163643", ...
0.0
-1
Called when a message is received with decoded JSON content
def receive(self, content, **kwargs): print(content) dispatch(content, self.path[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_message(self, message):\n print(\"RECEIVED on \" + self.session_name + \":\")\n message_json = json.loads(message)\n print(json.dumps(message_json, sort_keys=True, indent=2, separators=(',', ':')))\n\n for singleMsg in message_json:\n self._process_message(singleMsg)"...
[ "0.7854412", "0.76435155", "0.76435155", "0.7386805", "0.7192146", "0.71768695", "0.7144816", "0.7113034", "0.7106444", "0.7081956", "0.7069198", "0.7044991", "0.69177085", "0.69148946", "0.69056135", "0.68867594", "0.68732697", "0.6862182", "0.6853316", "0.6838448", "0.68328...
0.61205995
88
Perform things on connection close
def disconnect(self, message, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connection_closed(self):", "def close(self): \n\t\tself.connection = None", "def end(self):\n if self.conn:\n self.conn.close()\n self.conn = None\n #print(\"closed.\")", "def _on_connection_close(self):\n print(\"connection was closed, reconnecting...\")...
[ "0.8287754", "0.82687026", "0.8102429", "0.80203164", "0.80165076", "0.7942211", "0.7918457", "0.7875925", "0.78517574", "0.78462976", "0.781964", "0.7806219", "0.7805812", "0.78015393", "0.77674127", "0.7762862", "0.7762862", "0.77322", "0.77268296", "0.7720061", "0.7715943"...
0.0
-1
Simple exercise of the commandline mode
def test_script(self): f1 = self.write_file("foobar") f2 = self.write_file("foobarbaz") out = io.BytesIO() ghdiff.main([f1, f2], stdout=out) output = out.getvalue() self.assertTrue(b"-foobar" in output) self.assertTrue(b'+foobar<span class="highlight">baz</span>' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli() -> None:", "def cli() -> None:", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():"...
[ "0.7687243", "0.7687243", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "0.7510942", "...
0.0
-1
Simple test for nocss option
def test_no_css_option(self): f1 = self.write_file("foobar") f2 = self.write_file("foobarbaz") out = io.BytesIO() ghdiff.main([f1, f2, "--no-css"], stdout=out) output = out.getvalue() self.assertFalse(b"<style" in output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_checkCustoms(self):\n self.failUnlessEqual(self.nice.opts['myflag'], \"PONY!\")\n self.failUnlessEqual(self.nice.opts['myparam'], \"Tofu WITH A PONY!\")", "def nox(c, s=''):\n if not s:\n c.run('nox --list')\n else:\n c.run(f'nox -s {s}')", "def test_get_option_exist(...
[ "0.6366742", "0.627073", "0.61997247", "0.6189137", "0.60918605", "0.60011894", "0.5984865", "0.5972409", "0.5784358", "0.57673573", "0.57223225", "0.5683754", "0.5679617", "0.567664", "0.56709033", "0.56357384", "0.5614824", "0.5604445", "0.5579641", "0.55726093", "0.5570491...
0.0
-1
Base `class` for all spiders. It implements a bunch of methods that are reused by child classes. Also, defines an `abstractmethod` that needs to implemented.
def __init__( self, timestamp: datetime, start_urls: Optional[Union[str, List[str]]] = None, category: Optional[str] = None, gender: Optional[str] = None, consumer_lifestage: Optional[str] = None, search_term: Optional[str] = None, meta_data: Optional[Unio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abstract(f):\r\n\tdef raiser(*args,**kargs):\r\n\t\traise Exception('Abstract function must be overridden by a child class before being called')\r\n\treturn raiser", "def __init__(self):\n self.SPIDER = \"spider\"", "def use_abstract_base_class_one():\r\n print(\"* use_abstract_base_class_one() *...
[ "0.5925785", "0.5669243", "0.55507463", "0.54713047", "0.53880554", "0.5317189", "0.5303386", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", "0.52768236", ...
0.0
-1
Helper method to parse start_urls.
def parse_urls(start_urls: Union[str, List[str]]) -> List[str]: if not ( (type(start_urls) == str) or ((type(start_urls) == list) and (all([type(x) == str for x in start_urls]))) ): error_message = ( "Argument 'start_urls' need to be of type list or (c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_start_url(self, response):\n self.parse_obj(response)", "def start_requests(self):\n for url in self.start_urls:\n yield scrapy.Request(url, callback=self.parse)", "def start_requests(self):\n url = self.start_urls[0]\n yield scrapy.Request(url=url, callback=sel...
[ "0.7345545", "0.66011286", "0.653537", "0.6299785", "0.61055857", "0.60630804", "0.60070723", "0.59906334", "0.5949757", "0.5919338", "0.5888575", "0.5851758", "0.58476037", "0.5839682", "0.5839238", "0.5828793", "0.58075947", "0.57936287", "0.57855034", "0.5766114", "0.57447...
0.638832
3
Helper method to parse meta_data.
def parse_meta_data(meta_data: Union[Dict[str, str], str, None]) -> Union[dict, None]: if meta_data: meta_data = json.loads(meta_data) if isinstance(meta_data, str) else meta_data # type: ignore # noqa if isinstance(meta_data, dict): return meta_data else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_metadata(self, meta):\r\n output = {}\r\n for name, value in meta.items():\r\n name = name.lower()\r\n if name == \"summary\":\r\n # handle summary metadata as markdown\r\n # summary metadata is special case and join all list values\r\n ...
[ "0.746068", "0.6892583", "0.6836341", "0.66852564", "0.66316384", "0.6485698", "0.647439", "0.64668316", "0.636508", "0.6314219", "0.62637264", "0.6242225", "0.6163834", "0.61158377", "0.60986596", "0.60902125", "0.60852194", "0.6082936", "0.60725725", "0.6046314", "0.6040117...
0.6533727
5
The `Scrapy` framework executes this method. If start_urls are set, the spider will just crawl the specified urls. If no start_urls are specified (default) the spider will read all settings from its respective start_script file and generate start_requests.
def start_requests(self) -> Iterator[SplashRequest]: def get_request_specific_parameters() -> dict: if self.StartRequest == SplashRequest: return { "endpoint": "execute", "args": { # passed to Splash HTTP API "wait": s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_requests(self):\n for url in self.start_urls:\n yield scrapy.Request(url, callback=self.parse)", "def start_requests(self):\r\n try:\r\n\r\n for url in self.start_urls:\r\n yield scrapy.Request(url,\r\n callback=self...
[ "0.7262331", "0.7171378", "0.71610796", "0.69475484", "0.67612314", "0.6699213", "0.6567548", "0.65054625", "0.6427605", "0.6386813", "0.63609964", "0.63548535", "0.61784303", "0.616039", "0.6143129", "0.6100814", "0.5984085", "0.5961182", "0.59141284", "0.58525497", "0.58159...
0.6329376
12
Helper method for child classes. Simply instantiates a `SrapedPage` object and enqueues this to the scraping `Queue`.
def _save_SERP( self, response: Union[SplashJsonResponse, ScrapyHttpResponse, ScrapyTextResponse] ) -> None: scraped_page = ScrapedPage( timestamp=self.timestamp, source=self.source, merchant=self.merchant, country=self.country, url=respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enqueue(self, page):\n self._queue.append(page)", "def get_page_queue(url, queue):\n queue.put(urlopen(url).read())\n return None", "def _add_page_to_rank_queue(self, page):\n with Spider.processed_urls_lock:\n if page and page.url not in self.processed_urls:\n ...
[ "0.71564823", "0.6373749", "0.6046783", "0.59380674", "0.59113616", "0.5907949", "0.5791702", "0.5763333", "0.56091076", "0.55656135", "0.555843", "0.5536511", "0.55028975", "0.54806", "0.5454422", "0.54259396", "0.5412631", "0.54105043", "0.5390186", "0.5362956", "0.53565854...
0.59851176
3
Helper method for child classes. Simply instantiates a `SrapedPage` object and enqueues this to the scraping `Queue`.
def parse_PRODUCT(self, response: Union[SplashJsonResponse, ScrapyHttpResponse]) -> None: if meta_information := response.meta.get("meta_data"): meta_information |= response.meta.get("request_meta_information", {}) else: meta_information = response.meta.get("request_meta_informa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enqueue(self, page):\n self._queue.append(page)", "def get_page_queue(url, queue):\n queue.put(urlopen(url).read())\n return None", "def _add_page_to_rank_queue(self, page):\n with Spider.processed_urls_lock:\n if page and page.url not in self.processed_urls:\n ...
[ "0.7156211", "0.63737756", "0.6048151", "0.59868485", "0.5938351", "0.591402", "0.59112746", "0.5795364", "0.5764445", "0.5610664", "0.55691767", "0.5559017", "0.5537731", "0.55032164", "0.5480359", "0.54554003", "0.5425501", "0.541318", "0.5411602", "0.53905827", "0.5363092"...
0.0
-1
Abstract method forces child classes to implement this. It is responsible for yielding new `SplashRequest` for each product on the `response` page and use pagination to the new result page (a.k.a `SERP`).
def parse_SERP(self, response: SplashJsonResponse) -> Iterator[SplashRequest]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, response):\n product_urls = response.css(\n '.product-li .product-image a::attr(href)'\n ).getall()\n for product_url in product_urls:\n yield scrapy.Request(response.urljoin(product_url), self.parse_product)\n\n\n next_page_number = 2\n if '...
[ "0.69253975", "0.6723404", "0.6673714", "0.66428447", "0.66276383", "0.6357844", "0.6292618", "0.6221962", "0.6189304", "0.6114769", "0.61069465", "0.6071867", "0.59653133", "0.5960233", "0.5958122", "0.59552586", "0.59454393", "0.5938231", "0.5937393", "0.59161866", "0.59145...
0.6265049
7
Helper method to create default request meta. All 'SERP' and 'PRODUCT' requests need to " "implement this. It will propagate the meta information from the original/ parent request " "to the child requests.
def create_default_request_meta( response: Union[ScrapyTextResponse, ScrapyHttpResponse], original_url: Optional[str] = None ) -> Dict: return { "original_URL": original_url if original_url else response.url, "category": response.meta.get("category"), "gender": r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_info(self, request):\n\n\t\t# We have to re-resolve the request path here, because the information\n\t\t# is not stored on the request.\n\t\tview, args, kwargs = resolve(request.path)\n\t\tfor i, arg in enumerate(args):\n\t\t\tkwargs[i] = arg\n\n\t\tparameters = {}\n\t\tparameters.update(kwargs)\n\t\tp...
[ "0.5762792", "0.56348234", "0.56074893", "0.55480593", "0.55469114", "0.5497104", "0.5468277", "0.54309773", "0.54052013", "0.5381905", "0.537283", "0.53606224", "0.5316467", "0.5299309", "0.5298441", "0.5293145", "0.52903724", "0.5282184", "0.52806866", "0.5275312", "0.52701...
0.7019134
0
Check if a user is stored in the database with the given ID.
def userIDExists(self, id : int) -> bool: return id in self.users.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasUser(self, id):\n try:\n self.getUser(id)\n return True\n except KeyError:\n return False", "def checkIfUserExists(self, userID):\n return self.db.select_user(userID)", "def exists(cls, user_id):\n user_id = int(user_id)\n user = DB_...
[ "0.7826322", "0.7779238", "0.7474107", "0.7306266", "0.7229806", "0.7166336", "0.6960701", "0.68470055", "0.680666", "0.66621155", "0.664354", "0.6635361", "0.6557324", "0.6557324", "0.65509564", "0.65507483", "0.6542062", "0.650547", "0.6498227", "0.64851344", "0.646647", ...
0.76288635
2
Check if a given bbUser object is stored in the database. Currently only checks if a user with the same ID is stored in the database, not if the objects are the same.
def userObjExists(self, user : bbUser.bbUser) -> bool: return self.userIDExists(user.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_in_db(self) -> bool:\n query = \"\"\"SELECT * \n FROM Users \n WHERE Username=?;\"\"\"\n return len(self.db.fetchall(query, values=(self.username,))) > 0", "def isOwner(id, userId):\n db = core.connect()\n return db[id][\"createdBy\"] == userId",...
[ "0.66454977", "0.6629096", "0.6502776", "0.64873165", "0.6384", "0.63549405", "0.634741", "0.6321379", "0.63175", "0.63037634", "0.62980324", "0.6297806", "0.6245325", "0.62262326", "0.62138486", "0.62071496", "0.6190167", "0.6176963", "0.616143", "0.615577", "0.6141846", "...
0.7575999
0
Internal function to assert the type of and, potentially cast, an ID.
def validateID(self, id : int) -> int: # If ID is a string, ensure it can be casted to an int before casting and returning. if type(id) == str: if not lib.stringTyping.isInt(id): raise TypeError("user ID must be either int or string of digits") return int(id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_type(self):\n\n base_model = BaseModel()\n self.assertTrue(base_model.id, str)", "def check_id(self, id):", "def test_data_type_id(self):\n self.assertTrue(self.tester.data_type(ret_id=True), 2)", "def test_convert_id():", "def test_init_id_identity(self):\n self.ass...
[ "0.6917475", "0.6664331", "0.65523475", "0.6467995", "0.64658165", "0.6458434", "0.62941015", "0.62888676", "0.6277681", "0.62713206", "0.61878324", "0.6169987", "0.61562884", "0.61032397", "0.59731686", "0.5968201", "0.5962869", "0.5944459", "0.59211767", "0.59169257", "0.59...
0.5899975
21
Reset the stats for the user with the specified ID.
def reinitUser(self, id : int): id = self.validateID(id) # ensure the ID exists in the database if not self.userIDExists(id): raise KeyError("user not found: " + str(id)) # Reset the user self.users[id].resetUser()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_reset(self):\n self.stats.reset()", "def stats_reset(self):\n self.stats.reset()", "def reset_stats(self):\n print(\"Reseting stats\")\n self.player_lives = self.ai_stts.player_lives\n self.score = 0\n self.level = 1", "def resetUser(self):\n\t\turl = \"htt...
[ "0.6416", "0.6416", "0.63771105", "0.6241124", "0.6069007", "0.6018874", "0.6008657", "0.5996576", "0.59836346", "0.59318155", "0.5928619", "0.5910059", "0.5876897", "0.58712983", "0.58664316", "0.58137023", "0.5787853", "0.5773324", "0.5766223", "0.5684285", "0.5558619", "...
0.694401
0
Create a new bbUser object with the specified ID and add it to the database
def addUser(self, id : int) -> bbUser.bbUser: id = self.validateID(id) # Ensure no user exists with the specified ID in the database if self.userIDExists(id): raise KeyError("Attempted to add a user that is already in this bbUserDB") # Create and return a new user new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user_by_id(cls, m_id):", "def saveNewUser(self, userID):\n self.db.insert_new_user(userID)", "def fusion_api_add_user(self, body, api=None, headers=None):\n return self.user.create(body, api, headers)", "def create_user():\n new_user = User(id=login_session['gplus_id'],\n ...
[ "0.71949327", "0.7119717", "0.6967095", "0.6960353", "0.69133216", "0.6906858", "0.6867741", "0.68506837", "0.684258", "0.682456", "0.6823309", "0.6796022", "0.67648846", "0.67618465", "0.6743965", "0.6695233", "0.6691359", "0.6680211", "0.6674689", "0.66608787", "0.6653089",...
0.78019196
0
Store the given bbUser object in the database
def addUserObj(self, userObj : bbUser.bbUser): # Ensure no bbUser exists in the db with the same ID as the given bbUser if self.userIDExists(userObj.id): raise KeyError("Attempted to add a user that is already in this bbUserDB: " + str(userObj)) # Store the passed bbUser self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user(self):\n db.session.add(self)\n db.session.commit()", "def save_user(user):\n User.save_user(user)", "def write_user(self, _user):\n try:\n self.conn_cursor.execute(\"INSERT INTO users (id,bank) VALUES (?, ?)\", (_user.id, _user.bank))\n except sqlite3.In...
[ "0.778756", "0.7689327", "0.76267", "0.7370468", "0.7265316", "0.7023805", "0.6962059", "0.6888581", "0.6867369", "0.6859548", "0.6841464", "0.6841464", "0.68113154", "0.67926407", "0.67926407", "0.67617935", "0.6744484", "0.6736218", "0.6716842", "0.6694753", "0.66884285", ...
0.7119752
5
If a bbUser exists in the database with the requested ID, return it. If not, create and store a new bbUser and return it.
def getOrAddID(self, id : int) -> bbUser.bbUser: return self.getUser(id) if self.userIDExists(id) else self.addUser(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]", "def addUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n # Ensure no user exists with the specified ID in the database\n if self.userIDExists(id):\n ...
[ "0.71380436", "0.7094037", "0.70649517", "0.6900218", "0.68044686", "0.67403007", "0.6731143", "0.67079204", "0.6696172", "0.6682262", "0.6681719", "0.6681719", "0.6681719", "0.6681719", "0.6681203", "0.666396", "0.6660379", "0.66603625", "0.6650168", "0.6632992", "0.6603484"...
0.797189
0
Fetch the bbUser from the database with the given ID.
def getUser(self, id : int) -> bbUser.bbUser: id = self.validateID(id) return self.users[id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_user(self, id: utils.Intable) -> User | None:\n id64 = make_id64(id=id, type=Type.Individual)\n return await self._connection.fetch_user(id64)", "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def load_user(id):\n return User.query.get(int(id))", "def load_us...
[ "0.8142412", "0.7948193", "0.79404026", "0.79404026", "0.79404026", "0.79404026", "0.7924561", "0.7899446", "0.7896432", "0.7849403", "0.78431547", "0.78220767", "0.78131187", "0.7770938", "0.7769073", "0.77454466", "0.77377176", "0.7650907", "0.7642752", "0.7618635", "0.7615...
0.8525421
0
Get a list of all bbUser objects stored in the database
def getUsers(self) -> List[bbUser.bbUser]: return list(self.users.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_users(db):\n return list(db['user'].find())", "def get_all_users():\n db = api.db.get_conn()\n return list(db.users.find({}, {\"_id\": 0, \"password_hash\": 0}))", "def get_users():\n\n return User.query.all() # [<User user_id=1 fname=Alice lname=Apple>]", "def get_all_users():", "def...
[ "0.8300631", "0.77812666", "0.77371156", "0.7678607", "0.76764804", "0.7638404", "0.75855684", "0.75751007", "0.75272286", "0.7521709", "0.75214297", "0.74901927", "0.7472128", "0.74240303", "0.7348471", "0.7340735", "0.7311398", "0.72926855", "0.72752255", "0.72612697", "0.7...
0.75356483
8
Get a list of all user IDs stored in the database
def getIds(self) -> List[int]: return list(self.users.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_ids(self):\n return list(self.get_users())", "def get_id_users(self):\n return self.execute(TABELLE['id_users']['select']['all'])", "def get_uids():\n DB_NAME = 'cloud_storage.db'\n DB_DIRECTORY = 'server_side_storage/'\n db = sqlite3.connect('{}{}'.format(DB_DIRECTORY, DB_NAME)...
[ "0.83350194", "0.83074826", "0.8069338", "0.7976568", "0.78300416", "0.7765191", "0.7542464", "0.7480183", "0.74640286", "0.7435473", "0.74341965", "0.74210936", "0.7396314", "0.7283571", "0.71906507", "0.7168802", "0.7152981", "0.71111584", "0.71046853", "0.70904654", "0.708...
0.8086009
2
Serialise this bbUserDB into dictionary format.
def toDict(self, **kwargs) -> dict: data = {} # Iterate over all user IDs in the database for id in self.getIds(): # Serialise each bbUser in the database and save it, along with its ID to dict # JSON stores properties as strings, so ids must be converted to str first. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user2dict(self):\n d = {}\n d['username'] = self.username\n d['level'] = self.level\n d['name'] = self.name\n d['email'] = self.email\n d['creation'] = self.creation\n d['update'] = self.update\n d['nsentences'] = self.nsentences\n d['nsessions'] =...
[ "0.73725003", "0.72896534", "0.71920073", "0.71753246", "0.716274", "0.7151962", "0.71234363", "0.7105887", "0.7040066", "0.69651514", "0.6952894", "0.6938799", "0.6933408", "0.6907724", "0.68980014", "0.68346447", "0.6777401", "0.67636013", "0.6733848", "0.67159617", "0.6711...
0.7482245
0
Get summarising information about this bbUserDB in string format. Currently only the number of users stored.
def __str__(self) -> str: return "<bbUserDB: " + str(len(self.users)) + " users>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_get_str(self):\n return self.stats.get_all_str()", "def stats_get_str(self):\n return self.stats.get_all_str()", "def to_string(self):\n return \"User: {} Description: {} Ratings: {}\".format(self.id_user, self.description, self.ratings)", "def get_stats(self):\n result ...
[ "0.6607278", "0.6607278", "0.65238464", "0.6518738", "0.6509178", "0.6467798", "0.641684", "0.6371659", "0.62588465", "0.6195195", "0.61339843", "0.6110665", "0.6098782", "0.6087525", "0.60621756", "0.60452694", "0.60246444", "0.60194707", "0.6006507", "0.6000051", "0.5972194...
0.76016575
0
Construct a bbUserDB from a dictionaryserialised representation the reverse of bbUserDB.toDict()
def fromDict(cls, userDBDict : dict, **kwargs) -> bbUserDB: # Instance the new bbUserDB newDB = bbUserDB() # iterate over all user IDs to spawn for id in userDBDict.keys(): # Construct new bbUsers for each ID in the database # JSON stores properties as strings, so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt: dict) -> 'UserBase':\n return util.deserialize_model(dikt, cls)", "def toDict(self, **kwargs) -> dict:\n data = {}\n # Iterate over all user IDs in the database\n for id in self.getIds():\n # Serialise each bbUser in the database and save it, along ...
[ "0.67769945", "0.6622561", "0.65516293", "0.63922143", "0.63320786", "0.62116504", "0.6042782", "0.6004884", "0.5900546", "0.5864641", "0.5853948", "0.578413", "0.5688235", "0.5666956", "0.56637603", "0.5660747", "0.5650265", "0.5648268", "0.56327444", "0.5618494", "0.560434"...
0.71973324
0
set up for test
def setUpClass(cls): cls.user = User() cls.user.first_name = "Kev" cls.user.last_name = "Yo" cls.user.email = "1234@yahoo.com" cls.storage = db_storage()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup( self ):", "def setup(self) -> None:", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def _setup(self):", "def _setup(self):", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "...
[ "0.8239149", "0.81545687", "0.7943907", "0.7943907", "0.7942225", "0.7942225", "0.79307884", "0.7923598", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908888", "0.7908776", ...
0.0
-1
at the end of the test this will tear it down
def teardown(cls): del cls.user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown(self) -> None:", "def teardown(self) -> None:", "def teardown(self) -> None:", "def teardown(self):", "def teardown(self):", "def teardown(self):", "def teardown(self):\n pass", "def teardown(self):\n pass", "def teardown(self):\n pass", "def teardown(self) -> No...
[ "0.91463774", "0.91463774", "0.91463774", "0.9129943", "0.9129943", "0.9129943", "0.90080214", "0.90080214", "0.90080214", "0.8812721", "0.8812721", "0.86614734", "0.8510095", "0.8510095", "0.8370365", "0.8370365", "0.8370365", "0.83670706", "0.83619934", "0.83339196", "0.831...
0.0
-1
Screen with calendar for one month
def create_month_scr(self, month, toogle_today=False): scr = Screen() m = self.month_names_eng[self.active_date[1] - 1] scr.name = "%s-%s" % (m, self.active_date[2]) # like march-2015 # Grid for days grid_layout = GridLayout(cols=7, rows=7, size_hint=(1, 1), pos_hint={"top": 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_cal(request, year=None, month=None):\n if year == None:\n # get the current comic as a starting point\n lToday = Comic.objects.filter(published=True).order_by('-date')[0].date\n year = lToday.year\n month = lToday.month\n\n return calendar(request, year, month)", "def m...
[ "0.73538274", "0.6901004", "0.6769055", "0.6733737", "0.6690152", "0.65959895", "0.65230334", "0.6518159", "0.64170593", "0.63540894", "0.6350945", "0.6336885", "0.6195404", "0.6162957", "0.61168915", "0.60795885", "0.6076546", "0.60162735", "0.59980357", "0.59725446", "0.595...
0.7408204
0
Prepare data for showing on widget loading
def prepare_data(self): # Get days abbrs and month names lists self.month_names = cal_data.get_month_names() self.month_names_eng = cal_data.get_month_names_eng() self.days_abrs = cal_data.get_days_abbrs() # Today date self.active_date = cal_data.today_date_list() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data(self):", "def prepare_UI(self):", "def populate_widget(self):\n self.temp_dropdown.addItems(self.units_data[\"Choices\"][\"Temperature\"])\n self.volume_dropdown.addItems(self.units_data[\"Choices\"][\"Volume\"])\n self.press_dropdown.addItems(self.units_data[\"Choices\"][...
[ "0.73985404", "0.66375476", "0.6256399", "0.6207288", "0.61352146", "0.60843796", "0.60673505", "0.59987247", "0.59987247", "0.5973385", "0.59121627", "0.587666", "0.5833557", "0.57790965", "0.5755037", "0.57352716", "0.57310146", "0.5705217", "0.5695651", "0.56943774", "0.56...
0.6518631
2
Get caledar and months/years nums for quarter
def get_quarter(self): self.quarter_nums = cal_data.calc_quarter(self.active_date[2], self.active_date[1]) self.quarter = cal_data.get_quarter(self.active_date[2], self.active_date[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quarter_from_month(month: int) -> int:\n return ((month - 1) // 3) + 1", "def _quarter_number(self, dategiven):\n return RetailDate(dategiven).quarter", "def next_quarter_start(start_year:int, start_month:int, logger:lg.Logger = None) -> (int, int):\n if logger:\n logger.debug(F\"start ...
[ "0.71771586", "0.69877535", "0.69545823", "0.68355507", "0.65251267", "0.62602466", "0.6153807", "0.60453457", "0.59756655", "0.5955437", "0.58934164", "0.58909696", "0.5877462", "0.5877462", "0.5867307", "0.5819606", "0.5772608", "0.57516044", "0.5712844", "0.57028717", "0.5...
0.67201173
4
Get day value from pressed button
def get_btn_value(self, inst): self.active_date[0] = int(inst.text) selected = [self.active_date[0], self.active_date[1], self.active_date[2]] global selectedDates if selected in selectedDates: selectedDates.remove(selected) else: selectedDates.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_day():\n return handle_invalid_inputs(question_4, days)", "def day(sym, date):\n return get(sym, date, date)[0][1]", "def on_Calendar_day_selected_double_click(self, widget):\n try:\n agno, mes, dia = variables.calendar.get_date()\n fecha = \"%02d/\" % dia + \"%02d/\"...
[ "0.66065156", "0.6411967", "0.62181884", "0.61390465", "0.6137295", "0.61261487", "0.6031694", "0.6031341", "0.6031341", "0.6031341", "0.60150236", "0.60150236", "0.5965724", "0.59653014", "0.5939489", "0.59322006", "0.58828443", "0.587401", "0.58704", "0.58308136", "0.581959...
0.6740263
0
Go to screen with previous month
def go_prev(self, inst): # Change active date self.active_date = [self.active_date[0], self.quarter_nums[0][1], self.quarter_nums[0][0]] # Name of prev screen n = self.quarter_nums[0][1] - 1 prev_scr_name = "%s-%s" % (self.month_names_eng[n], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_previous_month(self):\n self.action.click(self.calendar_previous)\n time.sleep(3)", "def showPreviousMonth(self):\n pass", "def _prev_month(self):\r\n self._canvas.place_forget()\r\n\r\n self._date = self._date - self.timedelta(days=1)\r\n self._date = self.d...
[ "0.77513474", "0.7437955", "0.73504657", "0.73097664", "0.66519666", "0.6488268", "0.6330314", "0.6143109", "0.6109163", "0.6047146", "0.6028771", "0.6025365", "0.6016673", "0.5978298", "0.5845772", "0.5841132", "0.5791068", "0.57260734", "0.5630533", "0.5602191", "0.5602191"...
0.71048
4
Go to screen with next month
def go_next(self, inst): # Change active date self.active_date = [self.active_date[0], self.quarter_nums[2][1], self.quarter_nums[2][0]] # Name of prev screen n = self.quarter_nums[2][1] - 1 next_scr_name = "%s-%s" % (self.month_names_eng[n], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_next_month(self):\n self.action.click(self.calendar_next)\n time.sleep(3)", "def showNextMonth(self):\n pass", "def _next_month(self):\r\n self._canvas.place_forget()\r\n\r\n year, month = self._date.year, self._date.month\r\n self._date = self._date + self.t...
[ "0.8026814", "0.7535266", "0.73783004", "0.73252517", "0.6710318", "0.64836913", "0.6130388", "0.59935415", "0.5949899", "0.5932306", "0.591973", "0.5908469", "0.58657205", "0.58533937", "0.5806184", "0.5803234", "0.5780424", "0.5727439", "0.5727259", "0.5713089", "0.5697559"...
0.7162475
4
Switch months pages by touch move
def on_touch_move(self, touch): if self.touch_switch: # Left - prev if touch.dpos[0] < -30: self.go_prev(None) # Right - next elif touch.dpos[0] > 30: self.go_next(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changeDisplayedMonth(self):\n #ho bisogno di sapere qual è il mese mostrato\n currentMonth = self.indexMonth\n currentYear = self.currentYear\n\n sender = self.sender().objectName()\n if sender == 'bot_next':\n # if currentMonth < 11:\n if self.indexMont...
[ "0.6470862", "0.6099905", "0.5709868", "0.5687509", "0.56433487", "0.56086636", "0.5535471", "0.5520773", "0.54963934", "0.5425755", "0.5371083", "0.53478676", "0.5297901", "0.52765054", "0.5259761", "0.525924", "0.52506715", "0.52460074", "0.51859444", "0.51507366", "0.51237...
0.5567337
6
Project a vector onto an Linf ball.
def project_Linf_ball(x: "fasta.linalg.Vector", t: float) -> "fasta.linalg.Vector": N = len(x) xabs = np.abs(x) # Reverse sort the absolute values of z flipped = xabs.copy() flipped[::-1].sort() # Magic alpha = np.max((np.cumsum(flipped) - t) / np.arange(1, N+1)) if alpha > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_L1_ball(x: \"fasta.linalg.Vector\", t: float) -> \"fasta.linalg.Vector\":\n # By Moreau's identity, we convert to proximal of dual problem (L-inf norm)\n return x - project_Linf_ball(x, t)", "def translate(self, vector):\n if self.blender_object:\n self.blender_object.location...
[ "0.660014", "0.6530639", "0.62310714", "0.6171093", "0.61017925", "0.6068066", "0.59561163", "0.59489536", "0.5879308", "0.58778346", "0.5838586", "0.58375114", "0.581667", "0.58055514", "0.5805013", "0.5804504", "0.5783989", "0.5782783", "0.57660913", "0.5748762", "0.5747332...
0.6179265
3
Project a vector onto an L1 ball.
def project_L1_ball(x: "fasta.linalg.Vector", t: float) -> "fasta.linalg.Vector": # By Moreau's identity, we convert to proximal of dual problem (L-inf norm) return x - project_Linf_ball(x, t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, vector):\n if self.blender_object:\n self.blender_object.location = vector", "def project_vector(self, vector: array_like) -> Vector:\n point_in_space = self.point + vector\n point_on_plane = self.project_point(point_in_space)\n\n return Vector.from_poin...
[ "0.66520876", "0.6209839", "0.6140181", "0.6015735", "0.5979458", "0.5940027", "0.5939712", "0.59238505", "0.5875229", "0.5867069", "0.5799263", "0.5797262", "0.57569957", "0.5726671", "0.57266325", "0.5723105", "0.5687589", "0.56815106", "0.56803626", "0.5629013", "0.5628878...
0.7311037
0
Project a matrix onto a ball induced by the nuclear norm.
def project_Lnuc_ball(X: "fasta.linalg.Matrix", t: float) -> "fasta.linalg.Matrix": U, s, V = la.svd(X) # Construct the diagonal matrix of singular values, S, as a shrunken version of the original signal values S = np.zeros(X.shape) S[:len(s),:len(s)] = np.diag(shrink(s, t)) return U @ S @ V
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n det = self._mat[0][0]*self._mat[1][1] - self._mat[0][1]*self._mat[1][0]\n for i in range(2):\n for j in range(2):\n self._mat[i][j] = (self._mat[i][j])/(np.sqrt(det))", "def normalize(self):\r\n max = np.amax(self.matrix)\r\n min = np.a...
[ "0.63313407", "0.60166395", "0.59255046", "0.5873462", "0.58486867", "0.5786831", "0.5783354", "0.5758154", "0.56968874", "0.56630415", "0.55919844", "0.5558442", "0.55018854", "0.54998296", "0.548496", "0.5478803", "0.54655546", "0.545859", "0.544245", "0.5396391", "0.539067...
0.57607806
7
The shrink (softthresholding) operator, which is also the proximal operator for the L1norm. The shrink operator reducing the magnitudes of all entries in x by t, leaving them at zero if they're already less than t.
def shrink(x: np.ndarray, t: float) -> np.ndarray: return np.sign(x) * np.maximum(np.abs(x) - t, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_softshrink(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n dtype = infer_type(x).checked_type.dtype\n threshold = _expr.const(op.attr(\"lambda\"), dtype=dtype)\n zeros = _op.zeros_like(x)\n out = _op.where(x < -threshold, x + threshold, zeros) + _op.where(\n x > threshold,...
[ "0.65450245", "0.6496893", "0.64630055", "0.6456143", "0.6226922", "0.61587155", "0.5946745", "0.5927948", "0.5875077", "0.57929087", "0.57728153", "0.5728194", "0.5728194", "0.5728194", "0.5629461", "0.5480745", "0.543062", "0.5420821", "0.54135394", "0.5374806", "0.53720266...
0.78240633
0
build resnet backbone and position embedding according to config
def build_backbone(config): assert config.MODEL.BACKBONE in ['resnet50', 'resnet101'], "backbone name is not supported!" backbone_name = config.MODEL.BACKBONE dilation = False train_backbone = not config.EVAL return_interm_layers = False #TODO: impl case True for segmentation position_embedding...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backbone_generator(params):\n if params.architecture.backbone == 'resnet':\n resnet_params = params.resnet\n backbone_fn = resnet.Resnet(\n resnet_depth=resnet_params.resnet_depth,\n dropblock=dropblock_generator(params.dropblock),\n activation=params.batch_norm_activation.activatio...
[ "0.6338696", "0.62638956", "0.62531716", "0.6237589", "0.6195611", "0.6154484", "0.60957676", "0.6093641", "0.6082765", "0.6067601", "0.6043595", "0.6010979", "0.6000153", "0.5991751", "0.59515923", "0.59420633", "0.59154165", "0.58285683", "0.58096284", "0.58037734", "0.5793...
0.66462153
0
Implementation of the identity block as defined in Figure 3
def identity_block(X, f, filters, stage, block): # defining name basis conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '_branch' # Retrieve Filters F1, F2, F3 = filters # Save the input value. You'll need this later to add back to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeIdentity(self) -> None:\n ...", "def identity(cls):\n return super().identity(4, 4)", "def identity_block(self, input_tensor, middle_filter_size, filters, stage, block):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_...
[ "0.6719558", "0.64335775", "0.64263827", "0.6325968", "0.62210673", "0.6205097", "0.61472464", "0.61263555", "0.5965766", "0.5961469", "0.5954413", "0.5941736", "0.5941625", "0.5932608", "0.59137326", "0.58742166", "0.585961", "0.585453", "0.5833093", "0.58320105", "0.5832010...
0.5725329
35
Implementation of the convolutional block as defined in Figure 4
def convolutional_block(X, f, filters, stage, block, s = 2): # defining name basis conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '_branch' # Retrieve Filters F1, F2, F3 = filters # Save the input value X_shortcut = X #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conv_block( inputs, filters, kernel, strides, nl):\n channel_axis = 1 if K.image_data_format() == 'channels_first' else -1\n x = Conv2D(filters, kernel, padding='same', strides=strides)(inputs)\n x = BatchNormalization(axis=channel_axis)(x)\n return _return_activati...
[ "0.75467706", "0.7491661", "0.7307114", "0.72310984", "0.7224572", "0.7169003", "0.71397346", "0.7121883", "0.7079463", "0.70640475", "0.70419514", "0.7027111", "0.70232874", "0.7014711", "0.7007952", "0.70026505", "0.6999438", "0.69759107", "0.6945785", "0.6941995", "0.69197...
0.6933016
20
a simple data filter for On and Off data set
def simple(onArray, offArray): Larray = len(onArray) Larray2 = len(offArray) assert Larray == Larray2, "both arrays should have the same size" #onFiltered = numpy.array(onArray)[:,OnOff.misc.constants.dataRange] #offFiltered = numpy.array(offArray)[:,OnOff.misc.constants.dataRange] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_data_filter(self, arg):\n if arg:\n if arg.upper() == \"ON\":\n self.data_only = True\n print(\"Filtering for data\")\n elif arg.upper() == \"OFF\":\n self.data_only = False\n print(\"Raw data, no filtering\")\n ...
[ "0.790279", "0.68484104", "0.6469736", "0.6187022", "0.60985696", "0.6086896", "0.60415226", "0.60381603", "0.5973669", "0.59631866", "0.595", "0.5947962", "0.59049165", "0.58919203", "0.58900917", "0.5875511", "0.5874126", "0.5817856", "0.5786788", "0.5784326", "0.5749742", ...
0.64173406
3
For a single channel single sample, we compute Pois(d | fac(pars) (delta(pars) + nom) ) Gaus(a | pars[is_gaus], sigmas) Pois(a cfac | pars[is_poi] cfac)
def expected_actualdata(self, pars): tensorlib, _ = get_backend() pars = tensorlib.astensor(pars) deltas, factors = self._modifications(pars) allsum = tensorlib.concatenate(deltas + [tensorlib.astensor(self.thenom)]) nom_plus_delta = tensorlib.sum(allsum, axis=0) nom_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def G_MP9401(ps, **kw) -> MAG:\n g, i = kw.get(\"g\", \"g\"), kw.get(\"i\", \"i\")\n gmi = kw.get(\"gmi\", \"g-i\")\n\n if gmi in ps.colnames:\n gmi = ps[gmi]\n else:\n gmi = ps[g] - ps[i]\n\n ind = (-1.0 * MAG < gmi) & (gmi < 4 * MAG)\n if not all(ind):\n warnings.warn(\"MCg...
[ "0.5365971", "0.53142685", "0.5280462", "0.5248588", "0.5151607", "0.5151149", "0.50696945", "0.5016467", "0.5013076", "0.49877918", "0.4887354", "0.4882919", "0.4853184", "0.48526874", "0.4847001", "0.48311242", "0.48219612", "0.48190698", "0.4817454", "0.4801044", "0.479936...
0.0
-1
Create a model object with/without patches applied.
def model(self, **config_kwargs): measurement = self.get_measurement(**config_kwargs) log.debug( 'model being created for measurement {0:s}'.format(measurement['name']) ) patches = config_kwargs.get('patches', []) modelspec = { 'channels': self.spec['cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self):\n self.model = None\n pass", "def create_model(self):\n pass", "def create_model(self):\n pass", "def MakeModel(self):\n pass", "def new(self, **kwargs):\n return self.__model__(**self._preprocess_params(kwargs))", "def make_model():\n ...
[ "0.6639623", "0.64880705", "0.64880705", "0.63333046", "0.63234615", "0.62291735", "0.61787397", "0.6168018", "0.6163506", "0.61584336", "0.61175513", "0.61146307", "0.61119133", "0.6089317", "0.6030808", "0.6009319", "0.59917843", "0.5973701", "0.5952992", "0.59278697", "0.5...
0.60898846
13
Return the data for the supplied model with or without auxiliary data from the model. The model is needed as the order of the data depends on the order of the channels in the model.
def data(self, model, with_aux=True): try: observed_data = sum( (self.observations[c] for c in model.config.channels), [] ) except KeyError: log.error( "Invalid channel: the workspace does not have observation data for one of the chann...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_input_data_for_model(self, extra_data=None):\n extra_data = {} if extra_data is None else extra_data\n if self.metadata['sample_rate'] is not None:\n if self.audio_signal.sample_rate != self.metadata['sample_rate']:\n self.audio_signal.resample(self.metadata['sample...
[ "0.6538062", "0.6490415", "0.62376046", "0.6171267", "0.6053518", "0.58562785", "0.580033", "0.5770171", "0.57479113", "0.5745328", "0.56002873", "0.5590875", "0.555867", "0.5480762", "0.54566306", "0.54521996", "0.54192096", "0.5412202", "0.53936917", "0.5341618", "0.5324312...
0.72179353
0
Main web page, displays summary statistics of all switches
def switch_inventory(): lastupdate = getLastUpdate() switchdata = getSwitchInfo() return render_template("main.html", switches=switchdata, lastupdate=lastupdate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statistics():\n return render_template('statistics.html'), 200", "def index():\r\n\r\n title = \"Global Statistics\"\r\n\r\n n_auth = n_auth_users()\r\n\r\n n_anon = n_anon_users()\r\n\r\n n_total_users = n_anon + n_auth\r\n\r\n n_published_apps = cached_apps.n_published()\r\n n_draft_ap...
[ "0.69233876", "0.6406892", "0.6289335", "0.61874783", "0.6130209", "0.61086214", "0.60472643", "0.6045767", "0.6032195", "0.5959054", "0.5870697", "0.5863519", "0.58526677", "0.58438677", "0.58393335", "0.5834708", "0.5812339", "0.58045405", "0.5771641", "0.5763239", "0.57630...
0.5535049
51
This page shows detailed stats on an individual switch queried by serial number
def switch_info(serial): detail = getSwitchDetail(serial) intdetail = getInterfaceDetail(serial) try: raw_data = open(f"raw_output/{serial}.txt", "r").read().splitlines() except: raw_data = "None collected yet" return render_template( "detail.html", title=serial, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSwitchDetail(serial):\n swDB = switchdb.DB()\n raw_info = swDB.getSwitchDetail(serial)\n switch = {}\n for row in raw_info:\n switch[\"name\"] = row[0]\n switch[\"serial\"] = row[1]\n switch[\"model\"] = row[2]\n switch[\"swver\"] = row[3]\n switch[\"ip\"] = ro...
[ "0.747413", "0.6891839", "0.5926545", "0.58273053", "0.57952845", "0.5792791", "0.57800347", "0.56501704", "0.564042", "0.5636971", "0.56230223", "0.54754305", "0.5463351", "0.5437777", "0.5394672", "0.53712904", "0.536182", "0.53433543", "0.53223366", "0.52944213", "0.527366...
0.7308758
1
This page shows a summary of all port counts, etc across the entire network
def network_wide(): network = getNetworkWide() return render_template("network-wide.html", network=network)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ports(state):\n\tstate.report()", "def PortStatistics(self):\n return self._get_attribute('portStatistics')", "def get_port_counts(ssh):\r\n cmd02='netstat -na'\r\n retry_number=3\r\n try:\r\n while True:\r\n if retry_number == 0:\r\n logger.writeLog(\"...
[ "0.71391034", "0.7044147", "0.7031719", "0.6976165", "0.6814074", "0.6660063", "0.665406", "0.6509906", "0.6460758", "0.6430918", "0.6304462", "0.6292888", "0.62819636", "0.6264129", "0.62447363", "0.62227875", "0.61759615", "0.61522573", "0.6141049", "0.60898095", "0.6084936...
0.0
-1
Check DB for last runtime of backend script This is published on the main page to see when stats were last updated
def getLastUpdate(): swDB = switchdb.DB() lastupdate = swDB.getLastUpdate() swDB.close() return lastupdate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_init() -> str:\n return db[\"last_init\"]", "def test_log_last_started_datetime(self):\n initial_count = CostUsageReportStatus.objects.count()\n saver = ReportStatsDBAccessor(\"myreport\", self.manifest_id)\n saver.log_last_started_datetime()\n self.assertIsNotNone(sav...
[ "0.575571", "0.5727403", "0.56392384", "0.5554743", "0.5544511", "0.5508971", "0.5502992", "0.54756486", "0.54550827", "0.5454201", "0.54325056", "0.54227924", "0.5381801", "0.5367871", "0.53669065", "0.5365385", "0.536471", "0.5316883", "0.53158337", "0.53126395", "0.5308993...
0.6065848
0
Query DB for summary info on all switches currently monitored
def getSwitchInfo(): swDB = switchdb.DB() raw_info = swDB.getAllSummary() switchList = [] for row in raw_info: row = list(row) switch = {} switch["name"] = row[0] switch["serial"] = row[1] switch["swver"] = row[2] switch["ip"] = row[3] switch["chec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_switches_stats(self, site_id: str) -> List:\n try:\n stats = self.api.get(host=self.host, endpoint=f\"/api/v1/sites/{site_id}/stats/devices?type=switch\")\n except Exception as e:\n logger.error(f\"{TextColors.FAIL}Error getting switch stats:{TextColors.ENDC} {e}\")\n ...
[ "0.59377617", "0.58443993", "0.58337426", "0.569104", "0.5689093", "0.56877404", "0.5678661", "0.56559193", "0.56524736", "0.5558809", "0.5531664", "0.55013895", "0.5465066", "0.5456181", "0.54546607", "0.54425275", "0.5420958", "0.5404441", "0.53917074", "0.53812945", "0.536...
0.71028024
0
Query DB for details on one specific device by serial number
def getSwitchDetail(serial): swDB = switchdb.DB() raw_info = swDB.getSwitchDetail(serial) switch = {} for row in raw_info: switch["name"] = row[0] switch["serial"] = row[1] switch["model"] = row[2] switch["swver"] = row[3] switch["ip"] = row[4] switch["che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_get_device_info(db_path, rec_name):\n path_exist = os.path.exists(db_path)\n if path_exist is False:\n print '!!!Error, database does not exist.'\n return\n\n try:\n with db.connect(db_path) as conn:\n cursor = conn.cursor()\n # Prepare and execute SQL sta...
[ "0.6281861", "0.62783605", "0.6202396", "0.6042647", "0.596461", "0.5964163", "0.5939326", "0.59231377", "0.5860751", "0.585554", "0.57786566", "0.57782006", "0.5775878", "0.57700396", "0.57700396", "0.5758909", "0.5742942", "0.57343465", "0.5723668", "0.57158846", "0.5696746...
0.5622504
27
Query DB for interface details on one specific device by management IP
def getInterfaceDetail(serial): swDB = switchdb.DB() raw_info = swDB.getInterfaceDetail(serial) interfaceList = [] for row in raw_info: row = list(row) interface = {} interface["name"] = row[0] interface["description"] = row[1] interface["physical_address"] = row[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_info(task):\n\n interface_result = task.run(task=send_command, command=\"show interfaces\")\n task.host[\"facts\"] = interface_result.scrapli_response.genie_parse_output()\n interfaces = task.host[\"facts\"]\n for interface in interfaces:\n try:\n mac_addr = interfaces[interf...
[ "0.63337666", "0.62210196", "0.6105885", "0.6033438", "0.5927044", "0.58544815", "0.5841657", "0.5808452", "0.58042765", "0.57559174", "0.57140326", "0.5694235", "0.56908774", "0.56443346", "0.56404054", "0.5636814", "0.5565979", "0.55621296", "0.5549179", "0.55420583", "0.54...
0.6122693
2
Query DB for all switch statistcs, then tally results & return to web page
def getNetworkWide(): swDB = switchdb.DB() result = swDB.getNetworkWideStats() swDB.close() network = { "models": [], "swvers": [], "total": 0, "up": 0, "down": 0, "disabled": 0, "int10m": 0, "int100m": 0, "int1g": 0, "int10...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n\twith get_db().cursor() as cursor :\n\t\tcursor.execute(\"SELECT *, (SELECT COUNT(*) FROM `cheer` WHERE ask_id = ask.id) AS cheer_cnt FROM `ask`\")\n\t\tresult = cursor.fetchall()\n\n\treturn render_template('main.html',\n\t\tdataset=result,\n\t)", "def getSwitchInfo():\n swDB = switchdb.DB()\n...
[ "0.58005536", "0.579169", "0.5744348", "0.5681391", "0.5491771", "0.54005426", "0.53476256", "0.5337913", "0.533657", "0.5335353", "0.5330877", "0.5321876", "0.5253129", "0.52468574", "0.5244099", "0.5227676", "0.5225523", "0.5219429", "0.5215352", "0.51971906", "0.51844835",...
0.0
-1
Call to DB to delete a device by serial number
def deleteDevice(serial): swDB = switchdb.DB() swDB.deleteBySerial(serial) swDB.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_delete_device_record(db_path, rec_name):\n path_exist = os.path.exists(db_path)\n if path_exist is False:\n print '!!!Error, database does not exist.'\n return\n\n try:\n with db.connect(db_path) as conn:\n cursor = conn.cursor()\n # Prepare and execute SQ...
[ "0.71832097", "0.70881724", "0.6902768", "0.6834857", "0.67007685", "0.67007685", "0.66466284", "0.6552417", "0.65387774", "0.6451662", "0.64388514", "0.6282438", "0.6280378", "0.62574196", "0.6221847", "0.621336", "0.61614496", "0.61176556", "0.6114799", "0.6113734", "0.6084...
0.82801366
0
Does the user have the permission to publish a data.
def has_perm_publish_data(user): has_perm_publish(user, rights.PUBLISH_DATA)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canPublish(id, userId):\n db = core.connect()\n theShift = db[id]\n return user.isAdmin(userId) or (userId == theShift['createdBy'])", "def has_add_permission(self, request):\n if not settings.PUBLISHER_CODE:\n return False\n return super().has_add_permission(request)", "d...
[ "0.7401715", "0.68930787", "0.6854572", "0.68086797", "0.6761256", "0.67495507", "0.6707519", "0.6702206", "0.6684865", "0.66546744", "0.6624943", "0.66060966", "0.6596229", "0.65667605", "0.6543968", "0.6537075", "0.6512933", "0.65074724", "0.6503338", "0.64965105", "0.64941...
0.889468
0
Can read list of data.
def can_read_list_data_id(func, list_data_id, user): if user.is_superuser: return func(list_data_id, user) # check anonymous access _check_anonymous_access(user) list_data = func(list_data_id, user) check_can_read_list(list_data, user) return list_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_list(self, register, length):\n raise NotImplementedError", "def _read_data(self):", "def canread(self):\n return False", "def storage_can_read(self):\n return True", "def read_data(self) -> List[BaseRecord]:\n pass", "def read(self) -> List[str]:\n pass", "d...
[ "0.662519", "0.6616855", "0.6610192", "0.6583547", "0.6576495", "0.64457273", "0.6304789", "0.62909526", "0.6290033", "0.6213072", "0.616153", "0.61129534", "0.60768044", "0.59920454", "0.5950494", "0.5942837", "0.59417313", "0.593891", "0.59161913", "0.59137505", "0.5912139"...
0.6868034
0
Can read a data, given a query.
def can_read_data_query( func, query, user, workspace_filter=None, user_filter=None, order_by_field=DATA_SORTING_FIELDS, ): # check anonymous access _check_anonymous_access(user) # update the query query = _update_can_read_query(query, user, workspace_filter, user_filter) # g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, query):\r\n t1 = time.time()\r\n if self.database in ['redshift', 'postgres']:\r\n ret = postgres_helper.fetchall(config=self.conf, sql=query)\r\n else:\r\n raise Exception(\"database not supported yet: '{}'\"\r\n .format(self.dat...
[ "0.64174247", "0.6388573", "0.6367381", "0.6172934", "0.5943755", "0.59167004", "0.5904258", "0.5697214", "0.5670645", "0.56312513", "0.5612141", "0.555337", "0.55376184", "0.5506616", "0.550447", "0.54996186", "0.5492912", "0.5484353", "0.5476029", "0.5465419", "0.5450928", ...
0.71578825
0
Can read a data, given an aggregate query.
def can_read_aggregate_query(func, query, user): if user.is_superuser: return func(query, user) # check anonymous access _check_anonymous_access(user) # update the query query = _update_can_read_aggregate_query(query, user) # get list of data data = func(query, user) return da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_read_data_query(\n func,\n query,\n user,\n workspace_filter=None,\n user_filter=None,\n order_by_field=DATA_SORTING_FIELDS,\n):\n # check anonymous access\n _check_anonymous_access(user)\n # update the query\n query = _update_can_read_query(query, user, workspace_filter, user...
[ "0.68077844", "0.6013364", "0.5804927", "0.57963204", "0.5774573", "0.5536843", "0.5486568", "0.54431725", "0.534709", "0.53435445", "0.52316743", "0.5172882", "0.5158935", "0.5156636", "0.51558", "0.5118686", "0.5110658", "0.507409", "0.50682276", "0.5029962", "0.50261956", ...
0.7802571
0
Update query with access control parameters.
def _update_can_read_query( query, user, workspace_filter=None, user_filter=None ): accessible_workspaces = _get_read_accessible_workspaces_by_user(user) # update query with workspace criteria query = django_raw_query.add_access_criteria( query, accessible_workspaces, user, workspace_filter, us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, params):", "def update(self, query: str, *args, **kwargs):\n cursor = self._cursor()\n try:\n self._execute(cursor, query, args, kwargs)\n return cursor.rowcount\n finally:\n cursor.close()", "def _update(self, values):\n if self.que...
[ "0.6119067", "0.6095496", "0.60731256", "0.6058203", "0.58836794", "0.58246744", "0.5813785", "0.58044815", "0.5776203", "0.57282144", "0.57191473", "0.5662358", "0.5660843", "0.5659255", "0.5619666", "0.560143", "0.5595878", "0.55811363", "0.55611885", "0.5551484", "0.554431...
0.65168345
0
Update query with access control parameters.
def _update_can_read_aggregate_query(query, user): accessible_workspaces = _get_read_accessible_workspaces_by_user(user) # update query with workspace criteria query = mongo_raw_query.add_aggregate_access_criteria( query, accessible_workspaces, user ) return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_can_read_query(\n query, user, workspace_filter=None, user_filter=None\n):\n\n accessible_workspaces = _get_read_accessible_workspaces_by_user(user)\n # update query with workspace criteria\n query = django_raw_query.add_access_criteria(\n query, accessible_workspaces, user, workspac...
[ "0.65168345", "0.6119067", "0.6095496", "0.60731256", "0.6058203", "0.58836794", "0.58246744", "0.5813785", "0.58044815", "0.5776203", "0.57282144", "0.57191473", "0.5662358", "0.5660843", "0.5659255", "0.5619666", "0.560143", "0.5595878", "0.55811363", "0.55611885", "0.55514...
0.534593
59
Get read accessible workspaces by user.
def _get_read_accessible_workspaces_by_user(user): if not settings.CAN_ANONYMOUS_ACCESS_PUBLIC_DOCUMENT and user.is_anonymous: accessible_workspaces = [] else: # workspace case # list accessible workspaces accessible_workspaces = [ workspace.id for workspa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accessible_spaces(user):\n if not user:\n return []\n obj_list = get_objects_for_user(user, 'access_space',Space)\\\n .order_by('-created_at')\n return obj_list", "def get_own_spaces(user):\n if not user:\n return []\n own_spaces = []\n accessible_spacs = ge...
[ "0.6719666", "0.66262877", "0.6177913", "0.61746544", "0.61572975", "0.59542626", "0.5788981", "0.5735323", "0.5701356", "0.5671635", "0.5643736", "0.5525086", "0.55015767", "0.54937226", "0.549314", "0.54608184", "0.5457025", "0.54482085", "0.54317015", "0.54259753", "0.5395...
0.82568294
0
Can user write data in workspace.
def can_write_data_workspace(func, data, workspace, user): return can_write_in_workspace( func, data, workspace, user, rights.PUBLISH_DATA )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_write(self, auth_param: str) -> bool:\n perms = self._get_workspace_permissions([auth_param])\n return self._has_write_perm(perms.get(auth_param, WorkspacePermission.NONE))", "def canwrite(self):\n return False", "def set_data_writable(self):\n pass", "def isWriteable(self...
[ "0.72511923", "0.70142853", "0.6588434", "0.6476887", "0.6420118", "0.63587517", "0.6332469", "0.63128155", "0.62503433", "0.6213865", "0.6140603", "0.61385965", "0.60728014", "0.59627616", "0.59163034", "0.5911914", "0.5841909", "0.5827193", "0.5817602", "0.57675314", "0.575...
0.81769687
0
Can read from object id.
def can_read_blob(func, data, user): if user.is_superuser: return func(data, user) if data._blob is not None: _check_can_read(data._blob, user) return func(data, user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_id(self, id):", "def get_object(id):", "def read_object(self, object_id: str) -> Any:\n return self.objects[object_id]", "def has_object_permission(self , request , view , obj):\n if request.method in permissions.SAFE_METHODS:\n return True\n \n return o...
[ "0.68517625", "0.6691061", "0.65946645", "0.6365738", "0.6347586", "0.6273723", "0.62640613", "0.6212131", "0.61415297", "0.6131172", "0.6058819", "0.60123235", "0.5980215", "0.59708816", "0.5950038", "0.5917729", "0.5897726", "0.5897726", "0.5895458", "0.5891156", "0.5870854...
0.0
-1
Prompts the user to create a question
def get_question(): last_line = '\n' question = "" print("Type in your question here:") while last_line != "": current_line = input() if current_line == "": break question += current_line + "\n" variables = {} # Special syntax variables rand = random.ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_question():\n title_question = request.form.get(\"title\")\n question = request.form.get(\"question\")\n\n date_string = datetime.today().strftime('%Y-%m-%d')\n \n ask = Question(user_id = session[\"user_id\"],question_created=date_string, title_question = title_question, question = question...
[ "0.7486152", "0.6696017", "0.6658708", "0.66517705", "0.6646394", "0.6635777", "0.6586772", "0.65711033", "0.64845", "0.6458855", "0.64416367", "0.6407239", "0.63839", "0.63815075", "0.63770765", "0.6374164", "0.6351017", "0.6281378", "0.62183434", "0.62095314", "0.62069523",...
0.0
-1
Read data from pslg file
def read_pslg(file_name): with open(file_name, "r") as fp: components = fp.read().split("component: ")[1:] lpoints, lconnect_left, lconnect_right = [], [], [] index = 0 for component in components: raw_points = component.split("\n")[1:-1] points = [list(map(floa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_spgfile(casename=None):\n\n data={}\n \n if casename==None:\n print('_load_spgfile requires a filename to load.')\n return\n try:\n fp=open(casename+'_spg.dat','r')\n except IOError:\n print('_load_spgfile: invalid case name.')\n return data\n\n spg_st...
[ "0.6585657", "0.652411", "0.6342616", "0.62879246", "0.6264648", "0.6150379", "0.6124599", "0.6101262", "0.61011523", "0.60455316", "0.60414195", "0.6040804", "0.6021278", "0.6021278", "0.6021278", "0.60139185", "0.600449", "0.59920204", "0.5962291", "0.59514767", "0.5944652"...
0.62928504
3
Generate symmetric figure by reflection.
def generate_symmetry(points, pts_left, pts_right, mode = 1, offset = 0.2): assert(mode == 1 or mode == 2), "The selected mode (%d) is not defined!" % mode # horizental box_min, box_max = points.min(0), points.max(0) hor_axis = box_max[0] + offset new_comp = deepcopy(points) new_comp[:, 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self, diagram):", "def show_symmetry(points, nb_1, nb_2, title, save_path = None):\n\n fig = plt.figure(figsize = (6, 6))\n plt.title(title)\n plt.scatter(points[:, 0], points[:, 1], c = 'b', s = 5, label = \"point cloud\")\n plt.scatter(nb_1[:, 0], nb_1[:, 1], c = 'r', s = 5, label = \"...
[ "0.5937008", "0.54731977", "0.54227936", "0.5377924", "0.53774554", "0.5328629", "0.53062236", "0.5270452", "0.51984763", "0.5187913", "0.5158385", "0.51435167", "0.5114701", "0.5114701", "0.5091624", "0.5076573", "0.5064932", "0.5064614", "0.5055809", "0.5052378", "0.4979211...
0.49154073
29
Show a point cloud in 2d or 3d
def show_point_set(points, title, save_path = None): dim = points.shape[1] assert(dim == 2 or dim == 3), "Only data in 2 or 3 dimension space can be visualized." if dim == 2: fig = plt.figure(figsize = (6, 6)) plt.title(title) plt.scatter(points[:, 0], points[:, 1], c = 'b', s =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_point_cloud(points, colors=None, normals=None,\n show_frame=False, frame_size=1.0, frame_origin=(0, 0, 0)):\n pc = np2pcd(points, colors, normals)\n geometries = [pc]\n if show_frame:\n coord_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=frame...
[ "0.7614337", "0.7583234", "0.7297616", "0.71946776", "0.71542764", "0.71168196", "0.6915885", "0.6814755", "0.6801549", "0.6792311", "0.6709529", "0.6671749", "0.6652905", "0.6646663", "0.65614176", "0.6532126", "0.64922553", "0.6464758", "0.6449736", "0.63894534", "0.6383050...
0.61476123
30
Normalize and centralize a point cloud in a unit sphere
def data_preprocessing(points): mean_coords = points.mean(0) points -= mean_coords max_norm = np.max(np.linalg.norm(points, axis = 1)) points /= max_norm return points, mean_coords, max_norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_to_sphere(places, size, resolution=0.50, min_value=np.array([0., -50., -4.5]), scale=4, x=(0, 90), y=(-50, 50), z=(-4.5, 5.5)):\n x_logical = np.logical_and((places[:, 0] < x[1]), (places[:, 0] >= x[0]))\n y_logical = np.logical_and((places[:, 1] < y[1]), (places[:, 1] >= y[0]))\n z_logical = n...
[ "0.6750035", "0.67149276", "0.6667598", "0.65624475", "0.65602094", "0.650648", "0.64572716", "0.6323207", "0.624639", "0.624639", "0.62402195", "0.6174017", "0.61365646", "0.6134152", "0.6077822", "0.6074374", "0.606006", "0.6051627", "0.5994066", "0.59825337", "0.59711474",...
0.0
-1
Show a point cloud in 2d
def show_point_set_curvature(points, curvatures, title, thresh = 0.9, save_path = None): dim = points.shape[1] assert(dim == 2), "Only data in 2 dimension space can be visualized." selected_pts = points[np.abs(curvatures) < thresh] fig = plt.figure(figsize = (6, 6)) plt.title(title) plt.sca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_point_cloud(points, colors=None, normals=None,\n show_frame=False, frame_size=1.0, frame_origin=(0, 0, 0)):\n pc = np2pcd(points, colors, normals)\n geometries = [pc]\n if show_frame:\n coord_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=frame...
[ "0.72636724", "0.72375584", "0.71609396", "0.7132317", "0.6933942", "0.6919783", "0.6877211", "0.68398106", "0.65854543", "0.6562634", "0.65615726", "0.6518098", "0.64886963", "0.64688116", "0.64599943", "0.64297676", "0.64172477", "0.6347307", "0.6338426", "0.6316377", "0.62...
0.60903704
29
Show a point cloud in 2d
def show_point_set_normal(points, normals, title, save_path = None): dim = points.shape[1] assert(dim == 2), "Only data in 2 dimension space can be visualized." fig = plt.figure(figsize = (6, 6)) plt.title(title) plt.scatter(points[:, 0], points[:, 1], c = 'b', s = 5, label = "point cloud") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_point_cloud(points, colors=None, normals=None,\n show_frame=False, frame_size=1.0, frame_origin=(0, 0, 0)):\n pc = np2pcd(points, colors, normals)\n geometries = [pc]\n if show_frame:\n coord_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=frame...
[ "0.72636724", "0.72375584", "0.71609396", "0.7132317", "0.6933942", "0.6919783", "0.6877211", "0.68398106", "0.65854543", "0.6562634", "0.65615726", "0.6518098", "0.64886963", "0.64688116", "0.64599943", "0.64297676", "0.64172477", "0.6347307", "0.6338426", "0.6316377", "0.62...
0.56848264
66
Show a point cloud in 2d
def show_transformed_point_set(points_1, points_2, points_12, loss, save_path = None): fig = plt.figure(figsize = (6, 6)) plt.title("Loss = %f" % loss) plt.scatter(points_1[:, 0], points_1[:, 1], s = 5, label = "point cloud 1") plt.scatter(points_2[:, 0], points_2[:, 1], s = 5, label = "point cloud 2")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_point_cloud(points, colors=None, normals=None,\n show_frame=False, frame_size=1.0, frame_origin=(0, 0, 0)):\n pc = np2pcd(points, colors, normals)\n geometries = [pc]\n if show_frame:\n coord_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=frame...
[ "0.72636724", "0.72375584", "0.71609396", "0.7132317", "0.6933942", "0.6919783", "0.6877211", "0.68398106", "0.65854543", "0.6562634", "0.65615726", "0.6518098", "0.64886963", "0.64688116", "0.64599943", "0.64297676", "0.64172477", "0.6347307", "0.6338426", "0.6316377", "0.62...
0.57596034
56