query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
write spec back to directory, (if dir not specified is default spec dir)
def writeSpec(self,dir=""): for codestruct in self.codestructures: codestruct.writeSpec(dir)
[ "def write_spec(self):\n outfile = self.name + '.ospec'\n self.spec_file = outfile\n self.update_spec()\n self.append_log('# $> write_spec()\\n'\n '# >>> visgen spec: {0}\\n'\n .format(self.spec_file))\n with open(outfile, 'w') as f:\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read spec code and populate codestructures
def processSpecs(self): specSubDirName="_spec" codestructure = CodeStructure() for dir in self._dirs: if q.system.fs.exists(q.system.fs.joinPaths(dir,specSubDirName)): files=q.system.fs.listPyScriptsInDir(q.system.fs.joinPaths(dir,specSubDirName)) for ...
[ "def writeSpec(self,dir=\"\"):\n for codestruct in self.codestructures:\n codestruct.writeSpec(dir)", "def codegen():", "def parse_spec (spec_file):\n spec_object = None\n spec_name = spec_file.replace(\".\", \"_\")\n params = []\n default_params = {}\n int_conversion = []\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the flow in the pipe is laminar, you can use the Poiseuille Equation to calculate the flow rate mu = 0.001 @ 25 degrees C Q = (pi (D4) delta_p) / (128 mu pipe_length)
def pois_metric(pipe_diameter, delta_p, pipe_length): mu = 0.001 # water @ 25 degrees C pois = mu * 10 flow_rate_lam = (math.pi * (pipe_diameter ** 4) * delta_p) / (128 * pois * pipe_length) return flow_rate_lam
[ "def solar_ppa():\n per_kwh = 0.196 # [$/kWh]\n\n return per_kwh", "def Piping(T_in, p_in, m_dot, d_inner, l_pipe, f, epsilon_pipe, T_shield, N):\r\n\r\n ## Estimation of the influence of the arcs\r\n # Calculation according to VDI Heatatlas 2013\r\n # Assumption isoenthalpic flow\r\n state_Arc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a Plotly Dash 'A' element that downloads a file from the app.
def file_download_link(filename): location = f"/{UPLOAD_DIRECTORY}/{filename}" return html.A(filename, href=location)
[ "def download():\n return render_template('download.html')", "def create_link(self):\n self.filename = App.get_running_app().root.ids.camera_screen.capture()\n self.url = FileSharer(self.filename).share()\n self.ids.label.text = self.url", "def downloadFile(where):\r\n\tprint MapLinks( \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Locate the value for a grounded node and its parents in a rule set, return 1 if not found. For functors with binary ranges, when all parents match but child's value does not, return 1prob for other value.
def ruleMatch (ruleSet, node, parents): def getProb (node): for rule in ruleSet: #print rule if (rule.child.eq(node) and len(rule.parentList)==len(parents) and all([n[0].eq(n[1]) for n in zip(rule.parentList,parents)])): #print "winning...
[ "def search(self):\n open_set = set()\n closed_set = set()\n open_set.add(self.start_node)\n\n # loop through all nodes until open set is empty to build neighbor map\n while open_set:\n current_node = open_set.pop()\n closed_set.add(current_node)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return default uniform distribution for the range of a functor
def default(functor): return 1.0/functorRangeSize(functor)
[ "def _uniform(val_range):\r\n return np.random.uniform(val_range[0], val_range[1])", "def uniform_range(distribution, max_sigma, num_points=0, delta=0):\n\n min_val = distribution.minimum_boundary(max_sigma)\n max_val = distribution.maximum_boundary(max_sigma)\n\n if not num_points:\n if delta:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Look up the range for a functor
def functorRange(functor): for (name, range) in functorRangeList: if functor == name: return range else: raise Exception ("Functor " + functor + " not present in range list")
[ "def get_range(self, start, end):", "def __call__(self, *args):\n return self.range_", "def get_range(lst):\n pass", "def _in_range_op(spec):", "def getRange(self):\n \n pass", "def ranges(self, predicate):\n\n x = np.zeros(len(self)).astype(np.bool)\n for i, elem in enum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return cardinality of range for a functor
def functorRangeSize(functor): return len(functorRange(functor))
[ "def functorRange(functor):\n for (name, range) in functorRangeList:\n if functor == name:\n return range\n else:\n raise Exception (\"Functor \" + functor + \" not present in range list\")", "def interval_cardinality(self):\n return len(list(self.lower_contained_intervals())...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For functors with a binary range, return the other element
def functorOtherValue(functor, val): range = functorRange(functor) assert len(range) == 2 if val == range[0]: return range[1] else: return range[0]
[ "def functorRange(functor):\n for (name, range) in functorRangeList:\n if functor == name:\n return range\n else:\n raise Exception (\"Functor \" + functor + \" not present in range list\")", "def ranges(self, predicate):\n\n x = np.zeros(len(self)).astype(np.bool)\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the atoms, derived from the first entry in the joint probability table
def atomList(joints): assert len(joints) > 0 first = joints[0] functorList = first[1][:-2] # Second element of row, last two elements of that are joint prob and log prob atomList = [] for (node,_) in functorList: atomList.append(node.functor+"("+",".join(node.varList)+")") return atomLis...
[ "def jointProbabilities(constants, db, ruleList, bn):\n vars = bn.variableList()\n combs = generateCombos(vars, constants)\n joints = []\n for grounding in combs:\n joints.append((grounding, bn.jointProbs(grounding, db, ruleList)))\n return (vars, atomList(joints), joints)", "def prior_from_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the joint probabilities for all combinations of values
def jointProbabilities(constants, db, ruleList, bn): vars = bn.variableList() combs = generateCombos(vars, constants) joints = [] for grounding in combs: joints.append((grounding, bn.jointProbs(grounding, db, ruleList))) return (vars, atomList(joints), joints)
[ "def joint_proba(self, X):\n return self.weights * self._bernoulli(X)", "def joint_prob(network, assignment):\n prob = 1\n for a_key in assignment:\n conditions = []\n current = network[a_key]\n for parent in current['Parents']:\n conditions.append(True) if assignment[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate all possible groundings (assignments of constants to variables)
def generateCombos(vars,constants): # SUPER NOT GENERALIZED---TOO LATE AT NIGHT FOR ME TO DO RECURSIVE ALGORITHMS assert len(vars) == 2 and len(constants) == 2 combs = [] for c1 in constants: for c2 in constants: combs.append(Grounding([(vars[0], c1), (vars[1], c2)])) return comb...
[ "def define_all_variables():\n \"\"\"\n A copy of all vars as normal dictionary for reference\n all_vars_dict = {'tas': ['Amon', 'day'], 'ts': ['Amon'], 'tasmax': ['Amon', 'day'], 'tasmin': ['Amon', 'day'],\n 'psl': ['Amon', 'day'], 'ps': ['Amon'], 'uas': ['Amon'], 'vas': ['Amon'], 'sfcWind'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
` Given a joint probability table, format it for LaTeX. This function will have to be tailored for every paper. This function simply generates the {tabular} part of the table. The prologue and epilogue, including the caption and label, must be specified in the including file.
def formatJointTableForLaTeX(joints): (varList, atoms, probs) = joints cols = len(varList) + len (probs[0][1]) with open("table1.tex","w") as out: out.write ("\\begin{tabular}{|" + "|".join(["c"]*(cols-2))+"||c|c|}\n") out.write ("\\hline\n") # Table header out.write (" & ".j...
[ "def print_as_wiki_hybrid_table(rows, table_header):\n\n # Print as Wiki Table\n print('{| style=\"valign:top;\"')\n\n h_num, h_signature_date, h_subject, h_fedreg_page = table_header\n\n header = \"\"\"! Proc.&nbsp;No.\n! &nbsp;\n! align=\"left\" | Subject\n! <small>Signature Date</small>\n! align=\"ri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take replay file that was uploaded to ObjectStore and process data and store it to database and link to account
async def parse_replay(request, game): game = game.lower() replay_file = request.files.get("replay") if replay_file: if game == STARCRAFT: basic, result = await SC2Replay.process_replay(replay_file, request.args.get("load_map", False)) if result: # Lets creat...
[ "def send_to_restore(file_name, data):\n urlfetch.fetch(url=config.RESTORE_URL + '?name=' + file_name + '&source=db&packet',\n payload=urllib.urlencode({\"data\": services.event.entity_to_string(data)}),\n method=urlfetch.POST)", "def post_original_to_db( self, data, date_st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_execute_ map the request name provided to an ID
def execute(self, requestName, conn = None, trans = False): self.sql = "SELECT request_id from reqmgr_request WHERE " self.sql += "request_name=:request_name" binds = {"request_name": requestName} reqID = self.dbi.processData(self.sql, binds, conn = conn, transaction = trans) res...
[ "async def execute(self, /, request: RequestT) -> ResponseT:\n ...", "async def _execute(self, request: dict) -> dict:\n request['command'] = self.command\n return await self.adapter.send_request(request)", "def process_query(self, name, *args, **kwargs):\n return self._process_named_command...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use float16 for faster IO during training.
def save_float16_npy(data, path): np.save(path, data.astype(np.float16))
[ "def ggml_fp32_to_fp16(x: float) -> np.float16:\n ...", "def ggml_fp16_to_fp32(x: np.float16) -> float:\n ...", "def _update_use_bfloat16(configs, use_bfloat16):\n configs[\"train_config\"].use_bfloat16 = use_bfloat16", "def use_float16(self):\n queue = [] # queue for BFS\n queue.append(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return if Persona object passed into args is in defaul componenti propperty
def has_componente(self, persona): return True if persona.pk in self.pks_componenti else False
[ "def test_args_valid_component(self):\n output = addr.args_valid(name=None, addr='', component='someComponent')\n\n self.assertTrue(output)", "def isUseable(obj):", "def has_pobj(self, prep):\n if(prep not in self.prepositions):\n return False\n \n found_prep = Fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If an bundle is for native iOS, it has these properties in the Info.plist
def is_info_plist_native(plist): return ( 'CFBundleSupportedPlatforms' in plist and 'iPhoneOS' in plist['CFBundleSupportedPlatforms'] )
[ "def shallCreateAppBundle():\n return options.macos_create_bundle and isMacOS()", "def _setup_osgi_properties(self, properties, allow_bridge, extra_packages=None):\n osgi_properties = self._java.load_class(\"java.util.HashMap\")()\n for key, value in properties.items():\n if value is n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sign all the dylibs in this directory
def sign_dylibs(self, signer, path): for dylib_path in glob.glob(join(path, '*.dylib')): dylib = signable.Dylib(self, dylib_path, signer) dylib.sign(self, signer)
[ "def sign_dylibs(self, cms_signer, path):\n for dylib_path in glob.glob(join(path, '*.dylib')):\n dylib = signable.Dylib(self, dylib_path, cms_signer)\n dylib.sign(self, cms_signer)", "def sign(self, signer):\n # log.debug(\"SIGNING: %s\" % self.path)\n frameworks_path =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sign everything in this bundle, recursively with subbundles
def sign(self, signer): # log.debug("SIGNING: %s" % self.path) frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): # log.debug("SIGNING FRAMEWORKS: %s" % frameworks_path) # sign all the frameworks for framework_name in os.listdir(framew...
[ "def resign(self, deep, cms_signer, provisioner):\n # log.debug(\"SIGNING: %s\" % self.path)\n if deep:\n plugins_path = join(self.path, 'PlugIns')\n if exists(plugins_path):\n # sign the appex executables\n appex_paths = glob.glob(join(plugins_path,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
signs bundle, modifies in place
def resign(self, signer): self.sign(signer) log.debug("Resigned bundle at <%s>", self.path)
[ "def sign_update(self):\n # Loads private key\n # Loads version file to memory\n # Signs Version file\n # Writes version file back to disk\n self._add_sig()", "def sign(self, payload):\n raise NotImplementedError", "def sign_package(self):\n path_to = os.path.joi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a path to a provisioning profile, return the entitlements encoded therein
def extract_entitlements(provision_path): cmd = [ 'smime', '-inform', 'der', '-verify', # verifies content, prints verification status to STDERR, # outputs content to STDOUT. In our case, will be an XML plist '-noverify', # accept se...
[ "def parse_entitlement_path(path: str) -> Dict[str,str]:\n m = re.match(r\"^accounts/(?P<account>.+?)/customers/(?P<customer>.+?)/entitlements/(?P<entitlement>.+?)$\", path)\n return m.groupdict() if m else {}", "def get_firefox_profiles_path():\r\n return pathlib.Path(get_firefox_appdata_path(),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write entitlements to self.entitlements_path. This actually doesn't matter to the app, it's just used later on by other parts of the signing process.
def write_entitlements(self, entitlements): biplist.writePlist(entitlements, self.entitlements_path, binary=False) log.debug("wrote Entitlements to {0}".format(self.entitlements_path))
[ "def export_entitlements_file(self, dst_path):\n dst_path = Path(dst_path)\n dst_path.write_bytes(plistlib.dumps(self.entitlements))", "def stage_cert_file(self):\n if not self.cert:\n self.log.info(\"No cert found for %s\", self.user.name)\n \n uinfo = self.get_user_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function shows the log in window
def log_in(self): self.clear_screen() lbl_log_in = Label(self.root, text="Welcome. Please log in to the system.", font=self.title_font, bg=self.bg_color) lbl_log_in.pack(pady=5, padx=10) user_name = Label(self.root, text="ente...
[ "def show_log_window():\n current_handlers = logging.getLogger().handlers\n log_windows = [\n h for h in current_handlers if h.__class__.__name__ == \"WindowLoggingHandler\"\n ]\n if not log_windows:\n log_win = WindowLoggingHandler.basic_handler(Toplevel())\n logging.getLogger().ad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function shows the read window. it allows the client to read all the messages. both received and sent.
def read_messages(self, msg_num): self.clear_screen() user_label = Label(self.root, text="Hello " + self.username, font=self.title_font, bg=self.bg_color, height=2) user_label.pack(pady=5, padx=50) lbl_msg = Label(self.root, text="Message " + str(msg_num),...
[ "def show_messages(self):\n for msg in self.messages:\n print msg['text']", "def get_messages( self ):\n message = self.text_sock.recv( 4096 )\n while message:\n print( message.decode(), end='' )\n message = self.text_sock.recv( 4096 )\n self.clean_up()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function refreshes the read messages page.
def refresh(self, msg_num): if self.messages_window is not None: self.messages_window.destroy() self.messages_window = None self.read_messages(msg_num)
[ "async def chat_refresh(self, label):\n room = await self.get_room(label)\n messages = await self.fetch_all_message(room)\n await self.send_json(\n return_value(ACTION_REFRESH_CHAT, label, self.user.username, MSG_MESSAGE, messages)\n )", "def read_messages(self, msg_num):\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function makes sure that when going back from the read window, all windows work properly.
def go_back_read(self): if self.messages_window is not None: self.messages_window.destroy() self.messages_window = None self.choose_path()
[ "def ev_windowrestored(self, event: WindowEvent) -> None:", "def __window_forward(self):\n pass", "def refresh_window(self):", "def windows_initialization_part_1():\n layout_open_window = open_window_layout()\n layout_path_load_window = path_load_window_layout()\n layout_loading_window = loadi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opens a new window that contains all the messages.
def new_window_messages(self, button_see_all_msgs): # changing the button command to closing the window button_see_all_msgs.config(command=lambda: self.close_window(button_see_all_msgs)) # creating the chat Tk object self.messages_window = Tk() self.messages_window.resizab...
[ "def DoOpenNewWindow(self):\r\n pass", "def OpenWindow(self):\r\n self._Owner.Client.OpenDialog('CHAT', self.Name)", "def open_new_window(self):\n self.driver.execute_script('window.open(\"https://simple-chat-asapp.herokuapp.com/\")')", "def _create_window(self):\n wc = win32gui.WN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function recognizes the input of the microphone and turns it into text. the text is inserted to the text widget and then the user will be able to send it as a message
def speech_recognizer_function(self, text_widget): label_listening = Label(self.root, text="listening to input...", font=self.text_font, bg=self.bg_color) label_listening.pack(pady=10) recognizer = speech_recognition.Recognizer() microphone = speech_r...
[ "def mic_input(self):\n try:\n r = sr.Recognizer()\n # r.pause_threshold = 1\n # r.adjust_for_ambient_noise(source, duration=1)\n with sr.Microphone() as source:\n print(\"Listening....\")\n r.energy_threshold = 4000\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function colors the encrypted letter label in the simulator for 300 milliseconds
def color_letter(self, letter, lst_labels, plain_text_widget, encrypted_text_widget): new_letter, txt_encryption = self.simulator_enigma.encrypt_letter(letter) lst_encryption_letter_stages = [i[-1] for i in txt_encryption.split("\n")] lst_encryption_letter_stages.remove(')') self.sim...
[ "def display_cyan(text):\n print \"\\n\\n\"\n print colored(text, 'cyan', attrs=['reverse', 'blink'])", "def print_ascii_red(text):\n\t_print_ascii(text, _COLOR_RED)", "def _UpdateCharAlpha0Blue(self, data):\n\t\tfor [r, c, ch] in data:\n\t\t\t(x, y) = self.RowColToXY(r, c)\n\t\t\tself._DrawCubeXYBlue(x, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displays the enigma simulator
def simulator(self, rotors_settings=(1, 2, 3, 'A', 'A', 'A'), plugboard_settings=None, plain_text=""): self.clear_screen() user_label = Label(self.root, text="Hello " + self.username, font=self.title_font, bg=self.bg_color, height=2) user_label.g...
[ "def display(self):\n viewer = SpectraViewer(spectrometer=self)\n viewer.display()", "def ascii_show(self):\n self.ascii_form = ASCII_table.ASCIITable()\n self.ascii_form.show()", "def setup_screen(self):\n ugfx.init()\n width=ugfx.width()\n height=ugfx.height()\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function lets the user change the settings of the simulator
def change_settings(self): self.clear_screen() # making sure the screen grid will be organized label_line = Label(self.root, text=" ", font=self.text_font, bg=self.bg_color) label_line.grid(row=0, column=0) label_line = Label(self.root, text=" ", font=self.text_font, b...
[ "def test_020_change_settings(self):\n\n testflow.step(\"Modifying settings via CLI\")\n assert self.settings_cli.run(\n 'set',\n name='MESSAGE_OF_THE_DAY',\n value='Zdravicko',\n )[0], \"Failed to change MESSAGE_OF_THE_DAY setting\"\n\n testflow.step(\"Q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function adds a letter to the plugboard
def add_letter_in_plugboard(self, letter, lst_buttons): self.simulator_enigma.plugboard.add_letter(letter) self.set_plugboard(lst_buttons)
[ "def add_letter(self, letter):\r\n if (len(self.plugboard1) < 10 or\r\n (len(self.plugboard1) == 10 and self.plugboard2[-1] is None)) and \\\r\n letter not in self.plugboard1 and letter not in self.plugboard2:\r\n if len(self.plugboard1) == 0 or (len(self.plugboard1) < 10...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clears the screen from widgets.
def clear_screen(self): lst_grid = self.root.grid_slaves() for widget in lst_grid: widget.destroy() lst_pack = self.root.pack_slaves() for widget in lst_pack: widget.destroy()
[ "def clear_screen(screen):\n screen.fill([0, 0, 0])", "def clear(self):\r\n\r\n # Clear the widgets list\r\n self.widgets_list = []\r\n\r\n # Refresh the scroll area\r\n self._refresh()", "def clear_screen(self) -> None:\n assert self.screen is not None\n self.screen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve fastq files for the given lane, ready to process.
def get_fastq_files(directory, work_dir, item, fc_name, bc_name=None, glob_ext="_fastq.txt", config=None, unpack=True): if "files" in item and bc_name is None: names = item["files"] if isinstance(names, basestring): names = [names] files = [x if os.path.isabs(...
[ "def find_fastqs(location, project_id, sample_id, lane=None):\n basename = '*.fastq.gz'\n if lane:\n basename = '*L00' + str(lane) + basename\n\n pattern = os.path.join(location, project_id, sample_id, basename)\n fastqs = find_files(pattern)\n app_logger.debug('Found %s fastq files for %s', l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert barcode id to sample description, changing extension from _fastq.txt to .fastq in the process
def convert_barcode_id_to_name(multiplex, fc_name, fq): fqout = list([None, None]) if multiplex is None: fqout[0] = fq[0] if not fq[1] == None: fqout[1] = fq[1] else: bcid2name = dict([(mp['barcode_id'], mp['name']) for mp in multiplex]) for bcid in bcid2name.keys...
[ "def convert_name_to_barcode_id(multiplex, fc_name, fq):\n fqout = list([None, None])\n name2bcid = dict([(mp['name'], mp['barcode_id']) for mp in multiplex])\n for name in name2bcid.keys():\n mstr = \"%s_%s_\" % (fc_name, name) \n if fq[0].find(mstr) != -1:\n from_str = \"%s_%s_\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert sample description to barcode id, changing extension from .fastq to _fastq.txt in the process
def convert_name_to_barcode_id(multiplex, fc_name, fq): fqout = list([None, None]) name2bcid = dict([(mp['name'], mp['barcode_id']) for mp in multiplex]) for name in name2bcid.keys(): mstr = "%s_%s_" % (fc_name, name) if fq[0].find(mstr) != -1: from_str = "%s_%s_" %(fc_name, nam...
[ "def convert_barcode_id_to_name(multiplex, fc_name, fq):\n fqout = list([None, None])\n if multiplex is None:\n fqout[0] = fq[0]\n if not fq[1] == None:\n fqout[1] = fq[1]\n else:\n bcid2name = dict([(mp['barcode_id'], mp['name']) for mp in multiplex])\n for bcid in b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restore alembic table for gdrive migrations with latest correct content. Since the migration chain is disabled, this table won't be used. If the migration chain gets enabled, this table will contain correct tag for downgrades.
def downgrade(): op.execute(""" CREATE TABLE ggrc_gdrive_integration_alembic_version ( version_num varchar(32) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 """) op.execute(""" INSERT INTO ggrc_gdrive_integration_alembic_version (version_num) VALUES ('3f64d03c6c01') """)
[ "def downgrade():\n\n op.drop_column('shares', 'revert_to_snapshot_support')", "def downgrade_db(rev=\"base\"):\n print(cyan(\"Running Alembic migrations, downgrading DB to %s\" % rev))\n command.downgrade(alembic_cfg, rev)", "def downgrade(revision, sql):\n alembic_command.downgrade(alembic_config,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Browse the folder to locate the json file
def browse_folder(self): # Get the file name from the user selection filename = tkinter.filedialog.askopenfilename(initialdir=".", title="Select JSON file", filetypes=(("json files", "*.json"), ("txt files", "*.txt"), ...
[ "def openFile():\n global DEFAULT_DIR\n\n jsonFile = filedialog.askopenfilename(\n initialdir= DEFAULT_DIR,\n title = \"Open a file\",\n filetypes=((\"json files\", \"*.json\"),)\n )\n if jsonFile != \"\":\n jsonFile = open(jsonFile, \"r\")\n data = json.load(jsonFile)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build/load the barcode use the json file
def build_barcode(self): # Get the file name/path to the json file filename = self.filename_entry.get() # Check if the filename is given if not os.path.exists(filename): showerror("JSON File Not Exists", "JSON file not exists.\n" ...
[ "def build_barcode_from_json(path_to_json, barcode_type=\"Color\"):\n assert barcode_type in barcode_types, \"Invalid barcode type. The available types of \" \\\n \"the barcode are {:s}\".format(str(barcode_types))\n with open(path_to_json, \"r\") as infile:\n o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function resize the recived video to size(480,480) and captured resized frames during the process
def resizeVideo(n, format, vpath, cpath): start_time = time.time() t = time.process_time() vidcap = cv2.VideoCapture(vpath) success, image = vidcap.read() cv2.namedWindow('image') cv2.imshow('image', image) cv2.waitKey(1) count = 0 CODE = 'XVID' # default save to avi ...
[ "def __resize_width_and_height(self, new_width: int, new_height: int):\n\n for video_cnt, (video_type, video_path) in enumerate(self.frame_types.items()):\n video_meta_data = get_video_meta_data(video_path=video_path)\n out_path = os.path.join(self.temp_dir, video_type + \".mp4\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is action for the resize buttons to use, mainly call the resizeVideo methods
def resizeButton(format,vpath,cpath): if os.path.exists(cpath): cPath=cpath+'/vid-instance' if os.path.exists(vpath): vPath=vpath N, cPath = dirCapture(1, cPath) resizeVideo(N, format, vPath, cPath)
[ "def handleResize(self):\n pass", "def OnWindowResize(self):", "def on_size(self, *args):\n\n self.ids.newbutton.font_size = max(Window.width * (20 / 800), Window.height * (20 / 600))\n self.ids.openbutton.font_size = max(Window.width * (20 / 800), Window.height * (20 / 600))\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is called when multiStartButton is called and will use multicore() function to resize videos in parallel
def startMultiResizing(self): global totaltime try: str(cpath) try: str(filenames) try: print(filenames) totaltime = multicore(Format, filenames, cpath) self.resultLabel['text'] =...
[ "def __resize_width(self, new_width: int):\n\n for video_cnt, (video_type, video_path) in enumerate(self.frame_types.items()):\n video_meta_data = get_video_meta_data(video_path=video_path)\n out_path = os.path.join(self.temp_dir, video_type + \".mp4\")\n if video_meta_data[\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All entrys in the header must be specified in the metadata lines.
def check_header(self, entry): if entry not in self.metadata: raise SyntaxError("Header entry must be described in the metadata lines. Entry: %s is not in metadata." % entry)
[ "def _parse_hdr(self):\n self.schema[\"hdr\"] = {}\n for line in self.info.split(\"\\n\"):\n for hdr in [\"filename\", \"step\", \"last_update\"]:\n if line.startswith(hdr):\n self.schema[\"hdr\"][hdr] = line.split(\" = \")[-1].strip('\"')", "def check_he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test selection of a leaf node
def testSelectLeaf(self): menu = self.menu items = self.items assertTrue = self.assertTrue assertIsNone = self.assertIsNone menu.select(tag="a11") assertTrue(menu.selected) assertTrue(items["a1"].selected) assertTrue(items["a11"].selected) asse...
[ "def is_leaf(node):\n return node.children == {}", "def isLeaf(self):\n return True", "def is_leaf(self) -> bool:\r\n return self.weight > 0 and self.subtrees == []", "def test_leaf_node_getter(self):\n leaves = self.tree.get_leaf_nodes()\n answer = [2, 5, 6, 8, 9, 10]\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test selection of a branch
def testSelectBranch(self): menu = self.menu items = self.items assertTrue = self.assertTrue assertIsNone = self.assertIsNone menu.select(tag="a2") assertTrue(menu.selected) assertIsNone(items["a1"].selected) assertIsNone(items["a11"].selected) ...
[ "def testIsBranch(self):\n self.assertTrue(self.masterref.isBranch())\n self.assertFalse(self.ref.isBranch())", "def test_branch_options(self):\n self.init_test_repo('gbp-test-native')\n\n eq_(mock_ch(['--packaging-branch=foo']), 1)\n self._check_log(-2, \"gbp:error: You are not...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test selection of specific nodes
def testSelectSpecificNode(self): menu = self.menu items = self.items assertTrue = self.assertTrue assertIsNone = self.assertIsNone items["a2"].select() assertTrue(menu.selected) assertIsNone(items["a1"].selected) assertIsNone(items["a11"].selected) ...
[ "def test_node_selection(self, node: dict, selection_type: SelectionType):\n assert ListSelectedExecutor.node_selection(node) == selection_type", "def test_selecting_nodes_clicking_them_discovered(self):\n with Nodes()as n:\n for node in n.nodes_discovered:\n node.parent.cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test selection with nonexistent tag
def testSelectNonexistentTag(self): menu = self.menu items = self.items assertTrue = self.assertTrue assertIsNone = self.assertIsNone # Make a selection menu.select(tag="a21") assertTrue(menu.selected) assertIsNone(items["a1"].selected) assertI...
[ "def test_tags_content_search_invalid_tag(self):\n\n global NON_EXISTENT_TAG\n\n po = self.catalog.load_pageobject('TagsPage')\n\n self.browser.proxy_client.new_har(\"page\")\n po.goto_page()\n har_entry = self.browser.page_load_details()\n\n start_url = po.current_url()\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read and parse NEXUS input (a filename, filehandle, or string).
def read(self, input): # 1. Assume we have the name of a file in the execution dir or a # file-like object. # Note we need to add parsing of the path to dir/filename try: with File.as_handle(input, 'rU') as fp: file_contents = fp.r...
[ "def read_nexus(filename):\n f = open(filename)\n return parse_nexus(f)", "def parse(self, infile):\r\n raise NotImplementedError()", "def handle_input(filepath, genome_name):\n\n if genome_name:\n name = genome_name\n elif filepath != '-':\n name = os.path.splitext(os.path.basename...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform singular values decomposisiton on a document term matrix A. A = T S D^T A ~ T'S'D'^T Where T', S', and D' have a fewer columns than T, S, and D.
def computeTruncatedSVD(docTermMatrix, dim=500): T, S, D = np.linalg.svd(np.transpose(docTermMatrix), full_matrices=False) diagS = np.diag(S) shape = np.shape(diagS) if dim <= shape[0] and dim <= shape[1]: subT = T[:,:dim] subS = diagS[:dim,:dim] subD = np.transpose(D)...
[ "def decompose_matrix_truncated(self, sparse_td_mat):\n #sparse_td_mat = sparse.csc_matrix(td_mat.astype(float))\n\n # Use numpy to perform the singular value decomposition\n term_matrix, singular_vals, doc_matrix = svds(sparse_td_mat, k=self.rank)\n\n #print(term_matrix.shape, \" \", si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the advanced_catalog_count of this IaasUcsdManagedInfraAllOf.
def advanced_catalog_count(self, advanced_catalog_count): self._advanced_catalog_count = advanced_catalog_count
[ "def catalogs_count(self, catalogs_count):\n self._catalogs_count = catalogs_count", "def bm_catalog_count(self, bm_catalog_count):\n\n self._bm_catalog_count = bm_catalog_count", "def container_catalog_count(self, container_catalog_count):\n\n self._container_catalog_count = container_cata...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the bm_catalog_count of this IaasUcsdManagedInfraAllOf.
def bm_catalog_count(self, bm_catalog_count): self._bm_catalog_count = bm_catalog_count
[ "def container_catalog_count(self, container_catalog_count):\n\n self._container_catalog_count = container_catalog_count", "def catalogs_count(self, catalogs_count):\n self._catalogs_count = catalogs_count", "def standard_catalog_count(self, standard_catalog_count):\n\n self._standard_catal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the container_catalog_count of this IaasUcsdManagedInfraAllOf.
def container_catalog_count(self, container_catalog_count): self._container_catalog_count = container_catalog_count
[ "def catalogs_count(self, catalogs_count):\n self._catalogs_count = catalogs_count", "def bm_catalog_count(self, bm_catalog_count):\n\n self._bm_catalog_count = bm_catalog_count", "def standard_catalog_count(self, standard_catalog_count):\n\n self._standard_catalog_count = standard_catalog_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the esxi_host_count of this IaasUcsdManagedInfraAllOf.
def esxi_host_count(self, esxi_host_count): self._esxi_host_count = esxi_host_count
[ "def hyperv_host_count(self, hyperv_host_count):\n\n self._hyperv_host_count = hyperv_host_count", "def eip_count(self, eip_count):\n self._eip_count = eip_count", "def hosts_every(self, hosts_every):\n\n self._hosts_every = hosts_every", "def host_users(self, host_users):\n\n self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the external_group_count of this IaasUcsdManagedInfraAllOf.
def external_group_count(self, external_group_count): self._external_group_count = external_group_count
[ "def local_group_count(self, local_group_count):\n\n self._local_group_count = local_group_count", "def redundancyodata_count(self, redundancyodata_count):\n self._redundancyodata_count = redundancyodata_count", "def cpu_logical_count(self, cpu_logical_count):\n\n self._cpu_logical_count = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the hyperv_host_count of this IaasUcsdManagedInfraAllOf.
def hyperv_host_count(self, hyperv_host_count): self._hyperv_host_count = hyperv_host_count
[ "def esxi_host_count(self, esxi_host_count):\n\n self._esxi_host_count = esxi_host_count", "def vm_count(self, vm_count):\n\n self._vm_count = vm_count", "def vcpus(self, vcpus):\n self._vcpus = vcpus", "def host_num(self, host_num):\n\n self._host_num = host_num", "def vdc_count...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the local_group_count of this IaasUcsdManagedInfraAllOf.
def local_group_count(self, local_group_count): self._local_group_count = local_group_count
[ "def external_group_count(self, external_group_count):\n\n self._external_group_count = external_group_count", "def netapi32_NetLocalGroupSetMembers(jitter):\n ret_ad, args = jitter.func_args_stdcall([\"servername\", \"groupname\", \"level\", \"buf\", \"totalentries\"])\n raise RuntimeError('API not ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the standard_catalog_count of this IaasUcsdManagedInfraAllOf.
def standard_catalog_count(self, standard_catalog_count): self._standard_catalog_count = standard_catalog_count
[ "def catalogs_count(self, catalogs_count):\n self._catalogs_count = catalogs_count", "def container_catalog_count(self, container_catalog_count):\n\n self._container_catalog_count = container_catalog_count", "def bm_catalog_count(self, bm_catalog_count):\n\n self._bm_catalog_count = bm_cata...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the user_count of this IaasUcsdManagedInfraAllOf.
def user_count(self, user_count): self._user_count = user_count
[ "def user_count(self, user_count):\n self._user_count = user_count", "def user_claim_count(self, user_claim_count):\n self._user_claim_count = user_claim_count", "def _set_usr_ping_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the vdc_count of this IaasUcsdManagedInfraAllOf.
def vdc_count(self, vdc_count): self._vdc_count = vdc_count
[ "def vm_count(self, vm_count):\n\n self._vm_count = vm_count", "def vpc_count(self, vpc_count):\n self._vpc_count = vpc_count", "def segments_count(self, segments_count):\n\n self._segments_count = segments_count", "def redundancyodata_count(self, redundancyodata_count):\n self._re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the vm_count of this IaasUcsdManagedInfraAllOf.
def vm_count(self, vm_count): self._vm_count = vm_count
[ "def vdc_count(self, vdc_count):\n\n self._vdc_count = vdc_count", "def lun_count(self, lun_count):\n\n self._lun_count = lun_count", "def vcpus(self, vcpus):\n self._vcpus = vcpus", "def hyperv_host_count(self, hyperv_host_count):\n\n self._hyperv_host_count = hyperv_host_count", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats ``path`` with the rank zero values.
def _format_path_with_rank_zero(path: str) -> str: return path.format( rank=0, local_rank=0, node_rank=0, )
[ "def _get_local_rank_zero_path(path: Optional[str]) -> str:\n local_rank_zero = dist.get_global_rank() - dist.get_local_rank()\n paths = dist.all_gather_object(path)\n local_rank_zero_path = paths[local_rank_zero]\n assert local_rank_zero_path is not None, 'local rank zero provides the path'\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats ``path`` formatted with the current rank values.
def _format_path_with_current_rank(path: str) -> str: return path.format( rank=dist.get_global_rank(), local_rank=dist.get_local_rank(), node_rank=dist.get_node_rank(), )
[ "def _format_path_with_rank_zero(path: str) -> str:\n return path.format(\n rank=0,\n local_rank=0,\n node_rank=0,\n )", "def format_path(self, path):\n\t\thuman_readable_path = []\n\t\tfor pair in path:\n\t\t\tx1, y1 = self.list_to_grid_index(pair[0])\n\t\t\tx2, y2 = self.list_to_grid_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Broadcasts the ``path`` from the LOCAL rank zero to all LOCAL ranks.
def _get_local_rank_zero_path(path: Optional[str]) -> str: local_rank_zero = dist.get_global_rank() - dist.get_local_rank() paths = dist.all_gather_object(path) local_rank_zero_path = paths[local_rank_zero] assert local_rank_zero_path is not None, 'local rank zero provides the path' return local_ran...
[ "def broadcast(value, root_rank, name=None):\n return _impl.broadcast(K, value, root_rank, name)", "def extern_to_local_path(self, path: PurePath) -> Path:\n return self.path_supervisor / path.relative_to(self.path_extern_supervisor)", "def local_to_extern_path(self, path: PurePath) -> PurePath:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download the checkpoint stored at ``path``, potentially in ``object_store``, to ``node_checkpoint_folder``. Returns a tuple of (``composer_states_filepath``, ``extracted_checkpoint_folder``, ``extracted_rank_n``). The ``composer_states_filepath``, is the path to the composer states, which can be passed into
def download_checkpoint(path: str, node_checkpoint_folder: str, object_store: Optional[Union[ObjectStore, LoggerDestination]], progress_bar: bool, fsdp_sharded_state_dict_enabled: bool = False, deepsp...
[ "def download_checkpoint_ngc(checkpoint_url: str, checkpoint_path: pathlib.Path) -> None:\n with tqdm(unit=\"B\") as t:\n reporthook = download_progress(t)\n result = urllib.request.urlretrieve(checkpoint_url, reporthook=reporthook)\n\n filename = result[0]\n\n file_path = pathlib.Path(filena...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively flatten the keys of a dictionary or list into a set of paths.
def _flatten_keys(obj: Any, paths: List[str], existing_path: str): # Store path when we reach end, which is either non-Dict or empty Dict if isinstance(obj, list) and len(obj) > 0: for i, elm in enumerate(obj): _flatten_keys(elm, paths, f'{existing_path}/{i}') elif isinstance(obj, dict) ...
[ "def flatten_keys(in_keys):\n return_keys = []\n if isinstance(in_keys, str):\n return [in_keys]\n if isinstance(in_keys, Iterable):\n for key in in_keys:\n if isinstance(key, Iterable):\n return_keys += flatten_keys(key)\n else:\n return_ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace a file with its compressed version. The contents will be called ``basename`` inside the compressed archive.
def _compress_file(filename: str, basename: str): write_mode = _get_write_mode(filename) with tempfile.TemporaryDirectory() as tmpdir: shutil.move(filename, os.path.join(tmpdir, basename)) with tarfile.open(filename, write_mode) as tarball: tarball.add(tmpdir, arcname='')
[ "def __in_place_uncompress ( self , filein ) :\n _ , ext = os.path.splitext ( filein )\n if ( not ext ) or ( ext not in self.extensions ) : \n logger.error ( 'Unknown extension for %s' % filein )\n ##\n out , _ = os.path.split ( filein )\n outdir = out if out el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save Deepspeed model and tarball the files.
def _save_deepspeed_model(model, filename: str): write_mode = _get_write_mode(filename) read_mode = f'r{write_mode[1:]}' with tempfile.TemporaryDirectory() as tmpdir: model.save_checkpoint(tmpdir, _DEEPSPEED_TAG) if os.path.exists(filename): # extract to tmpdir to append below ...
[ "def archive_model(project):\n import tarfile, datetime\n os.chdir('build')\n model_name = project.get_property('model_name')\n archive_name = model_name + '_' + datetime.date.today().strftime(\"%y%m%d\")\n\n if model_name == 'deeppavlov_docs':\n import shutil\n shutil.make_archive(arch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the association type mapping for a given query string, splitting the category and predicate components apart
def get_association_type_mapping_by_query_string( query_string: str, ) -> AssociationTypeMapping: categories = parse_query_string_for_category(query_string) matching_types = [ a_type for a_type in AssociationTypeMappings.get_mappings() if set(a_type.category) == set(categories) ] if len(m...
[ "def lookup_categories(querystring):\n tokens = tokenize_query(querystring)\n categories = []\n for idx, token in enumerate(tokens):\n if token.type == \"EXTERNAL_COMMAND\":\n categories.append(category.get(token.value, \"Miscellaneous\"))\n elif token.type == \"MACRO\":\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the distance between the current entity and the given (x, y) coordinate.
def distance(self, x: int, y: int) -> float: return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2)
[ "def distance(x, y, coord):\n return math.sqrt((x - coord[0])**2 + (y - coord[1])**2)", "def get_dist(self, point_x, point_y):\n dist = sqrt((point_x - self.player_x) ** 2 + (point_y -\n self.player_y) ** 2)\n return dist", "def euclidean...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create dictionary with protein ids and fasta sequence from uniprot site
def open_uniprotsite(prot_names): fasta_dict = {} for prot_id in prot_names: uniprot_link = "https://www.uniprot.org/uniprot/" + prot_id + ".fasta" uniprot_fasta = urllib.request.urlopen(uniprot_link) fasta_sequence = uniprot_fasta.readlines()#.decode('utf-8') fasta_sequenc...
[ "def extract_protein_data_from_uniprot_text(uniprot_file):\n # all_genes = defaultdict(set)\n # for record in SwissProt.parse(open_file(uniprot_file)):\n # if record.gene_name.strip():\n # ## Main gene names\n # for name in [match.split()[0] for match in re.findall(\"Name=([^;]+)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create dictionary with protein ids and motif positions of N{P}[ST]{P} +overlapping matches
def search_motif(sequences): motif = re.compile(r'(?=(N[^P](S|T)[^P]))') #N{P}[ST]{P} motif_index = {} for key,value in sequences.items(): match_motif = re.finditer(motif, value) motif_start_list = [] for i in match_motif: motif_start_list.append(str(i.start()+1)) ...
[ "def findMotif(fastas):\n\tmatches = {}\n\tp = re.compile(\"N(?=[^P][ST][^P])\")\n\tfor entry in fastas:\n\t\tfor m in p.finditer(entry.values()[0]):\n\t\t\tkey = entry.keys()[0]\n\t\t\tif key not in matches:\n\t\t\t\tmatches[key] = [str(m.start()+1)]\n\t\t\telse:\n\t\t\t\tmatches[key].append(str(m.start()+1))\n\tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluate the provided object to the condition
def evaluate(self, obj): #obj._print() # substitute event's attributes names by their values. cond = self.condition for attr in obj._attr_: cond = re.sub('evt\.%s' % attr, "\"%s\"" % str(obj._attr_[attr]), cond) # if it remains evt.* objects in the rule, there is a ...
[ "def __call__(self, data: DataDict):\n return self.condition(data)", "def evaluate_condition(self, context):\n self.evaluated_condition = evaluate_condition(self.condition, context)\n return self.evaluated_condition", "def condition(self) -> global___Expression:", "def evaluate(self, env:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the actual_work_hours of this Workitems. 实际工时
def actual_work_hours(self): return self._actual_work_hours
[ "def work_hours_updated_time(self):\n return self._work_hours_updated_time", "def work_hours_created_time(self):\n return self._work_hours_created_time", "def work_hours_num(self):\n return self._work_hours_num", "def expected_work_hours(self):\n return self._expected_work_hours", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the actual_work_hours of this Workitems. 实际工时
def actual_work_hours(self, actual_work_hours): self._actual_work_hours = actual_work_hours
[ "def expected_work_hours(self, expected_work_hours):\n self._expected_work_hours = expected_work_hours", "def work_hours_updated_time(self, work_hours_updated_time):\n self._work_hours_updated_time = work_hours_updated_time", "def actual_work_hours(self):\n return self._actual_work_hours", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the assigned_user of this Workitems.
def assigned_user(self): return self._assigned_user
[ "def assigned_cc_user(self):\n return self._assigned_cc_user", "def assignee(self):\n return self._github_issue.assignees[0].login", "def assignee(self):\n membership = UnitMembershipFactory(unit=self.unit)\n return membership.user", "def user_assigned_identity_id(self) -> str:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the assigned_user of this Workitems.
def assigned_user(self, assigned_user): self._assigned_user = assigned_user
[ "def assigned_by_user(self, assigned_by_user):\n\n self._assigned_by_user = assigned_by_user", "def assigned_cc_user(self, assigned_cc_user):\n self._assigned_cc_user = assigned_cc_user", "def assigned_to_security_user_id(self, assigned_to_security_user_id):\n\n self._assigned_to_security_u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the begin_time of this Workitems. 工作项开始时间
def begin_time(self): return self._begin_time
[ "def start_time(self) -> datetime:\n return self._start_time", "def start_time(self):\n return self._start_time", "def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime", "def get_start_time(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the begin_time of this Workitems. 工作项开始时间
def begin_time(self, begin_time): self._begin_time = begin_time
[ "def begin_time(self, begin_time):\n if begin_time is None:\n raise ValueError(\"Invalid value for `begin_time`, must not be `None`\") # noqa: E501\n\n self._begin_time = begin_time", "def start_time(self, start_time):\n self._start_time = start_time", "def start_time(self, star...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the developer of this Workitems.
def developer(self): return self._developer
[ "def getDeveloperName(self):\n try:\n return DEVELOPER_NAME\n except AttributeError:\n return self.getWebmasterName()", "def get_maintainer(self):\n return self.paragraphs[0].get(\"Maintainer\")", "def getDeveloperEmail(self):\n try:\n return DEVELOPE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the developer of this Workitems.
def developer(self, developer): self._developer = developer
[ "def developer(self, developer):\n\n self._developer = developer", "def developer_name(self, developer_name):\n\n self._developer_name = developer_name", "def developer_info(self, developer_info):\n\n self._developer_info = developer_info", "def developer_website(self, developer_website):...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the assigned_cc_user of this Workitems. 抄送人
def assigned_cc_user(self): return self._assigned_cc_user
[ "def assigned_user(self):\n return self._assigned_user", "def assigned_cc_user(self, assigned_cc_user):\n self._assigned_cc_user = assigned_cc_user", "def assignee(self):\n return self._github_issue.assignees[0].login", "def assignee(self):\n membership = UnitMembershipFactory(unit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the assigned_cc_user of this Workitems. 抄送人
def assigned_cc_user(self, assigned_cc_user): self._assigned_cc_user = assigned_cc_user
[ "def assigned_user(self, assigned_user):\n self._assigned_user = assigned_user", "def assigned_by_user(self, assigned_by_user):\n\n self._assigned_by_user = assigned_by_user", "def assigned_cc_user(self):\n return self._assigned_cc_user", "def assigned_to_security_user_id(self, assigned_t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the discover_version of this Workitems. 发现问题的版本
def discover_version(self): return self._discover_version
[ "def query_version(self):\n return self.connection.cursor().execute('SELECT version()').fetchone()[0]", "def version(self, i, data):\n mLogger.info(\"Q-Chem version number\", extra={\"Parsed\": V.version})\n match = re.search(self.hooks['version'], data[i])\n if match:\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the discover_version of this Workitems. 发现问题的版本
def discover_version(self, discover_version): self._discover_version = discover_version
[ "def discover_version(self):\n return self._discover_version", "def registry_version(self, registry_version):\n\n self._registry_version = registry_version", "def update_version(self, version):", "def update_version(self, version):\n self.version = CPE.escape_for_cpe23_fs(version)", "de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the done_ratio of this Workitems. 工作项进度值
def done_ratio(self): return self._done_ratio
[ "def done_ratio(self, done_ratio):\n self._done_ratio = done_ratio", "def fraction_done(self):\n return self._num_done / float(len(self))", "def ratio(self):\n return self._ratio", "def step_ratio(self):\n step_ratio = self._step_ratio\n if step_ratio is None:\n s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the done_ratio of this Workitems. 工作项进度值
def done_ratio(self, done_ratio): self._done_ratio = done_ratio
[ "def done_ratio(self):\n return self._done_ratio", "def fraction_done(self):\n return self._num_done / float(len(self))", "def update(self, work_done):\n if work_done < 0:\n raise ValueError(f\"Negative new value: {work_done}\")\n work_done = min(work_done, self._total_wor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the expected_work_hours of this Workitems. 预计工时
def expected_work_hours(self): return self._expected_work_hours
[ "def actual_work_hours(self):\n return self._actual_work_hours", "def expected_work_hours(self, expected_work_hours):\n self._expected_work_hours = expected_work_hours", "def work_hours_num(self):\n return self._work_hours_num", "def getWorkedHours(self):\n hours = 0\n for t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the expected_work_hours of this Workitems. 预计工时
def expected_work_hours(self, expected_work_hours): self._expected_work_hours = expected_work_hours
[ "def actual_work_hours(self, actual_work_hours):\n self._actual_work_hours = actual_work_hours", "def expected_work_hours(self):\n return self._expected_work_hours", "def work_hours_created_time(self, work_hours_created_time):\n self._work_hours_created_time = work_hours_created_time", "d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the parent_work_item_id of this Workitems. 父工作项的id
def parent_work_item_id(self): return self._parent_work_item_id
[ "def parent_id(self):\n return self._parent_id", "def get_parent_id(self):\n return self._parent_id", "def parent_work_item_id(self, parent_work_item_id):\n self._parent_work_item_id = parent_work_item_id", "def parentReference(self):\n return self.properties.get('parentReference',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the parent_work_item_id of this Workitems. 父工作项的id
def parent_work_item_id(self, parent_work_item_id): self._parent_work_item_id = parent_work_item_id
[ "def parent_work_item_id(self):\n return self._parent_work_item_id", "def parent_id(self, parent_id):\n self._parent_id = parent_id", "def parent_id(self, parent_id):\n\n self._parent_id = parent_id", "def parent_change_id(self, parent_change_id):\n\n self._parent_change_id = paren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the release_version of this Workitems. 发布的版本
def release_version(self): return self._release_version
[ "def _GetReleaseVersion(self):\n lsb_release_content = self.device.RunCommand(\n ['cat', '/etc/lsb-release'],\n capture_output=True).output.strip()\n return auto_update_util.GetChromeosReleaseVersion(\n lsb_release_content=lsb_release_content)", "def release_version(self):\n if s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the release_version of this Workitems. 发布的版本
def release_version(self, release_version): self._release_version = release_version
[ "def _setrelease(self, release):\r\n self._release = release\r\n self['release'] = release['displayname']", "def product_version(self, product_version):\n\n self._product_version = product_version", "def __set_release(self, project):\r\n release = project.session.create(self._config[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the story_point of this Workitems. 故事点
def story_point(self): return self._story_point
[ "def getStory(self):\n return self.get_story()", "def get_story_point(issue):\n\tif 'timeoriginalestimate' not in issue.get('fields', {}): return 0\n\n\tpoints = issue['fields']['timeoriginalestimate']\n\tif points is None: return 0\n\n\tpoints = int(points/60/60/8)\n\tif points > 2: points = 2 # only allo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the story_point of this Workitems. 故事点
def story_point(self, story_point): self._story_point = story_point
[ "def story_url(self, story_url):\n\n self._story_url = story_url", "def story_point(self):\n return self._story_point", "def update_story(self):\n self.update_outline_from_instances()\n client = presalytics.client.api.Client(**self.client_info)\n story = client.story.story_id_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the severity of this Workitems. 严重的程度 \"提示\", \"一般\", \"严重\", \"致命\"
def severity(self, severity): self._severity = severity
[ "def severity(self, severity):\n\n self._severity = severity", "def severity_level(self, severity_level):\n self._severity_level = severity_level", "def issue_change_severity(self, issue, severity):", "def severity(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"severity\")", "d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the updated_time of this Workitems. 更新时间
def updated_time(self): return self._updated_time
[ "def update_time(self):\n return self._update_time", "def get_update_time(self):\n return self._utime", "def last_update_time(self):\n return self._last_update_time", "def work_hours_updated_time(self):\n return self._work_hours_updated_time", "def updated_datetime(self) -> datet...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the updated_time of this Workitems. 更新时间
def updated_time(self, updated_time): self._updated_time = updated_time
[ "def update_time(self, update_time):\n self._update_time = update_time", "def update_time(self, update_time):\n\n self._update_time = update_time", "def work_hours_updated_time(self, work_hours_updated_time):\n self._work_hours_updated_time = work_hours_updated_time", "def last_updated_ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the important of this Workitems. 重要程度 \"关键\", \"重要\", \"一般\", \"提示\"
def important(self): return self._important
[ "def is_important(self):\n if self.priority <= IMPORTANT_PRIORITY:\n return True\n else:\n return False", "def importantIndexerAT(context):\n return IImportant(context).is_important", "def ImportantPropertyString(self):\n return self._importantProperty", "def impo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the important of this Workitems. 重要程度 \"关键\", \"重要\", \"一般\", \"提示\"
def important(self, important): self._important = important
[ "def important(self):\n return self._important", "def is_important(self):\n if self.priority <= IMPORTANT_PRIORITY:\n return True\n else:\n return False", "def importantIndexerAT(context):\n return IImportant(context).is_important", "def critical(self, critical):\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }