query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
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),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_messages(self):\n for msg in self.messages:\n print msg['text']",
"def show(self):\n self.set_text(self.read())",
"def show_messages(self):\n self.masterlog.revealme()",
"def read(self):\n from x84.bbs import getch\n from x84.bbs.session import getsession\... | [
"0.67919517",
"0.6346908",
"0.6337899",
"0.6265047",
"0.6182557",
"0.618034",
"0.6140841",
"0.6108053",
"0.6107602",
"0.60914344",
"0.6021179",
"0.5947622",
"0.58789885",
"0.5855277",
"0.58248854",
"0.5822408",
"0.5808994",
"0.5804789",
"0.58033186",
"0.57892084",
"0.5787142"... | 0.6980507 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6961772",
"0.67089885",
"0.66341877",
"0.65815735",
"0.6418059",
"0.6338058",
"0.6332131",
"0.63038486",
"0.6238911",
"0.6234152",
"0.62187123",
"0.621134",
"0.621134",
"0.6167453",
"0.6129225",
"0.5976966",
"0.5967419",
"0.5957173",
"0.59484446",
"0.5933708",
"0.5933708",... | 0.76593846 | 0 |
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() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __window_back(self):\n pass",
"def ev_windowrestored(self, event: WindowEvent) -> None:",
"def __window_forward(self):\n pass",
"def TransferToWindow(self):\n return True",
"def TransferFromWindow(self):\n return True",
"def ev_windowrestored(self, event: tcod.event.WindowEvent) -... | [
"0.66543084",
"0.64756507",
"0.6218632",
"0.61270016",
"0.6059469",
"0.5967816",
"0.59462374",
"0.5911877",
"0.5886296",
"0.5857155",
"0.5838113",
"0.5830953",
"0.5825556",
"0.58215696",
"0.5817999",
"0.5753222",
"0.5739507",
"0.5733871",
"0.57087755",
"0.5703051",
"0.5699966... | 0.68879884 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _open_window(self):\r\n\t\t# Creating the window\r\n\t\tself._window = Window(self, Locations.RESTAL)",
"def open_main_window(self):\r\n track_terms_dic = ''\r\n sg.theme(self.look)\r\n\r\n layout = [[sg.Text('Welcome to tweeet monitor ')],\r\n [sg.Text('Please enter Det... | [
"0.71605724",
"0.6652545",
"0.6622106",
"0.6552646",
"0.65350586",
"0.6522257",
"0.6512286",
"0.64399976",
"0.6398846",
"0.6395453",
"0.63476604",
"0.6302807",
"0.6253829",
"0.6239314",
"0.6238414",
"0.6192727",
"0.6176429",
"0.6140522",
"0.6134743",
"0.61296725",
"0.60993296... | 0.7269994 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mic_input():\n try:\n r = sr.Recognizer()\n with sr.Microphone() as source:\n print('Say something...')\n r.pause_threshold = 1\n r.adjust_for_ambient_noise(source, duration=1)\n audio = r.listen(source)\n try:\n command = r.recogni... | [
"0.63976574",
"0.6331272",
"0.6316408",
"0.62616754",
"0.6221507",
"0.6133672",
"0.60445386",
"0.6034115",
"0.599703",
"0.5995486",
"0.59736764",
"0.5960848",
"0.5958265",
"0.59164345",
"0.58853114",
"0.5819938",
"0.58131707",
"0.5773462",
"0.57678306",
"0.57649124",
"0.57376... | 0.72579855 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ColorizeDNA(self, text):\n if (text == 'A'):\n escape = '\\033[92m' # Green\n elif (text == 'G'):\n escape = '\\033[93m' # Yellow\n elif (text == 'T'):\n escape = '\\033[91m' # Red\n elif (text == 'C'):\n escape = '\\033[96m' # Blue\n ... | [
"0.6488497",
"0.64416146",
"0.6429084",
"0.6220818",
"0.62159586",
"0.61817086",
"0.6160907",
"0.61200315",
"0.61137754",
"0.6078523",
"0.60778445",
"0.6075475",
"0.6072182",
"0.6067036",
"0.606216",
"0.60522145",
"0.602722",
"0.6022543",
"0.60124403",
"0.59898627",
"0.597070... | 0.801215 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_eng(self):\n self.clear_terminal()\n self.menu_eng()\n self.handle_selection_eng()",
"def display(self):\n viewer = SpectraViewer(spectrometer=self)\n viewer.display()",
"def display(self):\n viewer = SpectraViewer(spectrometer=self)\n viewer.display... | [
"0.6631773",
"0.6175526",
"0.6175526",
"0.61313206",
"0.6080019",
"0.5969126",
"0.5952151",
"0.5921271",
"0.5917744",
"0.59115",
"0.59061027",
"0.5887677",
"0.58850664",
"0.5868575",
"0.583884",
"0.5790793",
"0.5734754",
"0.5731992",
"0.5710725",
"0.57077515",
"0.5699957",
... | 0.6890839 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_settings_devices(self):\n self.set_thermostat, self.set_humidifier, self.set_sprinklers, self.set_ventilation = self.settings[3:]",
"def test_change_config(self):\n browser = Browser(self.app)\n portalURL = self.portal.absolute_url()\n browser.addHeader('Authorization', 'Basic... | [
"0.67250514",
"0.6616514",
"0.6587167",
"0.6572284",
"0.65574336",
"0.65571165",
"0.65545833",
"0.6387912",
"0.6380834",
"0.6380834",
"0.6371281",
"0.63633394",
"0.63439715",
"0.61811125",
"0.6178413",
"0.61066014",
"0.60833853",
"0.6053914",
"0.6019179",
"0.60047317",
"0.599... | 0.7095382 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.74521935",
"0.6864215",
"0.6653494",
"0.6578328",
"0.6481865",
"0.64462173",
"0.64435834",
"0.6416639",
"0.6378046",
"0.61352384",
"0.61273557",
"0.60847396",
"0.60462296",
"0.60263854",
"0.60161275",
"0.597719",
"0.5976378",
"0.5974929",
"0.596187",
"0.59597677",
"0.59399... | 0.84619296 | 0 |
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() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self) -> None:\n self.screen.clear()",
"def clear(screen):\n screen.clear()\n screen.refresh()",
"def clear_widgets(self):\n self.json_progress = None\n self.progress_message_bar = None\n self.json_progress_message_bar = None\n if self.progress_message_bar_wid... | [
"0.8092894",
"0.803967",
"0.78183275",
"0.7779582",
"0.77743113",
"0.7751474",
"0.7615676",
"0.76115173",
"0.7582601",
"0.75689197",
"0.74467134",
"0.7411865",
"0.74054694",
"0.7385278",
"0.7318546",
"0.7276925",
"0.72769",
"0.72769",
"0.72497535",
"0.7242884",
"0.7230591",
... | 0.86054236 | 0 |
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(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.74992424",
"0.5997929",
"0.5949587",
"0.59173447",
"0.5860292",
"0.5804238",
"0.55708313",
"0.55603546",
"0.54513943",
"0.5397355",
"0.53798234",
"0.53523076",
"0.5351622",
"0.534139",
"0.5237773",
"0.52329355",
"0.5212102",
"0.5193668",
"0.5143916",
"0.5136838",
"0.511812... | 0.61918277 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_\"... | [
"0.6623599",
"0.63540995",
"0.59808934",
"0.5929442",
"0.58410364",
"0.57554716",
"0.5716192",
"0.5710112",
"0.5637982",
"0.5631498",
"0.5599545",
"0.5590032",
"0.5577469",
"0.55256295",
"0.5518841",
"0.5507794",
"0.5507233",
"0.5487758",
"0.5482285",
"0.54775095",
"0.5447416... | 0.6429612 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.635295",
"0.6289378",
"0.6153358",
"0.59830755",
"0.5973969",
"0.59590584",
"0.59040374",
"0.58626246",
"0.5838718",
"0.57817864",
"0.5680377",
"0.5662274",
"0.5659372",
"0.56566316",
"0.5644152",
"0.5641196",
"0.5615736",
"0.5564444",
"0.5530782",
"0.5522661",
"0.54676783... | 0.6725366 | 0 |
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')
""") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downgrade():\n # # commands auto generated by Alembic - please adjust! ###\n op.drop_table('downstream_map')\n # # end Alembic commands ###",
"def upgrade():\n try:\n op.drop_table(\"ggrc_gdrive_integration_alembic_version\")\n except sa.exc.OperationalError as e:\n code, _ = e.orig.args\n ... | [
"0.6851007",
"0.68070155",
"0.6506316",
"0.64786386",
"0.64288044",
"0.6319381",
"0.61630434",
"0.59586895",
"0.5892953",
"0.5826305",
"0.58031607",
"0.57475394",
"0.57333404",
"0.5704555",
"0.566395",
"0.5661779",
"0.56194675",
"0.5548934",
"0.5502293",
"0.549745",
"0.548365... | 0.70814365 | 0 |
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"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_file():\r\n urlretrieve(URL, PATH)\r\n return PATH",
"def json_file():\r\n urlretrieve(URL, PATH)\r\n return PATH",
"def test_files(self, location):\n for filename in os.listdir(location):\n with open(location + '/' + filename) as json_file:\n data = json.l... | [
"0.62802076",
"0.62802076",
"0.6238737",
"0.61273605",
"0.60416484",
"0.5966435",
"0.59093004",
"0.59044904",
"0.5819813",
"0.5813722",
"0.57989556",
"0.5781541",
"0.56752443",
"0.5675066",
"0.5660146",
"0.5640253",
"0.56322503",
"0.5631106",
"0.5621598",
"0.56130177",
"0.560... | 0.7507324 | 0 |
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"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(self):\n # open json, len 161,260\n at_json = open_json(self.json_names[0])\n link_json = open_json(self.json_names[1])\n # if need preprocessing, do it\n if self.args.img_preprocessing:\n print(\"resize imgs\")\n for i in tqdm(range(len(link_json)... | [
"0.58827484",
"0.578684",
"0.5714043",
"0.56993884",
"0.5639737",
"0.5583572",
"0.54636484",
"0.5450821",
"0.54405653",
"0.54265416",
"0.5424942",
"0.5409185",
"0.53689647",
"0.53638726",
"0.5357695",
"0.5356618",
"0.53302157",
"0.5321161",
"0.53171873",
"0.53061134",
"0.5295... | 0.78892285 | 0 |
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
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(frame: Frame):\n\n frame.img = cv2.resize(frame.img, (720, 480))\n frame.orginal_img = cv2.resize(frame.orginal_img, (720, 480))\n\n return frame",
"def resize_video(frames, width: int = UNIVERSAL_RESIZE):\n if frames.size < 1:\n raise ValueError('Must provide at least o... | [
"0.6975515",
"0.6965948",
"0.6840254",
"0.66904473",
"0.6561962",
"0.65187913",
"0.64801097",
"0.6479887",
"0.6456022",
"0.64197224",
"0.64138234",
"0.63360685",
"0.6334037",
"0.6292876",
"0.62918407",
"0.62625307",
"0.62448573",
"0.61914134",
"0.61655945",
"0.6139185",
"0.61... | 0.74632716 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handleResize(self):\n pass",
"def resize(self):\n pass",
"def resize(self, event=None):\n #self.render()\n self.__resize_background(event)\n #self.__delete_background()\n #self.__create_background(self._imfname)\n for sym in self.itersymbols():\n ... | [
"0.7466857",
"0.67581195",
"0.6693336",
"0.6686181",
"0.6664426",
"0.66365945",
"0.6623954",
"0.6581972",
"0.65713274",
"0.6529807",
"0.6507639",
"0.6472563",
"0.6404809",
"0.6373768",
"0.63407046",
"0.632196",
"0.63161606",
"0.62875193",
"0.62567973",
"0.624347",
"0.62312657... | 0.74494356 | 1 |
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'] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multicore(format, filenames, cpath):\r\n start = time.time()\r\n po = multiprocessing.Pool(P)\r\n file = str(filenames).split(',')\r\n for file in filenames:\r\n print(file)\r\n po.apply_async(func=resizeButton, args=(format, file, cpath))\r\n time.sleep(M)\r\n print(\"Done\... | [
"0.6563744",
"0.64110225",
"0.5975478",
"0.59674823",
"0.59062296",
"0.5873052",
"0.58316374",
"0.58308446",
"0.578684",
"0.5743147",
"0.5654799",
"0.56200457",
"0.5559133",
"0.55516684",
"0.5550606",
"0.5521735",
"0.546656",
"0.54456455",
"0.5401045",
"0.5391771",
"0.5387132... | 0.69108474 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_header_missing_fields(self):\r\n\r\n # Default header, should not generate any errors/warnings\r\n header = ['AAA', 'XXX', 'YYY',\r\n 'ZZZ']\r\n errors = []\r\n warnings = []\r\n\r\n errors, warnings = check_header(header,\r\n ... | [
"0.6268195",
"0.6264674",
"0.62105215",
"0.6196427",
"0.6144928",
"0.6113776",
"0.60642403",
"0.60047483",
"0.5985811",
"0.5964642",
"0.59487873",
"0.5914528",
"0.5880523",
"0.58377224",
"0.58223",
"0.58066964",
"0.5804777",
"0.5768354",
"0.5765713",
"0.57347786",
"0.5703136"... | 0.7916447 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsLeaf(self):\n return not self.subtests",
"def is_leaf(node):\n return node.children == {}",
"def check_leaf_node(df):\r\n \r\n return len(set(df['class'])) == 1",
"def is_leaf(self, p):\n return self.num_children(p) == 0",
"def test_is_leaf(self):\n self.assertEqual(True, co... | [
"0.7235153",
"0.6678625",
"0.66372824",
"0.66100496",
"0.6575179",
"0.65703756",
"0.6556593",
"0.6548734",
"0.6526366",
"0.65042156",
"0.6485087",
"0.6446794",
"0.6434655",
"0.6423185",
"0.63771605",
"0.6371146",
"0.63690525",
"0.6355469",
"0.63342595",
"0.63308424",
"0.63199... | 0.7547813 | 0 |
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)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_branch(opt, params):\n\n # Check the current branch and hash\n _get_branch(opt)\n\n if params.git_branch != opt.git_branch or params.git_hash != opt.git_hash:\n msg = 'You are not on the right branch or commit. Please run the following in the repository: \\n'\n msg += f'git checko... | [
"0.648244",
"0.6446408",
"0.64247346",
"0.63390535",
"0.62524986",
"0.6216893",
"0.6167209",
"0.61396754",
"0.6128586",
"0.60267806",
"0.60020113",
"0.59735584",
"0.5965118",
"0.5926897",
"0.58735794",
"0.58632785",
"0.5858319",
"0.5858319",
"0.58455837",
"0.58444524",
"0.584... | 0.7612395 | 0 |
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)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.70753044",
"0.69574356",
"0.66272986",
"0.65160197",
"0.63747287",
"0.62622404",
"0.6255423",
"0.6250882",
"0.61456066",
"0.6128836",
"0.61121875",
"0.60613096",
"0.6057898",
"0.5994398",
"0.5972796",
"0.5919818",
"0.5912785",
"0.5878819",
"0.58584577",
"0.57744914",
"0.57... | 0.72523385 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tags_tag_search_invalid_tag(self):\n\n po = self.catalog.load_pageobject('TagsPage')\n po.goto_page()\n\n global NON_EXISTENT_TAG\n\n # perform the search\n self.browser.proxy_client.new_har(\"page\")\n po.search_for_tags(NON_EXISTENT_TAG)\n har_entry = sel... | [
"0.6625541",
"0.6273861",
"0.62554324",
"0.60222036",
"0.58781713",
"0.584287",
"0.5800551",
"0.5729907",
"0.5698181",
"0.5698148",
"0.5659998",
"0.56520003",
"0.5631423",
"0.5631034",
"0.55683744",
"0.55287963",
"0.550021",
"0.5499857",
"0.5495857",
"0.5495131",
"0.5466072",... | 0.7399087 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_nexus(filename):\n f = open(filename)\n return parse_nexus(f)",
"def parse(self, infile):\r\n raise NotImplementedError()",
"def _parse(self, infile):\n raise NotImplementedError()",
"def read_input(infile):\n #Some utility functions to read in particular types of input\n def r... | [
"0.5987714",
"0.59453547",
"0.58234787",
"0.58072245",
"0.57432646",
"0.5646696",
"0.5598178",
"0.557389",
"0.5563821",
"0.5482843",
"0.5413918",
"0.5413375",
"0.53326714",
"0.53081083",
"0.53040534",
"0.5293794",
"0.52868974",
"0.5284766",
"0.526946",
"0.52602595",
"0.523994... | 0.7064549 | 0 |
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)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def singular_decomp(A):\n # Initialization\n n, m = A.shape\n U = np.zeros((n, m), dtype='float64')\n\n # Diagonalization of A^T * A\n rot, e, V = eigen.diag(np.dot(np.transpose(A), A))\n\n # Calculate U\n U = np.dot(A, V)\n for i in range(m):\n e[i] = np.sqrt(e[i])\n U[:, i] ... | [
"0.6640744",
"0.58657926",
"0.58088976",
"0.57761854",
"0.57290536",
"0.5726822",
"0.5711986",
"0.5658731",
"0.5601522",
"0.55621266",
"0.5544685",
"0.5520135",
"0.54970425",
"0.5486736",
"0.5445198",
"0.54431707",
"0.5406663",
"0.53682363",
"0.53435516",
"0.529848",
"0.52955... | 0.6557088 | 1 |
Sets the advanced_catalog_count of this IaasUcsdManagedInfraAllOf. | def advanced_catalog_count(self, advanced_catalog_count):
self._advanced_catalog_count = advanced_catalog_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_catalog_count",
"def standard_catalog_count(self, standard_catalog_count):\n\n self._stan... | [
"0.57526886",
"0.5751853",
"0.56568986",
"0.46540743",
"0.46511573",
"0.45186806",
"0.4483399",
"0.43547434",
"0.43004668",
"0.4271701",
"0.4244447",
"0.42245948",
"0.42140615",
"0.41743332",
"0.4168656",
"0.41071948",
"0.41035506",
"0.40634376",
"0.4060891",
"0.4047798",
"0.... | 0.8002607 | 0 |
Sets the bm_catalog_count of this IaasUcsdManagedInfraAllOf. | def bm_catalog_count(self, bm_catalog_count):
self._bm_catalog_count = bm_catalog_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def container_catalog_count(self, container_catalog_count):\n\n self._container_catalog_count = container_catalog_count",
"def standard_catalog_count(self, standard_catalog_count):\n\n self._standard_catalog_count = standard_catalog_count",
"def advanced_catalog_count(self, advanced_catalog_count... | [
"0.67917866",
"0.62580836",
"0.60013944",
"0.5060284",
"0.4933995",
"0.4909605",
"0.48784313",
"0.48781607",
"0.47947842",
"0.4782925",
"0.47474197",
"0.47474197",
"0.46623227",
"0.46587622",
"0.4638956",
"0.46326226",
"0.46316606",
"0.46220344",
"0.4605496",
"0.45846856",
"0... | 0.7878276 | 0 |
Sets the container_catalog_count of this IaasUcsdManagedInfraAllOf. | def container_catalog_count(self, container_catalog_count):
self._container_catalog_count = container_catalog_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_count",
"def advanced_catalog_count(self, advanced_catalog_count):\n\n self._advanced... | [
"0.6810308",
"0.6344454",
"0.59025335",
"0.5486347",
"0.51642656",
"0.5138865",
"0.50294644",
"0.5021692",
"0.50136554",
"0.49914697",
"0.48896855",
"0.4718432",
"0.46324363",
"0.45579195",
"0.45579195",
"0.44740677",
"0.4469012",
"0.44313428",
"0.44271842",
"0.44019943",
"0.... | 0.8005635 | 0 |
Sets the esxi_host_count of this IaasUcsdManagedInfraAllOf. | def esxi_host_count(self, esxi_host_count):
self._esxi_host_count = esxi_host_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hyperv_host_count(self, hyperv_host_count):\n\n self._hyperv_host_count = hyperv_host_count",
"def hosts_every(self, hosts_every):\n\n self._hosts_every = hosts_every",
"def vcpu_set(vm_hostname, count, offline=False):\n with ExitStack() as es:\n vm = es.enter_context(_get_vm(vm_hos... | [
"0.59950227",
"0.5260858",
"0.50562745",
"0.50244135",
"0.49948582",
"0.48857233",
"0.48497176",
"0.48385507",
"0.482034",
"0.4762812",
"0.47252673",
"0.4718971",
"0.47022638",
"0.46596396",
"0.46280846",
"0.45461932",
"0.45392084",
"0.45244592",
"0.45231992",
"0.45225677",
"... | 0.8037844 | 0 |
Sets the external_group_count of this IaasUcsdManagedInfraAllOf. | def external_group_count(self, external_group_count):
self._external_group_count = external_group_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_group_count(self, local_group_count):\n\n self._local_group_count = local_group_count",
"def external_ids(self, external_ids):\n\n self._external_ids = external_ids",
"def esxi_host_count(self, esxi_host_count):\n\n self._esxi_host_count = esxi_host_count",
"def set_all_data_ex... | [
"0.53656894",
"0.4734468",
"0.4715213",
"0.4630498",
"0.46285418",
"0.4532851",
"0.45295992",
"0.44841346",
"0.44807005",
"0.44654495",
"0.44654495",
"0.44654495",
"0.44536784",
"0.4435368",
"0.43804",
"0.42757764",
"0.42720485",
"0.42300162",
"0.42260072",
"0.4207612",
"0.41... | 0.75556606 | 0 |
Sets the hyperv_host_count of this IaasUcsdManagedInfraAllOf. | def hyperv_host_count(self, hyperv_host_count):
self._hyperv_host_count = hyperv_host_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def esxi_host_count(self, esxi_host_count):\n\n self._esxi_host_count = esxi_host_count",
"def vcpu_set(vm_hostname, count, offline=False):\n with ExitStack() as es:\n vm = es.enter_context(_get_vm(vm_hostname))\n\n if vm.dataset_obj['datacenter_type'] != 'kvm.dct':\n raise Not... | [
"0.66588247",
"0.5818077",
"0.5640094",
"0.5640094",
"0.5394924",
"0.5279623",
"0.5277185",
"0.52716357",
"0.5202823",
"0.50858754",
"0.5027976",
"0.4993971",
"0.4947955",
"0.4938431",
"0.48995036",
"0.4849338",
"0.4816406",
"0.4814211",
"0.48059392",
"0.47629017",
"0.4759356... | 0.7839512 | 0 |
Sets the local_group_count of this IaasUcsdManagedInfraAllOf. | def local_group_count(self, local_group_count):
self._local_group_count = local_group_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_group_count(self, external_group_count):\n\n self._external_group_count = external_group_count",
"def _set_group_resource(self, _g):\n\n if isinstance(_g, Server):\n return\n\n for _, sg in _g.subgroups.items():\n self._set_group_resource(sg)\n _... | [
"0.5947293",
"0.509726",
"0.4911288",
"0.4911288",
"0.4911288",
"0.4881376",
"0.4801572",
"0.4801572",
"0.4801572",
"0.4801572",
"0.46374658",
"0.46280244",
"0.46024618",
"0.46024618",
"0.46024618",
"0.46024618",
"0.45948556",
"0.45816755",
"0.45816755",
"0.45816755",
"0.4581... | 0.76894385 | 0 |
Sets the standard_catalog_count of this IaasUcsdManagedInfraAllOf. | def standard_catalog_count(self, standard_catalog_count):
self._standard_catalog_count = standard_catalog_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_catalog_count",
"def advanced_catalog_count(self, advanced_catalog_count):\n\n self._adva... | [
"0.57423514",
"0.5616781",
"0.50827426",
"0.4542607",
"0.44935066",
"0.44344246",
"0.43874955",
"0.43789217",
"0.4358185",
"0.43167907",
"0.43059853",
"0.4270202",
"0.42586276",
"0.4214198",
"0.42093727",
"0.4138831",
"0.41344634",
"0.41310257",
"0.41012546",
"0.40627837",
"0... | 0.81387305 | 0 |
Sets the user_count of this IaasUcsdManagedInfraAllOf. | def user_count(self, user_count):
self._user_count = user_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_usr_ping_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"usr-ping-count\", rest_name=\"usr-ping-count\", pa... | [
"0.61215466",
"0.5793492",
"0.54216063",
"0.54033273",
"0.532203",
"0.5165332",
"0.5099306",
"0.5092787",
"0.5068327",
"0.5068107",
"0.5022238",
"0.5022238",
"0.49769667",
"0.49539578",
"0.49485537",
"0.4900824",
"0.48729518",
"0.48636237",
"0.48355436",
"0.4805139",
"0.48023... | 0.72169346 | 1 |
Sets the vdc_count of this IaasUcsdManagedInfraAllOf. | def vdc_count(self, vdc_count):
self._vdc_count = vdc_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vm_count(self, vm_count):\n\n self._vm_count = vm_count",
"def vm_count(self, vm_count):\n\n self._vm_count = vm_count",
"def set_cpu_count(self, nVmCpuCount):\n\t\tcall_sdk_function('PrlVmCfg_SetCpuCount', self.handle, nVmCpuCount)",
"def set_count(self, count, asset=None):\n self._... | [
"0.5437181",
"0.5437181",
"0.531096",
"0.5136232",
"0.50647324",
"0.49089286",
"0.47968695",
"0.4710327",
"0.46992522",
"0.46300593",
"0.46219018",
"0.46113285",
"0.46049786",
"0.4604565",
"0.45997623",
"0.45524865",
"0.45503348",
"0.45477548",
"0.45165822",
"0.45023248",
"0.... | 0.7397312 | 0 |
Sets the vm_count of this IaasUcsdManagedInfraAllOf. | def vm_count(self, vm_count):
self._vm_count = vm_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cpu_count(self, nVmCpuCount):\n\t\tcall_sdk_function('PrlVmCfg_SetCpuCount', self.handle, nVmCpuCount)",
"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 = ... | [
"0.60274035",
"0.5922383",
"0.5739843",
"0.5628235",
"0.56280166",
"0.5574185",
"0.55255973",
"0.53965175",
"0.5285271",
"0.5197171",
"0.5193007",
"0.5076765",
"0.5026433",
"0.5026433",
"0.50207126",
"0.49862435",
"0.4984859",
"0.49740753",
"0.4924906",
"0.49171144",
"0.49162... | 0.7385598 | 1 |
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,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6743314",
"0.6682493",
"0.5183608",
"0.51139396",
"0.51139396",
"0.51139396",
"0.50459886",
"0.49452367",
"0.49336353",
"0.49094725",
"0.4861403",
"0.48274943",
"0.48119223",
"0.48062816",
"0.47794765",
"0.47726187",
"0.4767327",
"0.47632933",
"0.47430956",
"0.4704121",
"0... | 0.890424 | 0 |
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(),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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(path):\n if len(path) > 1:\n result = [crayons.yellow(path[0].name)]\n\n previous = path[0]\n for item in path[1:]:\n ... | [
"0.7308434",
"0.6294355",
"0.6030438",
"0.58486265",
"0.58486265",
"0.58486265",
"0.5666408",
"0.5501491",
"0.54912573",
"0.5491005",
"0.5487094",
"0.5456914",
"0.5407116",
"0.53897357",
"0.5379467",
"0.5378536",
"0.53413504",
"0.5290244",
"0.5282369",
"0.5271615",
"0.5261161... | 0.8522862 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_path(self, path):\n self.clear_path()\n for coordinate in path:\n self.send_coordinate(coordinate)\n time.sleep(0.05)",
"def broadcast(value, root_rank, name=None):\n return _impl.broadcast(K, value, root_rank, name)",
"def extern_to_local_path(self, path: PurePa... | [
"0.558918",
"0.5540478",
"0.5262298",
"0.5138672",
"0.51280296",
"0.5033147",
"0.4981683",
"0.4957514",
"0.4915474",
"0.4859186",
"0.4790848",
"0.4757363",
"0.47432727",
"0.4711225",
"0.47017384",
"0.4673872",
"0.46665725",
"0.46487427",
"0.4647647",
"0.46301493",
"0.46140268... | 0.639906 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_checkpoint(\n path: str,\n state: State,\n logger: Logger,\n object_store: Optional[Union[ObjectStore, LoggerDestination]] = None,\n load_weights_only: bool = False,\n strict_model_weights: bool = False,\n progress_bar: bool = True,\n ignore_keys: Optional[Union[List[str], Callable... | [
"0.62694466",
"0.61993414",
"0.6029626",
"0.5934021",
"0.5839948",
"0.5779024",
"0.5675783",
"0.5657235",
"0.55893075",
"0.5551518",
"0.5551518",
"0.55440056",
"0.55313367",
"0.5514979",
"0.5417088",
"0.54159427",
"0.5401518",
"0.5353508",
"0.53150314",
"0.529472",
"0.5274455... | 0.7012607 | 0 |
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) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6875952",
"0.6714829",
"0.6393634",
"0.6268066",
"0.6147617",
"0.60040855",
"0.5961839",
"0.58822143",
"0.5856093",
"0.58354765",
"0.5823535",
"0.58075947",
"0.58066595",
"0.5770507",
"0.57541543",
"0.5746323",
"0.574392",
"0.57279015",
"0.5708329",
"0.5703219",
"0.5697986... | 0.7069572 | 0 |
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='') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_file(filename, contents):\n filename = path.join(PATH_ROOT, filename)\n filename_bak = \"%s.release.bak\" % filename\n os.rename(filename, filename_bak)\n with open(filename, \"w\") as out_file:\n out_file.write(\"\".join(contents))\n shutil.copymode(filename_bak, filename)\n o... | [
"0.6415052",
"0.6314928",
"0.6199872",
"0.6001604",
"0.5810293",
"0.5780952",
"0.5752636",
"0.57117546",
"0.5672663",
"0.5574416",
"0.55683494",
"0.55642724",
"0.55603486",
"0.5546732",
"0.5530672",
"0.55286574",
"0.550386",
"0.5496359",
"0.5496359",
"0.54615456",
"0.54451406... | 0.6844481 | 0 |
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
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self, step):\n\n # file_name = params['name']\n # pickle.dump(self, gzip.open(file_name, 'wb'))",
"def save(self, path=None):\n if path is None:\n path = os.path.join(logger.get_dir(), \"model.pkl\")\n\n with tempfile.TemporaryDirectory() as td:\n ... | [
"0.6917545",
"0.6801277",
"0.6786645",
"0.6771546",
"0.65725636",
"0.654351",
"0.6506806",
"0.6503191",
"0.6480949",
"0.6474152",
"0.64712524",
"0.64655024",
"0.6454765",
"0.64464855",
"0.643115",
"0.64104533",
"0.6390846",
"0.6343271",
"0.6322349",
"0.6322143",
"0.63072705",... | 0.7130798 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.58501035",
"0.52250046",
"0.51798195",
"0.48137656",
"0.4768399",
"0.46968216",
"0.4696489",
"0.46959627",
"0.46701097",
"0.46667367",
"0.46602768",
"0.46147487",
"0.46047112",
"0.45540965",
"0.4524083",
"0.4497096",
"0.44962004",
"0.44849357",
"0.4439901",
"0.443559",
"0.... | 0.71058404 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_to(self, x, y):\n\t\tdx = x - self.x\n\t\tdy = y - self.y\n\t\treturn math.sqrt((dx**2)+(dy**2))",
"def distance_from_center(self, x: int, y: int) -> float:\n width, height = self.width, self.height\n dis = distance(x, y, width/2, height/2)\n return dis",
"def distance(self, x... | [
"0.81523913",
"0.7383806",
"0.72868764",
"0.7262011",
"0.7195622",
"0.7163461",
"0.7131348",
"0.71239984",
"0.71239984",
"0.71239984",
"0.71239984",
"0.71239984",
"0.71239984",
"0.71239984",
"0.7074517",
"0.70256484",
"0.7024614",
"0.70112294",
"0.68983996",
"0.6831905",
"0.6... | 0.7916495 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prot_sequence_finder(protL):\n \n idDict = prot_id_converter(protL, \"9606\", inpDB = \"genesymbol\",outDB=\"refseqproteingi\")\n seqD = prot_entrez_fetch(idDict, retM=\"gb\", retT=\"fasta\")\n \n protD = {}\n \n for keyS, valueS in idDict.items():\n protD[keyS] = seqD[valueS]\n \n return protD",
... | [
"0.6781977",
"0.6571823",
"0.6411829",
"0.63938284",
"0.6391897",
"0.6324395",
"0.63109064",
"0.6232596",
"0.62234",
"0.6181884",
"0.61223954",
"0.60952413",
"0.6050396",
"0.5965492",
"0.5963545",
"0.5963038",
"0.5939162",
"0.58732736",
"0.5828895",
"0.578113",
"0.57796746",
... | 0.7153276 | 0 |
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))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping(reads_list, k, h, index, genome):\n snps_dict = {}\n # Map the read on the genome and store the snps found\n for read in reads_list:\n reversed_read = reverse_read(read)\n reverse = False\n list_mapping = seed_and_extend(read, k, h, index, genome)\n if list_mapping[... | [
"0.58689076",
"0.5789363",
"0.5755219",
"0.5687147",
"0.5647959",
"0.5635121",
"0.5623256",
"0.56161094",
"0.5606003",
"0.5603484",
"0.5583012",
"0.5560962",
"0.55549896",
"0.55387646",
"0.5521165",
"0.55000585",
"0.54610294",
"0.5446249",
"0.54335797",
"0.5430714",
"0.542768... | 0.71227914 | 0 |
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 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self, operand: object) -> bool:\n pass",
"def eval(self, Vobj):\n try:\n return Vobj.evaluated_on(self)\n except AttributeError:\n return self.A() * Vobj + self.b()",
"def condition(self) -> global___Expression:",
"def condition(self) -> global___Expres... | [
"0.6598018",
"0.6156341",
"0.6133143",
"0.6133143",
"0.6017951",
"0.59076935",
"0.5841889",
"0.5841889",
"0.5840776",
"0.5840498",
"0.5802535",
"0.57257354",
"0.5681474",
"0.56519026",
"0.56487983",
"0.5630435",
"0.56184256",
"0.56154966",
"0.56067294",
"0.55853695",
"0.55552... | 0.71140516 | 0 |
Gets the assigned_user of this Workitems. | def assigned_user(self):
return self._assigned_user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignee(self):\n membership = UnitMembershipFactory(unit=self.unit)\n return membership.user",
"def assigned_to(self) -> Optional[str]:\n return pulumi.get(self, \"assigned_to\")",
"def assigned_to(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"assigned_to\")... | [
"0.70582396",
"0.70253783",
"0.68387794",
"0.6594624",
"0.64337957",
"0.63194",
"0.62276447",
"0.61899453",
"0.61852264",
"0.617757",
"0.617757",
"0.6168088",
"0.6168088",
"0.6166981",
"0.612094",
"0.6104734",
"0.6104734",
"0.6104734",
"0.6104734",
"0.606838",
"0.60127085",
... | 0.8579693 | 0 |
Sets the assigned_user of this Workitems. | def assigned_user(self, assigned_user):
self._assigned_user = assigned_user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assigned_by_user(self, assigned_by_user):\n\n self._assigned_by_user = assigned_by_user",
"def assigned_user(self):\n return self._assigned_user",
"def assign_user_to_issue(self, issue, JIRAUsername):\r\n # TODO: Review docs\r\n self.jira.assign_issue(issue=issue, assignee=JIRAUsern... | [
"0.8350922",
"0.68189096",
"0.5876797",
"0.58575225",
"0.57323456",
"0.56373864",
"0.56373864",
"0.55778617",
"0.55627865",
"0.55390745",
"0.55118716",
"0.55098593",
"0.54444087",
"0.54271966",
"0.54271966",
"0.54271966",
"0.54271966",
"0.54271966",
"0.54271966",
"0.54271966",
... | 0.85572076 | 0 |
Gets the developer of this Workitems. | def developer(self):
return self._developer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developer(self):\n return self.proto.creator",
"def get_maintainer(self):\n return self.paragraphs[0].get(\"Maintainer\")",
"def technical_owner(self):\n return self._technical_owner",
"def user(self):\n return self._project.user",
"def is_developer(self):\n\n return ... | [
"0.6467594",
"0.6383037",
"0.59011614",
"0.58858037",
"0.5882263",
"0.58464813",
"0.58373034",
"0.58373034",
"0.58332425",
"0.5788284",
"0.5727513",
"0.5696962",
"0.5679556",
"0.5662634",
"0.56608135",
"0.5650917",
"0.5645489",
"0.5638031",
"0.56320435",
"0.5630453",
"0.56304... | 0.77347624 | 0 |
Sets the developer of this Workitems. | def developer(self, developer):
self._developer = developer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developer_certificate_identity(self, developer_certificate_identity):\n\n self._developer_certificate_identity = developer_certificate_identity",
"def developer(self):\n return self._developer",
"def set_maintainer(self, maintainer):\n self.paragraphs[0][\"Maintainer\"] = maintainer",
... | [
"0.6069986",
"0.6056044",
"0.5680614",
"0.5558243",
"0.5480942",
"0.5418043",
"0.53070056",
"0.5263238",
"0.51771384",
"0.51729125",
"0.5170096",
"0.51270753",
"0.50323236",
"0.50323236",
"0.5031481",
"0.49122766",
"0.48889783",
"0.4874513",
"0.48558733",
"0.4839325",
"0.4819... | 0.78007984 | 0 |
Sets the domain of this Workitems. | def domain(self, domain):
self._domain = domain | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domain(self, domain):\n\n self._domain = domain",
"def domain(self, domain):\n\n self._domain = domain",
"def setDomainRange(self, domain, range):\n self.domain = domain.cloneSpace()\n self.range = range.cloneSpace()\n return",
"def set_domain(self, var, domain) :\n ... | [
"0.6938591",
"0.6938591",
"0.68689",
"0.68229336",
"0.65074587",
"0.647992",
"0.64145446",
"0.6360417",
"0.6316579",
"0.6233607",
"0.62118834",
"0.62118834",
"0.6182328",
"0.61120147",
"0.60630286",
"0.6041117",
"0.6008707",
"0.5991201",
"0.5972056",
"0.596478",
"0.5924517",
... | 0.6992701 | 1 |
Convert a timedomain array `E` to the frequency domain via 2D FFT. `dx` and `dy` are sample spacing in x (leftright, 1st axis) and y (updown, 0th axis) directions. An optional `upsample > 1` will zeropad `E` to obtain an upsampled spectrum. Returns `(spectrum, xf, yf)` where `spectrum` contains the 2D FFT of `E`. If `N... | def makeSpectrum(E, dx, dy, upsample=10):
zeropadded = np.array(E.shape) * upsample
F = fft.fftshift(fft.fft2(E, zeropadded)) / E.size
xf = fft.fftshift(fft.fftfreq(zeropadded[1], d=dx))
yf = fft.fftshift(fft.fftfreq(zeropadded[0], d=dy))
return (F, xf, yf) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fft2d(pm, win, x, /, detrend='constant'):\n x = signal.detrend(x, type=detrend, axis=0) # remove trend or mean from \"time\"\n x = signal.detrend(x, type='constant', axis=1) # remove mean from \"longitude\"\n\n # Use 1D numpy.fft.rfft (identical)\n # Follows Libby's recipe, where instead real is... | [
"0.5888486",
"0.56503826",
"0.5601818",
"0.54491526",
"0.5392617",
"0.5390208",
"0.53717124",
"0.5368106",
"0.5360478",
"0.5329879",
"0.5306462",
"0.524618",
"0.5245024",
"0.524321",
"0.5240639",
"0.5181204",
"0.51742285",
"0.51686364",
"0.5167768",
"0.51577264",
"0.5120336",... | 0.74132943 | 0 |
Output a string to the html file with a trailing newline | def outputHtml(s):
htmlFile.write(s + "\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_html_page(htmldata, filename):\n begin = \"<html>\\n\\n<body>\\n\\n<p>\\n\"\n end = \"\\n</p>\\n\\n</body>\\n\\n</html>\"\n full_text = begin + htmldata + end\n f = open(filename, \"w\")\n f.write(full_text)\n f.close()",
"def finish(self):\r\n\r\n self.text += \"</html>\\n\"\r\n\... | [
"0.66473573",
"0.66443795",
"0.6528386",
"0.6365278",
"0.63228464",
"0.6304377",
"0.6303967",
"0.6297656",
"0.62927836",
"0.62136006",
"0.6187122",
"0.61672395",
"0.6166157",
"0.6161343",
"0.6142821",
"0.61315984",
"0.6131482",
"0.6089356",
"0.6076196",
"0.6050305",
"0.601354... | 0.8278069 | 0 |
Transpose a hash of hashes so that the inner keys are now outer | def transpose(h):
res = {}
for i in list(h.keys()):
v = h[i]
for j in list(v.keys()):
if not res.get(j, None):
res[j] = {}
res[j][i] = v[j]
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose_2d_table(dicts_within_dict_table):\n transposed_table = {}\n for x2 in dicts_within_dict_table:\n for x1 in dicts_within_dict_table[x2]:\n if x1 not in transposed_table:\n transposed_table[x1] = \\\n {x2: dicts_within_d... | [
"0.7166209",
"0.65619993",
"0.5991071",
"0.59697735",
"0.5820064",
"0.5810341",
"0.5809102",
"0.57978475",
"0.5764748",
"0.57150954",
"0.5670478",
"0.5656125",
"0.5622417",
"0.55814767",
"0.55814767",
"0.5565617",
"0.5564947",
"0.5563796",
"0.5557678",
"0.5549799",
"0.5546132... | 0.7801839 | 0 |
Set up the X axis, including scaling, labels and max/min values | def setupXAxis(plot, minVal, maxVal, label, logarithmic):
plot.set_xlabel(label)
if logarithmic:
plot.set_xscale("log")
plot.set_xlim(minVal, maxVal)
# plot.set_xscale('log', basex=2)
# tickLabels = [1]
# labelValue = minVal
# while labelValue <= maxVal:
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __draw_xaxis(self):\n self.ax.set_xlim(self.xlims)\n # put x ticks on top\n xticks = [1]\n xticks.extend(range(5, self.xmax+5, 5))\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"xlabel.fontsize\"] is None else self.settings.othe... | [
"0.76962334",
"0.7142678",
"0.70777565",
"0.7023679",
"0.6677621",
"0.66705173",
"0.6669855",
"0.66405183",
"0.65903085",
"0.6455307",
"0.64306533",
"0.64306533",
"0.6370854",
"0.6364356",
"0.62985694",
"0.6293797",
"0.6283952",
"0.62325585",
"0.6220945",
"0.61975974",
"0.617... | 0.7718785 | 0 |
Add the legend to the plot, shrinking the plot slightly to make room, since we add the legend outside the plot to the right, or leaving the plot full sized and allowing matplotlib to choose a good placement | def addLegend(ax, lines, impls, legendPos):
# If there's only one piece of data being plotted, there's no need for a legend
# since all the parameters will be in the title.
# Compute the length (in characters) of the longest implementation.
legendLen = max(list(map(len, impls)))
if legendLen == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legend(self):\n if self.nplots == 1:\n lax = self.ax\n loff = 0.2\n else:\n lax = self.ax1\n loff = 0.4\n box = lax.get_position()\n\n lax.figure.subplots_adjust(bottom=loff) # make space on bottom for legend\n lax.legend(self.plot... | [
"0.8135134",
"0.7360067",
"0.7313128",
"0.73119825",
"0.72300524",
"0.7143622",
"0.7033816",
"0.70186085",
"0.69774044",
"0.6967444",
"0.692776",
"0.6845011",
"0.6801535",
"0.6784947",
"0.6779383",
"0.67106515",
"0.65214556",
"0.6519761",
"0.65141386",
"0.6490154",
"0.6467635... | 0.76351845 | 1 |
Generate a single plot, which has various options. The maximum y axis value can be set Grid lines can be plotted across the graph Error bars can be plotted | def generatePlot(
bmName,
yAxisName,
npl,
sizeValues,
deviations=None,
yMax=None,
yMin=None,
yLines=(),
fileSuffix="",
xMin=None,
xLabel="",
logarithmic=False,
legendPos="best",
sortKeyFn=lambda x: x,
timeUnit=None,
):
print("Plot: '" + bmName + "'")
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TwoOrOneValuePlot(no_of_sets, Xax, Ydat1, Ydat2, Label1, Label2,\n xmin, xmax, ymin_1, ymax_1, ymin_2, ymax_2,\n XLab, YLab_1, YLab_2, SupTitle, Title, FileName,\n currentDate, currentTime, Software_version):\n\n rc('font', size=6, weight=... | [
"0.6829554",
"0.661534",
"0.6599279",
"0.6443192",
"0.64005935",
"0.6339009",
"0.6306646",
"0.6288057",
"0.6278511",
"0.62476623",
"0.6240224",
"0.6229401",
"0.62160033",
"0.62088746",
"0.62024546",
"0.6184107",
"0.6181531",
"0.6175892",
"0.61673915",
"0.61650753",
"0.6149910... | 0.66698444 | 1 |
Output a media wiki formatted table | def mediaWikiTable(leftmostTitle, array, formatFn=lambda x: str(x)):
columnKeys = extractColumnKeys(array)
print("{|")
for t in [leftmostTitle] + [str(k) for k in columnKeys]:
print("!" + " !! ".join(titles))
for k in sorted(array.keys, key=cmp_to_key(compareFn)):
print("|-")
pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_table():\n\n title_list = ('ID', 'Platform', 'Producer', 'Year', 'Elements')\n \n return table, title_list",
"def print_table(self):\n print(\"%-12s%-12s%-12s%-12s%-12s\" % (\"index\",\"balance\",\"payment\",\"interest\",\"amortization\"))\n print(\"-------------------------------... | [
"0.6593098",
"0.65204376",
"0.6463597",
"0.6431361",
"0.643116",
"0.6429846",
"0.63246125",
"0.63038605",
"0.6286171",
"0.626248",
"0.6258474",
"0.6157692",
"0.6144443",
"0.6130239",
"0.6066116",
"0.60581213",
"0.6050008",
"0.60433495",
"0.602486",
"0.60156596",
"0.6002523",
... | 0.7025748 | 0 |
Extract a time from a string of the form "%dm %4.2fs" which is what "time" generates. | def extractTime(s):
msRe = r"([0-9]+)m +([0-9]+\.[0-9]+)s"
matched = re.match(msRe, s)
if matched:
return 60 * int(matched.group(1)) + float(matched.group(2))
# Maybe we don't have any minutes
sRe = r"([0-9]+\.[0-9]+)s"
matched = re.match(sRe, s)
if matched:
return float(matc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(s: str):\n return utils.parsers.parse_eng_unit(s, base_unit='s', default=1e-12)",
"def parse_time(value: str) -> float:\n return float(value[:-1]) * TIME[value[-1]]",
"def _get_time(string):\n string = string[0:7] # Drop day\n return string.replace(\"-\", \"\")",
"def parse_time(s... | [
"0.7376245",
"0.69885296",
"0.69597244",
"0.680901",
"0.6714649",
"0.67008376",
"0.66874033",
"0.6630157",
"0.6610557",
"0.65271956",
"0.65221244",
"0.64632",
"0.6434758",
"0.64113086",
"0.6404067",
"0.6317093",
"0.63148624",
"0.6314434",
"0.631036",
"0.6283578",
"0.6228409",... | 0.7262653 | 1 |
Format a number in engineering format, where the exponent is a multiple of 3 | def engFormat(f):
if f == 0.0:
value = 0.0
exponent = 0
else:
exponent = math.log10(-f if f < 0 else f)
if exponent < 0:
exponent = -int(math.ceil(-exponent))
else:
exponent = int(math.floor(exponent))
for i in range(3):
if (exp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_engineering( number, unit = \"\" ):\n if math.isnan(number):\n return \"nan\"\n if number == 0.0:\n return 0\n\n convert_table = {-18:'a', -15:'f', -12:'p', -9:'n', -6:'u',\n -3:'m', -2:'c', -1:'d', 0:'', 3:'k',\n 6:'M', 9:'G', 12... | [
"0.7254678",
"0.6709356",
"0.65849704",
"0.6535096",
"0.64507467",
"0.64036494",
"0.63798475",
"0.6357471",
"0.6309954",
"0.6143084",
"0.61399496",
"0.6122176",
"0.61172795",
"0.6037605",
"0.59719115",
"0.5958524",
"0.58732384",
"0.5864186",
"0.5839863",
"0.5835042",
"0.58245... | 0.6764551 | 1 |
If a measurement has Min and Max, we can convert them into a notional error bar by replacing the name_SD field with a [minNamevalue, maxNamevalue] pair | def convertMinMaxIntoError(m, name, minName, maxName):
minVal = m.__dict__.get(minName, None)
maxVal = m.__dict__.get(maxName, None)
if maxVal == None or minVal == None:
return None
value = m.__dict__[name]
return [[value - minVal], [maxVal - value]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determinePlotLimits(self):\n max_str = \"up99\"\n min_str = \"dn99\"\n if self.keywords.get(\"limit_type\",\"99per\") == \"minmax\":\n max_str = \"max\"\n min_str = \"min\"\n \n # Determine the min/max of variables over all models\n limits = {... | [
"0.55634105",
"0.5557625",
"0.5547021",
"0.54915667",
"0.53918475",
"0.5362521",
"0.5332207",
"0.5294759",
"0.5274828",
"0.52670044",
"0.5266675",
"0.5235942",
"0.5220849",
"0.51992804",
"0.51608247",
"0.51373273",
"0.51251656",
"0.5120511",
"0.51145077",
"0.5092589",
"0.5086... | 0.66927224 | 0 |
Add an overall mean for the given field | def addOverallMeans(results, fieldNames, fields):
# Work out what the values we already have look like
meanValues = ["Overall Mean"]
geoMeanValues = ["Overall Geometric Mean"]
for name in fieldNames[1:]:
if name in fields:
values = [r.__dict__[name] for r in results]
geoM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMean(self, field):\n\n return np.mean([self.fitnesses[i][field] for i in range(len(self.fitnesses))])",
"def fmean(field):\n warnings.simplefilter(\"ignore\")\n return np.nanmean(field, axis=3, keepdims=True)",
"def mean(self, field, axis=None, region=None):\n # \n # If a regi... | [
"0.7278746",
"0.7135875",
"0.6684064",
"0.6644748",
"0.6622957",
"0.65778464",
"0.6480201",
"0.644461",
"0.6373308",
"0.6351624",
"0.6294219",
"0.62699544",
"0.62606704",
"0.6239302",
"0.62274325",
"0.6176736",
"0.6157787",
"0.6149142",
"0.6136901",
"0.61185",
"0.6103634",
... | 0.7149263 | 1 |
Find each set of results with the same first parameter, compute the min of their means and then scale all their results by that. The aim here is to scale results for specific processors in a way that is internally consistent. Scaling each run by its own min can be misleading, since then results which were smaller can l... | def normalizeResults(results, independentVariable, basis):
normValues = {}
if basis == "min":
reduction = min
elif basis == "mean":
reduction = mean
elif basis == "max":
reduction = max
print("Normalising by " + basis)
for k in results.keys():
ik = k.split(",")[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_together(data, comp):\n scales = []\n guess = 1.\n s = opt.minimize(sq_residuals_in_range, guess, args = (data, comp), \n method = 'Nelder-Mead').x\n return s",
"def cluster_means_scaled(self):\n if self.evaluate_by is not None:\n return(self.merged_scaled_... | [
"0.5730076",
"0.57292515",
"0.5662298",
"0.5552494",
"0.551228",
"0.5499445",
"0.5480341",
"0.5479149",
"0.5476675",
"0.5461815",
"0.5429813",
"0.5428306",
"0.5410855",
"0.5396706",
"0.5393401",
"0.5375831",
"0.5367997",
"0.5347249",
"0.53420913",
"0.5333558",
"0.5322741",
... | 0.6127019 | 0 |
Center the ship on the screen | def center_ship(self):
self.center = self.screen_rect.centerx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_ship(self):\n self.center = self.screen_rect.centerx",
"def center_ship(self):\n self.center = self.screen_rect.centerx",
"def center_ship(self):\n self.center = self.screen_rect.centerx",
"def center_ship(self):\n # Start each new ship at the bottom center\n sel... | [
"0.90181214",
"0.90181214",
"0.90181214",
"0.8599386",
"0.77910644",
"0.761576",
"0.7553747",
"0.7458518",
"0.7252782",
"0.72375983",
"0.7168899",
"0.71423084",
"0.7113291",
"0.7064254",
"0.7018259",
"0.6994591",
"0.6934956",
"0.69271857",
"0.6910503",
"0.69049215",
"0.690492... | 0.90641564 | 1 |
Calculates word frequency for a given text. We don't consider stop words when calculating frequency. | def word_frequency(text):
tokenizer = RegexpTokenizer(r'\w+')
tokens = tokenizer.tokenize(text)
stop = set(stopwords.words('english'))
tokens_without_stop = list(filter(lambda word: word.lower() not in stop, tokens))
counts = Counter(tokens_without_stop)
return counts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_word_counts(text : Text)->Counter:\n return Counter(tokenized_text(text))",
"def frequency(text):\n # TODO: change function input to a textfile?\n import collections\n freq = collections.Counter(text)\n # print freq\n return freq",
"def complexity(text:str) -> float:\n words = ... | [
"0.8071999",
"0.75517035",
"0.74244624",
"0.7402747",
"0.73363006",
"0.7313311",
"0.730345",
"0.72393984",
"0.72356933",
"0.7208666",
"0.7173497",
"0.7112697",
"0.7105219",
"0.7059449",
"0.7059299",
"0.7014396",
"0.7002395",
"0.69982463",
"0.6997513",
"0.69905484",
"0.6984714... | 0.818352 | 0 |
Check if a mol has 2D coordinates and if not, calculate them. | def check_2d_coords(mol, force=False):
if not force:
try:
mol.GetConformer()
except ValueError:
force = True # no 2D coords... calculate them
if force:
if USE_AVALON_2D:
pyAv.Generate2DCoords(mol)
else:
mol.Compute2DCoords() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_coords():\n split_coords = row[\"map_coord\"].split(',')\n map_x, map_y = [int(i) for i in split_coords]\n map_x_normed = ((map_x*2) / self.MINIMAP_DIM) - 1\n map_y_normed = -(((map_y*2) / self.MINIMAP_DIM) - 1)\n return map_x_normed, map_y_normed"... | [
"0.6219354",
"0.6077779",
"0.6013348",
"0.584337",
"0.58144647",
"0.5808867",
"0.5737401",
"0.57239455",
"0.56685406",
"0.56669194",
"0.56379074",
"0.56226474",
"0.5609471",
"0.56056577",
"0.5604061",
"0.55906796",
"0.55845845",
"0.5557084",
"0.5556743",
"0.55530614",
"0.5545... | 0.7064952 | 0 |
Returns True, if x is a number (i.e. can be converted to float). | def isnumber(x):
try:
float(x)
return True
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(x):\n if isinstance(x, (int, float)):\n return True\n else:\n return False",
"def is_float(x):\r\n try:\r\n float(x)\r\n except ValueError:\r\n return False\r\n return True",
"def _is_number(value):\n try:\n float(value)\n re... | [
"0.8831771",
"0.84678894",
"0.8269232",
"0.8268981",
"0.8215385",
"0.81769127",
"0.8087828",
"0.80597544",
"0.8051537",
"0.8027391",
"0.7998552",
"0.7986285",
"0.7984602",
"0.7984602",
"0.7984602",
"0.79576087",
"0.79458576",
"0.79081887",
"0.78952646",
"0.78746027",
"0.78025... | 0.90320134 | 0 |
For a given cluster_id calculate the distance from each point to the centroid/medoid. | def calculate_distances_for_cluster(self, cluster_id):
cluster_of_interest = self.embedding_df[self.embedding_df['cluster'] == cluster_id].copy()
if cluster_of_interest.empty:
raise ValueError(f'Cluster id {cluster_id} not found')
# Don't calculate distances for the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcDistortion(medoids, clusters, class_header=\"Class\"):\n distortion = 0\n for medoid_row_index, medoid_tuple in enumerate(medoids.iterrows()): # For every Medoid\n for _, datum in clusters[medoid_row_index].iterrows(): # For each point in the medoid cluster\n # Add... | [
"0.67842567",
"0.67745066",
"0.6764742",
"0.67052865",
"0.6705151",
"0.6693539",
"0.6685048",
"0.65840197",
"0.6572326",
"0.65583515",
"0.64906234",
"0.6264555",
"0.6253788",
"0.6250515",
"0.62433743",
"0.62167305",
"0.6175956",
"0.61737406",
"0.6170333",
"0.61438906",
"0.614... | 0.7704725 | 0 |
For a given cluster return a pandas dataframe of points ranked by distance to the cluster centroid/medoid | def rank_cluster_points_by_distance(self, cluster_id):
cluster_of_interest = self.embedding_df[self.embedding_df['cluster'] == cluster_id].copy()
if cluster_of_interest.empty:
raise ValueError(f'Cluster id {cluster_id} not found')
if 'dist_to_rep_point' not in s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_cluster_rankings(self):\n if 'dist_to_rep_point' not in self.embedding_df.columns:\n self.calculate_all_distances_to_center()\n\n self.embedding_df['rank_in_cluster'] = self.embedding_df.groupby('cluster')['dist_to_rep_point'].rank(method='min')",
"def cluster_spatial_positio... | [
"0.74079317",
"0.67105204",
"0.64238435",
"0.63077164",
"0.6306624",
"0.6294445",
"0.62434506",
"0.6157537",
"0.6113591",
"0.61009115",
"0.6098193",
"0.607835",
"0.60371375",
"0.6021003",
"0.60085094",
"0.60084623",
"0.5979887",
"0.59464717",
"0.59397215",
"0.5935677",
"0.592... | 0.74946755 | 0 |
Calculate the rank of each point within a cluster | def get_all_cluster_rankings(self):
if 'dist_to_rep_point' not in self.embedding_df.columns:
self.calculate_all_distances_to_center()
self.embedding_df['rank_in_cluster'] = self.embedding_df.groupby('cluster')['dist_to_rep_point'].rank(method='min') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank():\n return 0",
"def rankNeighbors(Data):\r\n strokeDist = []\r\n for i in range(len(Data)):\r\n strokeDist.append([])\r\n index = 0\r\n for point1 in Data:\r\n dist = []\r\n index1=0\r\n for point2 in Data:\r\n #dist.append(math.sqrt((center1[0]-cen... | [
"0.70503414",
"0.7008832",
"0.6786571",
"0.6764138",
"0.67443216",
"0.66818386",
"0.6654572",
"0.6623286",
"0.6598719",
"0.65756667",
"0.65539867",
"0.6456434",
"0.6411865",
"0.6378525",
"0.63583297",
"0.63149124",
"0.6295258",
"0.62677336",
"0.6262239",
"0.6217441",
"0.61610... | 0.7514025 | 0 |
Returns the object located at given coordinates. | def get_object_at_location(self, x, y):
object_map_at_target_location = self.maps.get((x, y))
if not object_map_at_target_location:
return None
return object_map_at_target_location.get_real_object() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_at_location(cls, x, y):\n object_map_at_target_location = cls.query\\\n .filter_by(x=x, y=y).one_or_none()\n if not object_map_at_target_location:\n return None\n return object_map_at_target_location.get_real_object()",
"def get_object_at(self, position, ... | [
"0.7401787",
"0.65084153",
"0.64662015",
"0.6462374",
"0.6404084",
"0.62852186",
"0.61791605",
"0.6087064",
"0.5851252",
"0.5840479",
"0.58224994",
"0.58224994",
"0.5814853",
"0.5790992",
"0.57650596",
"0.5756242",
"0.5745209",
"0.5740608",
"0.5726151",
"0.5704214",
"0.566702... | 0.71457946 | 1 |
Creates a food object randomly somewhere in this world. | def generate_food(self):
x = random.randint(0, self.width)
y = random.randint(0, self.height)
new_food = Food(self.id, x, y)
food_created = self.add_object(new_food)
if not food_created:
existing_object = self.get_object_at_location(x, y)
if isinstance(exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_food(self):\n self.penup()\n self.shape(\"circle\")\n self.color(\"green\")\n self.x_cordinates = random.randint(-210, 210)\n self.y_cordinates = random.randint(-210, 210)\n self.goto(self.x_cordinates, self.y_cordinates)\n print(f\"This Is Food {self.x_c... | [
"0.7924229",
"0.7388662",
"0.68496233",
"0.67906237",
"0.6670745",
"0.66257876",
"0.6595156",
"0.64915293",
"0.63676316",
"0.63369346",
"0.63189137",
"0.6317571",
"0.61416024",
"0.6115891",
"0.6053006",
"0.6016661",
"0.60126746",
"0.6003472",
"0.58886176",
"0.58674264",
"0.58... | 0.79373443 | 0 |
Return True if the choice's value is empty string or None. | def _choice_has_empty_value(choice):
value, _, crige = choice
return value is None or value == '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_empty(val):\n return val is not None and val != \"\"",
"def is_str_none_or_empty(val):\n if val is None:\n return True\n if isinstance(val, string_types):\n val = val.strip()\n if not val:\n return True\n return False",
"def empty(self, value):\r\n return ... | [
"0.7685549",
"0.76462",
"0.74445015",
"0.74445015",
"0.74445015",
"0.74445015",
"0.74445015",
"0.73680663",
"0.7361419",
"0.73225313",
"0.7155328",
"0.7097266",
"0.7065049",
"0.7033588",
"0.70299554",
"0.6994321",
"0.69693965",
"0.691823",
"0.6896403",
"0.687022",
"0.6839705"... | 0.8938283 | 0 |
Return a list of optgroups for this widget. | def optgroups(self, name, value, attrs=None):
groups = []
has_selected = False
for index, (option_value, option_label, option_crige) in enumerate(self.choices):
if option_value is None:
option_value = ''
subgroup = []
if isinstance(option_lab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_options(self):\n return [o for g in self.parser.option_groups for o in g.option_list]",
"def optgroups(self, name, value, attrs=None):\n options = []\n\n for index, (name, product_data) in enumerate(self.product_fields.items()):\n quantity = product_data['quantity']\n ... | [
"0.7063895",
"0.69440085",
"0.67643887",
"0.65815574",
"0.6523809",
"0.6515766",
"0.6399603",
"0.6360311",
"0.6360311",
"0.6360311",
"0.63217825",
"0.63090414",
"0.62958103",
"0.62820065",
"0.6253235",
"0.62510276",
"0.6211395",
"0.62001765",
"0.6191107",
"0.61584747",
"0.614... | 0.75911134 | 0 |
Sets up the cairo context and pango layout | def set_up_pangocairo(self, widget, event):
# Create the cairo context
self.cr = self.window.cairo_create()
#Create a pango layout
self.pg = self.cr.create_layout()
# Restrict Cairo to the exposed area; avoid extra work
self.cr.rectangle(event.area.x, event.ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_on_surface(surface):\n pangocairo_ctx = pangocairo.CairoContext(cairo.Context(surface))\n layout = pangocairo_ctx.create_layout()\n\n pango_ctx = layout.get_context()\n if language is not None:\n pango_ctx.set_language(pango.Language(language))\n\n if rtl:\n ... | [
"0.6378648",
"0.63250196",
"0.5820568",
"0.5630213",
"0.5574149",
"0.5553529",
"0.5505494",
"0.54557025",
"0.5414631",
"0.54144245",
"0.5352626",
"0.53398526",
"0.53367114",
"0.5331944",
"0.5321142",
"0.53158367",
"0.5298759",
"0.5253618",
"0.52352786",
"0.52059555",
"0.51881... | 0.7677612 | 0 |
Handles expose event. Sets up cairo and calls draw() to draw the text | def do_expose_event(self, widget, event):
self.set_up_pangocairo(widget, event)
self.draw(*self.window.get_size()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expose (self,widget,event):\n #Creating Cairo drawing context\n self.ctx = self.bin_window.cairo_create()\n #Setting context size to available size\n self.ctx.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)\n self.ctx.clip()\n self.ctx.transl... | [
"0.63333666",
"0.6331875",
"0.6298491",
"0.6249288",
"0.62065977",
"0.62057835",
"0.60598",
"0.6035482",
"0.5889406",
"0.58473253",
"0.5832056",
"0.58307505",
"0.5823392",
"0.5807295",
"0.579405",
"0.579405",
"0.579405",
"0.5785034",
"0.57550627",
"0.5724503",
"0.5721456",
... | 0.7019397 | 0 |
Invalidates the canvas to allow cairo to redraw | def invalidate_canvas(self):
if self.window:
x, y, w, h = self.get_allocation()
self.window.invalidate_rect((0,0,w,h), False)
self.cr = self.window.cairo_create()
self.cr.update_layout(self.pg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undraw(self):\n \n if not self.canvas: return\n if not self.canvas.isClosed():\n #self.canvas.delete(self.id)\n _tkExec(self.canvas.delete, self.id)\n if self.canvas.autoflush:\n #_root.update()\n _tkCall(_root.update)\n ... | [
"0.7170448",
"0.70177877",
"0.6811474",
"0.67474014",
"0.6741104",
"0.65798086",
"0.6572473",
"0.651364",
"0.64646524",
"0.6450033",
"0.64039034",
"0.6386848",
"0.6327218",
"0.62746847",
"0.62502813",
"0.6237061",
"0.6207101",
"0.612459",
"0.6124122",
"0.6107939",
"0.6056458"... | 0.8453374 | 0 |
Calls continuous_scroll every 38 ms until drag stops and the gobject.source is removed | def start_refresh(self, widget, context):
self.source_id = gobject.timeout_add(38, self.continuous_scroll, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def continuous_scroll(self, context):\n\n self.drawing.redraw_canvas(self.dy)\n \n return True",
"def on_scroll(self, event):\n if event.button == 'up':\n self.generations += 4000\n elif event.button == 'down':\n if self.generations >= 4000:\n ... | [
"0.67773175",
"0.65299225",
"0.6115261",
"0.6041647",
"0.5851163",
"0.57974243",
"0.5567167",
"0.5549752",
"0.5510689",
"0.54062074",
"0.5401114",
"0.5395652",
"0.53080606",
"0.5282082",
"0.5279963",
"0.52645594",
"0.519223",
"0.5188579",
"0.517752",
"0.51675165",
"0.5145534"... | 0.65430206 | 1 |
CPU kernel for 3d mesh to particles quantity interpolation | def mesh_to_particles_CPU_3d(mesh, mesh_quantity, indices, weights):
ip, jp, kp = indices
stridex = mesh.nx
stridey = mesh.ny
mq = np.ravel(mesh_quantity)
@np.vectorize
def check_outside(ip, jp, kp):
outside_idx = (jp < 0 or jp >= mesh.nx - 1 or
ip < 0 or ip >= me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init():\n\tN = np.int32(DIM) #prepare for stitching\n\t#HII_DIM = np.int32(HII_DIM)\n\tf_pixel_factor = DIM/HII_DIM;\n\tscale = np.float32(BOX_LEN)/DIM\n\tHII_scale = np.float32(BOX_LEN)/HII_DIM\n\tshape = (N,N,N)\n\t\n\tMRGgen = MRG32k3aRandomNumberGenerator(seed_getter=seed_getter_uniform, offset=0)\n\n\tker... | [
"0.6445836",
"0.6372974",
"0.61668825",
"0.59983677",
"0.5791244",
"0.5653549",
"0.5652757",
"0.56389385",
"0.56339914",
"0.55467594",
"0.55444217",
"0.55392367",
"0.5479442",
"0.5449648",
"0.5441298",
"0.5424582",
"0.54130393",
"0.53808963",
"0.5377156",
"0.5375097",
"0.5365... | 0.6884111 | 0 |
Make a short score with pick up and two voices. | def makeScoreWithPickup(self):
sc = stream.Score()
num_voices = 2
pitches = ['C', 'A-']
for i in range(num_voices):
part = stream.Part()
part.id = 'part %d' % i
time_sig = meter.TimeSignature('4/4')
key_sig = key.Key('c')
# Add pickup measure.
pickup = stream.Measure... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeScore(self):\n sc = stream.Score()\n num_voices = 2\n pitches = ['C', 'A-']\n for i in range(num_voices):\n part = stream.Part()\n part.id = 'part %d' % i\n time_sig = meter.TimeSignature('4/4')\n key_sig = key.Key('c')\n\n # Make a note.\n n1 = music21_note.Note(p... | [
"0.6722317",
"0.58068377",
"0.5768385",
"0.57021904",
"0.56786025",
"0.56589353",
"0.5603751",
"0.55136603",
"0.549756",
"0.5485879",
"0.54847825",
"0.5401103",
"0.5356562",
"0.5330451",
"0.53275734",
"0.53220344",
"0.52828926",
"0.5266709",
"0.52593845",
"0.5259334",
"0.5244... | 0.70795625 | 0 |
Make a short score with pick up and two voices. | def makeScore(self):
sc = stream.Score()
num_voices = 2
pitches = ['C', 'A-']
for i in range(num_voices):
part = stream.Part()
part.id = 'part %d' % i
time_sig = meter.TimeSignature('4/4')
key_sig = key.Key('c')
# Make a note.
n1 = music21_note.Note(pitches[i])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeScoreWithPickup(self):\n sc = stream.Score()\n num_voices = 2\n pitches = ['C', 'A-']\n for i in range(num_voices):\n part = stream.Part()\n part.id = 'part %d' % i\n time_sig = meter.TimeSignature('4/4')\n key_sig = key.Key('c')\n\n # Add pickup measure.\n pickup ... | [
"0.70795625",
"0.58068377",
"0.5768385",
"0.57021904",
"0.56786025",
"0.56589353",
"0.5603751",
"0.55136603",
"0.549756",
"0.5485879",
"0.54847825",
"0.5401103",
"0.5356562",
"0.5330451",
"0.53275734",
"0.53220344",
"0.52828926",
"0.5266709",
"0.52593845",
"0.5259334",
"0.524... | 0.6722317 | 1 |
Check the key, mode, tonic pitch class extraction from key signature. | def testExtractionOfKeySignatureAttributes(self):
num_to_major_key = {0: 'C',
1: 'G',
2: 'D',
3: 'A',
4: 'E',
5: 'B',
6: 'F#',
7: 'C#',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_key(self, key):\n raise NotImplementedError",
"def __getKeyInformation( self , flaglist ):\n\t\tkeyinfo = 0\n\t\tif 'HMAC_MD5_RC4' in flaglist:\n\t\t\tkeyinfo = setBit( keyinfo , 0 )\n\t\tif 'HMAC_SHA1_AES' in flaglist:\n\t\t\tkeyinfo = setBit( keyinfo , 1 )\n\t\tif 'group' in flaglist:\n\t\t\t... | [
"0.5945108",
"0.57941103",
"0.57145506",
"0.56614727",
"0.55908537",
"0.557824",
"0.5512754",
"0.55084723",
"0.54874986",
"0.54785895",
"0.5465614",
"0.5448584",
"0.53911096",
"0.536824",
"0.53185785",
"0.5297847",
"0.529589",
"0.5281158",
"0.52718353",
"0.52686393",
"0.52467... | 0.66755116 | 0 |
Test pretty_music21 score by comparing to music21 score. | def testCompareScores(self):
for score_type, source in self.sources.iteritems():
simple_score = self.simple_scores[score_type]
# Check overall length.
self.assertAlmostEqual(source.duration.quarterLength / 2.0,
simple_score.total_time)
# Check number of parts.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_music21(music: \"Music\") -> Score:\n # Create a new score\n score = Score()\n\n # Metadata\n if music.metadata:\n score.append(to_music21_metadata(music.metadata))\n\n # Tracks\n for track in music.tracks:\n # Create a new part\n part = Part()\n part.partName =... | [
"0.6397026",
"0.61292386",
"0.60153556",
"0.5894335",
"0.5888303",
"0.584743",
"0.58399576",
"0.58220565",
"0.5753058",
"0.57522446",
"0.5727253",
"0.5703115",
"0.565216",
"0.5651552",
"0.5611833",
"0.5602852",
"0.5571321",
"0.5554371",
"0.54933465",
"0.544632",
"0.5432133",
... | 0.6417285 | 0 |
Test if notes are sorted by start time. | def testSortedNotes(self):
for simple_score in self.simple_scores.values():
notes = simple_score.sorted_notes
assert all(notes[i].start_time <= notes[i + 1].start_time
for i in range(len(notes) - 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_add_note(self, start_step):\n return self.last_on is None or start_step - self.offset > self.last_on",
"def order_by_start(self):\n return self.order_by(\"start_time\")",
"def cmpBeginDate(artist1, artist2):\n return int(artist1['BeginDate']) < int(artist2['BeginDate'])",
"def cmpArtist... | [
"0.61224854",
"0.5865765",
"0.57295513",
"0.55280834",
"0.5441577",
"0.5399074",
"0.53915083",
"0.5378046",
"0.5370285",
"0.53318506",
"0.53177214",
"0.52837706",
"0.52716595",
"0.52472234",
"0.5236269",
"0.52277195",
"0.52230084",
"0.5207091",
"0.5160097",
"0.51134276",
"0.5... | 0.74918807 | 0 |
Runs the given command and gathers the output. If a callback is provided, then the output is sent to it, otherwise it is just returned. Optionally, the output of the command can be "watched" and whenever new output is detected, it will be sent to the given `callback`. | def run_cmd(cmd, callback=None, watch=False, background=False, shell=False):
if watch and not callback:
raise RuntimeError(
"You must provide a callback when watching a process."
)
output = None
if shell:
proc = subprocess.Popen(cmd, shell=True, stdout=subpro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddOutputCallback(self, callback):\n self.output_callbacks.append(callback)",
"def execute():\n command_line_args = argv[1:]\n args = cli(command_line_args)\n\n callback = args.callback\n kwargs = {\n k: v\n for k, v in args.__dict__.items()\n if k != \"callback\"\n }\n... | [
"0.60572314",
"0.58634955",
"0.58029765",
"0.5787524",
"0.573274",
"0.5612282",
"0.5592784",
"0.5578011",
"0.5532359",
"0.5510294",
"0.55036664",
"0.54866433",
"0.5473412",
"0.5423298",
"0.5419067",
"0.5387715",
"0.53372276",
"0.5322813",
"0.53072083",
"0.53039205",
"0.527183... | 0.61989796 | 0 |
Check that proportions in composition file sum to 1 | def check_proportions(self):
proportions = [
v['proportion'] for k, v in self.composition.items()
]
if sum(proportions) < 1.0:
raise ValueError('Sum of proportions between host and pathogen must be 1.0.')
elif sum(proportions) > 1.0:
raise V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_proportion(control, test):\n return set(control) == set(test) == {0, 1}",
"def __call__(self, read, info: ModificationInfo):\n n_count = read.sequence.lower().count('n')\n if self.is_proportion:\n if len(read) == 0:\n return False\n return n_count / l... | [
"0.6806141",
"0.6376372",
"0.63674873",
"0.6106981",
"0.59485376",
"0.59462976",
"0.5868693",
"0.58353674",
"0.5807831",
"0.5794899",
"0.57598245",
"0.57089925",
"0.56516993",
"0.5600838",
"0.55719936",
"0.5553505",
"0.5544299",
"0.5544022",
"0.5519452",
"0.55115443",
"0.5487... | 0.7553237 | 0 |
Clean up the Fastq index files from Pyfastx | def clean(self):
for _, data in self.composition.items():
index_file = Path(data['file'] + '.fxi')
if index_file.exists():
index_file.unlink() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_index(self):\n if self.index_module:\n self.index_module = None\n gc.collect()",
"def cleanup(self):\n index_id = self.params[\"index_id\"]\n\n # Remove the index document from the database.\n self.db.indexes.delete_one({\"_id\": index_id})\n\n ... | [
"0.6486027",
"0.6483935",
"0.61997026",
"0.6186733",
"0.6184694",
"0.6120797",
"0.61112803",
"0.61034113",
"0.6067713",
"0.6043162",
"0.6007758",
"0.60064405",
"0.5943808",
"0.59250754",
"0.59225947",
"0.5922426",
"0.59017795",
"0.5857676",
"0.58406806",
"0.583989",
"0.583783... | 0.7508633 | 0 |
Rename read headers from the Pyfastx reads (readonly) | def rename_headers(reads: list, organism: str):
i = 0
read_strings = []
for read in reads:
read_str = read.raw.splitlines()
read_str[0] = f'@{organism}_{i}'
read_str = '\n'.join(read_str)
read_strings.append(read_str)
i += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reset_header(self):\n new_header = []\n for col_name in self.header:\n is_left = self.left_cols.get(col_name)\n if is_left:\n new_header.append(col_name)\n self.header = new_header",
"def modify_bam_header(self, in_bam, out_bam):\n #bam_header... | [
"0.60041726",
"0.5952062",
"0.59352136",
"0.59297824",
"0.59085053",
"0.588155",
"0.58796203",
"0.5815924",
"0.5812585",
"0.56827",
"0.5642944",
"0.56334716",
"0.56306666",
"0.56273365",
"0.56152153",
"0.56103003",
"0.55797523",
"0.5561919",
"0.5546493",
"0.55092734",
"0.5469... | 0.7097539 | 0 |
Sample a list of Fastq reads / read names | def sample(fastq: list, reads: int = None, replacement: bool = False):
if replacement:
sampled_reads = random.choices(fastq, k=reads)
else:
sampled_reads = random.sample(fastq, k=reads)
return sampled_reads | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_read_list(samfile):\n read_sampler = ReadSampler()\n for line in samfile:\n line = sam_utils.SamAlignment(line)\n vals = line.get_aligned_blocks()\n if len(vals) > 1:\n logging.info(\"Skipping gapped read %s %s\"%(line.QNAME, str(vals))) \n read_sampler.a... | [
"0.6420504",
"0.6299379",
"0.5943049",
"0.5809539",
"0.5767165",
"0.5739098",
"0.57060987",
"0.5696739",
"0.5689907",
"0.56789887",
"0.55646765",
"0.55259854",
"0.5509567",
"0.5490724",
"0.54807556",
"0.5477975",
"0.54732245",
"0.547267",
"0.5464326",
"0.54481435",
"0.5440680... | 0.68244636 | 0 |
Set item in nested dictionary | def set_nested_item(data_dict: dict, key_list: tuple or list, value):
reduce(getitem, key_list[:-1], data_dict)[key_list[-1]] = value
return data_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self, key, value):\n self.tree[key] = value",
"def visit_dict(self, sydict):\n self.current.update(sydict)",
"def set(cls, hierarchical_dict: dict, key: str, value: Any) -> None:\n # split according to '.'\n hierarchical_key = key.split(\".\")\n\n # go over th... | [
"0.66427284",
"0.65705705",
"0.6513432",
"0.650163",
"0.6474375",
"0.64307684",
"0.6408831",
"0.63907933",
"0.63844234",
"0.6381398",
"0.6353006",
"0.63405037",
"0.6324578",
"0.63165903",
"0.63117933",
"0.63100886",
"0.63035226",
"0.6276476",
"0.62579644",
"0.6254745",
"0.622... | 0.77281743 | 0 |
returns a list of axes of a variable mv | def allAxes( mv ):
if mv is None: return None
return mv.getAxisList() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_axes(self) -> VGroup:\n return self.axes",
"def get_axes(self) -> VGroup:\n return self.axes",
"def axes(self):\n return self._axes",
"def axes(self):\n return self._axes",
"def axes(*x: Iterable[int]):\n return [_ti_core.Axis(i) for i in x]",
"def axes(self) -> np.... | [
"0.6138203",
"0.6138203",
"0.6132842",
"0.6132842",
"0.6125584",
"0.6117667",
"0.6023415",
"0.59184104",
"0.5736616",
"0.5717504",
"0.57096046",
"0.55749345",
"0.54218215",
"0.5417657",
"0.54154396",
"0.5380405",
"0.52959144",
"0.5287406",
"0.52542454",
"0.5213043",
"0.519815... | 0.7132127 | 0 |
Sometimes we get time units which aren't compatible with cdtime. This function will (try to) fix them. The input argument is a string, e.g. "months since Jan 1979" and the return value is another string, e.g. | def fix_time_units( timeunits ):
imon = timeunits.find("months since ")
if imon==0:
since="months since "
else:
iday = timeunits.find("days since ")
if iday==0:
since="days since "
else:
ihour = timeunits.find("hours since ")
if ihour==0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(string):\n units = {'s':1, 'm':60, 'h':60*60, 'd':24*60*60, 'M':30*24*60*60}\n string = string.replace(' ','')\n p = re.compile('(\\d+)\\s*(\\w+)')\n num, unit = p.match(string).groups()\n num = float(num)\n return num * units[unit]",
"def clean_unit(unit):\n return 'M' if unit.lower() =... | [
"0.62871355",
"0.62632513",
"0.6058695",
"0.60543835",
"0.60210484",
"0.6020246",
"0.59578264",
"0.5928724",
"0.5863947",
"0.585928",
"0.5834382",
"0.57287663",
"0.56812316",
"0.5627189",
"0.5626828",
"0.5603379",
"0.5575414",
"0.55661714",
"0.5550087",
"0.5532709",
"0.550852... | 0.80670094 | 0 |
Input is a variable which depends on latitude. This function will copy it to a new variable, except that the new variable's latitude axis will be restricted to latmin<=lat<=latmax; and of course the data will be restricted to correspond. | def restrict_lat( mv, latmin, latmax ):
if latmin==-90: latmin = -91 # just to make sure
if latmax==90: latmax = 91
# axes
latax,idx = latAxis2(mv)
if latax is None: return None
imin = min( [i for i in range(len(latax)) if latax[i]>=latmin and latax[i]<=latmax ] )
imax = max( [i for i in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return type(self)(self.lat_lon[0], self.lat_lon[1], **self._attrs)",
"def latvar( mv ):\n # First get the axis. This is probably not as general as we'll need...\n if mv is None: return None\n lat_axis = latAxis(mv)\n #latmv = mv.clone() # good if mv has only a lat axis\n ... | [
"0.58231395",
"0.5813714",
"0.56509984",
"0.52055085",
"0.5196696",
"0.51875114",
"0.51552486",
"0.5142588",
"0.5094556",
"0.50887316",
"0.5085515",
"0.50473696",
"0.504018",
"0.49421754",
"0.4902313",
"0.48965225",
"0.4887742",
"0.486856",
"0.48649704",
"0.48557973",
"0.4848... | 0.7229858 | 0 |
returns the mean of the variable over the supplied latitude range (in degrees, based on values of lat, not lat_bnds) The computed quantity is a scalar but is returned as a cdms2 variable, i.e. a MV. The input mv is a cdms2 variable, assumed to be indexed as is usual for CFcompliant variables, i.e. mv(time,lat,lon). At ... | def reduce2scalar_zonal_old( mv, latmin=-90, latmax=90, vid=None ):
# For now, I'm assuming that the only axes are time,lat,lon - so that zm is a scalar.
# And I'm assuming equal spacing in lon (so all longitudes contribute equally to the average)
# If they aren't, it's best to use area from cell_measures a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce2scalar_zonal( mv, latmin=-90, latmax=90, vid=None ):\n if vid==None:\n vid = 'reduced_'+mv.id\n axes = allAxes( mv )\n ilat = None\n for i,ax in enumerate(axes):\n if ax.id=='lat': ilat = i\n # reduce size of lat axis to (latmin,latmax)\n # Let's home a direct search will... | [
"0.67416596",
"0.6548467",
"0.6509797",
"0.62889326",
"0.6226794",
"0.6226794",
"0.6008768",
"0.59134054",
"0.5877358",
"0.57791483",
"0.5682933",
"0.5665746",
"0.55882084",
"0.55698764",
"0.55633837",
"0.55565643",
"0.55452055",
"0.55107474",
"0.5478772",
"0.54400945",
"0.53... | 0.6658991 | 1 |
returns the mean of the variable over the supplied latitude range (in degrees, based on values of lat, not lat_bnds) The computed quantity is a scalar but is returned as a cdms2 variable, i.e. a MV. The input mv is a cdms2 variable too. This function uses the cdms2 avarager() function to handle weights and do averages | def reduce2scalar_zonal( mv, latmin=-90, latmax=90, vid=None ):
if vid==None:
vid = 'reduced_'+mv.id
axes = allAxes( mv )
ilat = None
for i,ax in enumerate(axes):
if ax.id=='lat': ilat = i
# reduce size of lat axis to (latmin,latmax)
# Let's home a direct search will be fast enou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce2scalar_zonal_old( mv, latmin=-90, latmax=90, vid=None ):\n # For now, I'm assuming that the only axes are time,lat,lon - so that zm is a scalar.\n # And I'm assuming equal spacing in lon (so all longitudes contribute equally to the average)\n # If they aren't, it's best to use area from cell_me... | [
"0.6483892",
"0.6449936",
"0.63286823",
"0.6259683",
"0.6259683",
"0.60817444",
"0.59398943",
"0.5792978",
"0.5686484",
"0.5672774",
"0.5669752",
"0.5493353",
"0.548496",
"0.5436766",
"0.541976",
"0.541753",
"0.5412601",
"0.54037213",
"0.53908765",
"0.53008914",
"0.529571",
... | 0.65369064 | 0 |
averages mv over the full range all axes, to a single scalar. Uses the averager module for greater capabilities | def reduce2scalar( mv, vid=None ):
if vid==None: # Note that the averager function returns a variable with meaningless id.
vid = 'reduced_'+mv.id
axes = allAxes( mv )
axis_names = [ a.id for a in axes ]
axes_string = '('+')('.join(axis_names)+')'
avmv = averager( mv, axis=axes_string )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mean(self):\r\n for i in range(1,len(self.data[0])):\r\n self.prom.append(np.mean(self.data[:,i]))",
"def manual_mean(arr):\n my_sum = 0\n for i in range(0, arr.shape[0]):\n for j in range(0, arr.shape[1]):\n my_sum += arr[i,j]\n return my_sum / arr.si... | [
"0.6626889",
"0.63578427",
"0.625352",
"0.6220642",
"0.619339",
"0.6153601",
"0.61507607",
"0.61103404",
"0.61103404",
"0.6092938",
"0.60919166",
"0.6082729",
"0.602311",
"0.6023065",
"0.60227084",
"0.6014731",
"0.59958345",
"0.59730744",
"0.5966355",
"0.5960948",
"0.5960868"... | 0.6819693 | 0 |
returns the mean of the variable over all axes but latitude, as a cdms2 variable, i.e. a MV. The input mv is a also cdms2 variable, assumed to be indexed as is usual for CFcompliant variables, i.e. mv(time,lat,lon). At present, no other axes (e.g. level) are supported. At present mv must depend on all three axes. | def reduce2lat_old( mv, vid=None ):
# >>> For now, I'm assuming that the only axes are time,lat,lon
# And I'm assuming equal spacing in lon (so all longitudes contribute equally to the average)
# If they aren't, it's best to use area from cell_measures attribute if available; otherwise
# compute it with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce2lat( mv, vid=None ):\n if vid==None: # Note that the averager function returns a variable with meaningless id.\n vid = 'reduced_'+mv.id\n axes = allAxes( mv )\n axis_names = [ a.id for a in axes if a.id!='lat' ]\n axes_string = '('+')('.join(axis_names)+')'\n\n avmv = averager( m... | [
"0.6196711",
"0.61690545",
"0.6022679",
"0.5879041",
"0.57352066",
"0.56729776",
"0.5658441",
"0.56343806",
"0.56343806",
"0.5478811",
"0.54540074",
"0.5406501",
"0.5377368",
"0.53606015",
"0.53185415",
"0.5281884",
"0.52813756",
"0.5268177",
"0.525204",
"0.52350086",
"0.5188... | 0.6457875 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.