query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Disables the active autonomous mode. You can call this from your ``disabledInit`` method to call your autonomous mode's ``on_disable`` method.
def disable(self) -> None: if self.active_mode is not None: logger.info("Disabling '%s'", self.active_mode.MODE_NAME) self.active_mode.on_disable() self.active_mode = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_disable(self) -> None:\n self._cancel_automation()", "def _disable(self):\n self.enabled = False", "def disable(self):\n self._enabled = False", "def disable(self):\n self.enabled = False", "def disable(self):\n logging.debug(\"Disabling switch %s\" % self.name)\n ...
[ "0.77082705", "0.76330733", "0.75106084", "0.7497728", "0.7336437", "0.7231306", "0.72285575", "0.7021192", "0.69935936", "0.6988324", "0.69738656", "0.6952372", "0.69420177", "0.6940569", "0.68873125", "0.6846576", "0.6828831", "0.6814721", "0.6798325", "0.6734701", "0.67340...
0.823199
0
Selects the active autonomous mode and enables it
def _on_autonomous_enable(self) -> None: # XXX: FRC Dashboard compatibility # -> if you set it here, you're stuck using it. The FRC Dashboard # doesn't seem to have a default (nor will it show a default), # so the key will only get set if you set it. auto_mode = wpilib.Sma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_mode(self):\n self.__check_mode()\n if self.mode[\"auto_mode\"]:\n self.mode_auto()\n elif self.mode[\"auto_mode\"] is None: # Do Nothing\n self.mode_standby()\n else:\n self.mode_manual()", "def mode_auto(self):\n if self.__check_m...
[ "0.7211197", "0.7209405", "0.72089565", "0.69817746", "0.68681234", "0.6654427", "0.6608431", "0.6602831", "0.65308183", "0.6469202", "0.64663786", "0.64315754", "0.6398777", "0.6318559", "0.6315171", "0.6285268", "0.6250911", "0.6247391", "0.6247391", "0.62450135", "0.622641...
0.85152936
0
Create a chunked hdf5 dataset in a temporary directory for use in tests.
def fixture_chunked_hdf5_data(tmp_path_factory, request): # Make root dir root = tmp_path_factory.mktemp("data") # Set params num_chunks = request.param.num_chunks chunk_size = request.param.chunk_size data_shape = (1,) # Seed hdf5 data paths = [root / Path(f"{idx}.h5") for idx in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_hdf5_file(hdf5_file, n_train, n_valid, n_test):\n n_total = n_train + n_valid + n_test\n splits = create_splits(n_train, n_valid, n_test)\n hdf5_file.attrs['split'] = H5PYDataset.create_split_array(splits)\n vlen_dtype = h5py.special_dtype(vlen=numpy.dtype('uint8'))\n hdf5_file.create_da...
[ "0.701501", "0.6853009", "0.6639542", "0.6613534", "0.6424932", "0.6371469", "0.63680524", "0.63611555", "0.6336317", "0.6271188", "0.6250077", "0.6228745", "0.616856", "0.6167873", "0.61268145", "0.61167353", "0.60741633", "0.6038323", "0.60328007", "0.6025898", "0.6020997",...
0.86750126
0
Create a chunked json dataset in a temporary directory for use in tests.
def fixture_chunked_json_data(tmp_path_factory, request): # Make root dir root = tmp_path_factory.mktemp("data") # Set params num_chunks = request.param.num_chunks chunk_size = request.param.chunk_size # Seed JSON data paths = [root / Path(f"{idx}.json") for idx in range(num_chunks)] f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_chunked_hdf5_data(tmp_path_factory, request):\n # Make root dir\n root = tmp_path_factory.mktemp(\"data\")\n\n # Set params\n num_chunks = request.param.num_chunks\n chunk_size = request.param.chunk_size\n data_shape = (1,)\n\n # Seed hdf5 data\n paths = [root / Path(f\"{idx}.h5...
[ "0.70258194", "0.6218852", "0.6163091", "0.6123663", "0.60687613", "0.6043297", "0.59850633", "0.59793377", "0.59119284", "0.58738595", "0.5853754", "0.5810511", "0.5795334", "0.57883775", "0.57807326", "0.57653546", "0.5723074", "0.56702757", "0.565525", "0.5654163", "0.5602...
0.8353137
0
Create a image folder dataset in a temporary directory for use in tests.
def fixture_image_data(tmp_path_factory, request): # Make root dir root = tmp_path_factory.mktemp("data") # Set params num_images = request.param # Create image files paths = [root / Path(f"{idx}.png") for idx in range(num_images)] dimensions = [(idx % 10 + 1, (10 - idx) % 10 + 1) for idx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_directories(train_path, test_path):\n train_path.joinpath(\"images\").mkdir(parents=True)\n test_path.joinpath(\"images\").mkdir(parents=True)", "def make_directory_dataset(directory_path: str) -> None:\n dataset_path = Path(directory_path)\n test_path = dataset_path / 'test'\n train_pa...
[ "0.71932167", "0.71284103", "0.69951254", "0.69644856", "0.6944171", "0.6929569", "0.6812385", "0.6766725", "0.673779", "0.6720452", "0.67042", "0.6691994", "0.6689989", "0.65835524", "0.65601933", "0.65417504", "0.65079594", "0.64762", "0.6473956", "0.6467302", "0.64517516",...
0.7515927
0
Get the batter at a particular position in the batting order given top/bottom of inning
def get_batter(self, half, order): return self.lineup[order-1].id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getxyB(x, y):\n\t\treturn x*3+y", "def _get_loc_top_left_end_b(end_button_number):\r\n if end_button_number == 0:\r\n return 19 / 2, 25 / 2 # 0 is the end button while orientation == \"width\"\r\n\r\n elif end_button_number == 1:\r\n return 25 / 2, 23 / 2 # 1 is the end button while o...
[ "0.5775039", "0.5769451", "0.5739678", "0.56741536", "0.5642245", "0.5635222", "0.56308234", "0.56305456", "0.56302994", "0.5580484", "0.55689114", "0.556663", "0.5557171", "0.5522821", "0.55116755", "0.54655975", "0.54113954", "0.540188", "0.5387999", "0.5366533", "0.5350712...
0.6736391
0
makes lineup change based on Sub object
def make_sub(self, sub): [lu, subs] = [self.lineup, self.subs] if 'PositionSwitch' in str(type(sub)): done = False for player in lu: if player.id == sub.player: done = True player.switch.append(player.pos) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeChange(aligner, change):\n\tif len(change[1]) == 0:\n\t\taligner.delBase(change[0])\n\telif len(change[1]) == 1:\n\t\taligner.subBase(change[0], change[1])\n\telse:\n\t\taligner.insBase(change[0], change[1][:-1])", "def update_subway(BeiJingSubway):\n BeiJingSubway['西直门']['积水潭'] = 'line2'\n BeiJing...
[ "0.57067615", "0.56136876", "0.5431107", "0.5336604", "0.53345376", "0.53304523", "0.53304523", "0.5295087", "0.52895117", "0.5196379", "0.5177456", "0.5176448", "0.5148774", "0.5121558", "0.5111484", "0.5097203", "0.50917596", "0.50849277", "0.50813663", "0.507889", "0.50635...
0.6093217
0
build node including task_dep's
def build_nodes_with_deps(self, tasks, task_name): if task_name in self._processed: return else: self._processed.add(task_name) # add node itself if not in list of nodes self.nodes.setdefault(task_name, []) task = tasks[task_name] # reversing not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_build(argv):\n pytaskmaster.generator(\"setup.py.in\", \"setup.py\", config)\n pytaskmaster.generator(\"pytaskmaster/version.py.in\", \"pytaskmaster/version.py\", config)\n shell(\"python setup.py bdist_wheel\")\n if \"--sign\" in argv:\n for file in os.listdir(\"dist\"):\n a...
[ "0.66064805", "0.6304529", "0.6274259", "0.615437", "0.614353", "0.6101664", "0.6060883", "0.6047356", "0.6025223", "0.6014415", "0.5908902", "0.59042233", "0.58654684", "0.5841239", "0.58313036", "0.58256507", "0.57700115", "0.5733592", "0.5722518", "0.570495", "0.5691519", ...
0.63929623
1
build nodes with subtasks but no other task_dep
def build_nodes(self, tasks, clean_list): for name in clean_list: # add node itself if not in list of nodes self.nodes.setdefault(name, []) task = tasks[name] # reversing not required for dep_name in reversed(task.task_dep): if tasks[de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_nodes_with_deps(self, tasks, task_name):\n if task_name in self._processed:\n return\n else:\n self._processed.add(task_name)\n\n # add node itself if not in list of nodes\n self.nodes.setdefault(task_name, [])\n task = tasks[task_name]\n # ...
[ "0.70941085", "0.63707393", "0.59613657", "0.59554327", "0.59195566", "0.5885454", "0.5755916", "0.56664574", "0.5637033", "0.56342274", "0.55506593", "0.5529892", "0.55278635", "0.55210596", "0.55037177", "0.55002755", "0.5493501", "0.54913247", "0.54896176", "0.5485859", "0...
0.7119548
0
Use a basic Resolver to find the IP Addresses of specific nameservers This allows the porgram to be less dependant on hard coded IP Addresses
def public_ip_dns(resolv, nameservers, rdatatype, server, responsetype): for ns in nameservers: try: answer = resolv.query(ns, rdatatype) nameserver = answer[0].to_text() except Exception as e: print(e) continue resolve_public_ip(nameserver, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve(addresses):\n\n for addr in addresses:\n _, _, ips = socket.gethostbyname_ex(addr)\n for ip in ips:\n yield ip", "def get_resolvers(default: str = \"127.0.0.1\") -> str:\n resolvers: List = []\n try:\n with open(\"/etc/resolv.conf\", encoding=...
[ "0.6936479", "0.65642786", "0.6545789", "0.6440717", "0.64311206", "0.6364885", "0.6236591", "0.62123275", "0.6156122", "0.6147866", "0.6130928", "0.6101797", "0.6088958", "0.6075119", "0.60378224", "0.6004433", "0.59624976", "0.593056", "0.58989966", "0.5869352", "0.5858242"...
0.7494848
0
Using the resolved IP Address of a nameserver, query a specific server for the public IP Address of the host running this program
def resolve_public_ip(nameserver, server, responsetype): request_resolver = dns.resolver.Resolver() request_resolver.nameservers = [nameserver,] try: answer = request_resolver.query(server, responsetype) ip = answer[0].to_text().replace('"','').strip() ipaddress.ip_address(ip) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_ip_dns(resolv, nameservers, rdatatype, server, responsetype):\n for ns in nameservers:\n try:\n answer = resolv.query(ns, rdatatype)\n nameserver = answer[0].to_text()\n except Exception as e:\n print(e)\n continue\n resolve_public_ip(n...
[ "0.7237525", "0.6862172", "0.6637621", "0.6637621", "0.66072834", "0.66016024", "0.65239745", "0.65031326", "0.64731175", "0.6432121", "0.6424992", "0.6422536", "0.6409547", "0.6387513", "0.637834", "0.63011277", "0.62938577", "0.6290494", "0.6286547", "0.62517244", "0.624607...
0.7485398
0
Load player statistics, make sure goals at least equals shots and set indices according to players in lineups. Player not in lineups won't be included.
def make_player_stats(tournament, lineups): positions = find_player_positions(lineups) positions = positions.set_index('player_id')[['player_position']] player_stats = load_player_stats(tournament) player_stats.set_index('player_id', inplace=True) mask = player_stats['goals'] > player_stats['shots']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readPlayerFileAndFillStats(players_data_filename, game_stats):\n\tplayer_stats = {}\n\tteam_stats = {}\n\tgame_stats_clean = {}\n\tgame_stats = fillGameStats(players_data_filename, game_stats)\n\n\twith open(players_data_filename) as csvfile:\n\t reader = csv.DictReader(csvfile)\n\t for row in reader:\n\...
[ "0.6473567", "0.6369928", "0.6316587", "0.59145224", "0.5905105", "0.5772", "0.5766758", "0.57366437", "0.5711018", "0.57037127", "0.56874764", "0.5683247", "0.56676143", "0.5653891", "0.5648855", "0.5629543", "0.5604311", "0.55853164", "0.55709386", "0.5567451", "0.55339485"...
0.71618724
0
Read audio chunks from queue and yield.
def audio_stream() -> typing.Iterable[bytes]: frames = frame_queue.get() while frames: yield frames frames = frame_queue.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_audio():\n\tbuf = None\n\tnum_new_bytes = BUFFER_SIZE // REFRESH_BUFFER_FACTOR\n\twith open(INFILE) as fifo:\n\t\twhile True:\n\t\t\tif buf is None:\n\t\t\t\tbuf = fifo.read(BUFFER_SIZE)\n\t\t\telse:\n\t\t\t\tbuf = buf[num_new_bytes:] + fifo.read(num_new_bytes)\n\t\t\tyield buf", "async def async_readchu...
[ "0.7123791", "0.68189037", "0.6682187", "0.6352251", "0.6322491", "0.62974507", "0.6286665", "0.62764674", "0.62634826", "0.62544084", "0.6230898", "0.61809504", "0.61534625", "0.60943", "0.60639846", "0.6044643", "0.6019628", "0.6015428", "0.60127366", "0.5972718", "0.595726...
0.7560682
0
Transcribe live audio stream indefinitely.
def transcribe_proc(): while True: # Get result of transcription transcribe_result = transcriber.transcribe_stream( audio_stream(), sample_rate, sample_width, channels ) _LOGGER.debug("Transcription result: %s", transcribe_result) tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def transcribe_stream(args: argparse.Namespace, core: Voice2JsonCore) -> None:\n from rhasspyasr import Transcription\n from rhasspysilence import VoiceCommand, VoiceCommandResult\n\n # Make sure profile has been trained\n assert core.check_trained(), \"Not trained\"\n\n wav_sink = None\n w...
[ "0.6472893", "0.61215985", "0.6067832", "0.5947168", "0.59419954", "0.59041303", "0.58980197", "0.5896212", "0.5856194", "0.5832167", "0.5821672", "0.576574", "0.57346904", "0.57230276", "0.5704431", "0.5703715", "0.56770855", "0.56737936", "0.56722736", "0.566129", "0.565257...
0.7335401
0
Set the value of the CategoryParent input for this Choreo. ((optional, string) Indicates the ID of the highestlevel category to return. Multiple CategoryParent IDs can be specified in a commaseparated list.)
def set_CategoryParent(self, value): super(GetCategoriesInputSet, self)._set_input('CategoryParent', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sub_category(self, name, category_id, parent_category_id, **kwargs):\n kwargs[\"parent_category_id\"] = parent_category_id\n self.client._put(f\"/categories/{category_id}.json\", **kwargs)", "def parent_id(self, parent_id: int):\n if parent_id is None:\n raise ValueError(\...
[ "0.6129967", "0.5472301", "0.5323792", "0.52963334", "0.5156003", "0.5122369", "0.51155204", "0.51121783", "0.51076823", "0.51076823", "0.51076823", "0.51076823", "0.5062186", "0.50444716", "0.49758205", "0.4972529", "0.49427202", "0.49028528", "0.48824716", "0.4873548", "0.4...
0.73892105
0
Set the value of the CategorySiteID input for this Choreo. ((optional, string) The ID for the site for which to retrieve the category hierarchy. Use the numeric site code (e.g., 0 for US, 77 for eBay Germany, etc).)
def set_CategorySiteID(self, value): super(GetCategoriesInputSet, self)._set_input('CategorySiteID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_SiteID(self, value):\n super(GetCategoriesInputSet, self)._set_input('SiteID', value)", "def site_id(self, site_id):\n\n self._site_id = site_id", "def site_id(self, site_id):\n\n self._site_id = site_id", "def categories_id(self, categories_id):\n\n self._categories_id = ...
[ "0.6707115", "0.5398025", "0.5398025", "0.5373852", "0.5183332", "0.49956957", "0.46219173", "0.45263055", "0.4510416", "0.44572973", "0.44089535", "0.43879732", "0.4354011", "0.41838205", "0.40762675", "0.40462708", "0.4037234", "0.39882267", "0.39651904", "0.39525023", "0.3...
0.743803
0
Set the value of the LevelLimit input for this Choreo. ((optional, string) Indicates the maximum depth of the category hierarchy to retrieve, where the toplevel categories (metacategories) are at level 1. Default is 0.)
def set_LevelLimit(self, value): super(GetCategoriesInputSet, self)._set_input('LevelLimit', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetLimit(self, *args):\n return _BRepAlgo.BRepAlgo_NormalProjection_SetLimit(self, *args)", "def categories_level(self, categories_level):\n\n self._categories_level = categories_level", "def set_limit(self, limit):\n self.limit = limit\n self._prune()", "def setRevisionLimit(...
[ "0.59802634", "0.5946763", "0.5711779", "0.5509778", "0.5490343", "0.54478884", "0.54478884", "0.54478884", "0.5437157", "0.54352576", "0.5423509", "0.5397781", "0.5367426", "0.5363926", "0.53585196", "0.53347886", "0.5326937", "0.53143334", "0.5291554", "0.52813643", "0.5179...
0.78116244
0
Set the value of the SandboxMode input for this Choreo. ((conditional, boolean) Indicates that the request should be made to the sandbox endpoint instead of the production endpoint. Set to 1 to enable sandbox mode.)
def set_SandboxMode(self, value): super(GetCategoriesInputSet, self)._set_input('SandboxMode', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sandbox(self, sandbox):\n\n self._sandbox = sandbox", "def is_sandbox_environment(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"is_sandbox_environment\")", "def CreateSandbox() -> Sandbox:\n global _sandbox_name\n if _sandbox_name is None:\n return NullSandbox()\n e...
[ "0.5614144", "0.5567158", "0.51500666", "0.51233065", "0.51149535", "0.50982213", "0.49350753", "0.48719332", "0.48414156", "0.48161337", "0.46198162", "0.44927067", "0.44751006", "0.44662586", "0.44561806", "0.44053355", "0.43435562", "0.4293769", "0.4281894", "0.42796412", ...
0.67555255
0
Set the value of the UserToken input for this Choreo. ((required, string) A valid eBay Auth Token.)
def set_UserToken(self, value): super(GetCategoriesInputSet, self)._set_input('UserToken', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(self, user_token, user_device=None):\n\n self.user_token = user_token\n self.user_device = user_device", "def user(self, user_token, user_device=None):\n self.set('user', user_token)\n self.set('device', user_device)", "def set_user_api_token(connection, api_url, token):\n\...
[ "0.66497695", "0.63058317", "0.58796537", "0.58653057", "0.5778395", "0.5624388", "0.5522572", "0.5495309", "0.54718363", "0.53511024", "0.5306627", "0.52830744", "0.5225", "0.5205493", "0.5196284", "0.5194925", "0.5191801", "0.5144547", "0.50857335", "0.5083931", "0.5067435"...
0.66259897
1
Set the value of the ViewAllNodes input for this Choreo. ((optional, boolean) A flag that controls whether all eBay categories are returned, or only leaf categories are returned. To retrieve leaf categories, set this parameter to 'false'.)
def set_ViewAllNodes(self, value): super(GetCategoriesInputSet, self)._set_input('ViewAllNodes', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_nodes(self):\n return self._get_all_nodes()", "def add_nodes_from(self, nodes):\n self._Impl._nodes[\"all_nodes\"] = cudf.Series(nodes)", "def all_nodes(self, namespace=None):\n source = self._source(namespace)\n return self._list(source, 'all')", "def deactivate_all(s...
[ "0.5391109", "0.5390056", "0.52510315", "0.50688076", "0.50596285", "0.49692878", "0.49534097", "0.4930699", "0.48903552", "0.4888203", "0.48538244", "0.48459598", "0.47947457", "0.47933027", "0.47827104", "0.4774255", "0.47677267", "0.47593287", "0.47422218", "0.4693059", "0...
0.7972372
0
teardown any state that was previously setup with a call to setup_class.
def teardown_class(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown_class(klass):", "def teardown_class(klass):", "def teardown_class(self):\n self._tester = None\n self._sut = None", "def teardown_class(cls):\n pass", "def teardown_class(cls):\n pass", "def teardown_class(cls):", "def teardown_class(cls):", "def teardown_clas...
[ "0.81003416", "0.81003416", "0.8079559", "0.7988477", "0.7988477", "0.79816633", "0.79816633", "0.79816633", "0.7741436", "0.76517147", "0.7570522", "0.7541752", "0.75215787", "0.7399094", "0.73822033", "0.73822033", "0.73822033", "0.7380316", "0.7341067", "0.7341067", "0.733...
0.8194173
0
Test the module import for our vendored version of libjuju. Test and verify that the version of libjuju being imported by N2VC is our vendored version, not one installed externally.
def test_vendored_libjuju(self): for name in sys.modules: if name.startswith("juju"): module = sys.modules[name] if getattr(module, "__file__"): print(getattr(module, "__file__")) assert re.search('n2vc', module.__file__, re.IGN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_importable():\n root_path = os.path.dirname(MY_DIRECTORY)\n\n for version in versioning.get_all_versions():\n v = version.label.replace(\".\", \"_\")\n path = os.path.join(root_path, v)\n module_names = [m[:-3] for m in os.listdir(path) if m.endswith(\".py\")]\n for name ...
[ "0.6707853", "0.6500896", "0.6209891", "0.60962284", "0.6059041", "0.60238165", "0.599417", "0.5978221", "0.5883265", "0.586116", "0.58340436", "0.5832928", "0.57998675", "0.57977194", "0.57901615", "0.5789333", "0.57761467", "0.5762795", "0.5745518", "0.572795", "0.57217455"...
0.77674305
0
Ensure that the type and dimensions of the value are as expected. If from_string is True, the value is expected to be a unit symbol string.
def verify_dimensions(self, value, exception=True, from_string=False): if from_string: value = Quantity(1, value) try: if self.units is not None: try: value.assert_dimensions(self.units) except AttributeError: raise TypeError('Expected a Quantity, not "{0}"'.format(value)) except Incom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_empty_string(self):\n raw = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x0...
[ "0.6058552", "0.5902661", "0.58640677", "0.584069", "0.5795408", "0.57693225", "0.5753926", "0.5752173", "0.57210684", "0.5688301", "0.56866753", "0.567307", "0.5672647", "0.5659424", "0.56070775", "0.5603871", "0.5602504", "0.5601414", "0.55882144", "0.5556388", "0.55380595"...
0.6568141
0
Either use the specified converter, treat as a quantity, or do nothing.
def convert(self, value): if self.converter is not None: return self.converter(value) elif self.units is not None: q = Quantity(value) q.assert_dimensions(self.units) return q else: return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converter(item):\n pass", "def set_units_converter(self, converter):\n self._units_converter = converter", "def converterValue(self, converter):\n pass", "def get_quantity(item: dict):\n qty = item.get('quantity')\n if isinstance(qty, dict):\n return Decimal(qty[\"value\...
[ "0.6080261", "0.5783019", "0.5745135", "0.5397822", "0.53845406", "0.53512806", "0.52714175", "0.52201015", "0.520989", "0.52045816", "0.5190917", "0.5171038", "0.50769126", "0.5057457", "0.5053004", "0.5047589", "0.504609", "0.4977945", "0.49526244", "0.4933274", "0.49012908...
0.66022456
0
Determine whether the given wrapper already wraps this Resource.
def is_wrapped_by(self, name): try: self._find_wrapper_by_name(name) except ValueError: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_wrapable(mcs, attribute):\n return isfunction(attribute) and not isinstance(attribute, (classmethod, staticmethod))", "def wrap(wrapper, wrapped):\r\n if decorator:\r\n return decorator.decorator(wrapper, wrapped)\r\n return update_wrapper(wrapper, wrapped)", "def register(self, wrap...
[ "0.5660551", "0.56040525", "0.5594782", "0.55533165", "0.55367464", "0.55265677", "0.55185264", "0.5416225", "0.53686476", "0.5338563", "0.52991587", "0.5257137", "0.5256876", "0.52147627", "0.519328", "0.5120308", "0.5110175", "0.5081303", "0.50668675", "0.5045929", "0.49721...
0.71655154
0
gets the absolute path to the file
def get_abs_path(filename): dirname = os.path.dirname(os.path.abspath(__file__)) return os.path.join(dirname, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_path(self):\n\t\treturn call_sdk_function('PrlFsEntry_GetAbsolutePath', self.handle)", "def _get_path(): # THIS IS JUST FOR GETTING THE FILE\n return os.path.dirname(os.path.abspath(__file__)) + '/'", "def _abs_path(fn):\n return os.path.join(os.path.dirname(__file__), fn)", "def get_fu...
[ "0.7887799", "0.78053993", "0.77804095", "0.7762283", "0.7761981", "0.77285194", "0.76814115", "0.76741165", "0.7560067", "0.75413364", "0.7526306", "0.7487459", "0.746613", "0.7463732", "0.74426347", "0.7432694", "0.74262834", "0.7422942", "0.7370598", "0.7369104", "0.736023...
0.809167
0
Get the state of a previously configured CAN bus.
def can_state(send, bus): response = {'r': 'can_state', 'state': None} can = can_bus_map.get(bus, None) if can is not None: response['state'] = { pyb.CAN.STOPPED: 'stopped', pyb.CAN.ERROR_ACTIVE: 'error_active', pyb.CAN.ERROR_WARNING: 'error_warning', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_device_state():\n \n try:\n _debug_print(\"Connecting to bus...\")\n i2c_bus = smbus.SMBus(_bus_id)\n\n current_state = i2c_bus.read_byte(_device_addr) & 0x0F\n\n return int(current_state)\n\n except:\n print(\"Error: There was a problem reading from the device...
[ "0.6698612", "0.6196475", "0.6130076", "0.61101615", "0.6062818", "0.6031746", "0.6006805", "0.59833187", "0.59467405", "0.5912973", "0.5870844", "0.5869142", "0.58660966", "0.5829685", "0.5827593", "0.5827593", "0.5827593", "0.5827593", "0.5827593", "0.5827593", "0.5827593",...
0.7267014
0
If the password is correct, displays lstatistic page. Otherwise, displays appropriate error message.
def login(self, password): if (password == "loveluay"): self.lStatisticStackedWidget.setCurrentIndex(1) else: moreInfo = "\"" + password + "\" is incorrect. please try again or contact chilleo@gmail.com" self.message("Incorrect Password", "The password you entered is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return \"Please log in... Log in page\"", "def evaluate_password_health(users, print_password=False):\n hasUpperCase = \"[A-Z]\"\n hasLowerCase = \"[a-z]\"\n hasNumbers = \"\\d\"\n hasNonalphas = \"\\W\"\n results = []\n for username, password in users.items():\n ...
[ "0.5747581", "0.5714671", "0.56969535", "0.5679485", "0.5674646", "0.56705225", "0.5624725", "0.5614046", "0.56011856", "0.55548626", "0.5546437", "0.5505691", "0.54869825", "0.54830533", "0.54677933", "0.5462135", "0.54592884", "0.5451447", "0.5445026", "0.5444386", "0.54097...
0.66152185
0
checks if given entry is empty or not. (i) if entry is populated returns text (ii) otherwise raises value error
def checkEntryPopulated(self, entry, errorTitle='Field Not Populated', errorMessage='Please populate field.', errorDescription=None): # if user does not provide an error description generate one automatically if not errorDescription: errorDescription = 'relevant entry name: ' + str(entry.ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entry_field_values_are_not_empty(entry: _LexiconEntry) -> None:\n empty_fields = [f for f in _REQUIRED_FIELDS if not entry[f]]\n\n if empty_fields:\n field_str = \", \".join(sorted(empty_fields))\n raise InvalidLexiconEntryError(\n f\"Entry fields have empty values: '{field_str}'\")", "def ge...
[ "0.6981402", "0.6756794", "0.6678831", "0.66734993", "0.6366761", "0.6356786", "0.63151586", "0.631306", "0.62579745", "0.6219134", "0.6212304", "0.6151103", "0.61417395", "0.61398095", "0.6114239", "0.6044269", "0.60362357", "0.6025646", "0.602314", "0.60065186", "0.59784955...
0.7203207
0
checks if value of given entry is in range. i. if entry is in given range return it ii. otherwise raises value error
def checkEntryInRange(self, entry, min=(-1.0 * float('inf')), max=float('inf'), inclusive=True, errorTitle='Entry Out Of Range', errorMessage='', errorDescription=None): # if user does not provide an error description generate one automatically if not errorDescription: errorDescription = 'r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_range(num):\n for i in ranges.keys():\n if num in ranges[i]:\n return i", "def isInRange(self,section,option,testval):\n \"\"\" us to test if 15 is in range defined as e.g. \"1-10,12,16-19\" \"\"\"\n value=ConfigParser.SafeConfigParser.get(self,section,option)\n ...
[ "0.7152191", "0.7056733", "0.6937104", "0.6925974", "0.686642", "0.6862959", "0.6817519", "0.66738325", "0.66446173", "0.66358376", "0.6624139", "0.66183287", "0.65863585", "0.65854746", "0.65593094", "0.6500753", "0.6478799", "0.6467218", "0.644324", "0.64166504", "0.6406122...
0.7250366
0
returns the number of checkboxes that are checked
def getNumberChecked(self): return (self.checkboxScatterPlot.checkState() + self.checkboxDonutPlot.checkState() + self.checkboxAllTrees.checkState()) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_of_choices(self) -> int:\n return len(self._choices)", "def GetCheckBoxSize(*args, **kwargs):\n return _gdi_.RendererNative_GetCheckBoxSize(*args, **kwargs)", "def get_count_of_controls(self, recurse: bool) -> int:\n return len(list(self.get_all_controls(recurse)))", "def cou...
[ "0.63210493", "0.6222181", "0.6178917", "0.61608493", "0.61397576", "0.6122742", "0.6122495", "0.6058574", "0.6047955", "0.59916806", "0.59904414", "0.59828997", "0.594535", "0.59252757", "0.59179276", "0.59048724", "0.59024745", "0.5901195", "0.5893027", "0.5889103", "0.5889...
0.726542
0
toggles whether or not guiElement is enabled
def toggleEnabled(self, guiElement): enabled = guiElement.isEnabled() guiElement.setEnabled(not enabled)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enable_disable_gui(self, state):\r\n self.mainWidget.standbyPushButton.setDisabled(state)\r\n self.mainWidget.eventComboBox.setDisabled(state)\r\n self.mainWidget.roomComboBox.setDisabled(state)\r\n self.mainWidget.dateComboBox.setDisabled(state)\r\n self.mainWidget.talkComb...
[ "0.69816", "0.69582343", "0.6883505", "0.68738556", "0.68276453", "0.6776707", "0.67430043", "0.67430043", "0.6729134", "0.6666026", "0.6665531", "0.6665531", "0.662512", "0.6596297", "0.6528794", "0.65138054", "0.65128595", "0.64982307", "0.64661014", "0.6447577", "0.6399733...
0.8579611
0
i. open a dialog to get in which user enters a file name to save ii. sets the text of given text entry to match file user selected
def saveFileAs(self, textEntry): textEntry.setText(QtGui.QFileDialog.getSaveFileName(self, 'Export'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileName(self, textEntry):\n textEntry.setText(QtGui.QFileDialog.getOpenFileName())\n textEntry.emit(QtCore.SIGNAL('FILE_SELECTED'))", "def browse( self ):\n Tk.Tk().withdraw()\n filename = askopenfilename( initialdir = self.initialdir,\n ...
[ "0.7600504", "0.7478386", "0.73535603", "0.7231459", "0.71452034", "0.7135394", "0.7072531", "0.6995552", "0.6995552", "0.6938619", "0.6937704", "0.6916023", "0.68937707", "0.68868494", "0.688312", "0.68801373", "0.6855539", "0.6847503", "0.68176925", "0.6816151", "0.68119866...
0.7488586
1
i. open a dialog to get in which user selects a file ii. sets the text of given text entry to match file user selected
def getFileName(self, textEntry): textEntry.setText(QtGui.QFileDialog.getOpenFileName()) textEntry.emit(QtCore.SIGNAL('FILE_SELECTED'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browse_files_in(self,*args):\n path_to_data = tkFileDialog.askopenfilename()\n #show chosen value in textframe\n self.docstring.delete(0,tk.END)\n self.docstring.insert(0,path_to_data)\n #use chosen value as self.data_file\n self.data_file.set(path_to_data)", "def br...
[ "0.75972843", "0.7592121", "0.74247646", "0.73100656", "0.72838455", "0.7278615", "0.72531843", "0.72531843", "0.7165265", "0.71190333", "0.71152383", "0.7110643", "0.70934874", "0.7059284", "0.7045121", "0.68826526", "0.6851092", "0.6845944", "0.6842857", "0.6825622", "0.681...
0.7607524
0
i. open a dialog in which user selects a directory ii. sets the text of given text entry to match the directory the user selected
def openDirectory(self, textEntry): textEntry.setText(QtGui.QFileDialog.getExistingDirectory()) textEntry.emit(QtCore.SIGNAL("DIRECTORY_SELECTED"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def askForDir(self):\n self.dir = tkFileDialog.askdirectory(**self.dir_opt)\n self.textView.insert('end', 'Open %s\\n' % (self.dir))", "def browse( self ):\n Tk.Tk().withdraw()\n dirname = askdirectory()\n\n self.set_text( dirname )\n #rint( f\"get_text = {self.get_tex...
[ "0.79557335", "0.7627418", "0.7475416", "0.7445645", "0.73689944", "0.7321648", "0.72456354", "0.7223277", "0.7100498", "0.7093033", "0.70770675", "0.70672625", "0.70645624", "0.70553327", "0.7037435", "0.69944274", "0.69918424", "0.69603044", "0.68496865", "0.6845472", "0.68...
0.82809854
0
This method is used for the keystroke grading in the application. The data in retrieved from the database. This data is then used in the grading process. The user selects a key and that key then performs a task. There is a queue which loads the key selections which is used to add the marks and comments to the students ...
def startGrading(event): window.unbind("<s>", bind_id) cur.execute( "SELECT comment1, comment2, comment3, comment4, comment5 FROM cannedComments WHERE user_id =%s and moduleCode = %s and assignmentNo = %s", (userID, assignmentModuleCode, assignmentNo)) fetchedComments = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submitAssignment(self, _event=None):\n assignmentFilePath = AccessingFiles.getFilepath()\n cur.execute(\n \"SELECT * FROM assignments WHERE user_id =%s and student_id = %s and filename = %s and moduleCode = %s and assignmentNo = %s\",\n (userID, selection, it...
[ "0.61789244", "0.5682106", "0.55871874", "0.5540368", "0.5355401", "0.5321885", "0.5302319", "0.51488197", "0.51355994", "0.51158065", "0.5112609", "0.5047955", "0.50102323", "0.49364117", "0.4906312", "0.48952746", "0.4892012", "0.4890522", "0.48756707", "0.48665848", "0.484...
0.6797914
0
This method is used to highlight text in the student assignment. Firstly, the PDF is saved which does not include the highlighted text. The pdf is then opened and the text from the HighlightedText.txt file is copied and the the fitz module in python locates the text in the pdf and then adds a yellow background to the t...
def highlightingTextInFile(): savingFilePDF = re.sub('\t', '', item_text[0] + ".pdf") doc = fitz.open(gradedFilesFolder + "\\" + savingFilePDF) page = doc[0] with open(newTextFile, "r") as file2: time.sleep(0.5) text1 = file2.read() # Search for the text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight(self):\n\n if self.selected_text_file is None:\n return\n if self.selected_text_file[FULLTEXT] is None:\n return\n format_ = QtGui.QTextCharFormat()\n cursor = self.ui.textBrowser.textCursor()\n for item in self.case_text:\n try:\n ...
[ "0.65989536", "0.6505804", "0.6054621", "0.60322046", "0.60036427", "0.5864477", "0.57321054", "0.5600204", "0.55730855", "0.54676825", "0.54027605", "0.53352803", "0.5305688", "0.528708", "0.51586694", "0.51586694", "0.51586694", "0.5149887", "0.5149887", "0.51426286", "0.51...
0.83719736
0
This method copies the code in the assignment grading text box and creates a pdf file which will be used in order to highlight text
def savePDFFile(self): s = self.text.get("1.0", tk.END) f = open(file, "w", encoding='utf-8') f.write(s) f.close() # Create a file for each student with their graded files pdf = FPDF() pdf.add_page() pdf.set_font("Arial", s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlightingTextInFile():\n savingFilePDF = re.sub('\\t', '', item_text[0] + \".pdf\")\n doc = fitz.open(gradedFilesFolder + \"\\\\\" + savingFilePDF)\n page = doc[0]\n\n with open(newTextFile, \"r\") as file2:\n time.sleep(0.5)\n text1 = file2.read()\n\n ...
[ "0.6238947", "0.58214", "0.5817242", "0.5786519", "0.57760084", "0.57760084", "0.57760084", "0.57224184", "0.56881684", "0.56578857", "0.56418467", "0.5640361", "0.5613223", "0.56121486", "0.5571742", "0.5571385", "0.555584", "0.5549019", "0.553231", "0.55292517", "0.54780155...
0.70820236
0
This method is used to submit the students assignment grade to the database. If a grade for the student already exists in the database and the user selects that assignment for grading, they will be prompted with an message box asking if they want to regrade the assignment. If they select yes then they can regrade the a...
def submitAssignment(self, _event=None): assignmentFilePath = AccessingFiles.getFilepath() cur.execute( "SELECT * FROM assignments WHERE user_id =%s and student_id = %s and filename = %s and moduleCode = %s and assignmentNo = %s", (userID, selection, item_text[0],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_grade(self):\r\n student = self._student('POST', key='grader_id')\r\n if student is None:\r\n self._error_response()\r\n\r\n else:\r\n # Update the number of essays the student has graded\r\n student.grade_peer_essay()\r\n return self._succ...
[ "0.6543872", "0.63892865", "0.633533", "0.6332422", "0.63317186", "0.63130635", "0.62545836", "0.6071485", "0.6068624", "0.6017599", "0.59676605", "0.59659773", "0.59341687", "0.5874737", "0.57972556", "0.5783686", "0.5766519", "0.5579791", "0.55714285", "0.556687", "0.555967...
0.8227006
0
Adds the highlighted text in the assignment grading window to the HighlightedText.txt file
def highlightCode(self, _event=None): count = 0 if self.text.tag_ranges('sel'): self.text.tag_add('color' + str(count), tk.SEL_FIRST, tk.SEL_LAST) self.text.tag_configure('color' + str(count), foreground='black', background='yellow') count += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlightingTextInFile():\n savingFilePDF = re.sub('\\t', '', item_text[0] + \".pdf\")\n doc = fitz.open(gradedFilesFolder + \"\\\\\" + savingFilePDF)\n page = doc[0]\n\n with open(newTextFile, \"r\") as file2:\n time.sleep(0.5)\n text1 = file2.read()\n\n ...
[ "0.7374293", "0.6817336", "0.64692134", "0.6182169", "0.6022382", "0.59503573", "0.58533984", "0.5805103", "0.5790315", "0.57207805", "0.56802523", "0.5655003", "0.5655003", "0.56214184", "0.5620613", "0.55651665", "0.5480074", "0.547468", "0.5472067", "0.5469422", "0.5457528...
0.6832632
1
This method adds the marks and comments generated from the keystrokes into the students assignment
def addAssignmentComments(self, _event=None): self.text.insert(tk.END, "\n") self.text.insert(tk.INSERT, assignmentCommentsBox.get("1.0", "end-1c"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startGrading(event):\n window.unbind(\"<s>\", bind_id)\n cur.execute(\n \"SELECT comment1, comment2, comment3, comment4, comment5 FROM cannedComments WHERE user_id =%s and moduleCode = %s and assignmentNo = %s\",\n (userID, assignmentModuleCode, assignmentNo))\n fetch...
[ "0.55127954", "0.55074334", "0.53589535", "0.53228885", "0.5216916", "0.52080244", "0.5189307", "0.5166053", "0.5159105", "0.515391", "0.51526713", "0.50940263", "0.5013002", "0.5001225", "0.49976295", "0.49926817", "0.4991195", "0.4941163", "0.49386635", "0.49113652", "0.490...
0.60720026
0
If window is closed mid grading a message box display
def on_closingWindow(self): if messagebox.askokcancel("Quit", "Do you want to quit grading the assignment?\n File will be saved", parent=window): self.submitAssignment()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __window_close(self):\n pass", "def message_box(self):\n root = tk.Toplevel(self.top)\n root.attributes('-topmost', True)\n root.geometry(\"+650+100\")\n root.withdraw()\n messagebox.showinfo('Oh oh', 'Wrong message. Try again!')\n try:\n root.destr...
[ "0.73147106", "0.7060031", "0.69775015", "0.6929832", "0.6904085", "0.687413", "0.68636405", "0.68604046", "0.6857272", "0.6853422", "0.6843845", "0.68172044", "0.6751769", "0.6727031", "0.6711077", "0.669814", "0.669641", "0.66409177", "0.6637147", "0.66262764", "0.6613843",...
0.74814725
0
write_ROMS_grid(grd, filename) Write ROMS_CGrid class on a NetCDF file.
def write_ROMS_grid(grd, visc_factor, diff_factor, filename='roms_grd.nc'): Mm, Lm = grd.hgrid.x_rho.shape # Write ROMS grid to file nc = netCDF.Dataset(filename, 'w', format='NETCDF4') nc.Description = 'ROMS grid' nc.Author = 'Trond Kristiansen' nc.Created = datetime.now().isoformat() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_cdo_grid(self, outfile):", "def save_mrc(grid_object, path):\n\n return MRC_Grid_Write(grid_object, path)", "def write_shapefile(self, filename='grid.shp', epsg=None, prj=None):\n from ..export.shapefile_utils import write_grid_shapefile2\n if epsg is None and prj is None:\n ...
[ "0.65927523", "0.64591205", "0.64300597", "0.63076574", "0.62848854", "0.62485576", "0.6131454", "0.6101492", "0.605749", "0.6021716", "0.5946283", "0.5857305", "0.576592", "0.57481474", "0.5727841", "0.572196", "0.57188284", "0.56795627", "0.56728095", "0.56445134", "0.56236...
0.7655568
0
Test Numeric array to VTK array conversion and viceversa.
def test_array2vtk(self): # Put all the test arrays here. t_z = [] # Test the different types of arrays. t_z.append(numpy.array([-128, 0, 127], numpy.int8)) # FIXME: character arrays are a problem since there is no # unique mapping to a VTK data type and back. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arr2cell_array(self):\n # Test list of lists.\n a = [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9]]\n cells = array_handler.array2vtkCellArray(a)\n z = numpy.array([1, 0, 2, 1,2, 3, 3,4,5, 4, 6,7,8,9])\n arr = array_handler.vtk2array(cells.GetData())\n self.assertEqual(num...
[ "0.694688", "0.663548", "0.64812386", "0.6476549", "0.635363", "0.631881", "0.617769", "0.6159509", "0.614058", "0.60678095", "0.6061788", "0.5929297", "0.5926725", "0.59005785", "0.5837574", "0.5725261", "0.57149047", "0.5694535", "0.56775194", "0.5614327", "0.5610911", "0...
0.799915
0
Test Numeric array to vtkCellArray conversion.
def test_arr2cell_array(self): # Test list of lists. a = [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9]] cells = array_handler.array2vtkCellArray(a) z = numpy.array([1, 0, 2, 1,2, 3, 3,4,5, 4, 6,7,8,9]) arr = array_handler.vtk2array(cells.GetData()) self.assertEqual(numpy.sum(arr ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_array2vtk(self):\n # Put all the test arrays here.\n t_z = [] \n\n # Test the different types of arrays.\n t_z.append(numpy.array([-128, 0, 127], numpy.int8))\n\n # FIXME: character arrays are a problem since there is no\n # unique mapping to a VTK data typ...
[ "0.62945616", "0.5984892", "0.59832245", "0.5936498", "0.5862382", "0.583198", "0.5802998", "0.5767916", "0.5704477", "0.5664202", "0.56276673", "0.55963475", "0.5492892", "0.54758745", "0.54539454", "0.54508984", "0.54035276", "0.53702885", "0.53439134", "0.53292114", "0.531...
0.7681079
0
Test Numeric array to vtkPoints conversion.
def test_arr2vtkPoints(self): a = [[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]] p = array_handler.array2vtkPoints(a) self.assertEqual(p.GetPoint(0), (0.0, 0.0, 0.0)) self.assertEqual(p.GetPoint(1), (1.0, 1.0, 1.0)) p = vtk.vtkPoints() ident = id(p) p = array_handler.array2vt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_array2vtk(self):\n # Put all the test arrays here.\n t_z = [] \n\n # Test the different types of arrays.\n t_z.append(numpy.array([-128, 0, 127], numpy.int8))\n\n # FIXME: character arrays are a problem since there is no\n # unique mapping to a VTK data typ...
[ "0.6521495", "0.64818186", "0.5970698", "0.595983", "0.5753924", "0.5726312", "0.5666946", "0.5626826", "0.5600705", "0.55829287", "0.55201954", "0.550375", "0.5496389", "0.5471823", "0.54700726", "0.54335093", "0.53982234", "0.53903526", "0.53780526", "0.5361564", "0.5358959...
0.7969096
0
Test array to vtkIdList conversion.
def test_arr2vtkIdList(self): a = [1, 2, 3, 4, 5] p = array_handler.array2vtkIdList(a) for i, j in enumerate(a): self.assertEqual(p.GetId(i), j) p = vtk.vtkIdList() ident = id(p) p = array_handler.array2vtkIdList(numpy.array(a), p) for i, j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_array(self):\n arr = vtk.vtkIdTypeArray()\n arr.SetNumberOfTuples(10)\n for i in range(10):\n arr.SetValue(i, i)\n\n np = array_handler.vtk2array(arr)\n self.assertEqual(numpy.all(np == range(10)), True)", "def mkVtkIdList(self, it):\n vil = vtk.vt...
[ "0.7677187", "0.647352", "0.59208304", "0.5762081", "0.57502407", "0.5743467", "0.5742972", "0.57179093", "0.56799865", "0.56706077", "0.5654017", "0.5637075", "0.5625911", "0.55883914", "0.55837685", "0.55628437", "0.5555486", "0.55226254", "0.5453243", "0.54327404", "0.5366...
0.8411601
0
Test multiple signature cases that have array arguments.
def test_get_correct_sig(self): obj = tvtk_base.TVTKBase(vtk.vtkIdTypeArray) sigs = [ None, [['vtkDataArray']], [['int', 'vtkIdList']], [['int', 'vtkPoints'], ['int', 'int']], [['int', 'vtkPoints'], ['int']], [['int'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handler_array(self):\n\n @intent_handler\n def decorated_test(arr: List[str]):\n return arr\n\n r = create_request(\n \"TEST_CONTEXT\",\n arr=[\n \"31-12-2001\",\n \"31-12-1001\",\n ],\n )\n result...
[ "0.6318285", "0.6172812", "0.6162404", "0.610861", "0.6058716", "0.605753", "0.6045802", "0.60229707", "0.59978545", "0.59901863", "0.5983605", "0.59537596", "0.59348905", "0.5915856", "0.5899093", "0.5764791", "0.57222784", "0.57166", "0.568288", "0.56676954", "0.5647761", ...
0.65782744
0
Test if dereferencing array args works correctly.
def test_deref_array(self): sigs = [[['vtkDataArray']], [['vtkFloatArray']], [['vtkCellArray']], [['vtkPoints']], [['int', 'vtkIdList']], [['int', ('float', 'float'), 'vtkDataArray']], [['Prop', 'int', 'vtkDataArray'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ptr_or_array(*args):\n return _ida_hexrays.is_ptr_or_array(*args)", "def lookup_array(self, *args, **kwargs): # real signature unknown\n pass", "def lookup_array(self, *args, **kwargs): # real signature unknown\n pass", "def _check_args(self, args_):\n\n pass", "def test_vargs(...
[ "0.6318977", "0.60770243", "0.60770243", "0.59743184", "0.5915152", "0.5903806", "0.58661574", "0.5851228", "0.58363134", "0.57874745", "0.57700723", "0.55881095", "0.5572754", "0.5562253", "0.55080026", "0.5481902", "0.54778504", "0.5451302", "0.54414076", "0.5424659", "0.54...
0.6638242
0
Test the ArrayCache class.
def test_array_cache(self): cache = array_handler.ArrayCache() # Test if len works. self.assertEqual(len(cache), 0) arr = numpy.zeros(100, float) varr = vtk.vtkFloatArray() # test contains self.assertEqual(varr not in cache, True) cache.add(varr, arr) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_untimed(self):\n cache = TimedCache()\n for i in range(500):\n cache[i] = i\n for i in range(500):\n assert i in cache\n assert cache[i] == i", "def test__cache(self):\n # Access to a protected member _cache of a client class\n # pylint...
[ "0.68710124", "0.67767155", "0.6772086", "0.65992814", "0.65391827", "0.6536076", "0.6400671", "0.6391623", "0.63568", "0.6338708", "0.62691534", "0.62381554", "0.6217318", "0.61316127", "0.60631394", "0.6057452", "0.6055985", "0.6038328", "0.60332614", "0.5990136", "0.598484...
0.8419209
0
Test if a vtkIdTypeArray is converted correctly.
def test_id_array(self): arr = vtk.vtkIdTypeArray() arr.SetNumberOfTuples(10) for i in range(10): arr.SetValue(i, i) np = array_handler.vtk2array(arr) self.assertEqual(numpy.all(np == range(10)), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arr2vtkIdList(self):\n a = [1, 2, 3, 4, 5]\n p = array_handler.array2vtkIdList(a)\n for i, j in enumerate(a): \n self.assertEqual(p.GetId(i), j)\n p = vtk.vtkIdList()\n ident = id(p)\n p = array_handler.array2vtkIdList(numpy.array(a), p)\n ...
[ "0.7641578", "0.6041027", "0.59939146", "0.5906016", "0.57242924", "0.5714401", "0.57085663", "0.56843495", "0.55889595", "0.5541299", "0.5535113", "0.55233514", "0.5509437", "0.5506507", "0.5470009", "0.5457422", "0.5454575", "0.54334915", "0.5413795", "0.54070187", "0.54061...
0.8161448
0
Builds null model results. A null model results object is a `ModelResults` object in which all values are null. Returns ModelResults A null `ModelResults` object.
def build_null_model_results(cls): results_dict = {results_col: np.nan for results_col in specs.RESULTS_COLS} harvest_stats_dict = { buffer_pct: HarvestStats.build_null_harvest_stats() for buffer_pct in specs.BUFFER_PCTS} return cls({}, results_dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __unwrapResults(self):\n if self.__cachedResults is None:\n if self.__rawInfo.results is not None:\n resultList = json.loads(self.__rawInfo.results)\n assert len(resultList) == 2, \\\n \"Expected 2 elements, but got %s (%s).\" % (\n len(resultList), resultList...
[ "0.6237484", "0.5802736", "0.5723429", "0.5420379", "0.539289", "0.5236211", "0.5229382", "0.51973647", "0.51388884", "0.51044345", "0.50627637", "0.5057253", "0.49960345", "0.49328384", "0.49274898", "0.49107206", "0.48796177", "0.4867561", "0.48638237", "0.48547965", "0.485...
0.78038603
0
Gets the model results columns. These are the names of the variables of the `ModelResults` object, appearing in the same order as the list representation of the model results. Returns list A list of strings representing the names of the columns of the `ModelResults` object.
def get_model_results_cols(self): harvest_cols = HarvestStats.get_harvest_columns_for_buffers() return ["params"] + specs.RESULTS_COLS + harvest_cols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_columns(self):\n columns = []\n for column in self.columns:\n columns.append(column.data.name)\n return columns", "def columns(self):\n result = self.execute(self.commands.table_columns(self.name))\n return [x[0] for x in result]", "def columns(self, model=...
[ "0.68451345", "0.6789725", "0.6645704", "0.65304536", "0.65295225", "0.6463279", "0.64613503", "0.6439484", "0.6391215", "0.6350888", "0.63452", "0.6339204", "0.63063014", "0.63024807", "0.6265027", "0.626092", "0.6218528", "0.62119365", "0.6211512", "0.6210677", "0.6204148",...
0.7914969
0
Retrieves the model results. Returns dict A dictionary containing the model results.
def get_model_results(self): return self._results_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(self):\n return extract_results(self.model)", "def get_results(self):\n return self.results", "def get_results(self):\n return self.results", "def GetResults(self):\n return self._results", "def get_results(self):\n return self.result", "def get_results(self):\n...
[ "0.76512617", "0.7250927", "0.7250927", "0.7165058", "0.71104646", "0.7065672", "0.6948484", "0.6898489", "0.67698526", "0.6763811", "0.6760713", "0.6705164", "0.66972226", "0.66972226", "0.66551745", "0.6650503", "0.6627542", "0.6627542", "0.6627542", "0.66273904", "0.659701...
0.82414335
0
Converts the model results to a list. Returns list A 9element list consisting of the model parameters and 8 floats representing the model results.
def to_list(self): model_lst = [self._model_params] for result in specs.RESULTS_COLS: model_lst.append(self._results_dict[result]) for buffer_pct in specs.BUFFER_PCTS: model_lst.extend(self._harvest_stats_dict[buffer_pct].to_list()) return model_lst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_results(self):\n return self.__result_list", "def __to_list(__results):\n rows = []\n for row in __results:\n rows.append(row)\n \n __results.close()\n\n return rows", "def results(self) -> list:\n return self._...
[ "0.68007237", "0.67216784", "0.66928416", "0.6679285", "0.6616853", "0.66016215", "0.6484065", "0.6437642", "0.6435629", "0.6417909", "0.6390932", "0.63305646", "0.6188584", "0.6112668", "0.6065527", "0.60347897", "0.60145533", "0.6003021", "0.6002833", "0.59735084", "0.59684...
0.7711234
0
Checks if the model results are better than `other_model_results`. The current model results are better than `other_model_results` if the `HarvestStats` at the lowest buffer percentage are better than the `HarvestStats` at the same buffer percentage in `other_model_results`.
def is_better(self, other_model_results): buffer_pct = specs.TUNING_BUFFER_PCT return self._harvest_stats_dict[buffer_pct].is_better( other_model_results._harvest_stats_dict[buffer_pct])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_thresholded_data_with_models(self):\n pass", "def report_result(\n self,\n result: Mapping[str, Any],\n model: nn.Module,\n epoch: int,\n ) -> bool:\n metric = get_from_nested_dict(result, key=self.key, default=None)\n if metric is None:\n ...
[ "0.6502473", "0.62888247", "0.62768865", "0.6213037", "0.6123758", "0.6072899", "0.6068795", "0.5921778", "0.58675754", "0.58598775", "0.5847968", "0.5845987", "0.581194", "0.57880193", "0.5772249", "0.5712979", "0.5709731", "0.5681822", "0.5666867", "0.5664734", "0.56527406"...
0.83155894
0
Given an array of points which define a bezier curve, and two numbres 0<=a<b<=1, return an array of the same size, which describes the portion of the original bezier curve on the interval [a, b]. This algorithm is pretty nifty, and pretty dense.
def partial_bezier_points(points, a, b): a_to_1 = np.array([ bezier(points[i:])(a) for i in range(len(points)) ]) return np.array([ bezier(a_to_1[:i+1])(b) for i in range(len(points)) ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qbezier_bounds((x0, y0), (x1, y1), (x2, y2)):\n\n\t# cubic Bezier reprsented in polynomial base\n\t# f(t) = A*t^2 + B*t + C\n\tAx = x0 - 2*x1 + x2\n\tBx = -2*x0 + 2*x1\n\tCx = x0\n\n\tAy = y0 - 2*y1 + y2\n\tBy = -2*y0 + 2*y1\n\tCy = y0\n\n\t# find extremas:\n\t#\t1) x(0) = x0\n\t#\t2) x(1) = x2\n\t...
[ "0.6650105", "0.6489684", "0.64395845", "0.63854486", "0.6252875", "0.62005275", "0.61200774", "0.60908455", "0.6059499", "0.6040542", "0.6017206", "0.6016763", "0.59797376", "0.59575784", "0.5947453", "0.58710194", "0.58644146", "0.5855325", "0.58526003", "0.5766097", "0.576...
0.788962
0
Used instead of list(set(l)) to maintain order
def remove_list_redundancies(l): return sorted(list(set(l)), lambda a, b : l.index(a) - l.index(b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dedup_list(l):\n return list(set(l))", "def sort_4(l):\n l = list(set(l))\n l.sort()", "def list_remove_duplicates(l):\n seen = set()\n seen_add = seen.add\n return [x for x in l if not (x in seen or seen_add(x))]", "def _unique(li):\n return list(set(li))", "def remove_duplicates(...
[ "0.76383084", "0.7485584", "0.73525107", "0.72422785", "0.71003187", "0.7076367", "0.7041976", "0.7040292", "0.6993371", "0.6865298", "0.68229544", "0.6761196", "0.67215854", "0.6655654", "0.6635181", "0.66209424", "0.6594591", "0.6577758", "0.6537239", "0.6518429", "0.651641...
0.74946845
1
Used instead of list(set(l1).update(l2)) to maintain order, making sure duplicates are removed from l1, not l2.
def list_update(l1, l2): return filter(lambda e : e not in l2, l1) + list(l2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_lists(cls, li1, li2):\n if not li1:\n return li2[:]\n elif not li2:\n return li1[:]\n else:\n li = li1[:]\n for el in li2:\n if el not in li:\n li.append(el)\n return li", "def remove_repeated...
[ "0.7263704", "0.7154067", "0.68808377", "0.6878345", "0.6875592", "0.68290365", "0.6800653", "0.6670713", "0.66259474", "0.6581514", "0.65448564", "0.64174837", "0.6396892", "0.6333746", "0.6276453", "0.6201921", "0.6175894", "0.61337626", "0.6115901", "0.6112074", "0.6100564...
0.73580694
0
Returns true of p0 is on the line between p1 and p2
def is_on_line(p0, p1, p2, threshold = 0.01): p0, p1, p2 = map(lambda tup : np.array(tup[:2]), [p0, p1, p2]) p1 -= p0 p2 -= p0 return abs((p1[0] / p1[1]) - (p2[0] / p2[1])) < threshold
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_line_on_line(feature_1: Sequence, feature_2: Sequence) -> bool:\n\n line_on_line = False\n\n for coords in feature_1:\n\n line_on_line = boolean_point_on_line(coords, feature_2)\n if not line_on_line:\n break\n\n return line_on_line", "def isPointOnLine(node1, node2, poin...
[ "0.7579855", "0.7464677", "0.7417148", "0.7244791", "0.70288116", "0.7003025", "0.6978226", "0.6792469", "0.6780732", "0.67776585", "0.67377263", "0.6728503", "0.6726889", "0.6713754", "0.6703011", "0.6701114", "0.66139954", "0.6600058", "0.65791726", "0.65495944", "0.6538196...
0.8123824
0
Check if calculation is runnable, either as the original or as the restart
def runnable(self): if "calculations" not in self.ctx: return True # if no calculations have run return self.ctx.running_calc < 2 and self.can_restart()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_runnable(self):\n return self.state == self.STATE_INIT and not self.require", "def running(self) -> bool:", "def check_results(self):\n if not self.ctx.is_restart and self.can_restart():\n self.ctx.is_restart = True\n self.report('Calculation is not converged and rest...
[ "0.64345175", "0.64055866", "0.62883925", "0.6022785", "0.583515", "0.5817639", "0.5810944", "0.58060336", "0.58060336", "0.58060336", "0.57899654", "0.57723004", "0.5769942", "0.57578385", "0.5742459", "0.5721791", "0.57163495", "0.5706602", "0.5685521", "0.5668268", "0.5666...
0.7984654
0
Check the calculation results, amend calculation inputs and make it restart if needed
def check_results(self): if not self.ctx.is_restart and self.can_restart(): self.ctx.is_restart = True self.report('Calculation is not converged and restart parameters are given: calc scheduled for restart')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n welcome_message()\n continue_program = True\n num_calculations = 0\n # all the calculation options in the program\n calculation_options = [\"addition\", \"subtraction\", \"division\",\n \"multiplication\", \"exponents\", \"circle area\",\n ...
[ "0.62992084", "0.62845427", "0.625051", "0.625051", "0.60817975", "0.6077046", "0.60698175", "0.6059078", "0.6044138", "0.6044028", "0.6036768", "0.60181826", "0.5992498", "0.5992498", "0.5992498", "0.59184784", "0.588707", "0.5873105", "0.5863846", "0.5855877", "0.5837538", ...
0.7682695
0
Finalize calculation, clean remote directory if needed (adapted from aiidavasp)
def finalize(self): if not self.inputs.clean_workdir: return cleaned_calcs = [] for calculation in self.ctx.calculations: try: # noinspection PyProtectedMember calculation.outputs.remote_folder._clean() cleaned_calcs.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_terminated(self):\n super(PwBandsWorkChain, self).on_terminated()\n\n if self.inputs.clean_workdir.value is False:\n self.report('remote folders will not be cleaned')\n return\n\n cleaned_calcs = []\n\n for called_descendant in self.calc.called_descendants:\...
[ "0.6397654", "0.6368182", "0.61231685", "0.61225873", "0.6119665", "0.60274994", "0.6024973", "0.59868515", "0.593518", "0.5925773", "0.5923112", "0.591191", "0.5894966", "0.5868265", "0.5841424", "0.5815715", "0.580706", "0.5800703", "0.57971424", "0.57971424", "0.57971424",...
0.75777876
0
Query the database for a link on the current record. If found, update the existing link, if not, insert new row
def updateOrInsert(cls, session, link, model, recordID): outLink = Link.lookupLink(session, link, model, recordID) if outLink is None: outLink = Link(**link) else: outLink.update(link) return outLink
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_link_into_external_link(link, found_date, anchor, link_type):\r\n db = connect()\r\n cursor = db.cursor()\r\n print \"------------------------------------------------------------------------------\"\r\n print \"link:\",link\r\n print \"link:\",found_date\r\n #print \"link:\",str(anchor...
[ "0.623239", "0.6042356", "0.60063356", "0.591801", "0.5868072", "0.58506054", "0.5849309", "0.5798199", "0.5755617", "0.5753384", "0.573804", "0.5720427", "0.56632406", "0.5543761", "0.55327636", "0.55120534", "0.5490153", "0.54851514", "0.5463551", "0.5451651", "0.5436525", ...
0.7612958
0
Update fields on existing link
def update(self, linkData): for field, value in linkData.items(): if field == 'flags': setattr(self, field, value) elif(value is not None and value.strip() != ''): setattr(self, field, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relink(self, link_id):", "def put(self):\n if jwthandler.authorize_action(self, 1) == False:\n return None\n\n userdata = jwthandler.decode_userdata(self.request.headers[\"Authorization\"])\n\n body_categories = {\"link_id\": 1, \"view_id\": 0, \"node_id_1\": 0, \"node_id_2\":...
[ "0.68344724", "0.66124517", "0.660164", "0.65914994", "0.6363283", "0.63509566", "0.63125825", "0.6273736", "0.61451024", "0.61311626", "0.61165154", "0.6072572", "0.60497147", "0.60104465", "0.60076165", "0.5906549", "0.5847444", "0.5844992", "0.5826938", "0.58229995", "0.58...
0.68995327
0
Query database for link related to current record. Return link if found, otherwise return None
def lookupLink(cls, session, link, model, recordID): checkURL = Link.httpRegexSub(link.get('url', None)) return session.query(cls)\ .join(model.__tablename__)\ .filter(model.id == recordID)\ .filter(cls.url == checkURL)\ .one_or_none()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _link_for_query(self, query):\r\n results = list(query)\r\n return results[0] if results else None", "def link(self) -> Optional[str]:\n return pulumi.get(self, \"link\")", "def link(self) -> Optional[str]:\n return pulumi.get(self, \"link\")", "def _get_self_record(self, record: ...
[ "0.6749376", "0.6332646", "0.6332646", "0.62515604", "0.61730146", "0.61730146", "0.61730146", "0.6066266", "0.60131997", "0.5963378", "0.5962121", "0.5958353", "0.59456277", "0.589322", "0.5848187", "0.58002985", "0.5758175", "0.5740583", "0.5740583", "0.5739168", "0.5739168...
0.71646607
0
Create a new cell from a Cell protobuf.
def from_pb(cls, cell_pb): timestamp = _datetime_from_microseconds(cell_pb.timestamp_micros) if cell_pb.labels: return cls(cell_pb.value, timestamp, labels=cell_pb.labels) else: return cls(cell_pb.value, timestamp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cell(self, cid):\n self.cells[cid] = Cell()", "def reproduce(self, id, position, partner):\n return Cell(id, position, self, partner)", "def _create_cell(self,row_number,cell_number):\n cell = Cell(self)\n cell.x = cell_number * self.cell_width\n cell.y = row_numbe...
[ "0.6069733", "0.59923977", "0.591453", "0.5743067", "0.57002413", "0.5664882", "0.56352407", "0.56330913", "0.5609407", "0.5444072", "0.54251987", "0.5407165", "0.53757244", "0.53634584", "0.5359123", "0.53427815", "0.534006", "0.5338059", "0.5290304", "0.52515936", "0.525070...
0.7500258
0
Convert the cells to a dictionary. This is intended to be used with HappyBase, so the column family and
def to_dict(self): result = {} for column_family_id, columns in six.iteritems(self._cells): for column_qual, cells in six.iteritems(columns): key = (_to_bytes(column_family_id) + b':' + _to_bytes(column_qual)) result[key] = cells ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self) -> Dict[str, Any]:\n return {\n column_title: cell.get_value()\n for column_title, cell in self.column_title_to_cell.items()\n }", "def as_dict(self) -> Dict[str, Any]:\n return {\n column_title: cell.value\n for column_title, cel...
[ "0.76013017", "0.75878423", "0.71978664", "0.69413537", "0.66823757", "0.6574558", "0.643032", "0.64155895", "0.6379977", "0.6318955", "0.6313105", "0.6252503", "0.6244445", "0.62411374", "0.61758727", "0.61758727", "0.61758727", "0.61758727", "0.61758727", "0.61635846", "0.6...
0.79329205
0
Getter for the current (partial) row's key.
def row_key(self): return self._row_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __key__(self) -> Tuple[int, int]:\n return self.col, self.row", "def get_key(self) -> int:\n return self.__key", "def get_key(self) -> int:\n return self.key", "def get_key(self):\n return self.key", "def get_key(self):\n return self.key", "def key(self):\n r...
[ "0.72316724", "0.72159064", "0.7207303", "0.7157399", "0.7157399", "0.71138483", "0.7061789", "0.7047705", "0.6999932", "0.6988818", "0.6988818", "0.6988818", "0.6988818", "0.6960423", "0.6876054", "0.683839", "0.68287086", "0.6781018", "0.6758112", "0.67410135", "0.6730147",...
0.84983855
0
Cancels the iterator, closing the stream.
def cancel(self): self._response_iterator.cancel()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if callable(getattr(self._file, 'close', None)):\n self._iterator.close()\n self._iterator = None\n self._unconsumed = None\n self.closed = True", "def close(self):\n if self.closed:\n return\n self._stream.close()\n self._stream = None", ...
[ "0.67333686", "0.63217324", "0.6200361", "0.6189285", "0.60646605", "0.5990257", "0.59821737", "0.5979769", "0.5914633", "0.58941954", "0.58596677", "0.58370185", "0.5811813", "0.5810032", "0.5777921", "0.5777921", "0.57457614", "0.57253283", "0.5688793", "0.56884354", "0.568...
0.67483526
0
Consume the next ``ReadRowsResponse`` from the stream. Parse the response and its chunks into a new/existing row in
def consume_next(self): response = six.next(self._response_iterator) self._counter += 1 if self._last_scanned_row_key is None: # first response if response.last_scanned_row_key: raise InvalidReadRowsResponse() self._last_scanned_row_key = response.last_scan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _receive_response_body(\n self, request: Request, stream_id: int\n ) -> typing.AsyncIterator[bytes]:\n while True:\n event = await self._receive_stream_event(request, stream_id)\n if isinstance(event, h2.events.DataReceived):\n amount = event.flow_con...
[ "0.61128515", "0.6106053", "0.5749937", "0.5664724", "0.562037", "0.5559969", "0.55483514", "0.55231017", "0.551602", "0.551602", "0.5493233", "0.54856974", "0.5481049", "0.54711795", "0.5399032", "0.53882605", "0.5361007", "0.53610015", "0.53456414", "0.5320742", "0.52846736...
0.80644053
0
Return the capacity of the link that tp_ofid is on.
def get_link_capacity(self, src_port_ofid, dst_port_ofid): src_node_id = src_port_ofid.rsplit(":", 1)[-2] for neighbor in self.neighbors[src_node_id]: if neighbor["dst_port"] == dst_port_ofid: return neighbor["bps_capacity"] # Link not found raise KeyError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_capacity():\n fs.get_capacity()", "def Capacity(self) -> int:", "def getCapacity(self):\n\n return self._dfa._capacity", "def capacity(self):\n return self._cap", "def get_capacity_param(self):\n intr = self.get_interaction()\n return intr.get_capacity(None, None, None, None,...
[ "0.6554091", "0.6332799", "0.6309355", "0.6215011", "0.61785585", "0.6164421", "0.60826606", "0.60619515", "0.6057466", "0.6057466", "0.6057466", "0.6057466", "0.6056847", "0.6049901", "0.6034765", "0.60161144", "0.59946734", "0.59814006", "0.5973901", "0.5961227", "0.5903538...
0.7761142
0
Adjust a reserved link bandwidth by value bps.
def set_link_reservation(self, tp_ofid, value): try: # Get the node_id that the port is on node_id = tp_ofid.rsplit(":", 1)[-2] # Look for the port port = None for edge in self.neighbors[node_id]: if edge["src_port"] == tp_ofid: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_link_capacity(self, path, bw):\n\n # PART 1, TASK 3.4 add bw to edges", "def add_link_reservation(self, node_id, tp_ofid, value):\n\n try:\n # Look for the port\n port = None\n for edge in self.neighbors[node_id]:\n if edge[\"src_port\"] == t...
[ "0.61118245", "0.60168004", "0.58715844", "0.5852447", "0.57242996", "0.57220125", "0.5703579", "0.5702154", "0.5698886", "0.5678886", "0.56471074", "0.5643329", "0.5599899", "0.55982184", "0.5582539", "0.5551441", "0.55049795", "0.5464619", "0.5417648", "0.5377427", "0.53443...
0.6404733
0
Return a list of EdgeNode id's in this Topology
def get_edge_ids(self): edge_ids = [] for node_id in self.nodes: if (isinstance(self.nodes[node_id], EdgeNode)): edge_ids.append(node_id) return edge_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_edge_ids(self):\n node_ids = self.node_ids\n return [(node_ids[0], node_ids[1])]", "def node_ids(self):\n return [self.node_id]", "def get_node_ids(self):\n \n return self.node_ids", "def all_node_ids(self):\n return [i for i in range(0, self.n_inputs + self....
[ "0.8417553", "0.7780123", "0.7595157", "0.7044697", "0.70229703", "0.702295", "0.70166737", "0.6988524", "0.69479936", "0.6896795", "0.6852807", "0.68157274", "0.6791412", "0.6770623", "0.6764456", "0.6745589", "0.6739532", "0.67375714", "0.67306167", "0.66955346", "0.6693982...
0.8353254
1
Return a list of FogNode id's in this Topology
def get_fog_ids(self): fog_ids = [] for node_id in self.nodes: if (isinstance(self.nodes[node_id], FogNode)): fog_ids.append(node_id) return fog_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_ids(self):\n return [self.node_id]", "def get_node_ids(self):\n \n return self.node_ids", "def _node_ids(self, nodes=None): # this function comes from BaseCard.py\n if not nodes:\n nodes = self.nodes\n if isinstance(nodes[0], integer_types):\n ...
[ "0.7718199", "0.75891614", "0.707182", "0.70489115", "0.7045605", "0.6933897", "0.6912419", "0.6898886", "0.6818077", "0.671521", "0.6713926", "0.6675852", "0.66475016", "0.66136235", "0.65971607", "0.65971607", "0.6568176", "0.65103084", "0.6461194", "0.6459157", "0.64580387...
0.7993218
0
Add a queue to the OVSNode object. Does not add a queue to a physical switch. The queue input should just be the json sent to the controller.
def add_queue(self, queue): queue_id = queue["ovsdb:queues"][0]["queue-id"] self.queue_dict[queue_id] = queue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_queue(self, queue):\n with self.mutex:\n self.queues.append(queue)", "def enqueue(queue, item):\n new_node = Node(item, None)\n if empty_queue(queue):\n queue.front = new_node\n queue.back = new_node\n else:\n queue.back.next = new_node\n queue.back ...
[ "0.699978", "0.6716818", "0.65438", "0.65087456", "0.64866793", "0.6472381", "0.6423053", "0.63540053", "0.63540053", "0.62116456", "0.6189609", "0.61521506", "0.61341804", "0.6133515", "0.6109886", "0.61030436", "0.61030436", "0.61030436", "0.60970837", "0.60970837", "0.6097...
0.7638089
0
Add a qos to the OVSNode object. Updates qos if it already exists. Does not add a qos to a physical switch. The qos input should just be the json sent to the controller.
def add_qos(self, qos): qos_id = qos["ovsdb:qos-entries"][0]["qos-id"] self.qos_dict[qos_id] = qos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_qos(tenant_id, qos_name, qos_desc):\n LOG.debug(\"add_qos() called\")\n session = db.get_session()\n try:\n qos = (session.query(network_models_v2.QoS).\n filter_by(tenant_id=tenant_id).\n filter_by(qos_name=qos_name).one())\n raise c_exc.QosNameAlreadyExi...
[ "0.675133", "0.6740849", "0.6509288", "0.63825524", "0.6261487", "0.623508", "0.61480707", "0.6146155", "0.6125985", "0.60934", "0.5971305", "0.5832702", "0.5652961", "0.56214666", "0.55383885", "0.55369544", "0.55208385", "0.5508991", "0.5416964", "0.5408776", "0.52939504", ...
0.8248631
0
Remove a qos from the OVSNode object. Does not remove a qos from a physical switch.
def del_qos(self, qos_id): del self.qos_dict[qos_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_qos(tenant_id, qos_id):\n session = db.get_session()\n try:\n qos = (session.query(network_models_v2.QoS).\n filter_by(tenant_id=tenant_id).\n filter_by(qos_id=qos_id).one())\n session.delete(qos)\n session.flush()\n return qos\n except ex...
[ "0.7492389", "0.66317993", "0.65376616", "0.613438", "0.6096178", "0.5843171", "0.57433033", "0.57280266", "0.565263", "0.5633237", "0.55685246", "0.54654384", "0.54583687", "0.5413236", "0.5384401", "0.5379288", "0.5373369", "0.5344602", "0.52841705", "0.5275169", "0.5238269...
0.74182165
1
Set the port data of a node. Add/Remove a QoS to it beforehand.
def set_port_data(self, port_ofid, qos): # qos_id = qos["ovsdb:qos-entries"][0]["qos-id"] self.port_dict[port_ofid] = qos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_port(self, data):\n self.port = get_optional_value(data, self.PORT, None)\n if self.port:\n self.port = \":\" + str(self.port)\n else:\n self.port = \"\"", "def set_in_data(self, data: NodeData, port: Port):\n self.inputs[port.index] = copy(data)\n ...
[ "0.67488563", "0.66739744", "0.6240939", "0.62166893", "0.5869487", "0.58545256", "0.5842943", "0.5787363", "0.5717762", "0.5713686", "0.5713686", "0.5690743", "0.5690426", "0.56870556", "0.5679274", "0.5679274", "0.56715566", "0.56647885", "0.5629037", "0.5599139", "0.558414...
0.7049002
0
Remove a QoS from a port on the OVSNode object. Does not remove a qos from a physical switch port.
def del_port_qos(self, port_ofid): del self.port_dict[port_ofid]["termination-point"][0]["ovsdb:qos-entry"] # del self.port_dict[port_ofid]["ovsdb:port-external-ids"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_qos(tenant_id, qos_id):\n session = db.get_session()\n try:\n qos = (session.query(network_models_v2.QoS).\n filter_by(tenant_id=tenant_id).\n filter_by(qos_id=qos_id).one())\n session.delete(qos)\n session.flush()\n return qos\n except ex...
[ "0.6073217", "0.5983327", "0.5815346", "0.56779134", "0.55692255", "0.5565197", "0.54546815", "0.5450063", "0.5372083", "0.5365305", "0.53215384", "0.5122388", "0.5097211", "0.5077547", "0.50117797", "0.5011468", "0.49515623", "0.49181432", "0.48132536", "0.48091388", "0.4789...
0.7311583
0
Return the queuenumber of the queue which is on the specified qos. Throw KeyError for nonexistant qos_id or queue_id.
def get_queue_num(self, qos_id, queue_id): q_num = None queues = self.qos_dict[qos_id]["ovsdb:qos-entries"][0]["queue-list"] # Go through all queues for queue in queues: cur_queue_id = queue["queue-ref"].split("'")[-2] # If we have a match, get the q_num and bre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qos(self, qos_id):\n aname = \"cinder_v%s.get_qos\" % self.version\n with atomic.ActionTimer(self, aname):\n return self._get_client().qos_specs.get(qos_id)", "def get_qos(self, qos_id):\n return self._unify_qos(self._impl.get_qos(qos_id))", "def search_queue_number(self...
[ "0.66933286", "0.6456661", "0.6404476", "0.62828374", "0.6201854", "0.6167598", "0.6123524", "0.61234075", "0.60170996", "0.5987462", "0.5904443", "0.5872696", "0.58259076", "0.58259076", "0.58259076", "0.58225393", "0.58024627", "0.57807124", "0.5712098", "0.55508906", "0.55...
0.8528866
0
Dismisses any open user prompts in windows.
def _dismiss_user_prompts(session): current_window = session.window_handle for window in _windows(session): session.window_handle = window try: session.alert.dismiss() except webdriver.NoSuchAlertException: pass session.window_handle = current_window
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_launcher(self):\n self.misc.go_to_win(self.misc.bufwinnr(self.name))\n if self.misc.bufname() == self.name:\n vim.command('bd')\n self.misc.go_to_win(self.misc.bufwinnr(self.curr_buf.number))\n if self.nohidden_set:\n vim.command(\"set nohidde...
[ "0.6640128", "0.65973043", "0.6501951", "0.6496951", "0.63111687", "0.6168662", "0.6166496", "0.6155943", "0.61541855", "0.6115891", "0.60888875", "0.60834306", "0.60509425", "0.6042105", "0.6036628", "0.6024034", "0.6024034", "0.6023815", "0.60197735", "0.5955441", "0.595205...
0.77716744
0
If the current browsing context selected by WebDriver is a `` or an ``, switch it back to the toplevel browsing context.
def _switch_to_top_level_browsing_context(session): session.switch_frame(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_default(self):\n self.base_driver.switch_to.default_content()", "def i_go_back(self):\n if not world.using_selenium:\n assert False, (\"this step needs to be implemented for the \"\n + \"django test client\")\n world.browser.back()", "def switch_to_frame_...
[ "0.58153147", "0.5623497", "0.5574684", "0.5559198", "0.5539013", "0.5519285", "0.54529727", "0.53206336", "0.53082204", "0.52926224", "0.5244077", "0.52141947", "0.5180062", "0.5123678", "0.5098424", "0.5080767", "0.50088096", "0.49289653", "0.4915355", "0.48766986", "0.4849...
0.7291539
0
Set of window handles, filtered by an `exclude` list if provided.
def _windows(session, exclude=None): if exclude is None: exclude = [] wins = [w for w in session.handles if w not in exclude] return set(wins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, contains, ignore_hidden=True, ignore_smaller=(480, 800)):\n if type(contains) == str:\n contains = [contains]\n\n dct = {hwnd: window for hwnd, window in self.windows.items() if window.find(contains)}\n if ignore_hidden:\n dct = {hwnd: window for hwnd, wi...
[ "0.6869567", "0.5888472", "0.58635926", "0.57578135", "0.573252", "0.5632768", "0.5533731", "0.55274135", "0.5482475", "0.5399696", "0.5340132", "0.52620625", "0.52454895", "0.5245142", "0.52206814", "0.51517177", "0.5098032", "0.5060605", "0.5053272", "0.50375456", "0.503629...
0.8272605
0
Create an `iframe` element in the current browsing context and insert it into the document. Return an element reference.
def create_frame(session): def create_frame(): append = """ var frame = document.createElement('iframe'); document.body.appendChild(frame); return frame; """ response = session.execute_script(append) return create_frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iframe(src, width=400, height=300):\n return TAG.iframe(_src=src, _width=width, _height=height)", "def as_iframe(self, html_data):\n\n srcdoc = html_data.replace('\"', \"'\")\n return ('<iframe id=\"{div_id}\", srcdoc=\"{srcdoc}\" style=\"width: {width}; '\n 'height: {heig...
[ "0.6174784", "0.55865693", "0.54760414", "0.5332886", "0.51973313", "0.5196938", "0.51477903", "0.48718172", "0.48631668", "0.48425317", "0.48268217", "0.47691065", "0.47580108", "0.47167465", "0.47058505", "0.46702343", "0.45552185", "0.45123303", "0.4505555", "0.44861558", ...
0.6257008
0
Downgrades a share which use sharesafe to not use it
def downgrade_share_to_non_safe( ui, hgvfs, sharedvfs, current_requirements, mismatch_config, mismatch_warn, ): wlock = None source_requirements = localrepo._readrequires(sharedvfs, True) original_crequirements = current_requirements.copy() # we cannot be 100% sure on which requi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade_share_to_safe(\n ui,\n hgvfs,\n storevfs,\n current_requirements,\n mismatch_config,\n mismatch_warn,\n):\n wlock = None\n store_requirements = localrepo._readrequires(storevfs, False)\n original_crequirements = current_requirements.copy()\n # after upgrade, store requires...
[ "0.6136717", "0.60942453", "0.5921612", "0.5819336", "0.5804598", "0.57667804", "0.5730506", "0.5587024", "0.55807817", "0.55419433", "0.5486107", "0.54153746", "0.53993505", "0.5386615", "0.53716373", "0.5360348", "0.5339382", "0.5251872", "0.5182905", "0.5155481", "0.515402...
0.67952925
0
Save the list of package and repos in a freeze file. As this module is build on top of the pkg module, the user can send extra attributes to the underlying pkg module via kwargs. This function will call ``pkg.list_pkgs`` and ``pkg.list_repos``, and any additional arguments will be passed through to those functions. nam...
def freeze(name=None, force=False, **kwargs): states_path = _states_path() try: if not os.path.exists(states_path): os.makedirs(states_path) except OSError as e: msg = "Error when trying to create the freezer storage %s: %s" log.error(msg, states_path, e) raise C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(name=None, clean=False, **kwargs):\n if not status(name):\n raise CommandExecutionError(\"Frozen state not found.\")\n\n frozen_pkgs = {}\n frozen_repos = {}\n for fname, content in zip(_paths(name), (frozen_pkgs, frozen_repos)):\n with fopen(fname) as fp:\n content...
[ "0.61378956", "0.5859899", "0.5553727", "0.5517044", "0.5368273", "0.5356391", "0.5287984", "0.52467597", "0.5167484", "0.5165636", "0.51454926", "0.50794226", "0.50436324", "0.5004659", "0.4979779", "0.49662858", "0.49491364", "0.49177143", "0.49048695", "0.48790634", "0.487...
0.7397437
0
Add missing repositories and update the ret dict
def _add_missing_repositories(frozen_repos, ret, **kwargs): repos = __salt__["pkg.list_repos"](**kwargs) missing_repos = set(frozen_repos) - set(repos) for repo in missing_repos: try: # In Python 2 we cannot do advance destructuring, so we # need to create a temporary diction...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_repos(self):\n for repo in self.json_repos['repos']:\n title = str(repo[\"title\"])\n repo_url = str(repo['repo'])\n self.repos[title] = repo_url", "def prepare_repositories(self):\n if 'packages' not in self.image:\n return\n\n if self.i...
[ "0.6011542", "0.6000943", "0.59702677", "0.59536284", "0.57572675", "0.5679424", "0.5480698", "0.54709816", "0.54696035", "0.5465429", "0.5418876", "0.5358285", "0.5336003", "0.5319714", "0.5300553", "0.52956134", "0.52946633", "0.52800137", "0.5257892", "0.52492833", "0.5244...
0.73283684
0
Remove extra repositories and update the ret dict
def _remove_extra_repositories(frozen_repos, ret, **kwargs): repos = __salt__["pkg.list_repos"](**kwargs) extra_repos = set(repos) - set(frozen_repos) for repo in extra_repos: try: __salt__["pkg.del_repo"](repo, **kwargs) ret["repos"]["remove"].append(repo) log.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_repo(self, url, multiple=False):\n json_data = loads(self.get_from_net(url)) #TODO add code to detect error messages in JSON from API\n if not multiple: json_data = [json_data]\n repo_dets = []\n for i in json_data:\n dets = {\n 'full_name': i['ful...
[ "0.63768286", "0.6205617", "0.6049083", "0.601234", "0.60121554", "0.59163606", "0.5872671", "0.5815441", "0.57877725", "0.57659966", "0.56418854", "0.5562782", "0.5551324", "0.55462074", "0.5538305", "0.5520755", "0.5516609", "0.549151", "0.54913694", "0.53865844", "0.537592...
0.6732441
0
Add missing packages and update the ret dict
def _add_missing_packages(frozen_pkgs, ret, **kwargs): # NOTE: we can remove the `for` using `pkgs`. This will improve # performance, but I want to have a more detalied report of what # packages are installed or failed. pkgs = __salt__["pkg.list_pkgs"](**kwargs) missing_pkgs = set(frozen_pkgs) - set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_missing(base_pkg, missing, file_deps, use_test_depends=False):\n rospack = rospkg.RosPack()\n for launch_file in file_deps.keys():\n pkg = rospkg.get_package_name(os.path.dirname(os.path.abspath(launch_file)))\n\n if pkg is None: #cannot determine package\n print(\"ERRO...
[ "0.63271356", "0.62929744", "0.6243237", "0.6235455", "0.60803497", "0.60435265", "0.59839565", "0.59402096", "0.5894886", "0.5889566", "0.585334", "0.58395016", "0.58032274", "0.57730275", "0.57447606", "0.5739964", "0.57197624", "0.57119703", "0.56428427", "0.5610361", "0.5...
0.7601584
0
Remove extra packages and update the ret dict
def _remove_extra_packages(frozen_pkgs, ret, **kwargs): pkgs = __salt__["pkg.list_pkgs"](**kwargs) extra_pkgs = set(pkgs) - set(frozen_pkgs) for pkg in extra_pkgs: try: __salt__["pkg.remove"](name=pkg, **kwargs) ret["pkgs"]["remove"].append(pkg) log.info("Removed ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_packages(self, packages):", "def get_package_extras(provider_package_id: str) -> dict[str, list[str]]:\n if provider_package_id == \"providers\":\n return {}\n extras_dict: dict[str, list[str]] = {\n module: [get_pip_package_name(module)]\n for module in ALL_DEPENDENCIES[pro...
[ "0.6884728", "0.6164183", "0.60443765", "0.59631884", "0.59131014", "0.5821271", "0.58056074", "0.5762834", "0.57213247", "0.5667933", "0.56448823", "0.55830485", "0.5582136", "0.5575238", "0.5559194", "0.5512853", "0.55096483", "0.5499099", "0.5496219", "0.54939055", "0.5487...
0.7281054
0
Make sure that the system contains the packages and repos from a frozen state. Read the list of packages and repositories from the freeze file, and compare it with the current list of packages and repos. If there is any difference, all the missing packages are repos will be installed, and all the extra packages and rep...
def restore(name=None, clean=False, **kwargs): if not status(name): raise CommandExecutionError("Frozen state not found.") frozen_pkgs = {} frozen_repos = {} for fname, content in zip(_paths(name), (frozen_pkgs, frozen_repos)): with fopen(fname) as fp: content.update(json.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze(name=None, force=False, **kwargs):\n states_path = _states_path()\n\n try:\n if not os.path.exists(states_path):\n os.makedirs(states_path)\n except OSError as e:\n msg = \"Error when trying to create the freezer storage %s: %s\"\n log.error(msg, states_path, e)\...
[ "0.6693031", "0.55354106", "0.5459218", "0.53684884", "0.52549475", "0.5132709", "0.5117423", "0.5094458", "0.4987855", "0.4985477", "0.49605286", "0.49180958", "0.4916067", "0.49073735", "0.490322", "0.49010733", "0.48840627", "0.48726887", "0.4865071", "0.4854589", "0.48454...
0.7274024
0
Display the difference between two frozen states. The results are shown as as a dictionary with keys for packages and repositories. Each key may contain a changes dictionary showing items that differ between the two frozen states. Items shown in the "old" changes but not the "new" were removed. Items in "new" but not "...
def compare(old, new): ret = {} if not (status(old) and status(new)): raise CommandExecutionError("Frozen state not found.") for ofile, nfile in zip(_paths(old), _paths(new)): with fopen(ofile, "r") as ofp: old_dict = json.load(ofp) with fopen(nfile, "r") as nfp: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff(self, old, new):\n added = {}\n removed = {}\n updated = {}\n new_keys = set(new.keys())\n old_keys = set(old.keys())\n for key in new_keys.difference(old_keys):\n self.stack.append(key)\n if self.stack not in self.EXCLUDE_PATHS:\n ...
[ "0.6445065", "0.63510185", "0.62291247", "0.61684805", "0.60867995", "0.6075472", "0.6043765", "0.5956082", "0.5903646", "0.5833109", "0.5818187", "0.5767265", "0.5758895", "0.5721016", "0.5704464", "0.56633997", "0.5603045", "0.5588445", "0.5552404", "0.55448395", "0.5528738...
0.73044235
0
Interpolates two sets of latent codes linearly.
def interpolate(src_codes, dst_codes, step=5): if not (src_codes.ndim >= 2 and src_codes.shape == dst_codes.shape): raise ValueError( f"Shapes of source codes and target codes should both be " f"[num, *code_shape], but {src_codes.shape} and " f"{dst_codes.shape} are recei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_interpolate(src_code, dst_code, step=5):\n assert (len(src_code.shape) == 2 and len(dst_code.shape) == 2 and\n src_code.shape[0] == 1 and dst_code.shape[0] == 1 and\n src_code.shape[1] == dst_code.shape[1])\n\n linspace = np.linspace(0.0, 1.0, step)[:, np.newaxis].astype(np.f...
[ "0.62725574", "0.6111674", "0.60768944", "0.60146874", "0.5994274", "0.5972352", "0.5939591", "0.5883201", "0.5856789", "0.5837395", "0.5833687", "0.58239853", "0.5815338", "0.58129686", "0.57570577", "0.5739954", "0.57292", "0.5709187", "0.5701638", "0.5627414", "0.56159806"...
0.6663595
0
Mixes styles from style codes to those of content codes. Each style code or content code consists of `num_layers` codes, each of which is typically fed into a particular layer of the generator. This function mixes styles by partially replacing the codes of `content_codes` from some certain layers with those of `style_c...
def mix_style( style_codes, content_codes, num_layers=1, mix_layers=None, is_style_layerwise=True, is_content_layerwise=True, ): if not is_style_layerwise: style_codes = style_codes[:, np.newaxis] style_codes = np.tile( style_codes, [num_layers if axis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def style_transfer(content_image, style_image,\n content_layer_ids, style_layer_ids,\n weight_content=1.5, weight_style=10.0,\n weight_denoise=0.3,\n num_iterations=120, step_size=10.0):\n\n # Create an instance of the VGG16-model. This is ...
[ "0.5546307", "0.5322151", "0.5304092", "0.52960813", "0.5194528", "0.5082745", "0.49479872", "0.48794138", "0.48556757", "0.4852009", "0.47630924", "0.4735377", "0.4601009", "0.45873055", "0.45219663", "0.45044163", "0.44962087", "0.44862875", "0.44846854", "0.44637838", "0.4...
0.84206253
0
Parses boundary list. Sometimes, a text file containing a list of boundaries will significantly simplify image manipulation with a large amount of boundaries. This function is used to parse boundary information from such list file. Basically, each item in the list should be with format
def parse_boundary_list(boundary_list_path): if not os.path.isfile(boundary_list_path): raise ValueError(f"Boundary list `boundary_list_path` does not exist!") pdb.set_trace() boundaries = {} with open(boundary_list_path, "r") as f: for line in f: if line[: len("DISABLE")] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bbox(meta_data: List) -> List:\n\n x = [v for v in meta_data[0].split(\" \") if v][0]\n y = [v for v in meta_data[1].split(\" \") if v][0]\n w = [v for v in meta_data[2].split(\" \") if v][0]\n h = meta_data[3].replace(\")\", \"\").strip(\" \")\n\n return [x, y, w, h]", "def read_bounding_...
[ "0.6213156", "0.6167396", "0.6040958", "0.5963082", "0.5890223", "0.5804764", "0.5769279", "0.56760764", "0.56570864", "0.56555957", "0.5593112", "0.5554073", "0.5542578", "0.5527665", "0.5524644", "0.5523039", "0.5522045", "0.5506655", "0.54766965", "0.5425461", "0.54130983"...
0.7501823
0
(Optional) allocate torch tensors that could potentially be used in in the train_step() or evaluation_step() functions. If the load_to_gpu() function is called then those tensors will be moved to the gpu device.
def allocate_tensors(self): self.tensors = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cuda(self):\n if torch.cuda.is_available():\n self.automata = self.automata.cuda()\n self.inv_automata = self.inv_automata.cuda()\n self.action = self.action.cuda()\n self.inv_action = self.inv_action.cuda()", "def _place_cached_acts_data(inp_data: torch.Ten...
[ "0.573606", "0.5722874", "0.5655872", "0.5533152", "0.5515631", "0.5467257", "0.5454712", "0.5453343", "0.5453343", "0.5433174", "0.54190475", "0.54162455", "0.5402546", "0.5393747", "0.53816223", "0.5370867", "0.53450185", "0.5337499", "0.5332042", "0.5314197", "0.5313799", ...
0.6671218
0
Updates settings in TopView and triggers a redraw.
def update_settings(self): settings = { "reference": self, "draw_tangents": self.cbDrawTangents.isChecked(), } if self.cbShowSolarAngle.isChecked(): settings["show_solar_angle"] = self.cbSolarAngleType.currentText(), self.cbSolarBody.currentText() else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSettingsUI(self):\n\n pass", "def update(self):\n self.active = False\n self.top.update(self.rgb,self.cmyk,self.hsv)\n self.bot.update(self.rgb,self.cmyk,self.hsv)\n self.active = True", "def UpdateUI(self):\n # colors & font\n self.SetBackgroundColour...
[ "0.6638624", "0.6337346", "0.61559534", "0.6116857", "0.60962045", "0.60954", "0.6090623", "0.6031026", "0.60115486", "0.59824395", "0.5955727", "0.59068084", "0.59050995", "0.5873285", "0.58553267", "0.58553267", "0.5830154", "0.5823889", "0.5820076", "0.58084303", "0.580387...
0.6364625
1
Computes coordinates of tangent points given coordinates of flight path.
def tangent_point_coordinates(self, lon_lin, lat_lin, flight_alt=14, cut_height=12): med_lon = np.median(lon_lin) lon_lin = normalize_longitude(lon_lin, med_lon - 180, med_lon + 180) lins = list(zip(lon_lin[0:-1], lon_lin[1:], lat_lin[0:-1], lat_lin[1:])) lins = [(x0 * np.cos(np.deg2rad(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tangent(self, p):\n p = array(p, float)\n v = (p - self.o)\n v /= norm(v)\n b = self.o + ((cross(v, self.N) - v) / 3)*self.r\n mb = _mirror_(self.o, p, b) \n mbb = mb - b\n return mbb/norm(mbb)", "def to_tangent(self, vector, base_point):\n tangent_vec ...
[ "0.64119583", "0.62860763", "0.62766653", "0.6097216", "0.60910517", "0.6090201", "0.6041448", "0.6013547", "0.59927946", "0.5969202", "0.5915505", "0.59119284", "0.58881056", "0.5871481", "0.5823385", "0.5801728", "0.57816553", "0.57736695", "0.57451314", "0.5734588", "0.570...
0.6730327
0
This method returns the currently active IOManager instance, or creates a new one if none exists
def IOManager(): global _iom_instance global _iom_shutdown if _iom_instance: return _iom_instance if _iom_shutdown or _iom_shutdown is None: raise Exception("Should not call IOManager after shutdown") _iom_instance = _IOManager() _IOManager.set_signal_handlers([signal.SIGINT, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ioserver(self) -> _IOManager:\n return self._iomanager", "def new_manager() -> SyncManager:\n return Manager()", "def GetManager(self):\r\n\r\n return self.manager", "def get_instance(cls):\n global FW_MANAGER_API\n if not FW_MANAGER_API:\n FW_MANAGER_API = cls()...
[ "0.7698565", "0.6525439", "0.6344778", "0.6328575", "0.63087434", "0.6188434", "0.61720836", "0.6109373", "0.5934774", "0.5931367", "0.5905049", "0.5869388", "0.58146125", "0.56089675", "0.5588589", "0.5574307", "0.5538294", "0.5504296", "0.54978806", "0.54878485", "0.5487848...
0.66689914
1