query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return list of values for each div.test element.
def div_value_list(self): return self.q(css='div.test').attrs('value')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_text_list(self):\n return self.q(css='div.test').text", "def div_html_list(self):\n return self.q(css='div.test').html", "def get_individual_performance(self):\n\n divs = self.page.find_all(\"span\", {\"class\":\"value\"})\n values = [div.text for div in divs]\n retur...
[ "0.74490196", "0.68997157", "0.64932024", "0.61540717", "0.6152504", "0.6152504", "0.5885815", "0.58685976", "0.5835421", "0.58142436", "0.57759404", "0.5746933", "0.56337065", "0.5621383", "0.5567706", "0.5559967", "0.55586827", "0.55545664", "0.5553262", "0.5503301", "0.548...
0.7983814
0
Return list of html for each div.test element.
def div_html_list(self): return self.q(css='div.test').html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_text_list(self):\n return self.q(css='div.test').text", "def test_html(self):\n tags = (('<input', 3),\n ('<span', 1),\n ('<button', 1))\n\n for text, count in tags:\n with self.subTest():\n self.assertContains(self.resp, text, ...
[ "0.7729957", "0.62460953", "0.62029403", "0.601013", "0.597623", "0.5949348", "0.58157754", "0.5773843", "0.56723", "0.5651943", "0.5582805", "0.5582524", "0.5579697", "0.55494183", "0.5474166", "0.54684716", "0.5461556", "0.5445097", "0.5445097", "0.54369843", "0.54336387", ...
0.8394743
0
Return a list of the ids of outer divs with the specified text in a child element.
def ids_of_outer_divs_with_inner_text(self, child_text): return self.q(css='div.outer').filter( lambda el: child_text in [inner.text for inner in el.find_elements_by_css_selector('div.inner')] ).attrs('id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(self):\n page = r.get(self.url)\n tree = html.fromstring(page.content)\n ids_elements = tree.xpath(\"//div[@id='selectedcontent']/div/ul/li/a\")\n return [self._e_to_id(e) for e in ids_elements]", "def get_child_ids(id,conn):\n\n child_ids = ('WITH RECURSIVE children AS '\n ...
[ "0.55548036", "0.5479126", "0.54318756", "0.54250884", "0.53954", "0.5378344", "0.5358235", "0.532862", "0.53090286", "0.52930194", "0.5247154", "0.5223819", "0.5181133", "0.51650614", "0.5156875", "0.51566947", "0.512827", "0.5109152", "0.5081774", "0.5059653", "0.5021192", ...
0.877173
0
Wait for click handlers to be installed, then click a button and retrieve the output that appears after a delay.
def trigger_output(self): EmptyPromise(self.q(css='div#ready').is_present, "Click ready").fulfill() self.q(css='div#fixture button').first.click() EmptyPromise(self.q(css='div#output').is_present, "Output available").fulfill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def wait_for_click():\r\n global _canvas\r\n global _cue\r\n if _canvas == None:\r\n raise RuntimeError(\"Canvas is not open ...
[ "0.6465646", "0.6465646", "0.6274144", "0.62248296", "0.6096584", "0.6029719", "0.5998305", "0.5964109", "0.5912692", "0.58695084", "0.5805828", "0.5800075", "0.5798295", "0.5771682", "0.5740042", "0.5727599", "0.5700866", "0.56949717", "0.56949717", "0.56891507", "0.5687063"...
0.66481423
0
Make a promise that will not be fulfilled. Should raise a `BrokenPromise` exception.
def make_broken_promise(self): return EmptyPromise( self.q(css='div#not_present').is_present, "Invalid div appeared", try_limit=3, try_interval=0.01 ).fulfill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def promise_forced(promise):\n require_type(isa(promise,Promise),\n 'the parameter of promise_forced must be a Promise')\n return promise.exprs.env.find(Symbol('already-run?'))['already-run?']", "async def test_task_not_awaitable(arg):\n with pytest.raises(OSError):\n async with Scope(...
[ "0.5204269", "0.5157995", "0.5118575", "0.50748104", "0.5045879", "0.50228643", "0.48635247", "0.48367554", "0.48231182", "0.48055142", "0.48020154", "0.4710334", "0.4705783", "0.47007585", "0.4683378", "0.4586624", "0.45848158", "0.45210996", "0.45157987", "0.449673", "0.449...
0.7172702
0
Load the page named `page_name` after waiting for `delay_sec`.
def load_next(self, page, delay_sec): time.sleep(delay_sec) page.visit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page_content(self, url, delay):\r\n\r\n # if browser cannot connect to the server, repeat it infinitely.\r\n while True:\r\n try:\r\n # load the page\r\n self.sel_driver.get(url)\r\n\r\n # if the page is loaded, wait for delay seconds un...
[ "0.6076569", "0.60745835", "0.5974487", "0.5962621", "0.589742", "0.58021855", "0.5790462", "0.5778986", "0.5760904", "0.5742551", "0.55892485", "0.555522", "0.55303234", "0.550315", "0.5468579", "0.54579824", "0.54159063", "0.5409639", "0.53982323", "0.53721374", "0.5353541"...
0.7595584
0
Give focus to the element with the ``maincontent`` ID.
def focus_on_main_content(self): self.browser.execute_script("$('#main-content').focus()")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetFocus(self):\r\n \r\n self._main_win.SetFocus()", "def onMnemoToMain(self):\n self.second_main_text.SetFocus()", "def _focus(self, element):\n actions = ActionChains(self.selenium.driver)\n actions.move_to_element(element).click().perform()\n self.selenium.set_f...
[ "0.68469656", "0.64330465", "0.62243736", "0.5957323", "0.5938014", "0.59248924", "0.59248924", "0.59248924", "0.59248924", "0.58128226", "0.56373054", "0.5598049", "0.5598049", "0.5598049", "0.5598049", "0.55663764", "0.555354", "0.55340254", "0.5431309", "0.5403516", "0.537...
0.8871579
0
Return a boolean indicating whether the given item is visible.
def is_visible(self, name): return self.q(css="div.{}".format(name)).first.visible
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsItemVisible(self, item):\r\n\r\n # An item is only visible if it's not a descendant of a collapsed item\r\n parent = item.GetParent()\r\n\r\n while parent:\r\n \r\n if not parent.IsExpanded():\r\n return False\r\n \r\n parent = paren...
[ "0.8459566", "0.84089726", "0.77478164", "0.7686081", "0.75969285", "0.73080444", "0.7240645", "0.7220778", "0.7220778", "0.72025424", "0.71858346", "0.7166278", "0.7160818", "0.7160818", "0.71175337", "0.7071212", "0.7057632", "0.70267516", "0.70217055", "0.70079386", "0.697...
0.7075357
15
Return a boolean indicating whether the given element is present, but not visible.
def is_invisible(self, name): return self.q(css="div.{}".format(name)).first.invisible
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_element_visible(self):\n if self.web_element.is_displayed():\n return True\n else:\n return False", "def is_visible(self):\n try:\n return self.element.is_displayed()\n except (NoSuchElementException,\n ElementNotVisibleException,...
[ "0.79927605", "0.76851815", "0.7514392", "0.73334104", "0.72232956", "0.7165965", "0.7094234", "0.704868", "0.70152134", "0.6991982", "0.6934526", "0.6922148", "0.6860868", "0.67825663", "0.6755709", "0.6745916", "0.67344236", "0.6696617", "0.66683865", "0.6668148", "0.656032...
0.64932275
24
Click a button which will only work once RequireJS finishes loading.
def trigger_output(self): self.q(css='div#fixture button').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button(self):\n self.widgets.get('button').click()", "def click_button(self):\n self.q(css='div#fixture button').first.click()", "def click(self):\n self.dispatch['elementClick'] = self.clickJsFnc", "def click_button(self):\n self.q(css='div#fixture input').first.click()", ...
[ "0.680854", "0.66910315", "0.64084864", "0.6336114", "0.6120209", "0.61122954", "0.61030865", "0.6091507", "0.6059248", "0.5980037", "0.59742665", "0.5892647", "0.5888682", "0.5856755", "0.58410084", "0.5814442", "0.581181", "0.5751456", "0.57503045", "0.5749024", "0.5719854"...
0.59564984
12
Reload the page, wait for JS, then trigger the output.
def reload_and_trigger_output(self): self.browser.refresh() self.wait_for_js() # pylint: disable=no-member self.q(css='div#fixture button').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_page(self):\n self.m_driver.refresh()\n time.sleep(30)", "def refresh(self):\n self.log_info(f\"Browser.refresh: Refreshing the page\")\n self.CORE.refresh()\n return", "def refresh_page(self, callback=None):\n if callback is not None:\n callback...
[ "0.61143285", "0.6020823", "0.5730542", "0.5707968", "0.5650479", "0.5597226", "0.5587973", "0.5548144", "0.55204254", "0.55047655", "0.54316336", "0.53578436", "0.5348964", "0.5344503", "0.52896523", "0.5284119", "0.5284119", "0.5281825", "0.52662414", "0.5262159", "0.524401...
0.77481604
0
Click a button which will only work once RequireJS finishes loading.
def trigger_output(self): self.q(css='div#fixture button').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button(self):\n self.widgets.get('button').click()", "def click_button(self):\n self.q(css='div#fixture button').first.click()", "def click(self):\n self.dispatch['elementClick'] = self.clickJsFnc", "def click_button(self):\n self.q(css='div#fixture input').first.click()", ...
[ "0.6809526", "0.6691951", "0.6409184", "0.63370335", "0.61212236", "0.611287", "0.6103311", "0.6092065", "0.606103", "0.59802353", "0.5975364", "0.5893435", "0.58887005", "0.5856853", "0.5842421", "0.5815631", "0.5811794", "0.5753243", "0.57503897", "0.5748913", "0.5719881", ...
0.59564173
11
Wait for scripts to finish and then return the contents of the ``output`` div on the page.
def output(self): return super(RequireJSPage, self).output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self):\n\t\tself.wait_window(self)\n\t\treturn self.result", "def waitUntilFinished():", "def waitUntilFinished():", "def waitUntilFinished():", "def waitUntilFinished():", "def trigger_output(self):\n\n EmptyPromise(self.q(css='div#ready').is_present, \"Click ready\").fulfill()\n ...
[ "0.58988714", "0.5896934", "0.5896934", "0.5896934", "0.5896934", "0.5818085", "0.5690976", "0.56339425", "0.5543673", "0.5390721", "0.5287882", "0.52217585", "0.5208909", "0.51837784", "0.5157287", "0.5146636", "0.51380193", "0.51380193", "0.51380193", "0.51380193", "0.51246...
0.0
-1
Click the button on the page, which triggers an ajax call that updates the output div.
def click_button(self): self.q(css='div#fixture button').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def reload_and_trigger_output(self):\n self.browser.refresh()\n self.wait_for_js() # pylint: disable=no-member\n self.q...
[ "0.6879377", "0.6879377", "0.6518393", "0.6406209", "0.62057817", "0.61877733", "0.61342907", "0.6104341", "0.6008106", "0.5944604", "0.5852779", "0.5775311", "0.5756694", "0.57321346", "0.5669197", "0.56490207", "0.5648505", "0.5631494", "0.5623206", "0.5592204", "0.5576342"...
0.641759
3
Click button and wait until output id appears in DOM.
def is_button_output_present(self): self.wait_for_element_presence('div#ready', 'Page is Ready') self.q(css='div#fixture button').first.click() self.wait_for_element_presence('div#output', 'Button Output is Available')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n\n EmptyPromise(self.q(css='div#ready').is_present, \"Click ready\").fulfill()\n self.q(css='div#fix...
[ "0.7427304", "0.7427304", "0.73659456", "0.69929504", "0.6745575", "0.6593339", "0.62362456", "0.6128253", "0.5971103", "0.59329253", "0.59204847", "0.5899554", "0.5845453", "0.58411074", "0.5840437", "0.5811588", "0.58096135", "0.58032614", "0.5756631", "0.57544845", "0.5751...
0.71300626
3
Click button and wait until playing class disappeared from DOM
def is_class_absent(self): self.q(css='#spinner').first.click() self.wait_for_element_absence('.playing', 'Animation Stopped')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poll(self):\n\tself.met = self.button.poll()", "def wait_for_button(self, button, message=True):\n if message:\n rospy.loginfo(\"Waiting for xbox button: \" + button)\n \n wait_for(lambda: not self.get_button(button) == 0)", "def _check_play_button(self, mouse_pos):\n ...
[ "0.6262264", "0.6247249", "0.6172894", "0.6123498", "0.6084997", "0.6075153", "0.60310066", "0.6026245", "0.60012144", "0.5995387", "0.5967095", "0.59577924", "0.5948899", "0.59429574", "0.592757", "0.5881039", "0.5876616", "0.5875502", "0.58591527", "0.5838041", "0.58163005"...
0.6424565
0
Click button and wait until output is displayed.
def is_button_output_visible(self): self.wait_for_element_presence('div#ready', 'Page is Ready') self.q(css='div#fixture button').first.click() self.wait_for_element_visibility('div#output', 'Button Output is Visible')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n\n EmptyPromise(self.q(css='div#ready').is_present, \"Click ready\").fulfill()\n self.q(css='div#fix...
[ "0.7492994", "0.7492994", "0.74046254", "0.73170245", "0.6892896", "0.67912996", "0.6658468", "0.66095304", "0.66076696", "0.6600129", "0.64885914", "0.6422199", "0.63829", "0.63829", "0.6375364", "0.63732177", "0.6356924", "0.63511723", "0.6327557", "0.62831944", "0.62803334...
0.67361134
6
Click button and wait until spinner is disappeared.
def is_spinner_invisible(self): self.q(css='#spinner').first.click() self.wait_for_element_invisibility('#anim', 'Button Output is Visible')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_spinner_disappear(self):\n self.wait_for_element_disappear(loadings_catalog.LOADING_SPINNER)\n self.wait_for_element_disappear(loadings_catalog.LOADING)", "def wait_for_button(self, button, message=True):\n if message:\n rospy.loginfo(\"Waiting for xbox button: \" + butto...
[ "0.7126271", "0.6884283", "0.66924036", "0.65854484", "0.654948", "0.64384645", "0.63156706", "0.62573993", "0.62523603", "0.6224479", "0.61823416", "0.61524755", "0.6134778", "0.61076003", "0.6089265", "0.6077746", "0.6075494", "0.606039", "0.6058926", "0.6032544", "0.603163...
0.69422036
1
Determine if a given blockchain is valid
def valid_chain(self, chain): last_block = chain[0] current_index = 1 while current_index < len(chain): block = chain[current_index] # print(f'{last_block}') # print(f'{block}') # print("\n-----------\n") # Check that the hash of the block is correct last_block_hash = self.hash(last_block) if block['previous_hash'] != self.hash(last_block): return False # Check that the Proof of Work is correct if not self.valid_proof(last_block['proof'], block['proof'], last_block_hash): return False last_block = block current_index += 1 return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validChain(bc):\n #If the first block of chain is not equal to the genesis block, then chain is invalid\n if (json.dumps(Block.to_dict(bc.chain[0])) != json.dumps(Block.to_dict(Block.genesis()))):\n return False\n #check validity for all blocks in the blockchain\n for i i...
[ "0.763013", "0.7623251", "0.76183456", "0.7577117", "0.7567591", "0.7553642", "0.74016935", "0.7393162", "0.7381024", "0.7346507", "0.73355687", "0.7174818", "0.71236986", "0.71236986", "0.7094909", "0.70591253", "0.7049671", "0.69781476", "0.69487953", "0.694765", "0.6893976...
0.69277084
20
Creates a SHA256 hash of a Block
def hash(block): # We must make sure that the Dictionary is Ordered, or we'll have inconsistent hashes block_string = json.dumps(block, sort_keys=True).encode() return hashlib.sha256(block_string).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_block(self):\n sha = hasher.sha256()\n sha.update((str(self.index) + str(self.timestamp) + str(self.data) + str(self.previous_hash)).endswith('utf-8'))\n return sha.hexdigest()", "def compute_hash(block):\n block_string = json.dumps(self.__dict__, sort_keys= True)\n re...
[ "0.79220486", "0.79210114", "0.7906467", "0.7823901", "0.7823901", "0.78018546", "0.7720867", "0.76859254", "0.7677476", "0.7630424", "0.7623705", "0.7534247", "0.7505899", "0.7446964", "0.74002504", "0.74002504", "0.73705757", "0.73611194", "0.7283995", "0.72734344", "0.7201...
0.7548614
15
Check if value is prime
def is_prime(value: int) -> bool: if value == 1: return False if value <= 0: raise ValueError("Value must be greater than zero") for i in range(2, int(value**(1/2)) + 1): if value % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(value):\n\n if value < 2: raise ValueError\n\n for i in range(2, value):\n if value % i == 0:\n return False\n\n return True", "def is_prime(self):\n pass", "def is_prime(value):\n if value < 4:\n return True\n \n lower_bound = 2\n upper_bound = value-1\n...
[ "0.8251294", "0.7981401", "0.794535", "0.78773165", "0.7870162", "0.7779645", "0.77755505", "0.77661145", "0.77396506", "0.77324396", "0.77158386", "0.77105474", "0.7694114", "0.7672864", "0.7660135", "0.7650814", "0.76269066", "0.76167756", "0.7599302", "0.75861603", "0.7584...
0.81013525
1
Get all prime factors of the given value
def factors(value: int) -> list: prime_factors: list = [] for i in range(2, value + 1): if i > 2 and i % 2 == 0 or not is_prime(i): continue while value % i == 0: value = int(value / i) prime_factors.append(i) if value == 1: break return prime_factors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factors_of(value):\n\n # Okay, so we need to \"solve\" two problems here:\n # is a given number a factor of `value`?\n # and\n # is a given number PRIME?\n\n # I think the simplest non-stupid approach is to generate all \n # FACTORS OF VALUE, and then check to see which are prime!\n ...
[ "0.8195275", "0.8172038", "0.78768766", "0.78615814", "0.78161514", "0.7815678", "0.78074765", "0.7803163", "0.7796986", "0.7784412", "0.77701026", "0.7747795", "0.77219456", "0.7687131", "0.766128", "0.76611435", "0.76522994", "0.7594097", "0.75423145", "0.7516391", "0.75087...
0.85676354
0
Load the image located at the specified path
def _setup_image(self, image_path): if not os.access(image_path, os.R_OK): rospy.logerr("Cannot read file at '{0}'".format(image_path)) return None img = cv2.imread(image_path) # Return msg return cv_bridge.CvBridge().cv2_to_imgmsg(img, encoding="bgr8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(path) -> Image:\n return Image.open(path)", "def load_image(self, path):\n if path:\n self.original_image = cv2.imread(path, 1)\n self.prepare_images()", "def load_image(file_path):\r\n return Image.open(file_path)", "def load_image(path_to_image, image_name):\...
[ "0.8395559", "0.8235641", "0.80957776", "0.7978053", "0.79137325", "0.7833698", "0.76558286", "0.75878996", "0.7496194", "0.74551564", "0.7341567", "0.7297161", "0.7210053", "0.71392775", "0.7122944", "0.7110663", "0.70598626", "0.703482", "0.69894713", "0.6988201", "0.697644...
0.0
-1
Displays image(s) to robot's head
def display_image(self, image_path, display_in_loop=False, display_rate=1.0): rospy.logdebug("Display images in loop:'{0}', frequency: '{1}'".format(display_in_loop, display_rate)) image_msg = [] image_list = image_path if isinstance(image_path, list) else [image_path] for one_path in image_list: cv_img = self._setup_image(one_path) if cv_img: image_msg.append(cv_img) if not image_msg: rospy.logerr("Image message list is empty") else: r = rospy.Rate(display_rate) while not rospy.is_shutdown(): for one_msg in image_msg: self._image_pub.publish(one_msg) r.sleep() if not display_in_loop: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n display(self.image)", "def display_image(self, window_title: str = 'Drone Camera'):\n cv2.imshow(window_title, self.output)\n cv2.waitKey(1)", "def display(self, image):\n raise NotImplementedError()", "def view(self):\n window = tk.Tk()\n label ...
[ "0.71238935", "0.67987853", "0.66218305", "0.6546899", "0.6478864", "0.6478864", "0.636954", "0.634819", "0.6345504", "0.63256186", "0.62910193", "0.6277586", "0.62452334", "0.6237978", "0.620947", "0.6198384", "0.61778575", "0.61210454", "0.6117013", "0.61046207", "0.6096301...
0.0
-1
num_rays Number of beams for the simulated LiDAR. fov Field of view scan_std The standard deviation of the scan theta_disc Theta Discretization
def __init__(self, num_rays, fov, scan_std, batch_size=100): self.batch_size = batch_size # these were used in the old scan 2d self.num_rays = num_rays self.fov = fov self.scan_std = scan_std self.theta_inc = fov/num_rays # often used self.twopi = math.pi * 2 # cache vectors to send to gpu self.output_vector = np.zeros(self.num_rays, dtype=np.float32) self.noise = np.zeros(self.num_rays, dtype=np.float32) self.input_vector = np.zeros((self.num_rays, 3), dtype=np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_rays(self):\n try: \n return self._n_rays\n except AttributeError:\n self._n_rays = 0\n for r in self.rays(): self._n_rays += 1\n return self._n_rays", "def set_rays(self, nrays=10000, seed=6775431):\n self.NPOINT = nrays\n if (seed % ...
[ "0.61132187", "0.5876119", "0.56016153", "0.53787774", "0.531972", "0.52205455", "0.52205455", "0.52205455", "0.52205455", "0.5152057", "0.51412386", "0.50477684", "0.5036971", "0.5029574", "0.4998146", "0.4961353", "0.49178076", "0.49124226", "0.48896435", "0.48728356", "0.4...
0.5748073
2
x Position x on the map y Position y on the map theta Direction on the map
def scan(self, x, y, theta): # create ray list max_theta = theta + self.fov/2.0 min_theta = theta - self.fov/2.0 thetas = np.arange(min_theta, max_theta, self.theta_inc, dtype=np.float32) self.input_vector[:, 0] = x self.input_vector[:, 1] = y self.input_vector[:, 2] = thetas # run ray marching self.scan_method.calc_range_many(self.input_vector, self.output_vector) return self.output_vector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theta(self):\n return atan2(self.y, self.x)", "def theta(self):\n return float(np.arctan2(self.y, self.x))", "def xy(self,theta,phi):\n dist=great_circle_distance(self.theta0,theta,self.phi0,phi)\n [yt,xt]=np.unravel_index(np.argmin(dist),dist.shape)\n return xt,yt", "d...
[ "0.691251", "0.683143", "0.6619195", "0.6595212", "0.63898385", "0.628581", "0.6238489", "0.61594254", "0.61381114", "0.61379653", "0.61337817", "0.6127042", "0.6115421", "0.6079736", "0.60695887", "0.6060793", "0.6034483", "0.60037607", "0.60031086", "0.59396416", "0.5934096...
0.0
-1
For C,D and W unlabelled.
def get_separated_sequence(): return [("ABCDEFG", ("ABEFG", "CD")), ("ABCDEFGCDCDDC", ("ABEFG", "CDCDCDDC")), ("", ("", "")), ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label(d, X, ind_class0, ind_class1, N, V, binary):\n if binary == True:\n K = 1\n C = torch.zeros(N + V, K)\n C[ind_class0, :] = 0.0\n C[ind_class1, :] = 1.0\n else:\n K = 2\n C = torch.zeros(N + V, K)\n C[ind_class0, :] = torch.tensor([1.0, 0.0])\n ...
[ "0.5536485", "0.54773134", "0.52980894", "0.52534986", "0.52387166", "0.5181855", "0.5111285", "0.508858", "0.5086352", "0.5073076", "0.5041172", "0.5002552", "0.49880075", "0.49566722", "0.49318683", "0.49224657", "0.49038255", "0.49009168", "0.48969057", "0.4893255", "0.489...
0.0
-1
Build the actual URL to use.
def _full_url(url, _params={}): # Support for unicode domain names and paths. scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) if not scheme: raise ValueError("Invalid URL %r: No schema supplied" % url) netloc = netloc.encode('idna') if isinstance(path, unicode): path = path.encode('utf-8') path = requote_path(path) url = str(urlparse.urlunparse([scheme, netloc, path, params, query, fragment])) if _params: if urlparse.urlparse(url).query: return '%s&%s' % (url, _params) else: return '%s?%s' % (url, _params) else: return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_url(self):\n url = BASE_URL.format(self._host, self._port)\n _LOGGER.debug(\"TOON fetch URL: %s\", url)\n return url", "def _make_url(self):\n ...", "def create_url(self):\n self.base_url = self.base + self.strs[jpn.path_latest]", "def build_url(self, endpoint):\...
[ "0.82525396", "0.80543995", "0.7988607", "0.7964267", "0.79619455", "0.7841471", "0.77490044", "0.77251446", "0.77089393", "0.76246357", "0.75926405", "0.75856274", "0.7532603", "0.75000435", "0.74994606", "0.74262804", "0.742292", "0.74154943", "0.74154943", "0.73670965", "0...
0.0
-1
Sets up the connection. Will optionally accept a size or else will use a chunked TransferEncoding.
def setup(self, size=None): if size: self.size = size if not self.size: self.size = UNKNOWN_LENGTH self.body.length = self.size req = self.conn.make_request('PUT', self.url, headers=self.headers, data=self.body) self.req = req print "ChunkedTwistedConnection: STARTED REQUEST"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _send_connection_init(self, request: Request) -> None:\n # Need to set these manually here instead of manipulating via\n # __setitem__() otherwise the H2Connection will emit SettingsUpdate\n # frames in addition to sending the undesired defaults.\n self._h2_state.local_setting...
[ "0.5874525", "0.58596337", "0.57424444", "0.57155627", "0.571499", "0.5675915", "0.566236", "0.5662341", "0.56123924", "0.5471748", "0.5447842", "0.5433867", "0.5358979", "0.53248644", "0.53098845", "0.52834433", "0.5279242", "0.5220655", "0.5175288", "0.51495194", "0.5126971...
0.7370442
0
Sends a chunk of data.
def send_chunk(self, chunk): print "ChunkedTwistedConnection: send chunk" return self.body.send(chunk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_chunk(chunk, send_socket):\n length = len(chunk)\n data = str(length).zfill(MAX_CHUNK_SIZE).encode() + chunk\n send_socket.send(data)", "def send_chunk(chnk, sock):\n length = len(chnk)\n data = str(length).zfill(MAX_CHUNK_SIZE).encode() + chnk\n sock.send(data)...
[ "0.78114295", "0.7532161", "0.7232472", "0.71928585", "0.7086782", "0.7002679", "0.6989813", "0.69814444", "0.69016576", "0.68666893", "0.68550235", "0.6853498", "0.67988867", "0.6783611", "0.67816645", "0.67800605", "0.6746048", "0.6729257", "0.6725598", "0.67044735", "0.670...
0.7723083
1
Finished the request out and receives a response.
def finish(self): self.body.finish()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish(self):\n return self.tornado_request.finish()", "def done(self):\n ## All done with the request object\n self.closed = True\n self.d.callback('')", "def finished(self, reply):\n pass", "def finish_successful_request(self):\n self.session_manager.finish_suc...
[ "0.7359422", "0.73036295", "0.7245725", "0.712501", "0.69328076", "0.69194645", "0.6853112", "0.6752575", "0.67313087", "0.66815627", "0.66713023", "0.66713023", "0.6668481", "0.6632425", "0.65602535", "0.65523654", "0.6549984", "0.6437685", "0.6395554", "0.6376815", "0.62960...
0.6356392
20
This function will generate the file names in a directory tree by walking the tree either topdown or bottomup. For each directory in the tree rooted at directory top (including top itself), it yields a 3tuple (dirpath, dirnames, filenames).
def get_filepaths(directory): file_paths = [] # List which will store all of the full filepaths. # Walk the tree. for root, directories, files in os.walk(directory): for filename in files: if filename.endswith('.wav'): # Join the two strings in order to form the full filepath. filepath = os.path.join(root, filename) file_paths.append(filepath) # Add it to the list. # pdb.set_trace() file_paths.sort() return file_paths
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_tree(top):\n nodes = [top]\n for dirpath, dirnames, filenames in os.walk(top):\n for dirname in dirnames:\n nodes.append(os.path.join(dirpath, dirname))\n for filename in filenames:\n nodes.append(os.path.join(dirpath, filename))\n\n return nodes", "def walkt...
[ "0.74382895", "0.73284924", "0.6859594", "0.6823699", "0.6807483", "0.67260796", "0.6721552", "0.6637687", "0.6594345", "0.6485284", "0.6484495", "0.6478459", "0.64450955", "0.6372701", "0.63717425", "0.63453346", "0.6339544", "0.6330374", "0.6294579", "0.62940586", "0.627964...
0.0
-1
Calculate the distance and rotation to the edge of the desk
def getDistanceAndRotationToEdge(l, f, r): if DEBUG: print "lfr:", l,",",f,",",r # Maths help from: http://xaktly.com/MathNonRightTrig.html # - Specfically the law of cosines, but at least one of their # examples is wrong, but methods are correct... sigh. # # For triangle with forward length, shortest of # left and right length, and desk edge as sides... # # f = forward distance length # l = left distance length # r = right distance length # e = length of desk edge between left and right views # s = shortest of left and right distance length # v = "view" angle of how much robot looks left or right # g = angle between f and e # d = distance between robot and edge of desk # a = angle between the way the robot is facing and edge of desk # (i.e. if the robot is facing directly towards edge it's 0) # (in radians or degrees?..) # # e² = f² + s² - 2 * f * s * cos(v) # g = sin⁻¹ * (s * sin(v) / e) # d = f * sin(g) # a = 180 - 90 - g (minus or positive depending on if s is left or right) # Figure out if the edge of the desk is more to the right or left # s = min(l, r) <-- Used to use this, but need additional things. # r | l | s # x | x | ? # 1 | 1 | ? Logic table for _r_ight, _l_eft, and output # 0 | 0 | ? _s_hortest distances from robot to desk edge # x | 0 | l # 1 | x | r x = None # 0 | 1 | r 1 = arbitrary high-ish value # x | 1 | l 0 = arbitrary low-ish value # 1 | 0 | l # 0 | x | r # Distance to right and left are missing? if r is None and l is None: if DEBUG: print "INFO: Skipping edge calcs because of missing distances." return int(round(f)), 0 # Distance to right and left identical? elif r == l: if DEBUG: print "INFO: Skipping edge calcs because of identical distances." # This is unlikely-ish because l, f, r are floats... # # r < f r > f # ◆ | or ◼ # ____➘| __🠛__ # return int(round(min(r, f))), 0 # Figure out if _l_eft or _r_ight is the shorter distance else: if r is None: s = l direction = -1 elif l is None: s = r direction = 1 elif l < r: s = l direction = -1 elif r < l : s = r direction = 1 cosV = math.cos(math.radians(45)) sinV = math.sin(math.radians(45)) e = f**2 + s**2 - 2 * f * s * cosV e = math.sqrt(e) g = math.degrees(math.asin(s * sinV / e)) d = f * math.sin(math.radians(g)) # Switching degrees/radians f'debugging a = (90 - g) * direction ''' # Debug stuff print "f =", f print "l =", l print "r =", r print "e =", e print "s =", s print "v =", 45 print "g =", g print "d =", d print "a =", a ''' distance = int(round(d)) rotation = int(round(a)) if DEBUG: print "Distance to edge:", str(distance) + "cm" print "Rotation to edge:", str(rotation) + "°" return distance, rotation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEdgeAngle():\n '''\n returns angle a\n a\n ◿\n b c\n '''\n ANGLE_OFFSET = 8 # How far off the angle measurements are in degrees.\n THRESHOLD = 220 # How much light must be reflected to 'notice' the desk.\n angle = 0\n while angle < panTilt.TLT_RANGE:\n ...
[ "0.6792521", "0.67125314", "0.6442544", "0.6154413", "0.5941092", "0.5854384", "0.58526313", "0.5838844", "0.58166885", "0.5809942", "0.57968384", "0.5790198", "0.5733752", "0.57309914", "0.5662172", "0.5659722", "0.5644403", "0.5641197", "0.5620599", "0.55770284", "0.5569615...
0.6808179
0
Given a value break it down by the ilk of node (usb or pci), the vendor, and the device or product.
def parse_value(value: str) -> Tuple[str, str, str]: value_pattern = r'^(usb|pci)\(([^:]{4}):([^:]{4})\)$' matches = re.match(value_pattern, value) assert matches, value ilk, vendor, device = matches.group(1), matches.group(2), matches.group(3) return ilk, vendor, device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor_list():\n return ['nxos', 'eos', 'cumulus']", "def get_vendor(mac):\r\n return p.get_manuf(mac) or 'None'", "def bios_vendor(self):\n\t\treturn self.__info_dict['info']['bios_vendor']['value']", "def device_catalog_path_value_converter(value):\n paths = []\n for path in value:\n ...
[ "0.57974625", "0.5661134", "0.56355417", "0.55662423", "0.5533631", "0.5503334", "0.5503334", "0.5503334", "0.5503334", "0.5503334", "0.5503334", "0.5413959", "0.53457385", "0.5296801", "0.52907497", "0.52587706", "0.52237445", "0.52177995", "0.52067405", "0.517088", "0.51611...
0.6276907
0
Since the ventricle is usually not convex, using radial coordinates can be misleading. A simple search deals with the proper order of the points and ensures a singlepixel edge.
def _walk_on_edge(self, coordinates_of_edge): sorted_edge = list() edge_points = list() self.distance_matrix = cdist(coordinates_of_edge, coordinates_of_edge, metric='euclidean') self.distance_matrix[self.distance_matrix == 0] = 100 cur_point = list(min(coordinates_of_edge, key=lambda t: t[1])) sorted_edge.append(cur_point) while 1: try: new_point, flag = self._find_closest_point(coordinates_of_edge, cur_point, sorted_edge) except TypeError: plt.scatter(sorted_edge, s=1) plt.xlim((0, 256)) plt.ylim((-256, 0)) self._save_failed_qc_image('Search for new point failed') break if flag: edge_points.append(cur_point) if len(edge_points) == 2: break sorted_edge.reverse() cur_point = sorted_edge[-1] else: cur_point = new_point sorted_edge.append(cur_point) basal_septal_edge = min(edge_points, key=lambda x: x[0]) if np.all(basal_septal_edge != sorted_edge[0]): sorted_edge.reverse() return sorted_edge
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices ( self, *r):\n \n if len(r) == 3: # only 3 values given -> use x,y,radius method\n xpos = self.gpos\n xis = []\n yis = []\n dr2 = (xpos[0, :]-r[0])**2 + (xpos[1, :]-r[1])**2\n # array with true/false entries\n inds = dr2 <=...
[ "0.6597289", "0.6597289", "0.65620327", "0.61580426", "0.6140572", "0.60876256", "0.6040511", "0.59974813", "0.59635466", "0.59572154", "0.5936011", "0.58943766", "0.58940417", "0.586778", "0.5863292", "0.58565116", "0.5846335", "0.5845742", "0.5843002", "0.582725", "0.582498...
0.0
-1
Initialisation, where df is a pandas DataFrame and var is the name of the column to study and init_pars is a dictionary with initial values
def __init__(self, df, Z, Q, H, T, R, d, c, var='dep_var', secondvar=None, method='iterate'): self.method = method # Initialize all the system matrices as attributes of the class self.Z = Z self.Q = Q self.H = H self.T = T self.R = R self.d = d self.c = c # same for parameters and objects self.df = df self.var = var # The data itself self.y = np.array(df[var].values.flatten()) self.times = df.index # Options for the minimizer self.options = {'eps': 1e-09, 'maxiter': 200}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,df, init_pars, var='dep_var', var_name='Volume of Nile'):\n self.df = df\n self.var = var\n self.var_name = var_name\n self.y = np.array(df[var].values.flatten())\n self.times = df.index\n self.pardict = init_pars\n self.options = {'eps':1e-09,\n ...
[ "0.7032874", "0.5726817", "0.55134976", "0.5488105", "0.5354998", "0.5293255", "0.5284768", "0.5283604", "0.52450967", "0.52211875", "0.5218443", "0.52158165", "0.5208098", "0.5172965", "0.51615965", "0.5151945", "0.513557", "0.51037365", "0.5097976", "0.5087936", "0.50831324...
0.5161708
14
likelihood function of state space model, to be optimized by minimizer. Pass parameter vector to it and obtain likelihood
def __llik_fun__(self, par_ini): n = len(self.y) # Only the normal KFS if self.method == 'iterate': _, __, P, v, F = self.iterate(plot=False, estimate=True, init_params=par_ini) # KSF with regression coefficient (beta) elif self.method == 'iterateRegression': _, __, P, v, F = self.iterateRegression(plot=False, estimate=True, init_params=par_ini) L= -(n / 2)*np.log(2*np.pi) - 0.5 * np.sum(np.log(np.abs(F[1:]))) - 0.5 * np.sum((v[1:] ** 2) / F[1:]) #+ np.log(self.P_start) # Return negative likelihood since we minimize it with the minimizier return (-1)*L
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def likelihood(\n self,\n observation: np.ndarray,\n state: np.ndarray,\n control_z: Optional[np.ndarray] = None\n ) -> np.matrix:\n pass", "def log_likelihood(self, data, reward_model, bias_params):", "def __log_likelihood(self, params, *args):\n\t\tX, y, ...
[ "0.7302444", "0.7227682", "0.7056718", "0.704548", "0.7038803", "0.6894036", "0.68110865", "0.67771643", "0.67480403", "0.669332", "0.6690634", "0.66567886", "0.6648611", "0.6637662", "0.6605316", "0.6598561", "0.65950495", "0.6588439", "0.6587018", "0.65525615", "0.65012264"...
0.6453411
23
Optimize model by maximizing the likelihood
def fit_model(self, phi, omega, sigma_eta, beta=0): # Initialize at the initial values parsed to the class par_ini = [phi, omega, sigma_eta, beta] # Approximate the jabocian for more efficient minimization Lprime = lambda x: approx_fprime(x, self.__llik_fun__, 0.01) if self.method == 'iterateRegression': # Depending on whether we include the regression coefficient, use other optimizer est = minimize(self.__llik_fun__, x0=par_ini, options=self.options, method='Newton-CG', jac=Lprime) else: est = minimize(self.__llik_fun__, x0=par_ini, options=self.options, method='BFGS') # Return optimal parameters return est.x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(self): \n if self.model == 'ARD':\n estimate = minimize(\n fun=optim_func,\n x0=np.array([self.alpha, self.beta]),\n args=(self,),\n method='L-BFGS-B',\n bounds=((0, 50), (0, 50)),\n )\n ...
[ "0.7011556", "0.67614967", "0.6661641", "0.64753014", "0.6324813", "0.6313172", "0.62755656", "0.62447", "0.6160573", "0.6111164", "0.60700196", "0.60524917", "0.60361964", "0.6025766", "0.6025012", "0.6023183", "0.60038626", "0.600292", "0.598566", "0.59753746", "0.59354776"...
0.5914919
22
Iterate over the observations and update the filtered values after each iteration
def iterate(self, plot=True, estimate=False, init_params=None): # Create empty arrays to store values F = np.zeros(len(self.y)) a = np.zeros(len(self.y)) v = np.zeros(len(self.y)) P = np.zeros(len(self.y)) # Initialize at the initial values parsed to the class if estimate == True: self.T = np.array(init_params[0]) self.c = np.array(init_params[1]) self.R = np.array(init_params[2]) # self.H = np.array(init_params[0]) # self.Q = np.array(init_params[1]) P[0] = self.P_start a[0] = self.a_start # Iterate over the observatios for t in range(0, len(self.y) - 1): # Kalman filter equations v[t] = self.y[t] - self.Z * a[t] - self.d F[t] = self.Z * P[t] * self.Z.transpose() + self.H a_t = a[t] + ((P[t] * self.Z.transpose()) / F[t]) * v[t] a[t + 1] = self.T * a_t + self.c P_t = P[t] - ((P[t] * self.Z.transpose()) / F[t]) * self.Z * P[t] P[t + 1] = self.T * P_t * self.T.transpose() + self.R * self.Q * self.R.transpose() F[-1] = P[-1] + self.H v[-1] = self.y[-1] - a[-1] # Obtain std error of prediction form variance std = np.sqrt((P * self.H) / (P + self.H)) return a, std, P, v, F
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, other):\n for filter, value in other.items():\n self.__setitem__(filter, value)", "def update(self):\n for filter in self.filters:\n filter.update(self.learning_rate)", "def update(self, updates, predicate):\n for row in self.rows:\n if predicate(row...
[ "0.63613224", "0.62198365", "0.6080035", "0.60798997", "0.60306054", "0.58865666", "0.5883915", "0.58141124", "0.5800074", "0.5787996", "0.5541149", "0.5536493", "0.55307084", "0.5513393", "0.55123764", "0.5507698", "0.54158753", "0.5414475", "0.5403888", "0.53936756", "0.538...
0.0
-1
Iterate over the observations and update the filtered values after each iteration
def iterateRegression(self, plot=True, estimate=False, init_params=None): # Create empty arrays to store values F = np.zeros(len(self.y)) a_b = np.zeros((2,len(self.y))) # alphas and betas v = np.zeros(len(self.y)) P = np.zeros((len(self.y),2,2)) # Initialize at the initial values parsed to the class if estimate == True: self.T = np.array([[init_params[0],0],[0,1]]) self.c = np.vstack(([init_params[1],0])) self.R = np.vstack(([init_params[2]],[0])) self.a_start = np.vstack(([self.alpha_mean], [init_params[3]])) P[0,:,:] = self.P_start a_b[:,0:1] = self.a_start # Iterate for t in range(0, len(self.y) - 1): # Slightly different updating equations for KF since we now have regression coefficient v[t] = self.y[t] - np.dot(self.Z[:,t:t+1].T,a_b[:,t]) - self.d F[t] = np.dot(np.dot(self.Z[:,t:t+1].T, P[t]),self.Z[:,t:t+1]) + self.H a_t = a_b[:,t:t+1] + np.dot(P[t],self.Z[:,t:t+1] / F[t]) * v[t] a_b[:,t + 1:t+2] = np.dot(self.T, a_t) + self.c P_t = P[t] - np.dot((np.dot(P[t],self.Z[:,t:t+1]) / F[t]),np.dot(self.Z[:,t:t+1].T, P[t])) P[t + 1,:,:] = np.dot(np.dot(self.T, P_t),self.T.transpose()) + np.dot(self.R * self.Q,self.R.transpose()) F[-1] = np.dot(np.dot(self.Z[:,-1:].T, P[-1]),self.Z[:,-1:]) + self.H v[-1] = self.y[-1] - a_b[0,-1:] # Obtain std error of prediction form variance std = np.sqrt((P[:,0,0] * self.H) / (P[:,0,0] + self.H)) return a_b, std, P, v, F
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, other):\n for filter, value in other.items():\n self.__setitem__(filter, value)", "def update(self):\n for filter in self.filters:\n filter.update(self.learning_rate)", "def update(self, updates, predicate):\n for row in self.rows:\n if predicate(row...
[ "0.63613224", "0.62198365", "0.6080035", "0.60798997", "0.60306054", "0.58865666", "0.5883915", "0.58141124", "0.5800074", "0.5787996", "0.5541149", "0.5536493", "0.55307084", "0.5513393", "0.55123764", "0.5507698", "0.54158753", "0.5414475", "0.5403888", "0.53936756", "0.538...
0.0
-1
I have some docs
def docs():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document(self):\n ...", "def get_docs(self):\n return self.retrieve_docstring()", "def get_docs(self):\n return self.retrieve_docstring()", "def get_docs(self):\n return self.retrieve_docstring()", "def docs(self):\n self._doc_info = DocumentationURL()\n self._...
[ "0.7454927", "0.7446354", "0.7446354", "0.7446354", "0.73413706", "0.7109946", "0.71089756", "0.7055562", "0.70452785", "0.69460195", "0.68773216", "0.6874397", "0.6845154", "0.6833291", "0.67916155", "0.66953266", "0.6682665", "0.66622543", "0.66396433", "0.66306525", "0.656...
0.87407255
0
get filename as argument from user or if not given, take filename interactively. Return file handle
def get_filename_as_agrv_if_no_ask(prompt): Found = False ln = len(sys.argv) while not Found: if ln < 2: file = input( prompt) else: file = sys.argv[1] try: RFH = open(file) Found = True except FileNotFoundError: print("%%Error! File not found!") ln = 1 # break return RFH
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obtain_filename():\n file_wanted = input(\"Filename? \")\n return file_wanted", "def askInputFile():\n while True:\n print(\"Enter a valid .txt file\")\n # Try until a plain-text file is provided.\n try:\n fileName = easygui.fileopenbox(\"Enter a .txt file\",\n ...
[ "0.73346573", "0.72095716", "0.7022069", "0.69514996", "0.68601674", "0.68402874", "0.6771454", "0.67425793", "0.6699415", "0.6610038", "0.66019046", "0.6577786", "0.6573504", "0.65729046", "0.6548677", "0.6542653", "0.6541863", "0.653708", "0.6503757", "0.65007627", "0.64802...
0.70722294
2
prints a list consisting of each element is a list of 2 itmes as (str,int) in a neat format [example list = [ ("abc",1),("efghij",20),......etc ]
def tabular_formatted_printing(data_list): n = len(data_list) max = 0 for i in range(0,n): if int(len(data_list[i][0])) > max: max = len(data_list[i][0]) for i in range(0,n): if int(len(data_list[i][0])) < max: space = max - len(data_list[i][0]) else: space = 0 print(data_list[i][0]+space*' '+' : '+str(data_list[i][1])) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_list(numbers):\n print(' '.join(map(str, numbers)))", "def _list_to_printable(value):\n fixed_items = []\n for item in value:\n if isinstance(item, (int, float)):\n fixed_items.append(str(item))\n elif item == None:\n fixed_items.append(\"NULL\")\n eli...
[ "0.6564532", "0.6426839", "0.6420148", "0.6390392", "0.6295237", "0.6276649", "0.6256306", "0.6188778", "0.617754", "0.61772645", "0.6162995", "0.61229706", "0.61229706", "0.6106786", "0.60617495", "0.60488445", "0.6039565", "0.60372084", "0.6031298", "0.6028703", "0.6027985"...
0.0
-1
Running cost function (Lagrangian)
def lagr(self, x): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cost(AL, Y):\n pass", "def compute_cost(AL, Y):\n pass", "def compute_cost_derivative(AL, Y):\n pass", "def compute_cost(AL, Y, parameters ,lambd):\n L = len(parameters) // 2\n m = Y.shape[1]\n cost = -1 / m * np.sum(np.nan_to_num(Y * np.log(AL) + (1-Y) * np.log(1-AL)))\...
[ "0.6927716", "0.6886076", "0.6690253", "0.65850383", "0.6506424", "0.6447081", "0.6429702", "0.63852924", "0.63443947", "0.6304937", "0.626403", "0.62328404", "0.62026113", "0.61965936", "0.618344", "0.6173027", "0.6151762", "0.61476064", "0.6139949", "0.61124724", "0.6098959...
0.0
-1
Save data with games to file
async def save(self, res: dict): self.___cache_data(res['games'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, game):\n try:\n with open(self.filename, mode='w+') as file:\n # First char in the file is the next player\n file.write(game.next_player)\n # Then the board as a string of 64 characters\n file.write(str(game.board))\n\n ...
[ "0.76108927", "0.7576153", "0.73735857", "0.73119766", "0.71675503", "0.7154071", "0.7152303", "0.71430117", "0.7106383", "0.7105386", "0.7067481", "0.699197", "0.6965784", "0.69141096", "0.6870099", "0.68450946", "0.67772365", "0.6770521", "0.6744814", "0.6721609", "0.670798...
0.63036275
61
Get data from cached file and filter it
def __get_data(self, filters): if not os.path.exists(CACHE_FILE): raise DataNotScrappedError() df = pd.read_csv(CACHE_FILE) if not filters: return list(df.T.to_dict().values()) filtered_df = df[df['name'] == filters][['category', 'name']] return list(filtered_df.T.to_dict().values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retrieveCachedData(self):", "def read_data_cache_file(self):\n with open(self.cache_filename, 'r') as json_data:\n return json.load(json_data)", "def getData(self, local_cache):", "def read_data_cache(self):\n if os.path.exists(self.cache_filename):\n return self.read...
[ "0.7370039", "0.72422016", "0.71613204", "0.690746", "0.68249017", "0.67976505", "0.6747037", "0.66864574", "0.6593007", "0.6577908", "0.6532192", "0.6532192", "0.65105075", "0.6455156", "0.64536875", "0.64248145", "0.64161235", "0.6378454", "0.63769585", "0.6357792", "0.6318...
0.60076046
50
Get data from cached file
async def get(self, filters: dict = None): res = self.__get_data(filters) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retrieveCachedData(self):", "def getData(self, local_cache):", "def read_data_cache_file(self):\n with open(self.cache_filename, 'r') as json_data:\n return json.load(json_data)", "def GetFromCache(self, filename):\n return memcache.get('%s%s' % (self.CACHE_PREFIX, filename))", "d...
[ "0.8146995", "0.8129194", "0.79291904", "0.77733576", "0.77733576", "0.77026176", "0.7592949", "0.73793447", "0.73505074", "0.7287", "0.7261666", "0.7246066", "0.7216164", "0.71735895", "0.71685135", "0.71626484", "0.7114864", "0.7036473", "0.7034909", "0.70220995", "0.700636...
0.0
-1
Grava objetos em formato texto no arquivo de Indices.
def gravarArquivoIndices(indices): arq = open("arquivoIndices.txt", "w") for i in indices.indices: linha = i.codigo + "," + str(i.indice) + "," + str(i.excluido) + "\n" arq.write(linha) arq.close() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj_index(self) -> str:\n return str(self._data[\"index\"])", "def WriteIndexContent(indexList, formatindex, fpindex):#{{{\n if formatindex == FORMAT_TEXT:\n numRecord = len(indexList[0])\n idList = indexList[0]\n v1 = indexList[1]\n v2 = indexList[2]\n v3 = index...
[ "0.56216776", "0.5584734", "0.55089396", "0.5442182", "0.53701806", "0.53672534", "0.5365042", "0.5347537", "0.53458637", "0.5334542", "0.5304593", "0.52780014", "0.52368265", "0.52331924", "0.5230119", "0.52129966", "0.51751065", "0.51676047", "0.5156888", "0.5112448", "0.51...
0.6343497
0
Grava objetos em formato texto no arquivo Extencao
def gravarArquivoExtencao(chave, nomeLivro, nomeAutor, mes, ano, extencao): arq = open("arquivoExtencao.txt", "w") linha = chave + nomeLivro + nomeAutor + mes + ano + "\n" arq.seek(extencao, 0) arq.write(linha) arq.close() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save2txt(obj, file: str):\n with open(file, \"w\") as f:\n print(obj, file=f)", "def convert_txt_to_data():\n pass", "def __str__(self):\n line = ''\n for linea in self.lista:\n for atributo in linea:\n if linea[atributo] != \"\":\n li...
[ "0.62898755", "0.60060185", "0.58115673", "0.5791528", "0.5781442", "0.57075506", "0.57075506", "0.5631964", "0.56186527", "0.55803376", "0.5567039", "0.55542934", "0.5503587", "0.54971385", "0.5476744", "0.53883576", "0.5385696", "0.53556794", "0.5348875", "0.5341528", "0.53...
0.0
-1
Grava objetos em formato texto no arquivo Extencao
def getArquivoExtencao(chave): arq = open("arquivoExtencao.txt", "r") linha = arq.readline() achou = False while linha and not achou: if linha[0:7] == chave: achou = True linha = arq.readline() arq.close() return linha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save2txt(obj, file: str):\n with open(file, \"w\") as f:\n print(obj, file=f)", "def convert_txt_to_data():\n pass", "def __str__(self):\n line = ''\n for linea in self.lista:\n for atributo in linea:\n if linea[atributo] != \"\":\n li...
[ "0.628988", "0.60054374", "0.58121145", "0.5792043", "0.57810664", "0.57079685", "0.57079685", "0.5631726", "0.5618268", "0.5581328", "0.5566677", "0.55541193", "0.55033374", "0.54966205", "0.5477309", "0.53887737", "0.538603", "0.5356381", "0.5347529", "0.53421474", "0.53346...
0.0
-1
Accepts any number of Pattern instances.
def __init__(self, *patterns): # Validate. for pattern in patterns: if type(pattern) != models.patterns.Pattern: raise TypeException("Session only initialized with Pattern instances.") self.patterns = patterns
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_patterns(self, patterns: Iterable[AttributeRulerPatternType]) -> None:\n for p in patterns:\n self.add(**p) # type: ignore[arg-type]", "def make_pattern_set(self):\n \n _pattern = []\n for x in range(1,9):\n _pattern.append(self.make_pattern())\n ...
[ "0.63439953", "0.630216", "0.6195141", "0.6144406", "0.6016073", "0.5959742", "0.58526075", "0.58162165", "0.5781618", "0.5735671", "0.57103336", "0.566348", "0.5650091", "0.5646195", "0.557469", "0.5488463", "0.5486494", "0.5430798", "0.53853893", "0.536901", "0.5356352", ...
0.6190371
3
Return all row and column groups.
def get_regular_groups(self, grid, min=3): row_groups = self._get_row_groups(grid.grid, models.patterns.RowPattern, min) col_groups = self._get_row_groups(grid.grid.T, models.patterns.ColumnPattern, min) return row_groups + col_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self, *columns):\n # TODO: This really needs to just use Pandas.MultiIndex, stack(),\n # and pivot(). I just need to rework the FactorExprNode stuff\n # to produce a MultiIndex; then, this DataCube can just pass\n # in self._expr.\n raise NotImplementedError", "def ...
[ "0.61957633", "0.6163433", "0.6040524", "0.5894949", "0.58843005", "0.58239186", "0.58054775", "0.5755542", "0.56944263", "0.56619304", "0.56394035", "0.56309", "0.56161165", "0.56100893", "0.55997294", "0.55897653", "0.5586745", "0.5579677", "0.55577207", "0.55577207", "0.55...
0.68432385
0
Return groups with a min size that exist with grid on xaxis.
def _get_row_groups(self, array, pattern, min): groups = [] for row, col in zip(array, xrange(len(array))): start = 0 while start + min <= len(row): size = 1 orb_type = type(row[start]) for cell in xrange(start + 1, len(row)): if orb_type != type(row[cell]): break size += 1 start += 1 if size >= min: groups.append(pattern( orb_type, size, (col, start - size + 1) )) start += 1 return groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_regular_groups(self, grid, min=3):\n row_groups = self._get_row_groups(grid.grid, models.patterns.RowPattern, min)\n col_groups = self._get_row_groups(grid.grid.T, models.patterns.ColumnPattern, min)\n return row_groups + col_groups", "def remove_small_boxes(boxlist, min_size):\n ...
[ "0.5814698", "0.56901836", "0.56703305", "0.5670049", "0.55432373", "0.55418265", "0.55418265", "0.5527169", "0.5518961", "0.5517546", "0.55114937", "0.55114937", "0.5501184", "0.5484425", "0.54797846", "0.5464368", "0.54571414", "0.53910476", "0.5375301", "0.5354567", "0.534...
0.48264712
91
Sends message to destination
async def connection_made(self, transport: asyncio.transports.BaseTransport) -> None: self.transport = transport transport.write(self.message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(msg, dest=None):", "def send_message(message, destination):\n\n #Your code here\n pass", "def send(self):\n if(self.target):\n try:\n self.message = self.message +\"\\r\\n\"\n self.target[0].send(self.message)\n except socket.error, ...
[ "0.7889077", "0.76901394", "0.7472363", "0.7467401", "0.7311258", "0.7185726", "0.7074459", "0.7047595", "0.70432305", "0.70432305", "0.70432305", "0.7038259", "0.70371765", "0.6928427", "0.69204515", "0.6901408", "0.6896311", "0.6889627", "0.6871901", "0.68246526", "0.680819...
0.0
-1
Parses incoming dns message.
async def data_received(self, data: bytes) -> None: self.response_message.set_result(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dns_entry(self, msg):\n if msg['message'].find('Calling getaddrinfo') > -1:\n match = re.search(r'Calling getaddrinfo for host \\[(?P<host>[^\\]]+)\\]', msg['message'])\n if match:\n hostname = match.groupdict().get('host')\n if hostname not in self.dn...
[ "0.6813776", "0.6387554", "0.6330695", "0.62516606", "0.6083002", "0.59635645", "0.5952545", "0.5765341", "0.5750907", "0.57202256", "0.56227237", "0.5602068", "0.55890054", "0.55267555", "0.5508064", "0.55026555", "0.54993564", "0.5461191", "0.5436913", "0.54354006", "0.5335...
0.0
-1
Create or replace Secret and SecretACL
def create_or_replace_from_model(cls, secret, secret_acl, user_ids=None, session=None): secret.updated_at = timeutils.utcnow() secret_acl.updated_at = timeutils.utcnow() secret.save(session=session) if secret_acl.id: secret_acl.save(session=session) else: secret_acl.create(session=session) cls._create_or_replace_acl_users(secret_acl=secret_acl, user_ids=user_ids, session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_secret(secret_name, secret_value, environment):\n environment.add_cleanup(\n environment.cfy.secrets.delete,\n kwargs={\n 'secret_name': secret_name,\n },\n )\n environment.cfy.secrets.create(\n secret_name=secret_name,\n secret_value=secret_value,\...
[ "0.64323485", "0.62295574", "0.6069437", "0.596446", "0.5957099", "0.59304917", "0.5887804", "0.58768106", "0.5779729", "0.577644", "0.57579327", "0.57563096", "0.570285", "0.5653871", "0.56200135", "0.56157786", "0.56119484", "0.55998737", "0.5584007", "0.5539168", "0.553808...
0.5757704
11
Create or replace acl_user
def _create_or_replace_acl_users(cls, secret_acl, user_ids, session=None): if user_ids is None: return user_ids = set(user_ids) now = timeutils.utcnow() secret_acl.updated_at = now for acl_user in secret_acl.acl_users: if acl_user.user_id in user_ids: # input user_id already exists acl_user.updated_at = now acl_user.save(session=session) user_ids.remove(acl_user.user_id) else: acl_user.delete(session=session) for user_id in user_ids: acl_user = secret_acl_user.SecretACLUser(acl_id=secret_acl.id, user_id=user_id) acl_user.create(session=session) if secret_acl.id: secret_acl.save(session=session) else: secret_acl.create(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_user(cls, user):\r\n pass", "def set(isamAppliance, name, user_name, type='embedded_ldap', check_mode=False, force=False):\n new_user = True\n ret_obj = ibmsecurity.isam.base.management_authorization.role.get(isamAppliance, name)\n\n if (ret_obj['data']['users'] == None):\n ret_obj...
[ "0.6455713", "0.6377649", "0.63585895", "0.6333561", "0.62336445", "0.61381245", "0.6114977", "0.6101846", "0.60849553", "0.60306436", "0.6008215", "0.6007202", "0.5928761", "0.59142447", "0.5895722", "0.5890398", "0.5890398", "0.5881839", "0.5862956", "0.5856963", "0.5847015...
0.6061465
9
Delete acl in Secret
def delete_acls_for_secret_model(cls, secret, session=None): cls.db_repo.delete_acls_for_secret(secret, session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vault_delete_authorization_for_vault_section(self):\n pass", "def delete_acl(self, sg):\n self.security_group_driver.delete_acl(sg)", "def delete(key, **kwargs):\n cluster_call(\n \"secret_delete\",\n key=key,\n **kwargs,\n confirm=f\"Delete secret {key}\",...
[ "0.66316605", "0.65926045", "0.64347994", "0.6348736", "0.6199564", "0.61836725", "0.61462086", "0.61307585", "0.6130368", "0.60911834", "0.6086925", "0.6073761", "0.6018572", "0.6013481", "0.60084015", "0.59860677", "0.593387", "0.58928955", "0.58561933", "0.5819227", "0.578...
0.6557337
2
Delete acl in a secret.
def delete_acls_for_secret(cls, secret, session=None): session = cls.get_session(session=session) for entity in secret.secret_acls: entity.delete(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_acls_for_secret_model(cls, secret, session=None):\n cls.db_repo.delete_acls_for_secret(secret, session)", "def delete_acl(self, sg):\n self.security_group_driver.delete_acl(sg)", "def delete_secret_link(link_id):\n\n Secret_Link.objects.filter(link_id=link_id).delete()", "def dele...
[ "0.7304661", "0.7133021", "0.6473207", "0.6455759", "0.6440277", "0.6435884", "0.64185977", "0.6405398", "0.63174623", "0.6266833", "0.6206975", "0.6191693", "0.61805665", "0.6168148", "0.6163188", "0.60189515", "0.59845203", "0.5972625", "0.59346336", "0.5915101", "0.5906380...
0.72501093
1
Obtain basic information about onefs
def show(self, username, txn_id): logger = get_task_logger(txn_id=txn_id, task_id=self.request.id, loglevel=const.VLAB_ONEFS_LOG_LEVEL.upper()) resp = {'content' : {}, 'error': None, 'params': {}} logger.info('Task starting') try: info = vmware.show_onefs(username) except ValueError as doh: logger.error('Task failed: {}'.format(doh)) resp['error'] = '{}'.format(doh) else: logger.info('Task complete') resp['content'] = info return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInfo():", "def info() -> None:", "def info(self):\n return self.nfo", "def info(self):", "def info(self):", "def demo():\n logging.basicConfig(level=logging.INFO, format=\"%(message)s\")\n fcm = FMQLCacher(\"Caches\")\n fcm.setVista(\"CGVISTA\", \"http://vista.caregraf.org/fmqlEP\"...
[ "0.6832259", "0.67963994", "0.66478056", "0.61971104", "0.61971104", "0.61895555", "0.6114911", "0.6114911", "0.6095414", "0.60491127", "0.5942189", "0.5878473", "0.58726853", "0.584561", "0.5845232", "0.58328277", "0.58308643", "0.58216065", "0.58098024", "0.5809369", "0.580...
0.0
-1
Deploy a new OneFS node
def create(self, username, machine_name, image, front_end, back_end, ram, cpu_count, txn_id): logger = get_task_logger(txn_id=txn_id, task_id=self.request.id, loglevel=const.VLAB_ONEFS_LOG_LEVEL.upper()) resp = {'content' : {}, 'error': None, 'params': {}} logger.info('Task starting') try: resp['content'] = vmware.create_onefs(username, machine_name, image, front_end, back_end, ram, cpu_count, logger) except ValueError as doh: logger.error('Task failed: {}'.format(doh)) resp['error'] = '{}'.format(doh) logger.info('Task complete') return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy():", "def deploy_node(self, node_name, node, node_folder, client):\n if client is None:\n client = self.CLIENT\n\n # Create specific command for input and output parameters\n param_i = [\"--i={}\".format(p) for p in node[\"to_set\"]]\n param_o = [\"--o={}\".forma...
[ "0.69264865", "0.63039076", "0.62826276", "0.6249289", "0.6248976", "0.6238209", "0.6202333", "0.6194543", "0.6194543", "0.6194543", "0.61874604", "0.6165393", "0.6107505", "0.6099111", "0.60960966", "0.6072571", "0.6064653", "0.60304236", "0.60209894", "0.6007666", "0.598098...
0.5484384
66
Destroy a OneFS node
def delete(self, username, machine_name, txn_id): logger = get_task_logger(txn_id=txn_id, task_id=self.request.id, loglevel=const.VLAB_ONEFS_LOG_LEVEL.upper()) resp = {'content' : {}, 'error': None, 'params': {}} logger.info('Task starting') try: vmware.delete_onefs(username, machine_name, logger) except ValueError as doh: logger.error('Task failed: {}'.format(doh)) resp['error'] = '{}'.format(doh) else: logger.info('Task complete') return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_node(self):\n driver = self.driver\n driver.ex_detach_floating_ip_from_node(self.node, self.floating_ip)\n driver.destroy_node(self.node)\n sleep(15)\n for volume in self.volumes:\n driver.destroy_volume(volume)", "def deletenode(self, node_p=None):\n ...
[ "0.74795836", "0.7125707", "0.70684725", "0.6884586", "0.6880332", "0.674062", "0.66680616", "0.6622097", "0.66166276", "0.65986913", "0.6577545", "0.65129596", "0.65098155", "0.65094095", "0.6506481", "0.6490085", "0.64562887", "0.6453083", "0.64295024", "0.6426773", "0.6406...
0.0
-1
Obtain the available OneFS images/versions that can be deployed
def image(self, txn_id): logger = get_task_logger(txn_id=txn_id, task_id=self.request.id, loglevel=const.VLAB_ONEFS_LOG_LEVEL.upper()) resp = {'content' : {}, 'error': None, 'params': {}} logger.info('Task starting') resp['content'] = {'image': vmware.list_images()} logger.info('Task complete') return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_images():\n return AVAILABLE_IMAGES", "def get_installed_images(self):\n raise NotImplementedError", "def list_images(self):\n \n logging.debug(\"list_images entered for %s\" % self.machine_name) \n snapshots = cs.list_snapshots()\n res = []\n serv...
[ "0.69780606", "0.6833153", "0.6587997", "0.6557733", "0.63813823", "0.63264614", "0.62088", "0.61655736", "0.5964975", "0.5890417", "0.5876325", "0.5871348", "0.5833859", "0.58310384", "0.5792491", "0.5789766", "0.5733587", "0.57318777", "0.57247746", "0.57242477", "0.5707273...
0.0
-1
Turn a blank OneFS node into a usable device
def config(self, cluster_name, name, username, version, int_netmask, int_ip_low, int_ip_high, ext_netmask, ext_ip_low, ext_ip_high, gateway, dns_servers, encoding, sc_zonename, smartconnect_ip, join_cluster, compliance, txn_id): logger = get_task_logger(txn_id=txn_id, task_id=self.request.id, loglevel=const.VLAB_ONEFS_LOG_LEVEL.upper()) resp = {'content' : {}, 'error': None, 'params': {}} logger.info('Task starting') nodes = vmware.show_onefs(username) node = nodes.get(name, None) if not node: error = "No node named {} found".format(name) resp['error'] = error logger.error(error) return resp elif node['meta']['configured']: error = "Cannot configure a node that's already configured" resp['error'] = error logger.error(error) else: # Lets set it up! logger.info('Found node') console_url = node['console'] if join_cluster: logger.info('Joining node to cluster {}'.format(cluster_name)) setup_onefs.join_existing_cluster(console_url, cluster_name, compliance, logger) else: logger.info('Setting up new cluster named {}'.format(cluster_name)) setup_onefs.configure_new_cluster(version=version, console_url=console_url, cluster_name=cluster_name, int_netmask=int_netmask, int_ip_low=int_ip_low, int_ip_high=int_ip_high, ext_netmask=ext_netmask, ext_ip_low=ext_ip_low, ext_ip_high=ext_ip_high, gateway=gateway, dns_servers=dns_servers, encoding=encoding, sc_zonename=sc_zonename, smartconnect_ip=smartconnect_ip, compliance=compliance, logger=logger) node['meta']['configured'] = True vmware.update_meta(username, name, node['meta']) logger.info('Task complete') return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addDevice(self, node, fullDeviceName, device):", "def _get_device(node):\n\n vpp = VppPCIUtil(node)\n vpp.get_all_devices()\n\n # Save the device information\n node[\"devices\"] = {}\n node[\"devices\"][\"dpdk_devices\"] = vpp.get_dpdk_devices()\n node[\"devices\"][\...
[ "0.6119266", "0.5911754", "0.59111613", "0.5813898", "0.5722772", "0.56492436", "0.56458735", "0.5626259", "0.5560795", "0.55487764", "0.5547376", "0.5536614", "0.55227935", "0.549715", "0.545163", "0.5447037", "0.5447037", "0.542734", "0.5422956", "0.54173166", "0.54056215",...
0.0
-1
Change the network an OneFS node is connected to
def modify_network(self, username, machine_name, new_network, txn_id): logger = get_task_logger(txn_id=txn_id, task_id=self.request.id, loglevel=const.VLAB_ONEFS_LOG_LEVEL.upper()) resp = {'content' : {}, 'error': None, 'params': {}} logger.info('Task starting') try: vmware.update_network(username, machine_name, new_network) except ValueError as doh: logger.error('Task failed: {}'.format(doh)) resp['error'] = '{}'.format(doh) logger.info('Task complete') return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_target_network(self):\r\n self.send(self.server_conn, (sys._getframe().f_code.co_name, {}))", "def set_network(self, network: str) -> None:\n return self.add_value(self._network_attribute, network)", "def set_node(self, name, state):\n self.source_net.nodes[name] = state", "de...
[ "0.6587989", "0.63514805", "0.63323206", "0.61741155", "0.61734724", "0.6134296", "0.6105218", "0.6065056", "0.60462487", "0.59799916", "0.5911158", "0.5871496", "0.583898", "0.58377373", "0.5814114", "0.580636", "0.5799185", "0.5790336", "0.5773519", "0.57696205", "0.5767448...
0.5633962
35
Loads a checkpoint of a model, may be the model or the mean teacher model. Assumes the model has already been created, and the checkpoint exists. This does not set checkpoint epoch. This method should not be called externally. Use instead try_load_checkpoint_for_model or try_load_checkpoint_for_mean_teacher_model
def _load_checkpoint(cls, model: DeviceAwareModule, checkpoint_path: Path, key_in_state_dict: str, use_gpu: bool) -> int: logging.info(f"Loading checkpoint {checkpoint_path}") checkpoint = ModelAndInfo.read_checkpoint(checkpoint_path, use_gpu) try: state_dict = checkpoint[key_in_state_dict] except KeyError: logging.error(f"Key {key_in_state_dict} not found in checkpoint") return False if isinstance(model, torch.nn.DataParallel): result = model.module.load_state_dict(state_dict, strict=False) else: result = model.load_state_dict(state_dict, strict=False) if result.missing_keys: logging.warning(f"Missing keys in model checkpoint: {result.missing_keys}") if result.unexpected_keys: logging.warning(f"Unexpected keys in model checkpoint: {result.unexpected_keys}") return checkpoint[ModelAndInfo.EPOCH_KEY]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(model, checkpoint_path: str): \r\n checkpoint = torch.load(checkpoint_path)\r\n model.load_state_dict(checkpoint['model'])\r\n epoch = checkpoint['epoch']\r\n print('Loaded model from {}, epoch {}'.format(checkpoint_path, epoch))", "def load_checkpoint(tag, params, model):\r\n file...
[ "0.7765723", "0.77516997", "0.7738326", "0.77286375", "0.7725346", "0.76465744", "0.7636256", "0.75987977", "0.75818604", "0.75716907", "0.75123113", "0.74969316", "0.73805517", "0.7359161", "0.7350395", "0.7348898", "0.73487484", "0.73225814", "0.7317315", "0.72933567", "0.7...
0.68640363
42
Updates a torch model so that input minibatches are parallelized across the batch dimension to utilise multiple gpus. If model parallel is set to True and execution is in test mode, then model is partitioned to perform full volume inference. This assumes the model has been created, that the optimizer has not yet been created, and the the model has not been adjusted twice. This method should not be called externally. Use instead adjust_model_for_gpus or adjust_mean_teacher_model_for_gpus
def _adjust_for_gpus(cls, model: DeviceAwareModule, config: ModelConfigBase, model_execution_mode: ModelExecutionMode) -> DeviceAwareModule: if config.use_gpu: model = model.cuda() logging.info("Adjusting the model to use mixed precision training.") # If model parallel is set to True, then partition the network across all available gpus. if config.use_model_parallel: devices = config.get_cuda_devices() assert devices is not None # for mypy model.partition_model(devices=devices) # type: ignore else: logging.info("Making no adjustments to the model because no GPU was found.") # Update model related config attributes (After Model Parallel Activated) config.adjust_after_mixed_precision_and_parallel(model) # DataParallel enables running the model with multiple gpus by splitting samples across GPUs # If the model is used in training mode, data parallel is activated by default. # Similarly, if model parallel is not activated, data parallel is used as a backup option use_data_parallel = (model_execution_mode == ModelExecutionMode.TRAIN) or (not config.use_model_parallel) if config.use_gpu and use_data_parallel: logging.info("Adjusting the model to use DataParallel") # Move all layers to the default GPU before activating data parallel. # This needs to happen even though we put the model to the GPU at the beginning of the method, # but we may have spread it across multiple GPUs later. model = model.cuda() model = DataParallelModel(model, device_ids=config.get_cuda_devices()) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_model_parallel(self, global_rank: int, world_size: int) -> None:\n app_state = AppState()\n\n # we initialize megatron-lm model parallel and data parallel groups\n # after initializing DDP with PTL.\n if app_state.model_parallel_size is not None:\n # destroy groups i...
[ "0.5936191", "0.56602675", "0.56224686", "0.5621566", "0.55595684", "0.54760945", "0.54551095", "0.54427326", "0.54231954", "0.54035556", "0.5396976", "0.53836715", "0.5365184", "0.53514045", "0.5305904", "0.5280321", "0.5267586", "0.5260385", "0.525179", "0.5249681", "0.5188...
0.70964164
0
Creates a model (with temperature scaling) according to the config given.
def create_model(self) -> None: self._model = create_model_with_temperature_scaling(self.config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_with_temperature_scaling(config: ModelConfigBase) -> Any:\n # wrap the model around a temperature scaling model if required\n model = config.create_model()\n if isinstance(config, SequenceModelBase) and config.temperature_scaling_config:\n model = ModelWithTemperature(model, config...
[ "0.8444309", "0.65563035", "0.637411", "0.6288527", "0.62518233", "0.622743", "0.622743", "0.6217139", "0.6207316", "0.6149929", "0.6077935", "0.6031471", "0.6030025", "0.6021649", "0.5992696", "0.59753346", "0.5956578", "0.5916777", "0.5907874", "0.5907593", "0.58919555", ...
0.8335938
1
Loads a checkpoint of a model. The provided model checkpoint must match the stored model.
def try_load_checkpoint_for_model(self) -> bool: if self._model is None: raise ValueError("Model must be created before it can be adjusted.") if not self.checkpoint_path: raise ValueError("No checkpoint provided") if not self.checkpoint_path.is_file(): logging.warning(f'No checkpoint found at {self.checkpoint_path} current working dir {os.getcwd()}') return False epoch = ModelAndInfo._load_checkpoint(model=self._model, checkpoint_path=self.checkpoint_path, key_in_state_dict=ModelAndInfo.MODEL_STATE_DICT_KEY, use_gpu=self.config.use_gpu) logging.info(f"Loaded model from checkpoint (epoch: {epoch})") self.checkpoint_epoch = epoch return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(model, checkpoint_path: str): \r\n checkpoint = torch.load(checkpoint_path)\r\n model.load_state_dict(checkpoint['model'])\r\n epoch = checkpoint['epoch']\r\n print('Loaded model from {}, epoch {}'.format(checkpoint_path, epoch))", "def load_checkpoint(self, session, model_dir):\n ...
[ "0.8315826", "0.8164179", "0.8112332", "0.8067118", "0.8025133", "0.80095977", "0.79719204", "0.792332", "0.78759766", "0.7870545", "0.7857625", "0.78201485", "0.777726", "0.76251996", "0.7613241", "0.76099503", "0.7592557", "0.75774544", "0.75367856", "0.75308794", "0.751686...
0.7488327
21
Updates the torch model so that input minibatches are parallelized across the batch dimension to utilise multiple gpus. If model parallel is set to True and execution is in test mode, then model is partitioned to perform full volume inference.
def adjust_model_for_gpus(self) -> None: if self._model is None: raise ValueError("Model must be created before it can be adjusted.") # Adjusting twice causes an error. if self.is_model_adjusted: logging.debug("model_and_info.is_model_adjusted is already True") if self._optimizer: raise ValueError("Create an optimizer only after creating and adjusting the model.") self._model = ModelAndInfo._adjust_for_gpus(model=self._model, config=self.config, model_execution_mode=self.model_execution_mode) self.is_model_adjusted = True logging.debug("model_and_info.is_model_adjusted set to True")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adjust_for_gpus(cls, model: DeviceAwareModule, config: ModelConfigBase,\n model_execution_mode: ModelExecutionMode) -> DeviceAwareModule:\n if config.use_gpu:\n model = model.cuda()\n logging.info(\"Adjusting the model to use mixed precision training.\")\n ...
[ "0.63490736", "0.6151383", "0.6141063", "0.610996", "0.6103388", "0.60952216", "0.59621423", "0.5786127", "0.5765342", "0.5759161", "0.57430667", "0.56928396", "0.56227285", "0.55986506", "0.55617046", "0.5559076", "0.55540496", "0.54423124", "0.5432483", "0.5429761", "0.5385...
0.0
-1
Generates the model summary, which is required for model partitioning across GPUs, and then moves the model to GPU with data parallel/model parallel by calling adjust_model_for_gpus.
def create_summary_and_adjust_model_for_gpus(self) -> None: if self._model is None: raise ValueError("Model must be created before it can be adjusted.") if self.config.is_segmentation_model: summary_for_segmentation_models(self.config, self._model) # Prepare for mixed precision training and data parallelization (no-op if already done). # This relies on the information generated in the model summary. self.adjust_model_for_gpus()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_and_print_model_summary(config: ModelConfigBase, model: DeviceAwareModule) -> None:\n random_state = RandomStateSnapshot.snapshot_random_state()\n # There appears to be a bug in apex, where previous use (in training for example) causes problems\n # when another model is later built on the CPU...
[ "0.7002343", "0.62532896", "0.62355524", "0.6192523", "0.61289847", "0.6088246", "0.59602416", "0.5950651", "0.59498066", "0.5881187", "0.588016", "0.5873111", "0.58373106", "0.5834648", "0.58186084", "0.58035755", "0.57857174", "0.57534796", "0.5750009", "0.5738947", "0.5732...
0.7819205
0
Creates a model as per the config, and loads the parameters from the given checkpoint path. Also updates the checkpoint_epoch.
def try_create_model_and_load_from_checkpoint(self) -> bool: self.create_model() if self.checkpoint_path: # Load the stored model. If there is no checkpoint present, return immediately. return self.try_load_checkpoint_for_model() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_checkpoint(model_config, path):\n model = models.VisionTransformer(num_classes=1, **model_config)\n variables = model.init(\n jax.random.PRNGKey(0),\n jnp.ones([1, 16, 16, 3], jnp.float32),\n train=False,\n )\n _save(variables['params'], path)", "def load_model(self, checkpoint):\n ...
[ "0.771995", "0.75882643", "0.7439317", "0.7204472", "0.71614414", "0.71529615", "0.71529615", "0.70953584", "0.70633674", "0.7042233", "0.7033582", "0.69744486", "0.6970394", "0.6955097", "0.6915084", "0.6887449", "0.6820261", "0.6804254", "0.679512", "0.677149", "0.67633355"...
0.6709257
23
Creates a model as per the config, and loads the parameters from the given checkpoint path. The model is then adjusted for data parallelism and mixed precision. Also updates the checkpoint_epoch.
def try_create_model_load_from_checkpoint_and_adjust(self) -> bool: success = self.try_create_model_and_load_from_checkpoint() self.create_summary_and_adjust_model_for_gpus() return success
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, model_path):\n # TODO: include new params based on ConfigEnum\n checkpoint = torch.load(model_path)\n\n self.image_size = checkpoint['image_size']\n self.device = checkpoint['device']\n self.fp16 = checkpoint['fp16']\n self.accumulate_grad_steps = checkpoint...
[ "0.77299833", "0.74241644", "0.7334485", "0.7309532", "0.71466875", "0.7120709", "0.7097819", "0.70120436", "0.6995636", "0.69388175", "0.69167244", "0.69100595", "0.69032747", "0.6854969", "0.68546087", "0.68304265", "0.6785825", "0.67773795", "0.6773737", "0.67481923", "0.6...
0.6487272
47
Creates a model (with temperature scaling) according to the config given.
def create_mean_teacher_model(self) -> None: self._mean_teacher_model = create_model_with_temperature_scaling(self.config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_with_temperature_scaling(config: ModelConfigBase) -> Any:\n # wrap the model around a temperature scaling model if required\n model = config.create_model()\n if isinstance(config, SequenceModelBase) and config.temperature_scaling_config:\n model = ModelWithTemperature(model, config...
[ "0.84457386", "0.83382916", "0.65599996", "0.6377564", "0.6291746", "0.62521607", "0.6228496", "0.6228496", "0.62193686", "0.62099886", "0.6151095", "0.60817146", "0.60338646", "0.60337704", "0.60258543", "0.5996558", "0.5979533", "0.5957634", "0.5921604", "0.59115314", "0.59...
0.57454526
34
Loads a checkpoint of a model. The provided model checkpoint must match the stored model.
def try_load_checkpoint_for_mean_teacher_model(self) -> bool: if self._mean_teacher_model is None: raise ValueError("Mean teacher model must be created before it can be adjusted.") if not self.checkpoint_path: raise ValueError("No checkpoint provided") if not self.checkpoint_path.is_file(): logging.warning(f'No checkpoint found at {self.checkpoint_path} current working dir {os.getcwd()}') return False epoch = ModelAndInfo._load_checkpoint(model=self._mean_teacher_model, checkpoint_path=self.checkpoint_path, key_in_state_dict=ModelAndInfo.MEAN_TEACHER_STATE_DICT_KEY, use_gpu=self.config.use_gpu) logging.info(f"Loaded mean teacher model from checkpoint (epoch: {epoch})") self.checkpoint_epoch = epoch return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(model, checkpoint_path: str): \r\n checkpoint = torch.load(checkpoint_path)\r\n model.load_state_dict(checkpoint['model'])\r\n epoch = checkpoint['epoch']\r\n print('Loaded model from {}, epoch {}'.format(checkpoint_path, epoch))", "def load_checkpoint(self, session, model_dir):\n ...
[ "0.8315387", "0.81653464", "0.8112465", "0.80683154", "0.8026479", "0.80094665", "0.79719937", "0.7923825", "0.7876365", "0.7869957", "0.78584534", "0.782106", "0.7777016", "0.7624399", "0.7612878", "0.76103896", "0.7592807", "0.7576732", "0.7537933", "0.75310373", "0.751883"...
0.0
-1
Updates the torch model so that input minibatches are parallelized across the batch dimension to utilise multiple gpus. If model parallel is set to True and execution is in test mode, then model is partitioned to perform full volume inference.
def adjust_mean_teacher_model_for_gpus(self) -> None: if self._mean_teacher_model is None: raise ValueError("Mean teacher model must be created before it can be adjusted.") # Adjusting twice causes an error. if self.is_mean_teacher_model_adjusted: logging.debug("model_and_info.is_mean_teacher_model_adjusted is already True") self._mean_teacher_model = ModelAndInfo._adjust_for_gpus(model=self._mean_teacher_model, config=self.config, model_execution_mode=self.model_execution_mode) self.is_mean_teacher_model_adjusted = True logging.debug("model_and_info.is_mean_teacher_model_adjusted set to True")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adjust_for_gpus(cls, model: DeviceAwareModule, config: ModelConfigBase,\n model_execution_mode: ModelExecutionMode) -> DeviceAwareModule:\n if config.use_gpu:\n model = model.cuda()\n logging.info(\"Adjusting the model to use mixed precision training.\")\n ...
[ "0.63509315", "0.6149969", "0.61396825", "0.6108458", "0.61034065", "0.60946226", "0.59626156", "0.57862693", "0.57671374", "0.5759996", "0.57448643", "0.5693965", "0.56239045", "0.5599338", "0.55595565", "0.55579144", "0.55540186", "0.5442606", "0.54349464", "0.5431222", "0....
0.0
-1
Generates the model summary, which is required for model partitioning across GPUs, and then moves the model to GPU with data parallel/model parallel by calling adjust_model_for_gpus.
def create_summary_and_adjust_mean_teacher_model_for_gpus(self) -> None: if self._mean_teacher_model is None: raise ValueError("Mean teacher model must be created before it can be adjusted.") if self.config.is_segmentation_model: summary_for_segmentation_models(self.config, self._mean_teacher_model) # Prepare for mixed precision training and data parallelization (no-op if already done). # This relies on the information generated in the model summary. self.adjust_mean_teacher_model_for_gpus()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_summary_and_adjust_model_for_gpus(self) -> None:\n if self._model is None:\n raise ValueError(\"Model must be created before it can be adjusted.\")\n\n if self.config.is_segmentation_model:\n summary_for_segmentation_models(self.config, self._model)\n # Prepare...
[ "0.78193945", "0.70014805", "0.6252593", "0.6235304", "0.61942273", "0.6128506", "0.608759", "0.5960813", "0.59513026", "0.59509206", "0.58809274", "0.58801025", "0.5874364", "0.5837946", "0.58353555", "0.5803747", "0.57844466", "0.5753908", "0.5749925", "0.57394", "0.5733452...
0.5817216
15
Creates a model as per the config, and loads the parameters from the given checkpoint path. Also updates the checkpoint_epoch.
def try_create_mean_teacher_model_and_load_from_checkpoint(self) -> bool: self.create_mean_teacher_model() if self.checkpoint_path: # Load the stored model. If there is no checkpoint present, return immediately. return self.try_load_checkpoint_for_mean_teacher_model() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_checkpoint(model_config, path):\n model = models.VisionTransformer(num_classes=1, **model_config)\n variables = model.init(\n jax.random.PRNGKey(0),\n jnp.ones([1, 16, 16, 3], jnp.float32),\n train=False,\n )\n _save(variables['params'], path)", "def load_model(self, checkpoint):\n ...
[ "0.77202636", "0.7588646", "0.7440869", "0.7204906", "0.71627265", "0.7153112", "0.7153112", "0.7096752", "0.7063371", "0.7042817", "0.7034828", "0.6975058", "0.69707805", "0.69557154", "0.69152653", "0.6887786", "0.6820848", "0.68042725", "0.67946786", "0.6771584", "0.676246...
0.0
-1
Creates a model as per the config, and loads the parameters from the given checkpoint path. The model is then adjusted for data parallelism and mixed precision. Also updates the checkpoint_epoch.
def try_create_mean_teacher_model_load_from_checkpoint_and_adjust(self) -> bool: success = self.try_create_mean_teacher_model_and_load_from_checkpoint() self.create_summary_and_adjust_mean_teacher_model_for_gpus() return success
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, model_path):\n # TODO: include new params based on ConfigEnum\n checkpoint = torch.load(model_path)\n\n self.image_size = checkpoint['image_size']\n self.device = checkpoint['device']\n self.fp16 = checkpoint['fp16']\n self.accumulate_grad_steps = checkpoint...
[ "0.77288234", "0.7422351", "0.73331386", "0.7309896", "0.7146994", "0.7120653", "0.709593", "0.70095086", "0.6994309", "0.6936953", "0.6916758", "0.6907432", "0.6901133", "0.685239", "0.6851834", "0.682932", "0.6783703", "0.6779041", "0.6770681", "0.6748651", "0.6746794", "...
0.0
-1
Creates a torch optimizer for the given model, and stores it as an instance variable in the current object.
def create_optimizer(self) -> None: # Make sure model is created before we create optimizer if self._model is None: raise ValueError("Model checkpoint must be created before optimizer checkpoint can be loaded.") # Select optimizer type if self.config.optimizer_type in [OptimizerType.Adam, OptimizerType.AMSGrad]: self._optimizer = torch.optim.Adam(self._model.parameters(), self.config.l_rate, self.config.adam_betas, self.config.opt_eps, self.config.weight_decay, amsgrad=self.config.optimizer_type == OptimizerType.AMSGrad) elif self.config.optimizer_type == OptimizerType.SGD: self._optimizer = torch.optim.SGD(self._model.parameters(), self.config.l_rate, self.config.momentum, weight_decay=self.config.weight_decay) elif self.config.optimizer_type == OptimizerType.RMSprop: self._optimizer = RMSprop(self._model.parameters(), self.config.l_rate, self.config.rms_alpha, self.config.opt_eps, self.config.weight_decay, self.config.momentum) else: raise NotImplementedError(f"Optimizer type {self.config.optimizer_type.value} is not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimizer(self, model: nn.Module) -> torch.optim.Optimizer: # type: ignore\n pass", "def build_optimizer(model: nn.Module, args: Namespace) -> Optimizer:\n params = [{'params': model.parameters(), 'lr': args.init_lr, 'weight_decay': 0}]\n\n return Adam(params)", "def get_optimizer(args, model...
[ "0.75656193", "0.7248476", "0.7094529", "0.70669323", "0.6984369", "0.68603814", "0.67578644", "0.66976243", "0.6690973", "0.66653234", "0.66625184", "0.66552", "0.6637654", "0.66292614", "0.6535859", "0.65118015", "0.6485002", "0.6414784", "0.6320487", "0.6311424", "0.630625...
0.70478994
4
Loads a checkpoint of an optimizer.
def try_load_checkpoint_for_optimizer(self) -> bool: if self._optimizer is None: raise ValueError("Optimizer must be created before optimizer checkpoint can be loaded.") if not self.checkpoint_path: logging.warning("No checkpoint path provided.") return False if not self.checkpoint_path.is_file(): logging.warning(f'No checkpoint found at {self.checkpoint_path} current working dir {os.getcwd()}') return False logging.info(f"Loading checkpoint {self.checkpoint_path}") checkpoint = ModelAndInfo.read_checkpoint(self.checkpoint_path, self.config.use_gpu) try: state_dict = checkpoint[ModelAndInfo.OPTIMIZER_STATE_DICT_KEY] except KeyError: logging.error(f"Key {ModelAndInfo.OPTIMIZER_STATE_DICT_KEY} not found in checkpoint") return False self._optimizer.load_state_dict(state_dict) logging.info(f"Loaded optimizer from checkpoint (epoch: {checkpoint[ModelAndInfo.EPOCH_KEY]})") self.checkpoint_epoch = checkpoint[ModelAndInfo.EPOCH_KEY] return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(path, model, optimizer=None, reset_optimizer=True):\n print(\"Load checkpoint from: {}\".format(path))\n state_dict, optimizer_state = _load(path)\n\n model.load_dict(state_dict)\n if not reset_optimizer and optimizer is not None:\n if optimizer_state is not None:\n ...
[ "0.83664644", "0.80974585", "0.80771816", "0.80259275", "0.7999482", "0.79903316", "0.7857532", "0.7640271", "0.75701135", "0.748829", "0.7443241", "0.74228936", "0.7389801", "0.7375046", "0.7372049", "0.7315069", "0.7312009", "0.72855306", "0.725681", "0.7247519", "0.7220198...
0.7403394
12
Creates an optimizer and loads its state from a checkpoint.
def try_create_optimizer_and_load_from_checkpoint(self) -> bool: self.create_optimizer() if self.checkpoint_path: return self.try_load_checkpoint_for_optimizer() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(self, checkpoint: Dict[str, OrderedDict]):\n self.model.load_state_dict(checkpoint[\"model_state_dict\"])\n self.optimizer.load_state_dict(checkpoint[\"optimizer_state_dict\"])\n return self", "def create_optimizer(self) -> None:\n # Make sure model is created befo...
[ "0.7107619", "0.70649505", "0.7064646", "0.69969", "0.6977983", "0.6892563", "0.6793151", "0.67687976", "0.673699", "0.6716268", "0.65814966", "0.650589", "0.64456534", "0.64456534", "0.6368876", "0.632732", "0.6312547", "0.6301847", "0.62795025", "0.6267788", "0.623797", "...
0.71238905
0
Saves a checkpoint of the current model and optimizer_type parameters in the specified folder and uploads it to the output blob storage of the current run context. The checkpoint's name for epoch 123 would be 123_checkpoint.pth.tar.
def save_checkpoint(self, epoch: int) -> Path: logging.getLogger().disabled = True model_state_dict = self.model.module.state_dict() \ if isinstance(self.model, torch.nn.DataParallel) else self.model.state_dict() checkpoint_file_path = self.config.get_path_to_checkpoint(epoch) checkpoint_file_path.parent.mkdir(exist_ok=True, parents=True) info_to_store = { ModelAndInfo.EPOCH_KEY: epoch, ModelAndInfo.MODEL_STATE_DICT_KEY: model_state_dict, ModelAndInfo.OPTIMIZER_STATE_DICT_KEY: self.optimizer.state_dict() } if self.config.compute_mean_teacher_model: assert self.mean_teacher_model is not None # for mypy, getter has this built in mean_teacher_model_state_dict = self.mean_teacher_model.module.state_dict() \ if isinstance(self.mean_teacher_model, torch.nn.DataParallel) \ else self.mean_teacher_model.state_dict() info_to_store[ModelAndInfo.MEAN_TEACHER_STATE_DICT_KEY] = mean_teacher_model_state_dict torch.save(info_to_store, checkpoint_file_path) logging.getLogger().disabled = False logging.info(f"Saved model checkpoint for epoch {epoch} to {checkpoint_file_path}") return checkpoint_file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_checkpoint(checkpoint, model_dir, checkpoint_prefix):\n\n checkpoint_path = os.path.join(model_dir, checkpoint_prefix)\n saved_path = checkpoint.save(checkpoint_path)\n logging.info('Saving model as TF checkpoint: %s', saved_path)\n return", "def save_checkpoint(checkpoint_dir, epoch, iteration, sa...
[ "0.73279613", "0.7212068", "0.7110705", "0.70985615", "0.7074814", "0.7049468", "0.7041478", "0.7008442", "0.7005684", "0.6975668", "0.6948612", "0.6930357", "0.69280964", "0.68722343", "0.6871008", "0.686374", "0.6840294", "0.67784363", "0.6768815", "0.6761419", "0.6749226",...
0.7023109
7
Initialize the weights of a Pytorch module.
def init_weights(m: Union[torch.nn.Conv3d, torch.nn.BatchNorm3d]) -> None: import torch if isinstance(m, torch.nn.Conv3d): torch.nn.init.normal_(m.weight, 0, 0.01) elif isinstance(m, torch.nn.BatchNorm3d): torch.nn.init.constant_(m.weight, 1) torch.nn.init.constant_(m.bias, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_weights(module: nn.Module, name: str, head_bias: float = 0., flax=False):\n if isinstance(module, nn.Linear):\n if name.startswith('head'):\n nn.init.zeros_(module.weight)\n nn.init.constant_(module.bias, head_bias)\n else:\n if flax:\n # F...
[ "0.77734", "0.7753587", "0.76126516", "0.76039255", "0.75937414", "0.7557966", "0.75483835", "0.75483835", "0.75483835", "0.7541337", "0.75397253", "0.7527526", "0.74981326", "0.7479258", "0.7456155", "0.74487233", "0.74385613", "0.74289656", "0.74223495", "0.74188006", "0.73...
0.0
-1
Generates a human readable summary of the present segmentation model, writes it to logging.info, and stores the ModelSummary object inside the argument `model`.
def summary_for_segmentation_models(config: ModelConfigBase, model: DeviceAwareModule) -> None: assert isinstance(model, BaseModel) crop_size = config.crop_size if isinstance(crop_size, int): crop_size = (crop_size, crop_size, crop_size) try: model.generate_model_summary(crop_size, log_summaries_to_files=config.log_summaries_to_files) except AttributeError as e: logging.warning(f"summary_for_segmentation_models failed with exception {e}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_and_print_model_summary(config: ModelConfigBase, model: DeviceAwareModule) -> None:\n random_state = RandomStateSnapshot.snapshot_random_state()\n # There appears to be a bug in apex, where previous use (in training for example) causes problems\n # when another model is later built on the CPU...
[ "0.73806274", "0.7147296", "0.6999165", "0.6930897", "0.68741435", "0.6732777", "0.67200786", "0.6702313", "0.6616318", "0.65155643", "0.6488972", "0.6480176", "0.6442557", "0.64185977", "0.6416413", "0.6397906", "0.6342395", "0.63167113", "0.63136315", "0.6211133", "0.620451...
0.7225569
1
Writes a human readable summary of the present model to logging.info, and logs the number of trainable parameters to AzureML.
def generate_and_print_model_summary(config: ModelConfigBase, model: DeviceAwareModule) -> None: random_state = RandomStateSnapshot.snapshot_random_state() # There appears to be a bug in apex, where previous use (in training for example) causes problems # when another model is later built on the CPU (for example, before loading from a checkpoint) # https://github.com/NVIDIA/apex/issues/694 # Hence, move the model to the GPU before doing model summary. if config.use_gpu: model = model.cuda() if isinstance(config, ScalarModelBase): # To generate the model summary, read the first item of the dataset. Then use the model's own # get_model_input function to convert the dataset item to input tensors, and feed them through the model. train_dataset = config.get_torch_dataset_for_inference(ModelExecutionMode.TRAIN) train_item_0 = next(iter(train_dataset.as_data_loader(shuffle=False, batch_size=1, num_dataload_workers=0))) model_inputs = get_scalar_model_inputs_and_labels(config, model, train_item_0).model_inputs # The model inputs may already be converted to float16, assuming that we would do mixed precision. # However, the model is not yet converted to float16 when this function is called, hence convert back to float32 summary = ModelSummary(model) summary.generate_summary(input_tensors=model_inputs, log_summaries_to_files=config.log_summaries_to_files) elif config.is_segmentation_model: summary_for_segmentation_models(config, model) assert model.summarizer summary = model.summarizer # type: ignore else: raise ValueError("Don't know how to generate a summary for this type of model?") RUN_CONTEXT.log(LoggingColumns.NumTrainableParameters, summary.n_trainable_params) random_state.restore_random_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self):\n\n self.model.summary(print_fn=lambda x: logging.info(x))", "def model_summary():\n print(\"\\n\")\n print(\"=\" * 30 + \"Model Structure\" + \"=\" * 30)\n model_vars = tf.trainable_variables()\n slim.model_analyzer.analyze_vars(model_vars, print_info=True)\n print(\"=\"...
[ "0.7465972", "0.73062223", "0.68315184", "0.6818728", "0.67563677", "0.67499065", "0.673236", "0.6722741", "0.66750515", "0.6649921", "0.6504973", "0.64990056", "0.64763284", "0.64610624", "0.64330405", "0.64009935", "0.63829356", "0.6330708", "0.62939197", "0.62824273", "0.6...
0.60460424
30
Create a model with temperature scaling by wrapping the result of config.create_model with ModelWithTemperature, if temperature scaling config has been provided, otherwise return the result of config.create_model
def create_model_with_temperature_scaling(config: ModelConfigBase) -> Any: # wrap the model around a temperature scaling model if required model = config.create_model() if isinstance(config, SequenceModelBase) and config.temperature_scaling_config: model = ModelWithTemperature(model, config.temperature_scaling_config) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self) -> None:\n self._model = create_model_with_temperature_scaling(self.config)", "def do_create_model(**kwargs):\n model_params = {\n 'name': kwargs['dag_run'].conf.get('model_name'),\n 'description': 'A custom DNN regressor model',\n 'regions': [REGION]\n }\n\n ...
[ "0.73296446", "0.57077694", "0.570612", "0.57056636", "0.56610817", "0.55574673", "0.54785675", "0.5419638", "0.53965676", "0.53905576", "0.538604", "0.538604", "0.5313637", "0.52842414", "0.52818054", "0.5228253", "0.5218954", "0.5209238", "0.52031755", "0.5201383", "0.51910...
0.8471851
0
Initialize your data structure here.
def __init__(self): self.buckets = collections.defaultdict(list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Build a dictionary through a list of words
def buildDict(self, words: List[str]) -> None: for word in words: self.buckets[len(word)].append(word)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dict(word_list):\r\n\r\n # initialize a dictonary\r\n d = dict()\r\n\r\n # iterate through the word_list, mapping sorted letters to word\r\n for i in word_list:\r\n\r\n # key - sorted letters in the word\r\n # how to sort ? --> convert to list, then sort. Finally join the sorted...
[ "0.7771935", "0.7714796", "0.76650697", "0.75896126", "0.7402118", "0.7371921", "0.7257023", "0.724838", "0.72190464", "0.71511894", "0.7121465", "0.70906883", "0.70329714", "0.69910663", "0.6939837", "0.6926235", "0.69013107", "0.68620795", "0.68157786", "0.6809816", "0.6763...
0.75077
4
Returns if there is any word in the trie that equals to the given word after modifying exactly one character
def search(self, word: str) -> bool: # # for candidate in self.buckets[len(word)]: # # for a, b in zip(word, candidate): # # result = any(sum(a!=b)) return any(sum(a!=b for a, b in zip(word, candidate)) == 1 for candidate in self.buckets[len(word)]) # # for candidate in self.buckets[len(word)]: # sum = 0 # for a, b in zip(word, candidate): # sum += (a!=b) # if sum == 0: # return True # return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_word(trie, string: str) -> bool:\n return any(w == string for w in trie)", "def search(self, word):\n curr = self.trie\n for i, ch in enumerate(word):\n curr = curr.get(ch, {})\n if curr:\n continue\n else:\n break\n \n...
[ "0.7898829", "0.77123356", "0.76817137", "0.7651471", "0.74973875", "0.7494274", "0.7490946", "0.7471417", "0.7440383", "0.7440078", "0.74153924", "0.74125475", "0.73968333", "0.7382937", "0.73649126", "0.7333139", "0.73310703", "0.7293905", "0.729297", "0.72762936", "0.72757...
0.664082
86
Load twine from a .json filename, filelike or a json string and validates twine contents.
def _load_twine(self, source=None): if source is None: # If loading an unspecified twine, return an empty one rather than raising error (like in _load_data()) raw_twine = {} logger.warning("No twine source specified. Loading empty twine.") else: raw_twine = self._load_json("twine", source, allowed_kinds=("file-like", "filename", "string", "object")) self._validate_against_schema("twine", raw_twine) self._validate_twine_version(twine_file_twined_version=raw_twine.get("twined_version", None)) return raw_twine
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_tweets(filename):\n\n try:\n with open(filename, 'r') as f:\n data = json.loads(f.read())\n except:\n print('ERROR in load_tweets.')\n\n return data", "def test_loader_loads_from_file():\n base_json = 'tests/test_json.json'\n json_test = {\"foo\": \"bar\"}\n as...
[ "0.64222986", "0.61474323", "0.6144654", "0.61129427", "0.6093864", "0.6074711", "0.6030403", "0.59984696", "0.59946185", "0.59418505", "0.59320986", "0.58631575", "0.5842694", "0.5824927", "0.57905143", "0.5786703", "0.5777964", "0.57755256", "0.5758631", "0.57461494", "0.57...
0.7133785
0
Load data from either a .json file, an open file pointer or a json string. Directly returns any other data.
def _load_json(self, kind, source, **kwargs): if source is None: raise exceptions.invalid_json_map[kind](f"Cannot load {kind} - no data source specified.") # Decode the json string and deserialize to objects. try: data = load_json(source, **kwargs) except FileNotFoundError as e: raise exceptions.file_not_found_map[kind](e) except jsonlib.decoder.JSONDecodeError as e: raise exceptions.invalid_json_map[kind](e) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_data_from_file(self, input_file_path):\n with FileOrBufferHandler(input_file_path, 'r', \n encoding=self.file_encoding) as input_file:\n try:\n data = json.load(input_file)\n except (json.JSONDecodeError, UnicodeDecodeError):\n ...
[ "0.74808633", "0.7463258", "0.7429995", "0.7426092", "0.73366517", "0.72446245", "0.7234326", "0.7181051", "0.7129091", "0.71012217", "0.7058075", "0.70502263", "0.7007759", "0.6973326", "0.69674516", "0.6960993", "0.69258857", "0.69136333", "0.6907644", "0.6902104", "0.68784...
0.7064134
10
Get the schema for the given strand.
def _get_schema(self, strand): if strand == "twine": # The data is a twine. A twine *contains* schema, but we also need to verify that it matches a certain # schema itself. The twine schema is distributed with this packaged to ensure version consistency... schema_path = "schema/twine_schema.json" elif strand in CHILDREN_STRANDS: # The data is a list of children. The "children" strand of the twine describes matching criteria for # the children, not the schema of the "children" data, which is distributed with this package to ensure # version consistency... schema_path = "schema/children_schema.json" elif strand in MANIFEST_STRANDS: # The data is a manifest of files. The "*_manifest" strands of the twine describe matching criteria used to # filter files appropriate for consumption by the digital twin, not the schema of the manifest data, which # is distributed with this package to ensure version consistency... schema_path = "schema/manifest_schema.json" else: if strand not in SCHEMA_STRANDS: raise exceptions.UnknownStrand(f"Unknown strand {strand}. Try one of {ALL_STRANDS}.") # Get schema from twine.json file. schema_key = strand + "_schema" try: return getattr(self, schema_key) except AttributeError: raise exceptions.StrandNotFound(f"Cannot validate - no {schema_key} strand in the twine") return jsonlib.loads(pkg_resources.resource_string("twined", schema_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_schema(self):\n self._pick()\n return Schema()", "def _get_schema_using_query(self, query: str) -> sch.Schema:\n return sch.Schema.from_tuples(self._metadata(query))", "def schema(self):\n return _parse_schema_resource(self._properties.get(\"schema\", {}))", "def get_sche...
[ "0.66698045", "0.6518725", "0.6390867", "0.6313399", "0.6210594", "0.62096435", "0.61262435", "0.61096203", "0.6025287", "0.5981262", "0.5939648", "0.5933518", "0.5902661", "0.58778864", "0.5872866", "0.58726424", "0.58520615", "0.58372164", "0.58244634", "0.5824207", "0.5819...
0.8233626
0
Validate data against a schema, raises exceptions of type InvalidJson if not compliant.
def _validate_against_schema(self, strand, data): schema = self._get_schema(strand) try: jsonschema_validate(instance=data, schema=schema) logger.debug("Validated %s against schema", strand) except ValidationError as e: raise exceptions.invalid_contents_map[strand](str(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, json_data):\n self._errors = None\n success = True\n for item in self._schema:\n if not item.validate(json_data):\n success = False\n\n return success", "def validate_schema(*,\n jsonschema: dict,\n dat...
[ "0.7925582", "0.78330433", "0.7702376", "0.7666036", "0.7600036", "0.75039744", "0.75000393", "0.74321485", "0.73822933", "0.73632777", "0.7302417", "0.72996646", "0.7248956", "0.71885204", "0.718743", "0.7182984", "0.69556284", "0.6946508", "0.69202065", "0.6914744", "0.6913...
0.76444364
4
Validate that the installed version is consistent with an optional version specification in the twine file.
def _validate_twine_version(self, twine_file_twined_version): installed_twined_version = pkg_resources.get_distribution("twined").version logger.debug( "Twine versions... %s installed, %s specified in twine", installed_twined_version, twine_file_twined_version ) if (twine_file_twined_version is not None) and (installed_twined_version != twine_file_twined_version): raise exceptions.TwineVersionConflict( f"Twined library version conflict. Twine file requires {twine_file_twined_version} but you have {installed_twined_version} installed" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_version(self):\n pass", "def validate_configurator_version():\n if settings.CONFIGURATOR_MODULE == \"bootmachine.contrib.configurators.salt\":\n pkgver = settings.SALT_AUR_PKGVER\n pkgrel = settings.SALT_AUR_PKGREL\n response = urllib2.urlopen(\"https://aur.archlinux.o...
[ "0.6902856", "0.6780541", "0.67345285", "0.6424998", "0.6407822", "0.64057225", "0.6383413", "0.6376578", "0.6337082", "0.6273863", "0.6264896", "0.62600714", "0.6233149", "0.62270665", "0.6219592", "0.61668104", "0.61236084", "0.6105264", "0.60952014", "0.60824794", "0.60168...
0.7964266
0
Validate values against the twine schema.
def _validate_values(self, kind, source, cls=None, **kwargs): data = self._load_json(kind, source, **kwargs) self._validate_against_schema(kind, data) if cls: return cls(**data) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate():", "def validate(self, name, values):\r\n \r\n pass", "def is_schema_valid(self, schema):\n for k, v in schema.items():\n if v[0] == \"var_len\":\n assert len(v) == 2\n assert v[1] in TF_VALUE\n\n if v[0] == \"fixed_len\":\...
[ "0.6888409", "0.6783357", "0.6623987", "0.6546313", "0.6526652", "0.6525666", "0.64644414", "0.6449077", "0.6449077", "0.64253944", "0.6407268", "0.63882005", "0.6381051", "0.63460135", "0.63460135", "0.6308076", "0.6282616", "0.6282616", "0.6281018", "0.62414503", "0.6232009...
0.0
-1
Validate manifest against the twine schema.
def _validate_manifest(self, kind, source, cls=None, **kwargs): data = self._load_json(kind, source, **kwargs) # TODO elegant way of cleaning up this nasty serialisation hack to manage conversion of outbound manifests to primitive inbound = True if hasattr(data, "to_primitive"): inbound = False data = data.to_primitive() self._validate_against_schema(kind, data) self._validate_all_expected_datasets_are_present_in_manifest(manifest_kind=kind, manifest=data) if cls and inbound: return cls(**data) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_manifest(\n request: ValidateManifestRequest = Body(...),\n schema: Any = Depends(get_description_schema),\n) -> ValidateManifestResponse:\n\n _, response = _validate_manifest(request, schema)\n return response", "def validate_input_manifest(self, source, **kwargs):\n return self....
[ "0.70706165", "0.67949265", "0.6726037", "0.6626515", "0.6575376", "0.650649", "0.6169406", "0.6119033", "0.6040567", "0.59697014", "0.59644884", "0.59519655", "0.5935721", "0.591002", "0.5886837", "0.58650386", "0.5852848", "0.5783439", "0.5762712", "0.5759838", "0.5739801",...
0.6218101
6
Check that all nonoptional datasets specified in the corresponding manifest strand in the twine are present in the given manifest.
def _validate_all_expected_datasets_are_present_in_manifest(self, manifest_kind, manifest): # This is the manifest schema included in the `twine.json` file, not the schema for `manifest.json` files. manifest_schema = getattr(self, manifest_kind) for expected_dataset_name, expected_dataset_schema in manifest_schema["datasets"].items(): if expected_dataset_name in manifest["datasets"]: continue if expected_dataset_schema.get("optional", False): continue raise exceptions.invalid_contents_map[manifest_kind]( f"A dataset named {expected_dataset_name!r} is expected in the {manifest_kind} but is missing." )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_manifest(manifest):\n if not manifest:\n raise Exception('manifest is null')\n\n for key in ['dublin_core', 'checking', 'projects']:\n if key not in manifest:\n raise Exception('manifest missing key \"{0}\"'.format(key))\n\n # check checking\n ...
[ "0.68781096", "0.5914848", "0.5894921", "0.58664596", "0.5797446", "0.5790559", "0.575301", "0.57257426", "0.56155634", "0.5589998", "0.55779296", "0.5571627", "0.55710405", "0.5568376", "0.55295604", "0.5499033", "0.5491544", "0.5466877", "0.54596764", "0.5446938", "0.542575...
0.7935964
0
Get the names of strands that are found in this twine.
def available_strands(self): return self._available_strands
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_strands(self):\n return iter(self.strand_list)", "def getStationsName(self) :\n names = []\n for sts in self._stations :\n names.append(sts.getName())\n\n return names", "def get_well_aliases(self):\n return self.info_wells['well'].unique()", "def list_a...
[ "0.6584263", "0.65621185", "0.63851863", "0.62019277", "0.61951375", "0.60891676", "0.60425985", "0.6007916", "0.59496164", "0.59036535", "0.5884974", "0.58607626", "0.57966846", "0.57783294", "0.5773814", "0.5770074", "0.57655287", "0.5721144", "0.5684944", "0.5684944", "0.5...
0.71010107
0
Get the names of the manifest strands that are found in this twine.
def available_manifest_strands(self): return self._available_manifest_strands
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_strands(self):\n return self._available_strands", "def list_manifests():\n import enaml\n with enaml.imports():\n from .pulses.manifest import PulsesManagerManifest\n from .tasks.manifest import PulsesTasksManifest\n from .measure.manifest import PulsesMeasureManif...
[ "0.6490598", "0.61462444", "0.6061251", "0.6059069", "0.59545153", "0.59168273", "0.5911148", "0.5903504", "0.5897712", "0.5851716", "0.58406675", "0.5829558", "0.58154243", "0.5781835", "0.57704556", "0.57661283", "0.57341903", "0.56977165", "0.56977165", "0.56939626", "0.56...
0.7861807
0