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
View all verb and tense quiz options.
def quiz_selection(): verbs = crud.get_verbs() tenses = crud.get_tenses() return render_template("verb-conjugation.html", verbs=verbs, tenses=tenses)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_all():\n for q in Question.all_questions:\n print 'from', q.file\n q.ask()", "def show_results(self):\n print(\"Survey results:\")\n for response in self.responses:\n print('- ' + response)", "def get_answers(self):\r\n pass", "def option_show_advanced...
[ "0.600085", "0.58309793", "0.565951", "0.5643114", "0.55537456", "0.55362535", "0.55034494", "0.5461608", "0.5451248", "0.5445065", "0.5440097", "0.5396626", "0.5365166", "0.535084", "0.53193617", "0.5317761", "0.5285466", "0.5230963", "0.5222562", "0.52065843", "0.51965123",...
0.68374383
0
Return an RFC3339compliant timestamp.
def rfc3339(self): if self._nanosecond == 0: return _to_rfc3339(self) nanos = str(self._nanosecond).rjust(9, "0").rstrip("0") return "{}.{}Z".format(self.strftime(_RFC3339_NO_FRACTION), nanos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rfc3339_time() -> Text:\n\n return datetime.datetime.utcnow().isoformat('T') + 'Z'", "def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n return time.strftime(\"%Y-%m-%d-%H-%M-%S-{}\".format(moment_us), time.gmtime(moment))", "def get_timestamp(self):\n ...
[ "0.7412164", "0.7067743", "0.70454866", "0.680817", "0.6691189", "0.66868603", "0.664912", "0.66445935", "0.66431254", "0.6610651", "0.65642494", "0.65453845", "0.65272963", "0.65122104", "0.649016", "0.6486672", "0.64797294", "0.6453291", "0.64185005", "0.6393736", "0.637609...
0.75104326
0
Saves the result dictionary as JSON to a well known location in the working space folder. Relative to the working space folder, the JSON is stored in 'output/results.json'. Folders are created as needed.
def save_result(working_space: str, result: dict) -> None: result_path = os.path.join(working_space, 'output') if not os.path.exists(result_path): os.makedirs(result_path) result_path = os.path.join(result_path, 'result.json') logging.info("Storing result at location: '%s'", result_path) log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, result_dir):\n path = os.path.join(result_dir, self._filename)\n\n util.write_json(path, {\n 'results': self._results,\n 'params': self._params,\n 'requirements': self._env.requirements,\n 'commit_hash': self._commit_hash,\n 'date'...
[ "0.79232246", "0.7569962", "0.7325321", "0.7315301", "0.7306659", "0.72789645", "0.7265616", "0.719532", "0.71553546", "0.706384", "0.7049616", "0.70123094", "0.6973604", "0.69650054", "0.69412196", "0.69017756", "0.68920434", "0.68472093", "0.6750217", "0.6739409", "0.665639...
0.7699649
1
Generates a 6 character alphanumeric code to be used to verify that the user has purchased a cartridge.
def create_secret_code(): characters = string.ascii_uppercase + string.digits size = 6 return ''.join(random.choice(characters) for _ in range(size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_new_code():\n code = ''.join(random.choice(string.digits) for i in range(6))\n return code", "def gen_code():\n return ''.join([random.choice(string.ascii_uppercase + string.digits) for _ in range(10)])", "def generate_code(self):\n code = ''.join(\n random.choic...
[ "0.74614185", "0.7150063", "0.7099597", "0.6996119", "0.6931389", "0.6922186", "0.68661886", "0.67869914", "0.6760706", "0.6746724", "0.67371583", "0.6697226", "0.65777385", "0.651033", "0.6507484", "0.6506442", "0.64953274", "0.64928424", "0.6449761", "0.643318", "0.64188457...
0.7415497
1
Remove outliers from ``Series``.
def filter_outliers(data: pd.Series, std: int=3) -> pd.Series: return data[(data - data.mean()).abs() <= (std * data.std())]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_outliers(self, data, sd_val):\n data = data.dropna()\n data = data[(np.abs(stats.zscore(data)) < float(sd_val)).all(axis=1)]\n return data", "def rem_outliers(s):\n s_mean = s.mean()\n s_std = s.std()\n s_min = s_mean - 3 * s_std\n s_max = s_mean + 3 * s_std\n retur...
[ "0.745088", "0.7391351", "0.7311255", "0.7210623", "0.712991", "0.71262974", "0.7124151", "0.7059068", "0.7044938", "0.70288086", "0.7001559", "0.69933045", "0.6866978", "0.6784392", "0.6720005", "0.6652681", "0.6555574", "0.6537433", "0.64253753", "0.6419967", "0.63965493", ...
0.7444352
1
Tests behavior if interface.get_vessel_list throws a DoesNotExistError
def test_get_vessel_list_throws_DoesNotExistError(): interface.get_vessel_list = mock_get_vessel_list_throws_DoesNotExistError interface.release_vessels = mock_release_vessels response = c.post('/html/del_resource', good_data, follow=True) assert(response.status_code == 200) assert("Unable to remove"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_url_vessel_empty_list(self):\n url = reverse('vessel-list')\n response = self.get(url)\n self.assertEqual(response.status_code, status.HTTP_200_OK)", "def test_get_vessel_list_throws_InvalidRequestError():\r\n interface.get_vessel_list = mock_get_vessel_list_throws_InvalidRequestEr...
[ "0.72203964", "0.71185136", "0.7066029", "0.679958", "0.5962365", "0.590518", "0.58169925", "0.57935566", "0.5749535", "0.5715016", "0.5686451", "0.56774145", "0.5670005", "0.5656361", "0.56513494", "0.5625519", "0.5612344", "0.56053144", "0.55029345", "0.54844", "0.54839444"...
0.75056046
0
Tests behavior if interface.get_vessel_list throws an InvalidRequestError
def test_get_vessel_list_throws_InvalidRequestError(): interface.get_vessel_list = mock_get_vessel_list_throws_InvalidRequestError interface.release_vessels = mock_release_vessels response = c.post('/html/del_resource', good_data, follow=True) assert(response.status_code == 200) assert("Unable to rem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_url_vessel_empty_list(self):\n url = reverse('vessel-list')\n response = self.get(url)\n self.assertEqual(response.status_code, status.HTTP_200_OK)", "def test_get_vessel_list_throws_DoesNotExistError():\r\n interface.get_vessel_list = mock_get_vessel_list_throws_DoesNotExistError\...
[ "0.6953142", "0.67237854", "0.66492444", "0.6389677", "0.620747", "0.5982903", "0.5849792", "0.58475804", "0.57987154", "0.57366586", "0.557864", "0.55655384", "0.5556224", "0.54853606", "0.54853606", "0.5484565", "0.5474907", "0.54696727", "0.54495025", "0.54492813", "0.5443...
0.75849336
0
Tests behavior if interface.release_vessels throws an InvalidRequestError
def test_release_vessels_throws_InvalidRequestError(): interface.get_vessel_list = mock_get_vessel_list interface.release_vessels = mock_release_vessels_throws_InvalidRequestError response = c.post('/html/del_resource', good_data, follow=True) assert(response.status_code == 200) assert("Unable to rem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_vessel_list_throws_InvalidRequestError():\r\n interface.get_vessel_list = mock_get_vessel_list_throws_InvalidRequestError\r\n interface.release_vessels = mock_release_vessels\r\n response = c.post('/html/del_resource', good_data, follow=True)\r\n \r\n assert(response.status_code == 200)\r\n asse...
[ "0.6750871", "0.6093183", "0.6056714", "0.5971273", "0.59207636", "0.58044356", "0.578226", "0.5749196", "0.5587508", "0.5565045", "0.54786885", "0.54742163", "0.54639006", "0.5455582", "0.54409415", "0.5428984", "0.5417074", "0.54011023", "0.53716034", "0.5360595", "0.535100...
0.7573449
0
Save the buffer contents in a file with the given filename
def save_as(self, filename): # Join together the buffer contents so it can be written to a file contents = "" for line in self.buffer.get_lines(): contents += line + '\n' # Attempt to open or create the file and write the contents to it try: with open(filename, 'w') as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Write(buf, filename):\n with open(filename, 'wb') as f:\n f.write(buf)", "def save_file(self, filename):\r\n \r\n f = open(filename,'w')\r\n f.write(self.body)\r\n f.close", "def write(self, filename=None):\n # Take filename and expand tilde.\n if filename is n...
[ "0.74837494", "0.707368", "0.7064249", "0.6976132", "0.66752696", "0.6646077", "0.6633993", "0.6593267", "0.65920824", "0.6573828", "0.6536589", "0.6536589", "0.65348256", "0.6523011", "0.65186787", "0.648745", "0.64630646", "0.64508384", "0.64131004", "0.63882536", "0.637275...
0.7714931
0
Return weather or not a file name has been set
def has_filename(self): if self.filename == "untitled": return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_new_file(self):\n return self.filename is None", "def filename(self) -> Optional[str]:\n ...", "def isBasedInHiddenFile(self):\n #type: () -> Optional[bool]\n return (\n None if self.realFileName is None #if before\n else self.realFileName != self.fileN...
[ "0.6959931", "0.69592226", "0.6951416", "0.68595546", "0.68428236", "0.68309575", "0.68021667", "0.67782605", "0.6746299", "0.66894406", "0.6678487", "0.6630654", "0.65806156", "0.6525225", "0.65238625", "0.65157396", "0.6504091", "0.65025294", "0.6500659", "0.64631623", "0.6...
0.8064465
0
Add a character to the buffer at the cursors current position
def add_char(self, char): if self.pos >= self.line_length(): self.buffer.append_char(char, self.line) else: self.buffer.insert_char(char, self.line, self.pos) self.pos += 1 self.has_changes = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addChar (self, c) :\r\n # Notice the \\n so we can notice when new lines begin\r\n if (c=='\\n') :\r\n self.lineNumber_ += 1\r\n self.charNumber_ = 0\r\n \r\n # Keep the last 1024 or so characters\r\n if (self.data_.full()) :\r\n self.da...
[ "0.72998464", "0.720256", "0.7192313", "0.71792465", "0.7026925", "0.6762037", "0.6726603", "0.6712365", "0.6637423", "0.662271", "0.6604135", "0.65804297", "0.6580041", "0.6575565", "0.646021", "0.6420522", "0.63929373", "0.6347639", "0.6338991", "0.63316494", "0.6328756", ...
0.80837435
0
Delete the character behind the cursor or join line to the one above
def backspace(self): # If the position is at the beggining of a line that is not the first # line then join the line to the end of the line above it. if self.pos == 0 and self.line > 0: self.pos = self.buffer.line_length(self.line - 1) self.buffer.join_lines(self.line - 1, self.line) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_forward():\r\n point().delete_right_char()", "def clear_line_after(self) -> \"Cursor\":\n self._output.write(\"\\x1b[K\")\n\n return self", "def backspace(self):\n if self.current_index > 0:\n self.current_index -= 1\n self.line[self.current_index] = gamestate...
[ "0.7527465", "0.729241", "0.7284611", "0.72036695", "0.70729005", "0.6992967", "0.6897935", "0.6848832", "0.6840378", "0.6833158", "0.6825223", "0.6706762", "0.6673771", "0.6631402", "0.6623533", "0.66097546", "0.65821445", "0.6568563", "0.65677965", "0.6565864", "0.6565159",...
0.76642966
0
Delete the character under the cursor
def delete(self): # If the position in the buffer is on a char if self.pos < self.buffer.line_length(self.line): self.buffer.delete_char(self.line, self.pos) self.has_changes = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n del self.characters[self.cursor.position]", "def delete_forward():\r\n point().delete_right_char()", "def backspace(entry):\n entry.delete_symbol()", "def _delChar(self, pos):\n nonGlyph = countInSet(self.text[:pos], self.NO_GLYPH_CHARS)\n\n self.allVertices = sel...
[ "0.82906467", "0.73986584", "0.7359406", "0.7227849", "0.7168641", "0.6955541", "0.66195863", "0.6606934", "0.65643644", "0.6553981", "0.65507", "0.65390956", "0.652098", "0.6479685", "0.6413434", "0.63415545", "0.6319842", "0.63145006", "0.6278936", "0.6263064", "0.6234896",...
0.74214077
1
Move the cursor up a line or within the line if a wrap width is given
def up(self, wrap = None): len_current = self.line_length() # If there is line wrapping if wrap: # If the position is in the top wrap of the line move it into the # last wrap of the line above it. Take into account shorter lines if self.pos < wrap and self.line > 0: len_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def down(self, wrap = None):\n len_current = self.line_length()\n \n # If there is line wrapping\n if wrap:\n wraps_current = int(len_current / wrap)\n columns_current = len_current % wrap\n \n # If the position is not in the bottom wrap of the line move it down a\n # wrap. Tak...
[ "0.7428185", "0.6528294", "0.62725735", "0.6061254", "0.6049975", "0.5999769", "0.5879037", "0.5761063", "0.57182825", "0.5612058", "0.56017333", "0.5597055", "0.5573323", "0.5563547", "0.55090386", "0.5465161", "0.5446503", "0.5443915", "0.5440159", "0.54241407", "0.5423677"...
0.8001269
0
Move the cursor down a line or within the line if wrap width is given
def down(self, wrap = None): len_current = self.line_length() # If there is line wrapping if wrap: wraps_current = int(len_current / wrap) columns_current = len_current % wrap # If the position is not in the bottom wrap of the line move it down a # wrap. Take into account...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up(self, wrap = None):\n len_current = self.line_length()\n \n # If there is line wrapping\n if wrap:\n \n # If the position is in the top wrap of the line move it into the\n # last wrap of the line above it. Take into account shorter lines\n if self.pos < wrap and self.line > 0:\...
[ "0.7282259", "0.65697646", "0.63280654", "0.6278724", "0.6258118", "0.6026035", "0.6025714", "0.59524655", "0.58828807", "0.5844057", "0.5785511", "0.57741666", "0.5715548", "0.5617951", "0.55869836", "0.5586518", "0.55736643", "0.5569546", "0.55602664", "0.5536436", "0.55340...
0.7542303
0
Move cursor right once. Wont move up if line begin is reached
def right(self): if self.pos < self.buffer.line_length(self.line): self.pos += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_right(self, step: int = 1) -> None:\n if self.cursor_pos.y < self.width - 1:\n self.cursor_pos = Point(self.cursor_pos.x, self.cursor_pos.y+step)\n else:\n self.cursor_pos = Point(self.cursor_pos.x, 0)", "def move_right(self) -> None:\n if not self.buffer:\n ...
[ "0.76631117", "0.75563663", "0.75281566", "0.7331321", "0.70240384", "0.69982034", "0.6981223", "0.69527495", "0.69527495", "0.69385767", "0.6848111", "0.6813645", "0.67973435", "0.67660815", "0.66800827", "0.66345584", "0.6620433", "0.65905064", "0.65749073", "0.6568575", "0...
0.7801659
0
Return the length of the current line or a line a given offset
def line_length(self, dLine = 0): return self.buffer.line_length(self.line + dLine)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineOffset(self):\n if self.__lineOffset is None:\n self.__lineOffset = self.__offset - self.__source.rfind(\"\\n\", 0, self.__offset) - 1\n\n return self.__lineOffset", "def __len__(self):\n nlines = self.get_endline() - self.get_startline() + 1\n if nlines < 0:\n ...
[ "0.670328", "0.6597389", "0.652373", "0.6489323", "0.6456836", "0.6371697", "0.633413", "0.6271833", "0.6259438", "0.6247852", "0.62300384", "0.61852074", "0.6146044", "0.6099755", "0.6070542", "0.6052635", "0.6051297", "0.6044246", "0.60049206", "0.59722704", "0.5970488", ...
0.7565296
0
Creates a live demonstration of the kernelization algorithm
def kernel_stream_demo(args: Dict[str, Any]): path = args["<edge_list_file>"] read_func = get_read_func_from_edgelist(path) # Set up graphs kernel_exists = True graph = read_func(path) edges = list(graph.edges) if args["--shuffle"]: shuffle(edges) k = int(args["<k>"]) kern...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n dist = \"Euclidean\"\n path = \"\"\n k_v = 2\n error = []\n k_vals = []\n\n for i in range(len(sys.argv)):\n if sys.argv[i] == \"--path\":\n path = sys.argv[i+1]\n if sys.argv[i] == \"--k\":\n k_v = int(sys.argv[i+1])\n if sys.argv[i] == ...
[ "0.6887435", "0.666323", "0.6602766", "0.65625256", "0.64616084", "0.6310591", "0.6247457", "0.6233544", "0.6176472", "0.6066823", "0.60558283", "0.60446703", "0.60367167", "0.6026387", "0.60035414", "0.5995146", "0.5965171", "0.59172124", "0.58743846", "0.5867801", "0.585712...
0.6938872
0
Apply video compression to sample `x`.
def __call__(self, x: np.ndarray, y: Optional[np.ndarray] = None) -> Tuple[np.ndarray, Optional[np.ndarray]]: def compress_video(x: np.ndarray, video_format: str, constant_rate_factor: int, dir_: str = ""): """ Apply video compression to video input of shape (frames, height, width, chan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n x = self.encoder(x)\n x = self.decoder(x)\n x = self.upsample(x)\n return x", "def compress_video(x: np.ndarray, video_format: str, constant_rate_factor: int, dir_: str = \"\"):\n import ffmpeg\n\n video_path = os.path.join(dir_, f\"tmp_vi...
[ "0.62431544", "0.61411947", "0.59244233", "0.5863686", "0.547034", "0.5356348", "0.53366745", "0.52343965", "0.5205393", "0.52026373", "0.520205", "0.5157827", "0.515539", "0.5153465", "0.51358205", "0.51312935", "0.5118787", "0.5098527", "0.5098527", "0.5097953", "0.50705427...
0.6377516
0
Apply video compression to video input of shape (frames, height, width, channel).
def compress_video(x: np.ndarray, video_format: str, constant_rate_factor: int, dir_: str = ""): import ffmpeg video_path = os.path.join(dir_, f"tmp_video.{video_format}") _, height, width, _ = x.shape # numpy to local video file process = ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, x: np.ndarray, y: Optional[np.ndarray] = None) -> Tuple[np.ndarray, Optional[np.ndarray]]:\n\n def compress_video(x: np.ndarray, video_format: str, constant_rate_factor: int, dir_: str = \"\"):\n \"\"\"\n Apply video compression to video input of shape (frames, heigh...
[ "0.7005404", "0.65108484", "0.65095425", "0.65095425", "0.6496657", "0.62425435", "0.617896", "0.61784387", "0.6174512", "0.6041225", "0.6038537", "0.60358", "0.6024578", "0.6021074", "0.60200936", "0.6014781", "0.59937036", "0.5989535", "0.59697646", "0.5966458", "0.59648705...
0.67326015
1
Retrieve lessons from the lesson pages.
def get_lessons(lesson_id): url = '{0}?cat={1}'.format(BASE_URL, lesson_id) page = requests.get(url, verify=False) soup = BeautifulSoup(page.content) output = [] for item in soup.find(id='playlist').findAll('dd'): video_id = item.find('a')['href'].split('=')[-1] title = item.find('a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lessons(self, course: str):\n\n lesson_link: Any = self.courses[course][\"link\"]\n lesson_data = self._parse_lesson(lesson_link)\n # self.courses[course][\"lessons\"] = lesson_data\n self.lessons = lesson_data", "def get_lessons(course_id, lesson=None):\n lesson_list = []\...
[ "0.7031197", "0.66613", "0.6472741", "0.6313995", "0.6297631", "0.5964357", "0.581034", "0.5612484", "0.55869335", "0.55612785", "0.54270446", "0.53654546", "0.5331647", "0.53290176", "0.53130364", "0.5286712", "0.52614826", "0.52531", "0.5216531", "0.5206971", "0.5196762", ...
0.6672646
1
Read kalman stats from file or from event info.json files. If ``from_info`` is True, read all individual event info files instead of the data file. This is also tried if the kalman stats file does not exist, which allows regenerating the kalman stats file.
def read_kalman_stats(opt, from_info=False) -> Table: path = PERIGEES_INDEX_TABLE_PATH(opt.data_dir) if path.exists() and not from_info: LOGGER.info(f"Reading kalman perigee data from {path}") kalman_stats = Table.read(path) else: rows = [] # Look for files like 2019/Jan-12/i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_raw_data(dir, matlab=False):\n\n\tcurrent_dir = os.getcwd() \n\t\n\tos.chdir(dir)\n\t\n\tfile_names = []\n\tdata = {}\n\t\n\t\n\t## For text files\n\tif not matlab:\n\t\tfiles = glob.glob('*.txt')\n\t\t\n\t\tassert len(files) > 0, 'No *.txt files found!'\n\n\t\tif len(glob.glob('*.mat')) > 0:\n\t\t\tpr...
[ "0.4899632", "0.48992625", "0.47160295", "0.437661", "0.4311666", "0.4288543", "0.42800748", "0.42469117", "0.4233831", "0.42296544", "0.42119592", "0.41696903", "0.41607457", "0.41453016", "0.4135022", "0.41290072", "0.41133738", "0.40929687", "0.40890434", "0.40732569", "0....
0.75553703
0
Get the perigee events within start/stop. This selects perigees within start/stop and then finds the span of ERs (obsid > 38000) within +/ 12 hours of perigee.
def get_evts_perigee( start: CxoTime, stop: CxoTime, stats_prev: Table ) -> List["EventPerigee"]: LOGGER.info(f"Getting perigee events between {start} and {stop}") # event_types = ["EEF1000", "EPERIGEE", "XEF1000"] cmds_perigee = get_cmds( start=start, stop=stop, type="ORBPOINT", event_type="EPE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events_between(self, starting_measure, starting_offset, ending_measure, ending_offset):\n output_events = []\n for i in range(starting_measure - 1, ending_measure - 1 + 1):\n for event in self.event_groups[i].events:\n if i == starting_measure - 1:\n i...
[ "0.6134211", "0.5756863", "0.55772746", "0.55682397", "0.5507305", "0.5474169", "0.5452615", "0.54349256", "0.54202586", "0.54048604", "0.54045105", "0.53980404", "0.5391256", "0.53887755", "0.53694963", "0.5359015", "0.5358162", "0.53519845", "0.5336736", "0.53093964", "0.53...
0.7126352
0
generates layouts for every turn reachable in tic tac toe and stores unique ones as well as noting the branching paths between them
def generate_boards(): print "Generating data, please hold on..." # a list for turns, each which is a list of boards, which are unique layouts # a completely blank layout is always the start of the game, counting for turn 0 game = [[Board(' ' * 9, 1)]] # there are at most 9 turns in a game of tic ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_double_layouts(self):\n\n # create a new game, dict for layouts and key pairs list\n game = Game(self.sourcefile)\n layout_dict = {}\n key_pairs = []\n \n # save layout per move\n for i in range(len(self.moves_set)):\n game.move(self.moves_set[i]...
[ "0.62333226", "0.575861", "0.57528615", "0.57119054", "0.569873", "0.56291664", "0.5619137", "0.5589775", "0.5571963", "0.55691195", "0.5565758", "0.55309206", "0.5498591", "0.54836804", "0.54823405", "0.54684675", "0.54012", "0.53977394", "0.53662795", "0.5365347", "0.536063...
0.74448156
0
Print a comparison of two time series (original and computed)
def print_comparison(name, dates, times, orig_data, comp_data): # Output comparison of data print(' ORIGINAL COMPUTED') print(f' DATE TIME {name.upper():>9} {name.upper():>9} DIFFERENCE') print('------- ------ --------- --------- ----------') zip_data = zip(dates, times, orig_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_comparison(name, dates, times, original_data, computed_data):\n \n # Output comparison of data\n print(' ORIGINAL COMPUTED')\n print(f' DATE TIME {name.upper():>9} {name.upper():>9} DIFFERENCE')\n print('------- ------ --------- --------- ----------')\n zip_data = zi...
[ "0.7352779", "0.648902", "0.62641907", "0.62638307", "0.6202008", "0.6156125", "0.6137342", "0.61093706", "0.5890883", "0.5816313", "0.5804589", "0.5792591", "0.5783776", "0.57681495", "0.5733674", "0.57219535", "0.57205397", "0.566985", "0.5667738", "0.56619906", "0.5653714"...
0.71664226
1
Chooses a random id of length 'length'. There are 62^'length' possible randids. For length '12', that's 10K+ years of making a guess 10 times a second to find a single random page, with a billion pages.
def randid(length=12): import random return ''.join(random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for x in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_id(length=MAX_ID_LENGTH - 1):\n arb_id = random.choice(LEAD_ID_CHARACTERS)\n for i in range(length - 1):\n arb_id += random.choice(CHARACTERS)\n return arb_id", "def generate_id(length: int = 8):\n return \"\".join(random.choices(string.ascii_uppercase, k=length))", "def _crea...
[ "0.74631286", "0.74071676", "0.7272849", "0.70104885", "0.67147696", "0.6712778", "0.66736937", "0.66303253", "0.6618916", "0.6553483", "0.65376747", "0.6533648", "0.65256494", "0.65190023", "0.65097946", "0.6489149", "0.64810395", "0.64748263", "0.6467832", "0.64407367", "0....
0.7521966
0
(bed file) > (dictionary) Goes through a bed file and generates a dictionary (bed record) containing the as the key chromosome name and as the value a list of strings each containing the start and end values.
def go_thru(bed_file): bedrecord = dict() #Create dictionary with information from this bed file #print 'Hi I just made a dictionary in which to parse the contents of your bed file' beddata = open(bed_file,'r') #print 'OK, so now I am opening your file called', bed_file thereadline= beddat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessBed(fname):\n res = {}\n iter = parseBed(fname)\n for i in iter:\n res.setdefault(i.chr,[])\n res[i.chr].append(i)\n for k in res.keys():\n res[k].sort()\n return res", "def parseBed(fname):\n \n handle=open(fname,'r')\n for line in handle:\n if l...
[ "0.6995929", "0.69823384", "0.6857566", "0.6807039", "0.67754483", "0.64668125", "0.63240325", "0.63110536", "0.6243366", "0.6156544", "0.6155014", "0.61454624", "0.6142284", "0.6125358", "0.6071565", "0.60690844", "0.6011632", "0.6009527", "0.600553", "0.5945978", "0.5937032...
0.7402694
0
Make chromosomes (the keys to the dictionary generated in go_thru() and export them as a list. Then compare the list of chromosomes to make sure that they are all present in both bed files. Export the list of K present in both files. Gets rid of chromosomes absent in one of the files.
def compare_chr(track1, track2): intersect = set(track1.keys()).intersection(set(track2.keys())) chr_list = list(intersect) #print 'comparing chromosome lists' return chr_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vennDiagram(bed1File, bed2File, only1Output=None, only2Output=None, bothOutput=None):\n\n bed1 = readJunctionsFromBed(bed1File, True)\n bed2 = readJunctionsFromBed(bed2File, True)\n\n count1 = 0\n count2 = 0\n countBoth = 0\n\n out1 = None\n if only1Output:\n out1 = open(only1Output...
[ "0.59915525", "0.5780983", "0.5709366", "0.5594828", "0.54817486", "0.5479288", "0.54211676", "0.53936136", "0.53814256", "0.53754616", "0.5370748", "0.5358605", "0.53075075", "0.52847266", "0.5281747", "0.5231825", "0.5209457", "0.5146825", "0.5144458", "0.5140907", "0.51274...
0.59735173
1
(list)(list)>(list)(list) Takes two lists consisting of start and end positions in bed file for each histone mark track, and concatenates them into a single list, then sorts them first by start or end and then by value of position.
def overlap(list1,list2): coord=[] for pos1 in list1: #print 'pos in list1 is', pos1 coord.append(('S',int(pos1.split('-')[0]), 'l1')) #print 'S is ', pos1.split('-')[0] coord.append(('E',int(pos1.split('-')[1]),'l1')) #print 'E is ', pos1.split('-')[1] #prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_sort(input_list,start,end):\n if start < end:\n mid=(start+end)//2\n merge_sort(input_list,start,mid)\n merge_sort(input_list,mid+1,end)\n return merge(input_list,start,mid,end)", "def sort(data,start,end):\n if start < end:\n partition_index=partition(d...
[ "0.5854926", "0.5793867", "0.5785533", "0.572386", "0.56655353", "0.5634396", "0.56323624", "0.5561383", "0.5551479", "0.5536983", "0.5528434", "0.55122155", "0.54951143", "0.5471806", "0.54362905", "0.542897", "0.54168636", "0.5415553", "0.53996116", "0.53777754", "0.5354802...
0.63203555
0
Filter files based on inclusion lists Return a list of files which match and of the Unix shellstyle wildcards provided, or return all the files if no filter is provided.
def IncludeFiles(filters, files): if not filters: return files match = set() for file_filter in filters: match |= set(fnmatch.filter(files, file_filter)) return [name for name in files if name in match]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infile_list(args):\n infiles = []\n for arg in args:\n infiles += glob.glob(arg)\n infiles = [pipes.quote(f) for f in infiles]\n return infiles", "def _filter_file_list(files, local_metadata, remote_metadata):\n def _is_tracked(filename, metadata):\n \"\"\"\n Is the filena...
[ "0.6862338", "0.67467535", "0.6701581", "0.66219026", "0.65032023", "0.63339174", "0.63240343", "0.6266551", "0.62537444", "0.62388927", "0.620612", "0.62047184", "0.6192042", "0.61909294", "0.6186091", "0.6183439", "0.61790496", "0.61758393", "0.6166299", "0.6145202", "0.613...
0.7507073
0
Filter files based on exclusions lists Return a list of files which do not match any of the Unix shellstyle wildcards provided, or return all the files if no filter is provided.
def ExcludeFiles(filters, files): if not filters: return files match = set() for file_filter in filters: excludes = set(fnmatch.filter(files, file_filter)) match |= excludes return [name for name in files if name not in match]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_file_list(files, local_metadata, remote_metadata):\n def _is_tracked(filename, metadata):\n \"\"\"\n Is the filename tracked in the remote metadata dict.\n The file may be not even locally tracked yet\n \"\"\"\n current_local_sha = local_metadata.get(filename, None...
[ "0.70751107", "0.69046474", "0.68281114", "0.6743084", "0.66904205", "0.66463363", "0.6558046", "0.65148014", "0.6402117", "0.6395745", "0.6389003", "0.62757593", "0.621235", "0.62065065", "0.6146359", "0.6127292", "0.60841036", "0.60451764", "0.5971961", "0.5971407", "0.5970...
0.76014906
0
CopyPath from src to dst Copy a fully specified src to a fully specified dst. If src and dst are both files, the dst file is removed first to prevent error. If and include or exclude list are provided, the destination is first matched against that filter.
def CopyPath(options, src, dst): if options.includes: if not IncludeFiles(options.includes, [src]): return if options.excludes: if not ExcludeFiles(options.excludes, [src]): return if options.verbose: print('cp %s %s' % (src, dst)) # If the source is a single file, copy it individuall...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_file(src, dst, ignore=None):\n # Sanity checkpoint\n src = re.sub('[^\\w/\\-\\.\\*]', '', src)\n dst = re.sub('[^\\w/\\-\\.\\*]', '', dst)\n if len(re.sub('[\\W]', '', src)) < 5 or len(re.sub('[\\W]', '', dst)) < 5:\n debug.log(\"Error: Copying file failed. Provided paths are invalid! src='%s...
[ "0.6933519", "0.67284834", "0.6617384", "0.6540199", "0.6409578", "0.63443166", "0.63072366", "0.62956154", "0.6293814", "0.6271471", "0.6246239", "0.60427904", "0.59695697", "0.5941309", "0.5925351", "0.5902801", "0.5888825", "0.58824974", "0.587282", "0.58454823", "0.584172...
0.7357302
0
MovePath from src to dst. Moves the src to the dst much like the Unix style mv command, except it only handles one source at a time. Because of possible temporary failures do to locks (such as antivirus software on Windows), the function will retry up to five times.
def MovePath(options, src, dst): # if the destination is not an existing directory, then overwrite it if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) # If the destination exists, the remove it if os.path.exists(dst): if options.force: Remove(['-vfr', dst]) if os.path.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mv(self, src_path, dst_path):\n try:\n postdata = codecs.encode(json.dumps({ 'src': src_path, 'dst': dst_path }), 'utf-8')\n self._urlopen('/api/fileops/move', postdata).read()\n except HTTPError as err:\n raise RuntimeError(\"Unable to move '{}' to '{}'\".format(...
[ "0.6545725", "0.6515758", "0.6515758", "0.64532274", "0.6410229", "0.6364384", "0.6355971", "0.62232614", "0.6181752", "0.61022437", "0.60913193", "0.60819167", "0.5994191", "0.59898484", "0.5962427", "0.5898883", "0.58975774", "0.587177", "0.5837211", "0.5770024", "0.5693028...
0.7736526
0
A Unix style rm. Removes the list of paths. Because of possible temporary failures do to locks (such as antivirus software on Windows), the function will retry up to five times.
def Remove(args): parser = argparse.ArgumentParser(usage='rm [Options] PATHS...', description=Remove.__doc__) parser.add_argument( '-R', '-r', '--recursive', dest='recursive', action='store_true', default=False, help='remove directories recursively.') parser.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveDirectory(*path):\n file_path = os.path.join(*path)\n if not os.path.exists(file_path):\n return\n\n if sys.platform == 'win32':\n # Give up and use cmd.exe's rd command.\n file_path = os.path.normcase(file_path)\n for _ in xrange(3):\n print('RemoveDirectory running %s' % (' '.join(\...
[ "0.67757183", "0.67640287", "0.6433328", "0.63947535", "0.633532", "0.6212685", "0.6200401", "0.61364526", "0.6127158", "0.6074084", "0.60736746", "0.60635823", "0.60595375", "0.5995567", "0.59570605", "0.5914583", "0.58932567", "0.5856356", "0.58533007", "0.5850695", "0.5818...
0.6825982
0
A Unix style zip. Compresses the listed files.
def Zip(args): parser = argparse.ArgumentParser(description=Zip.__doc__) parser.add_argument( '-r', dest='recursive', action='store_true', default=False, help='recurse into directories') parser.add_argument( '-q', dest='quiet', action='store_true', default=False, help='quiet op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zip_files(files, empty_files, output):\n with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) as ziph:\n for dest in empty_files:\n info = zipfile.ZipInfo(filename=dest, date_time=(1980, 1, 1, 0, 0, 0))\n info.external_attr = 0777 << 16L # give full access to included file\n ziph.writest...
[ "0.733347", "0.72406137", "0.7125013", "0.7061359", "0.70390105", "0.7023428", "0.70149624", "0.6967614", "0.6934503", "0.6867805", "0.6803735", "0.67500716", "0.6682049", "0.6674095", "0.6657717", "0.6655772", "0.6642757", "0.6613005", "0.66035706", "0.65900576", "0.64857435...
0.7761106
0
Creates a dictionary of features.
def to_feature_dict(self): return {feature:self.get_feature(feature) for feature in self._FEATURES}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_features(self):\n to_return = dict()\n\n to_return['bias'] = 1.0\n to_return['user:' + self.user] = 1.0\n to_return['format:' + self.format] = 1.0\n to_return['token:' + self.token.lower()] = 1.0\n\n to_return['part_of_speech:' + self.part_of_speech] = 1.0\n ...
[ "0.7605807", "0.75966465", "0.7547767", "0.73763937", "0.7233561", "0.7123075", "0.70871353", "0.7015776", "0.700296", "0.6997553", "0.694234", "0.6940923", "0.6922698", "0.6909729", "0.69082737", "0.6811572", "0.67771375", "0.67759395", "0.6761649", "0.6675939", "0.6673177",...
0.79030627
0
Method to collect Stock data from AlphaVantage Method collects the Tweets specified for the specified ticker from Tweepy and saves them.
def collect_tweets(ticker): # Authenticate Tweepy credentials auth = tweepy.OAuthHandler(settings.TWITTER_CONSUMER_KEY, settings.TWITTER_SECRET_CONSUMER_KEY) auth.set_access_token(settings.TWITTER_TOKEN_KEY, settings.TWITTER_SECRET_TOKEN_KEY) api = tweepy.API(auth) stock = Stock.objects.get(ticke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_stock_data(tickers, save=True):\n prices = pd.DataFrame()\n ts = TimeSeries(key='EY2QBMV6MD9FX9CP', output_format='pandas')\n\n for ticker in tickers:\n successful_grab = False\n ticker_daily_adj = None\n\n while successful_grab is not True:\n try:\n ...
[ "0.6157226", "0.61464995", "0.59085757", "0.5862062", "0.5860293", "0.5832759", "0.58293784", "0.57610583", "0.56994617", "0.5661048", "0.56468123", "0.5610657", "0.5573914", "0.5555875", "0.55339915", "0.5507903", "0.5481855", "0.5459223", "0.5448679", "0.5437222", "0.543092...
0.78968906
0
Register a callable object.
def register(self, obj): if not callable(obj): raise ValueError(f"object must be callable") obj_name = obj.__name__ if obj_name in self._obj_dict: pass # print(f"{obj_name} is already registered in {self.name}") # raise KeyError(f'{obj_name} is al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register( key, obj ):\n global callbacks\n callbacks[ key ] = obj", "def register(self):\n REGISTERED_FUNCTIONS[self.path] = self", "def _register_callable(\n self,\n f: Any,\n name: str,\n aggregation: bool,\n parameters: List[Tuple[str, type]],\n ret...
[ "0.6782388", "0.6430132", "0.61815214", "0.61594105", "0.6158772", "0.6114551", "0.609576", "0.608244", "0.60799956", "0.60368454", "0.5975155", "0.5974563", "0.5970224", "0.5968892", "0.5927308", "0.5923337", "0.5915322", "0.59058833", "0.5901849", "0.58824235", "0.58619", ...
0.7541181
0
Build a callable object from configuation dict.
def build_from_config( config, registry, default_args=None, match_object_args=False ): if config is None: return None assert isinstance(config, dict) and "name" in config assert isinstance(default_args, dict) or default_args is None name = config["name"] name = name.replace("-", "_") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_callable_kwargs(config: InstConf, default_module: Union[str, ModuleType] = None) -> (type, dict):\n if isinstance(config, dict):\n key = \"class\" if \"class\" in config else \"func\"\n if isinstance(config[key], str):\n # 1) get module and class\n # - case 1): \"a.b....
[ "0.58034515", "0.57293683", "0.5724343", "0.5703751", "0.5685489", "0.5578687", "0.5514746", "0.54510975", "0.54171664", "0.5389978", "0.53591245", "0.5319346", "0.53167105", "0.5313625", "0.5299541", "0.5285164", "0.5197402", "0.5194518", "0.5183609", "0.51273054", "0.511718...
0.5859784
0
Initialize a new FFMpeg wrapper object. Optional parameters specify the paths to ffmpeg and ffprobe utilities.
def __init__(self, ffmpeg_path=None, ffprobe_path=None): def which(name): path = os.environ.get_parser('PATH', os.defpath) for d in path.split(':'): fpath = os.path.join(d, name) if os.path.exists(fpath) and os.access(fpath, os.X_OK): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, executable=\"ffprobe\", global_options=\"\", inputs=None):\n super(FFprobe, self).__init__(\n executable=executable, global_options=global_options, inputs=inputs\n )", "def __init__(\n self, executable=\"ffmpeg\", global_options=None, inputs=None, outputs=None\n...
[ "0.6561802", "0.64016914", "0.6363934", "0.5849916", "0.58092856", "0.573448", "0.5698482", "0.5652191", "0.56246364", "0.55915654", "0.54411674", "0.5407398", "0.53775966", "0.5373673", "0.5371317", "0.53640306", "0.52425927", "0.5226642", "0.5160404", "0.514741", "0.5144468...
0.80697465
0
Convert the source media (infile) according to specified options (a list of ffmpeg switches as strings) and save it to outfile. Convert returns a generator that needs to be iterated to drive the conversion process. The generator will periodically yield timecode of currently processed part of the file (ie. at which seco...
def convert(self, infile, outfile, opts, timeout=10, preopts=None, postopts=None): if os.name == 'nt': timeout = 0 if not os.path.exists(infile): raise FFMpegError("Input file doesn't exist: " + infile) cmds = [self.ffmpeg_path] if preopts: cmds.exte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(from_: Path,\n to_: Path,\n *,\n force: bool = False) -> None:\n if not from_.exists():\n raise FileNotFoundError(f\"'{from_}' doesn't exist\")\n if to_.exists():\n if not force:\n raise exceptions.FileEvenExistsError(f\"'{to_}' even exist...
[ "0.56139004", "0.53700686", "0.52830744", "0.5208299", "0.51823676", "0.50471944", "0.5017532", "0.50037694", "0.49034742", "0.4880749", "0.47778627", "0.47714263", "0.4754747", "0.46861088", "0.4681197", "0.4670765", "0.46648082", "0.45863622", "0.45649004", "0.45644942", "0...
0.6806187
0
Register a new handler for a specific slash command
def register(self, command: str, handler: Any): if not command.startswith("/"): command = f"/{command}" LOG.info("Registering %s to %s", command, handler) self._routes[command].append(handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register(self, comm, handler):", "def _register_handler(self, callback, cmd, helphint, hidden, handlers,\n synonyms=(), plugin=None):\n # Register any synonyms (done before we frig with the handlers)\n for entry in synonyms:\n self._register_handler(callback...
[ "0.66050607", "0.6488118", "0.6455913", "0.63224286", "0.62794155", "0.62301844", "0.6192825", "0.61768305", "0.6152243", "0.61095166", "0.61037755", "0.60059524", "0.60009134", "0.5937418", "0.5923331", "0.59176046", "0.59151715", "0.5913708", "0.58904934", "0.58497286", "0....
0.78429383
0
Read a Waymo ego_pose file
def parse_ego_pose_file(ego_pose_file): ego_poses = {} with open(ego_pose_file, 'r') as f: for line in f.readlines(): line = line.rstrip() line = line.split(',') timestamp_micro = int(line[0]) pose = np.array([float(x) for x in line[1:]]).reshape(4, 4) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_poses(self):\n print('Loading poses for sequence ' + self.sequence + '...')\n\n pose_file = os.path.join(self.pose_path, self.sequence + '.txt')\n\n # Read and parse the poses\n try:\n self.T_w_cam0 = []\n with open(pose_file, 'r') as f:\n f...
[ "0.64440465", "0.642082", "0.6161004", "0.59746593", "0.5859893", "0.5809093", "0.5723148", "0.56689817", "0.56615466", "0.5603466", "0.5602688", "0.55753565", "0.55375", "0.5500092", "0.54698247", "0.545957", "0.5449294", "0.5443041", "0.54186076", "0.53790516", "0.53673875"...
0.75926197
0
Convert a NuScenesObject to a Bbox3D
def waymo_object_to_bbox3d(o, frame_index): return Bbox3D(o.x, o.y, o.z, o.l, o.w, o.h, o.yaw, frame=o.ref_frame, obj_type=o.obj_type, stamp=frame_index, score=o.score)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_label_to_box_3d(obj_label):\n\n fc.check_object_label_format(obj_label)\n\n box_3d = np.zeros(7)\n\n box_3d[0:3] = obj_label.t\n box_3d[3] = obj_label.l\n box_3d[4] = obj_label.w\n box_3d[5] = obj_label.h\n box_3d[6] = obj_label.ry\n\n return box_3d", "def b_transform_cube(b_ob...
[ "0.61987334", "0.61626554", "0.60703915", "0.60206556", "0.58586913", "0.57093024", "0.5580755", "0.55471516", "0.55148286", "0.5499369", "0.5482052", "0.5461504", "0.5441759", "0.54299873", "0.54185647", "0.5400274", "0.5377804", "0.5348333", "0.5327999", "0.53279144", "0.53...
0.69672847
0
this is a function that is used to verify if the Exit edit mode button is displayed in TEAMS.
def check_TEAMS_exit_edit_mode_Button(driver = None,intervalWaitForPage = None,output = None): global verify, log_path pageLoadWaitInterval = intervalWaitForPage if intervalWaitForPage != None else 5 if (driver == None or output == None): print "ERROR in check_TEAMS_exit_edit_mode_Button(): Please send webdriv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_exit(self):\n return True", "def state_preview_exit(cfg, app, win):", "def is_edit(self):\n return self._tag == 'edit'", "def exit_check(self):\n if self.changed:\n msg = \"The current object has not been saved - would you like to exit?\"\n reply = QMess...
[ "0.6533513", "0.64115244", "0.62993443", "0.6278795", "0.627007", "0.626141", "0.61285347", "0.612151", "0.60363686", "0.6028714", "0.60132474", "0.5996961", "0.59871906", "0.59546524", "0.5943055", "0.59272546", "0.5925924", "0.5906537", "0.5845683", "0.5838273", "0.582006",...
0.74778014
0
Writes all connections of a molecule into one line and returns as np array
def write_conns_in_one_line(data, N_max, n_per_conn): # write all connections of a molecule into one line data = data.groupby('molecule_name').apply(lambda x: x.values.reshape(-1)) # pad with nans mol_list = [] for i in range(len(data)): n = N_max * (n_per_conn+1) - len(data[i]) mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectivity_matrix(self):\n # TODO: make this more memory efficient by ordering i,j in code when needed.\n temp = []\n for i in range(self.n_atom):\n for j in range(i+1, self.n_atom):\n if self.bond(i, j):\n temp.append([i+1, j+1])\n sel...
[ "0.5919387", "0.58005446", "0.55780476", "0.553181", "0.5501123", "0.54834193", "0.5477078", "0.5464846", "0.533232", "0.52614045", "0.5224273", "0.52067107", "0.5179197", "0.5155321", "0.51372504", "0.5133801", "0.51067024", "0.51050067", "0.50948536", "0.5088741", "0.506080...
0.6940061
0
Standardizes scc by type and saves everything
def standardize_and_save_train(data, scc, type_data, N_max, n_per_conn, path): size = (N_max*n_per_conn - np.isnan(data).sum(axis=1)) // n_per_conn # remove size 1 molecules data = data[size!=1] scc = scc[size!=1] type_data = type_data[size!=1] size = size[size!=1] # standardize type_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _SaveSuspectedCLs(\n suspected_cls, master_name, builder_name, build_number, failure_type):\n for suspected_cl in suspected_cls:\n suspected_cl_util.UpdateSuspectedCL(\n suspected_cl['repo_name'], suspected_cl['revision'],\n suspected_cl['commit_position'], analysis_approach_type.HEURISTIC...
[ "0.53527796", "0.48657048", "0.4840384", "0.48110694", "0.4809684", "0.4795651", "0.472314", "0.47031", "0.4693356", "0.46858063", "0.46800965", "0.46186087", "0.46148878", "0.46077034", "0.46013483", "0.4600135", "0.4594256", "0.45909703", "0.45855772", "0.45818898", "0.4577...
0.6809345
0
Return the PermClass containing all permutations up to the given length.
def all(cls, max_length): return PermClass([PermSet.all(length) for length in range(max_length + 1)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permutatation_by_length(length, permutation_set):\n pass", "def guess_basis(self, max_length=6):\n assert (\n max_length <= self.max_len\n ), \"The class is not big enough to check that far!\"\n\n # Find the first length at which perms are missing.\n for length, ...
[ "0.71164477", "0.6639119", "0.6269324", "0.6241461", "0.622866", "0.616659", "0.61158764", "0.60792464", "0.6075472", "0.6008308", "0.6007796", "0.59446824", "0.59340173", "0.58739895", "0.5801515", "0.57797754", "0.5774455", "0.5759966", "0.57079226", "0.56256104", "0.560162...
0.78563213
0
Modify `self` by removing permutations that do not satisfy the `property`.
def filter_by(self, property): for length in range(len(self)): for p in list(self[length]): if not property(p): self[length].remove(p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_by(self, property):\n C = copy.deepcopy(self)\n C.filter_by(property)\n return C", "def removeDuplicate(self,permutations=True):\n ind,ok = self.testDuplicate(permutations)\n return self[ind[ok]]", "def clearProperty(*args):", "def clearProperty(*args):", "de...
[ "0.58707166", "0.5852598", "0.58254266", "0.58254266", "0.58254266", "0.58254266", "0.5796714", "0.57930195", "0.57692075", "0.5452164", "0.54516786", "0.54340243", "0.5398869", "0.5398869", "0.5398869", "0.5398869", "0.53718495", "0.5368747", "0.53646755", "0.53518665", "0.5...
0.7654139
0
Return a copy of `self` that has been filtered using the `property`.
def filtered_by(self, property): C = copy.deepcopy(self) C.filter_by(property) return C
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_filtering(self):\r\n clone = copy.deepcopy(self)\r\n clone._allow_filtering = True\r\n return clone", "def filter_by(self, property):\n for length in range(len(self)):\n for p in list(self[length]):\n if not property(p):\n self[le...
[ "0.71182835", "0.68695885", "0.62238836", "0.6067556", "0.5971925", "0.59450746", "0.588143", "0.5807814", "0.5804987", "0.5721194", "0.56818587", "0.56648064", "0.55875915", "0.55407995", "0.54704565", "0.54670125", "0.54438066", "0.5432381", "0.54123914", "0.5409055", "0.53...
0.8608328
0
Guess a basis for the class up to "max_length" by iteratively generating the class with basis elements known so far (initially the empty set) and adding elements that should be avoided to the basis. Search mode goes up to the max length in the class and prints out the number of basis elements of each length on the way.
def guess_basis(self, max_length=6): assert ( max_length <= self.max_len ), "The class is not big enough to check that far!" # Find the first length at which perms are missing. for length, S in enumerate(self): if len(S) < factorial(length): start...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_basis(self, max_length=6, search_mode=False):\n\n t = time.time()\n\n assert max_length < len(self), 'class not big enough to check that far'\n\n if search_mode:\n max_length = len(self)-1\n\n # Find the first length at which perms are missing.\n not_all_perm...
[ "0.75921", "0.61178046", "0.5979814", "0.5643039", "0.5527009", "0.5503019", "0.54588383", "0.5352529", "0.53102463", "0.5286225", "0.52744913", "0.527253", "0.52582645", "0.52432245", "0.52397716", "0.5235602", "0.5205583", "0.51763463", "0.51498365", "0.5075549", "0.5072652...
0.6833219
1
Return the union of the two permutation classes.
def union(self, other): return PermClass([S_1 + S_2 for S_1, S_2 in zip(self, other)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(set1, set2):", "def union(a, b):\r\n return list(set(a) | set(b))", "def union(a, b):\n return list(set(a) | set(b))", "def union(a, b):\n return list(set(a) | set(b))", "def _control_union(self, entities_1: List[str], entities_2: List[str]):\n return list(set(entities_1).union(se...
[ "0.6826644", "0.66227067", "0.658717", "0.658717", "0.64879555", "0.64367926", "0.6419794", "0.63842964", "0.63831425", "0.63432133", "0.6324109", "0.6324109", "0.6262606", "0.6262606", "0.62462246", "0.6229771", "0.6208712", "0.6176275", "0.6149572", "0.6138486", "0.61124706...
0.751311
0
Given a fitted classification model with feature importances, creates a horizontal barplot of the top 10 most important features.
def plot_importances(model, X_train_df, count = 10, return_importances = False, model_name = None, save_fig = False): importances = pd.Series(model.feature_importances_, index= X_train_df.columns) importances = importances.sort_values(ascending = False) top_imp = list(importances.sort_values(asce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_feature_importance(model, x_train, n=12):\n # extract and sort the feature importance\n features = model.feature_importances_\n feature_names = x_train.columns.values\n\n # combine the features importance and column names into a matrix and sort them\n feature_matrix = np.array([features, fe...
[ "0.72053033", "0.71699697", "0.7103706", "0.689223", "0.6787334", "0.676711", "0.6759439", "0.6745823", "0.6685218", "0.6671483", "0.66482466", "0.656502", "0.6540204", "0.6513533", "0.6497981", "0.64888465", "0.6476057", "0.6410694", "0.63880503", "0.63738155", "0.6222233", ...
0.72323865
0
Detects outliers using the Zscore>3 cutoff. Returns a boolean Series where True=outlier
def find_outliers_z(data): zFP = np.abs(stats.zscore(data)) zFP = pd.Series(zFP, index=data.index) idx_outliers = zFP > 3 return idx_outliers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_outlier(points, thresh=3.5):\n if len(points.shape) == 1:\n points = points[:,None]\n median = np.median(points, axis=0)\n diff = np.sum((points - median)**2, axis=-1)\n diff = np.sqrt(diff)\n med_abs_deviation = np.median(diff)\n\n modified_z_score = 0.6745 * diff / med_abs_deviati...
[ "0.7372204", "0.7347039", "0.72379816", "0.72093225", "0.7197352", "0.7143112", "0.7124173", "0.692372", "0.68723196", "0.68039775", "0.67991555", "0.6691045", "0.6686342", "0.66102344", "0.66076815", "0.6597073", "0.65257156", "0.6483273", "0.6468104", "0.645345", "0.6453088...
0.819929
0
Determines outliers using the 1.5IQR thresholds.
def find_outliers_IQR(data): res = data.describe() q1 = res['25%'] q3 = res['75%'] thresh = 1.5*(q3-q1) idx_outliers =(data < (q1-thresh)) | (data > (q3+thresh)) return idx_outliers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_outliers(x):\n outliers = np.array([])\n\n IQR = iqr(x)\n low_cut = np.percentile(x,25) - 1.5*IQR\n high_cut = np.percentile(x,75) + 1.5*IQR\n\n for sub in x.index:\n if x.loc[sub] < low_cut or x.loc[sub] > high_cut:\n # outliers = np.append(outliers,np.asarray(x == i)...
[ "0.7312946", "0.71711165", "0.7104051", "0.7031879", "0.69975835", "0.69557506", "0.69528335", "0.6874209", "0.6798811", "0.65834653", "0.6569872", "0.6486448", "0.6450941", "0.64337593", "0.64293826", "0.6391283", "0.6367405", "0.636632", "0.6259762", "0.6258333", "0.6254081...
0.7957246
0
Filters outliers from given data via the "find_outliers_IQR" function and saves filtered values to a new DataFrame
def filter_outliers(data): idx_out = find_outliers_IQR(data) cleaned = data[~idx_out].copy() # print(f'There were {idx_out.sum()} outliers.') return cleaned
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_outliers_IQR(data): \n \n res = data.describe()\n q1 = res['25%']\n q3 = res['75%']\n thresh = 1.5*(q3-q1)\n idx_outliers =(data < (q1-thresh)) | (data > (q3+thresh))\n return idx_outliers", "def filter_outliers(self, df, outlier):\n return df[~outlier].reset_index(dro...
[ "0.7899556", "0.75043386", "0.7186214", "0.71685565", "0.7134353", "0.71028703", "0.70568556", "0.7023544", "0.69353133", "0.68823826", "0.6858225", "0.68442225", "0.6770016", "0.675921", "0.669157", "0.6602507", "0.6570492", "0.6569533", "0.6558121", "0.65446496", "0.6520120...
0.84360087
0
Runs a ttest on two samples from the same independent variable; prints whether or not they are significant; and returns pvalue as a variable called "pvalue."
def ttest_review(sample_1, sample_2, alpha=.05): result = stats.ttest_ind(sample_1, sample_2) crit_val, p_val = result ## Creating interpretation based on p-value results. if p_val < .05: print(f'The feature is statistically significant with a p-value of {p_val}.') else: pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _t_test(_sample_a, _sample_b):\n res = stats.ttest_ind(_sample_a, _sample_b, axis=0, equal_var=equal_var, nan_policy='propagate')\n print('Independent t-test\\nt-statistic: {}\\np-value: {}'.format(res[0], res[1]))\n print('-' * 10)", "def calculate_t_test(mean1, mean2, var1, var2, n1, n...
[ "0.7822148", "0.71075654", "0.70718163", "0.7043813", "0.7022971", "0.6847565", "0.6847342", "0.6802037", "0.66970724", "0.667655", "0.66473764", "0.6610097", "0.65943104", "0.65460646", "0.6540486", "0.6539085", "0.65042484", "0.644084", "0.64313716", "0.64187086", "0.641236...
0.7776446
1
Plotting a figure to visualize parameter coefficients
def plot_param_coef(model, kind = 'barh', figsize = (10,5)): ## Getting coefficients as a Series params = model.params[1:] params.sort_values(inplace=True) plt.figure(figsize=figsize) # Used if large number of params ax = params.plot(kind=kind) ax.axvline() ax.set_xlabel('Coefficient') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot():\n xvals = np.arange(-50, 250, step=0.1)\n\n fig = plt.figure()\n plt.suptitle(\"Gaussian with smooth transition to power law\")\n\n A0vals = [10, 11]\n avals = [5*10**-3, 10**-3, 5*10**-4]\n ttvals = [10., 50., 100.]\n cvals = [-0.1, -0.9, -5./3., -4.]\n offset = [-30, 0.0, 30]\...
[ "0.7194646", "0.7173507", "0.6597603", "0.654072", "0.6468319", "0.64644027", "0.6439089", "0.6413635", "0.637166", "0.6341059", "0.6325652", "0.6312689", "0.63120836", "0.6265934", "0.625251", "0.6251491", "0.62430817", "0.6190655", "0.6189252", "0.61731386", "0.61717844", ...
0.7313041
0
Plots a figure to visualize parameter pvalues exceeding stated alpha.
def plot_p_values(model, kind = 'barh', figsize = (10,5), alpha = .05): pv = model.pvalues[1:] pv_high = pv[pv > alpha] pv_low = pv[pv <= alpha] pv_high.sort_values(ascending=False, inplace=True) if len(pv_high) > 0: plt.figure(figsize=figsize) # Used if large number of params ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p_plot(data,pv_index=0,alpha=0.05):\n ####if it's a pd.dataframe, rename to col header\n if isinstance(data, pd.DataFrame):\n if isinstance(pv_index, int):\n pv_index = data.columns.get_values()[pv_index]\n data =data.rename(columns ={pv_index: \"p_value\"})\n if not (np.i...
[ "0.657726", "0.6151264", "0.59895754", "0.59583163", "0.59405845", "0.5909575", "0.5869844", "0.5831743", "0.58210385", "0.5804914", "0.5795052", "0.57885706", "0.5769044", "0.5761594", "0.57519627", "0.5731968", "0.5731957", "0.5722585", "0.5717964", "0.5657798", "0.5656237"...
0.67259836
0
Evaluates the performance of a model on training data
def eval_perf_train(model, X_train=None, y_train=None): # if X_train != None and y_train != None: y_hat_train = model.predict(X_train) train_mae = metrics.mean_absolute_error(y_train, y_hat_train) train_mse = metrics.mean_squared_error(y_train, y_hat_train) train_rmse = np.sqrt(metrics.mean_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_perf_total(model, X_train, y_train, X_test, y_test):\n\n y_hat_train = model.predict(X_train)\n y_hat_test = model.predict(X_test)\n \n train_mae = metrics.mean_absolute_error(y_train, y_hat_train)\n train_mse = metrics.mean_squared_error(y_train, y_hat_train)\n train_rmse = np.sqrt(metr...
[ "0.73358834", "0.73080355", "0.72717404", "0.72445047", "0.72132945", "0.72110033", "0.71732163", "0.7143858", "0.71342355", "0.70897985", "0.7084085", "0.7028087", "0.70188946", "0.7007979", "0.6981331", "0.69766915", "0.69762504", "0.6974851", "0.6973674", "0.6969121", "0.6...
0.7601281
0
Evaluate the performance of a given model on the testing data
def eval_perf_test(model, X_test, y_test): y_hat_test = model.predict(X_test) test_mae = metrics.mean_absolute_error(y_test, y_hat_test) test_mse = metrics.mean_squared_error(y_test, y_hat_test) test_rmse = np.sqrt(metrics.mean_squared_error(y_test, y_hat_test)) test_r = metrics.r2_score(y_test, y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_model(model, X_test, Y_test, category_names):\n\n print(\"Testing Performance\")\n print(classification_report(Y_test, model.predict(X_test), target_names=category_names))\n\n #Todo cat names", "def evaluate_model(model, X_test, y_test):\n # run prediction with test data\n y_pred = mo...
[ "0.7771298", "0.76623577", "0.7547008", "0.75343114", "0.7407108", "0.73708004", "0.7349949", "0.7340081", "0.7324706", "0.73219764", "0.73095006", "0.72968715", "0.72346336", "0.7234285", "0.719979", "0.7182023", "0.71800107", "0.71700156", "0.71667916", "0.7146786", "0.7143...
0.7736204
1
Evaluates the performance of a model on training data
def eval_perf_total(model, X_train, y_train, X_test, y_test): y_hat_train = model.predict(X_train) y_hat_test = model.predict(X_test) train_mae = metrics.mean_absolute_error(y_train, y_hat_train) train_mse = metrics.mean_squared_error(y_train, y_hat_train) train_rmse = np.sqrt(metrics.mean_squ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_perf_train(model, X_train=None, y_train=None):\n\n # if X_train != None and y_train != None:\n\n y_hat_train = model.predict(X_train)\n \n train_mae = metrics.mean_absolute_error(y_train, y_hat_train)\n train_mse = metrics.mean_squared_error(y_train, y_hat_train)\n train_rmse = np.sqrt(m...
[ "0.7601281", "0.73080355", "0.72717404", "0.72445047", "0.72132945", "0.72110033", "0.71732163", "0.7143858", "0.71342355", "0.70897985", "0.7084085", "0.7028087", "0.70188946", "0.7007979", "0.6981331", "0.69766915", "0.69762504", "0.6974851", "0.6973674", "0.6969121", "0.69...
0.73358834
1
Get parameter constraints. Returns dict or sequence of dict Equality and inequality constraints. See scipy.optimize.minimize
def get_constraints(self): return ({'type': 'ineq', 'fun': lambda x: x[1] - x[2]}, {'type': 'ineq', 'fun': lambda x: x[3] - x[4]})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConstraints(self, nStates, nParams):\n # currently untested and unused\n raise NotImplementedError(\n \"constraints have not been implemented for this Experiment\")", "def objective_constraints(self, variables, mask, load, generation, reservations=None):\n constraint_list =...
[ "0.6881272", "0.66086096", "0.6579088", "0.6528492", "0.6473818", "0.64624715", "0.6349276", "0.6349276", "0.6345814", "0.6336405", "0.6333328", "0.62987316", "0.6298038", "0.6296775", "0.6277697", "0.6087487", "0.6079092", "0.60544395", "0.6052682", "0.6023962", "0.60235626"...
0.715775
0
convert to a geodataframe Uses the same parameters as array_to_dataframe
def raster_to_geodataframe(*a, **kw) -> gpd.GeoDataFrame: kw["geo"] = True return raster_to_dataframe(*a, **kw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeGeoDf(self, arr: dict):\n geometry_points = [Point(x, y) for x, y in zip(arr[\"X\"], arr[\"Y\"])]\n elevetions = arr[\"Z\"]\n df = gpd.GeoDataFrame(columns=[\"elevation\", \"geometry\"])\n df['elevation'] = elevetions\n df['geometry'] = geometry_points\n df = df.se...
[ "0.7414189", "0.7339243", "0.7252249", "0.6799631", "0.6643421", "0.6636774", "0.6576207", "0.64738333", "0.64714026", "0.6319929", "0.63041216", "0.62951463", "0.6272487", "0.62259114", "0.6190221", "0.61478746", "0.61438227", "0.61257994", "0.60967374", "0.6092033", "0.6090...
0.7731929
0
GIVEN correct item id WHEN /gs/api/v1/54590 is called THEN it returns status 200
def test_correctitemid_status200(self): config = self.__load_config() url = f"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/54590" r = requests.get(url) self.assertEqual(r.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correctitemid_correctresponsebody(self):\r\n config = self.__load_config()\r\n url = f\"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/54590\"\r\n r = requests.get(url)\r\n\r\n expected = {\r\n 'itemId': 54590,\r\n 'name': 'Sharpened Twil...
[ "0.6747325", "0.64232856", "0.62856835", "0.62728584", "0.626374", "0.6185258", "0.61106116", "0.6109352", "0.6107731", "0.6023801", "0.6018421", "0.59478205", "0.59417444", "0.5801451", "0.57989514", "0.57970667", "0.5776777", "0.57645893", "0.5755658", "0.57544607", "0.5748...
0.7938036
0
GIVEN correct item id WHEN /gs/api/v1/54590 is called THEN it returns correct message body
def test_correctitemid_correctresponsebody(self): config = self.__load_config() url = f"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/54590" r = requests.get(url) expected = { 'itemId': 54590, 'name': 'Sharpened Twilight Scale', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correctitemid_status200(self):\r\n config = self.__load_config()\r\n url = f\"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/54590\"\r\n r = requests.get(url)\r\n self.assertEqual(r.status_code, 200)", "def get_item_detail(item_id):\n pass", "def get_it...
[ "0.6074377", "0.579045", "0.57845813", "0.56190115", "0.5607293", "0.56032187", "0.55939", "0.5583104", "0.5578272", "0.55464506", "0.55355704", "0.55175406", "0.5496165", "0.54874635", "0.54852206", "0.5482914", "0.54752815", "0.5474251", "0.5472206", "0.5456713", "0.5446291...
0.67007536
0
GIVEN item id not in database WHEN /gs/api/v1/54590123 is called THEN it returns message body with error 002
def test_itemidnotindb_returnerr002(self): config = self.__load_config() url = f"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/54590123" r = requests.get(url) expected = { "ErrorCode": "E001", "ErrorMessage": "Item ID not in data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correctitemid_status200(self):\r\n config = self.__load_config()\r\n url = f\"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/54590\"\r\n r = requests.get(url)\r\n self.assertEqual(r.status_code, 200)", "def test_update_item_incorrect_id(test_client, item):\n...
[ "0.67247957", "0.644694", "0.6350344", "0.6243379", "0.62398946", "0.6226191", "0.60893637", "0.6078208", "0.60741085", "0.593693", "0.58945924", "0.5894188", "0.58937216", "0.5800409", "0.57709134", "0.5752169", "0.5729775", "0.56522334", "0.56265795", "0.5623816", "0.561192...
0.7131409
0
GIVEN item id not valid WHEN /gs/api/v1/asdfg is called THEN it returns message 404
def test_itemidnotvalid_return4042(self): config = self.__load_config() url = f"http://{config['api']['host']}:{config['api']['port']}/gs/api/v1/asdfg" r = requests.get(url) self.assertEqual(r.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_item_not_found(self):\n resp = self.app.get('/items/0')\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)", "def test_get_single_bad_item(test_client):\n\n response = test_client.get(BAD_ITEM_URL)\n\n data = json.loads(response.get_data())\n\n assert response.sta...
[ "0.7137308", "0.70888245", "0.7062536", "0.6974903", "0.69301313", "0.68988854", "0.68076444", "0.6800001", "0.6726583", "0.66637677", "0.6646029", "0.6623722", "0.66190183", "0.661218", "0.6599899", "0.65989226", "0.64434445", "0.64308655", "0.64130604", "0.6410084", "0.6410...
0.78823984
0
count number of aparitions of pattern dintrun fisier
def parse_file_count(path, args): try: fisier = open(path, 'r') except IOError: print("Nu am putut deschide fisierul :", path) return n_found = 0 pattern = args.pattern for line in fisier: if args.ignore_case: line = line.lower() pattern = patt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pattern_count(sequence, pattern):\n return len(re.findall(r'(?=' + pattern + ')', sequence))", "def count():", "def pattern_count(text, pattern):\n return len([i\n for i in range(0, len(text) - len(pattern) + 1)\n if text[i:i + len(pattern)] == pattern])", "def cou...
[ "0.7307175", "0.70045376", "0.6915059", "0.68551326", "0.6829665", "0.6796761", "0.66697985", "0.6597165", "0.65943575", "0.6564186", "0.6545753", "0.64330035", "0.6394136", "0.6371323", "0.63517815", "0.63134825", "0.62883955", "0.62866604", "0.6211942", "0.6205408", "0.6183...
0.7055671
1
Report if src and dest are different. Arguments
def check(src, perm, dest, cmds, comp, verbose=False): if comp == Cmp.differ: ansiprint(f"The file '{src}' differs from '{dest}'.", fg=Color.red, i=True) elif comp == Cmp.nodest: ansiprint( f"The destination file '{dest}' does not exist", fg=Color.black, bg=Co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equals_with_different_sources(self):\n measurement_1 = Measurement(self.metric(), sources=[{\"source_uuid\": SOURCE_ID}])\n measurement_2 = Measurement(self.metric())\n self.assertFalse(measurement_1.equals(measurement_2))", "def compare(src, dest):\n xsrc, xdest = os.path.exists...
[ "0.654689", "0.6510692", "0.61557376", "0.61256444", "0.60510474", "0.6012479", "0.59540343", "0.5925164", "0.590129", "0.588346", "0.58549356", "0.5794634", "0.57847124", "0.5747154", "0.57156837", "0.57082486", "0.5705017", "0.5698565", "0.5669838", "0.5648875", "0.56427705...
0.6719928
0
Print the difference between src and dest. Arguments
def diff(src, perm, dest, cmds, comp, verbose=False): if comp != Cmp.differ: return with open(src) as s, open(dest) as d: srcl, destl = list(s), list(d) out = unified_diff(destl, srcl, dest, src) colordiff(out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_dry_run_copy_info(source, dest):\n\n def shorten_home(path):\n expanded_home = os.path.expanduser(\"~\")\n path = str(path)\n if path.startswith(expanded_home):\n return path.replace(expanded_home, \"~\")\n return path\n\n def truncate_middle(path: str, accept...
[ "0.6709384", "0.63324916", "0.63003516", "0.62832433", "0.62829316", "0.62491095", "0.6149095", "0.5964433", "0.59323263", "0.58849573", "0.58178675", "0.5776394", "0.5690763", "0.56890917", "0.56674516", "0.5649746", "0.56477267", "0.564664", "0.562467", "0.5609834", "0.5607...
0.6461151
1
Parse a install file list. The install file list should have the name 'filelist.' or 'filelist..', where the hostname is without the domain. Both are tried, in the order given above.
def parsefilelist(verbose): user = pwd.getpwuid(os.getuid()).pw_name hostname = os.environ["HOST"].split(".")[0] filenames = [f"filelist.{user}", f"filelist.{hostname}.{user}"] installs = [] for filename in filenames: try: with open(filename, "r") as infile: for l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_filelist(self):\n if not os.path.exists(self.filelist):\n print \"couldn't find \",self.filelist\n return\n\n f = open( self.filelist, 'r' )\n flist = f.readlines()\n self.larlitefilelist = []\n for f in flist:\n if \".root\" in f:\n ...
[ "0.62899894", "0.6053552", "0.58387065", "0.56976694", "0.55428076", "0.543702", "0.5347889", "0.53217775", "0.53147715", "0.5311632", "0.52500206", "0.5237415", "0.5211338", "0.52101344", "0.51486844", "0.51301765", "0.51095843", "0.50503826", "0.50044495", "0.49863774", "0....
0.7423649
0
This function returns the price per kWh at APP
def abbott_elec(): per_kwh = 0.08 # [$/kWh] return per_kwh
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_kwh_price(supplier_with_transaction):\n\n supplier_item = supplier_with_transaction.get('supplier_detail')\n total_kwh_price = 0\n if supplier_item.get('has_time_based_kwh') and supplier_item.get('time_price'):\n # start to compute as complex\n for rec in supp...
[ "0.71423", "0.69435227", "0.6919334", "0.66548496", "0.663056", "0.6410288", "0.6407813", "0.63824", "0.6294701", "0.6294701", "0.6252796", "0.62478536", "0.6247632", "0.6194834", "0.6162884", "0.6131623", "0.61082387", "0.6062231", "0.6058075", "0.60528606", "0.6048763", "...
0.7098736
1
This function converts a mass flow rate in klbs/hr of steam to an energy in kWh. Known values are currently hard coded.
def to_kwh(m): cp = 4243.5 # specific heat of water [J/ kg K] dT = 179 # change in steam temperature [deg C] h_in = 196 # inlet enthalpy [BTU/lb] h_out = 1368 # outlet enthalpy [BTU/lb] # times 0.29307107 to convert from BTU/hr to kilowatts kwh = (m * (h_out - h_in)) * 0.29307107 return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mel2hz(mel):\n return 700 * np.exp(mel / 1127) - 700", "def mel2hz(mel):\n return 700 * (numpy.exp(mel/1127.0)-1)", "def convert_H_kJmol(en_H):\n return en_H/kJmol_H", "def convert_kJmol_H(en_kJmol):\n return en_kJmol*kJmol_H", "def mel2hz(mel):\n return 700. * (10**(mel/2595.0)-1)",...
[ "0.65070075", "0.647109", "0.6463585", "0.64307433", "0.6367391", "0.6315835", "0.6300439", "0.62821877", "0.62821877", "0.62517065", "0.62285256", "0.6186239", "0.61541593", "0.615211", "0.6126979", "0.612365", "0.612063", "0.61140716", "0.61104786", "0.6107376", "0.6066106"...
0.725068
0
This function returns the price per kwh of electricity when it is produced by solar power at the UIUC solar farm.
def solar_ppa(): per_kwh = 0.196 # [$/kWh] return per_kwh
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abbott_elec():\n per_kwh = 0.08 # [$/kWh]\n return per_kwh", "def compute_kwh_price(supplier_with_transaction):\n\n supplier_item = supplier_with_transaction.get('supplier_detail')\n total_kwh_price = 0\n if supplier_item.get('has_time_based_kwh') and supplier_item.get('time_price...
[ "0.70530295", "0.6877747", "0.6414504", "0.6401159", "0.63494396", "0.63399446", "0.6335698", "0.6288253", "0.62364966", "0.62210023", "0.6209003", "0.6197808", "0.61296284", "0.61269224", "0.60681945", "0.60333014", "0.6009466", "0.6003833", "0.59978616", "0.5968576", "0.596...
0.7044015
1
Returns the layout specified as the class attribute default_layout. Override this method to provide more complex behavior.
def get_layout(self): return self._layout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layoutDefault(self): # real signature unknown; restored from __doc__\n pass", "def layout(self) -> str:\n return self._layout", "def layout(self):\n return self._layout_manager", "def currentLayout( self ):\n return self._current_layout_name", "def getLayout(self, *args):\n ...
[ "0.7747452", "0.69015557", "0.6825233", "0.66689813", "0.66203535", "0.6539448", "0.6419217", "0.6396516", "0.63342154", "0.63152045", "0.62654394", "0.62495625", "0.62386113", "0.6141546", "0.6068759", "0.6058207", "0.602838", "0.59690404", "0.5852301", "0.5848287", "0.58481...
0.73576134
1
FindRoutes determines the shortest paths to visit the input stops and returns the driving directions, information about the visited stops, and the route paths, including travel time and distance. The tool is capable of finding routes that visit several input stops in a sequence you predetermine or in the sequence that ...
def find_routes( stops, measurement_units = """Minutes""", analysis_region = None, reorder_stops_to_find_optimal_routes = False, preserve_terminal_stops = """Preserve First""", return_to_start = False, use_time_windows = False, time_of_day = None, time_zone_for_time_of_day =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stops_on_routes_with_direction():\n routes_and_stops = {}\n routes = ['102y', '102z', '104y', '104z', '111y', '111z', '114y', '114z', '116y', '116z', '118y', '11y', '11z', '120y', '120z', '122y', '122z', '123y', '123z', '130y', '130z', '13y', '13z', '140y', '140z', '142y', '142z', '145y', '145z', '14Cy',...
[ "0.6546947", "0.6405214", "0.6124267", "0.58605796", "0.5816492", "0.5779385", "0.57356185", "0.5716994", "0.56505096", "0.5648405", "0.5640563", "0.56386757", "0.5620506", "0.55997664", "0.55781066", "0.5576032", "0.5576032", "0.5568899", "0.55527645", "0.5546889", "0.554688...
0.6941076
0
Perform one weighted dba iteration and return the new average
def _dba_iteration(tseries, ftvector, avg, weights, fs): # the number of time series in the set n = len(tseries) # length of the time series ntime = avg.shape[0] # features of avg avg_ft = ExtraFeatures(avg,fs) scaler.fit(ftvector) # number of dimensions (useful for MTS) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_weights(self):\n for feat, weight in self.weights.items():\n total = self._totals[feat]\n total += (self.i - self._tstamps[feat]) * weight\n averaged = total / float(self.i)\n self.weights[feat] = averaged\n return None", "def calculate_averag...
[ "0.6735685", "0.65043914", "0.6491874", "0.6491874", "0.6491874", "0.6479693", "0.64793587", "0.6329713", "0.6180607", "0.61702657", "0.6145819", "0.61137694", "0.6075552", "0.59591585", "0.59500974", "0.5940664", "0.5910114", "0.58602995", "0.58529896", "0.5830189", "0.58301...
0.7245355
0
team_str is either 'TEA' or 'TEA'; team code is FD code. Returns standard 3letter code.
def ParseTeam(team_str): fd_team_code = team_str[3:-4] if '<b>' in team_str else team_str return { 'SA': 'SAS', 'NO': 'NOP', 'GS': 'GSW', 'NY': 'NYK', 'BKN': 'BRK', 'CHA': 'CHO', }.get(fd_team_code, fd_team_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team(team):\n if team == \"left\":\n return \"0\"\n elif team == \"right\":\n return \"1\"\n elif team == \"spec\":\n return \"-1\"", "def get_team_alliance(event: str, match: int, team: int) -> typing.Optional[str]:\n \n if team in get_match_allian...
[ "0.6921741", "0.5983766", "0.573982", "0.5738846", "0.56040615", "0.5561792", "0.54862833", "0.54771405", "0.54294246", "0.52948797", "0.5249644", "0.51467144", "0.51280034", "0.5080651", "0.505249", "0.503452", "0.5026184", "0.5024583", "0.5010263", "0.49874726", "0.49641785...
0.7903837
0
Encode to a binary vector a list of literals
def binary_encode(self, literals): arr = np.zeros(len(self.encoder), dtype='bool') for p in literals: assert isinstance(p, Literal) arr[self.encoder[p]] = True return arr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_vector_of_t(value: list):\n return encode_u32(len(value)) + bytes([i for j in value for i in j])", "def vectorize_doc_list(docList):\n vecList = bc.encode(docList)\n return vecList", "def encode_list(L):\n return \"&\".join([\"%s=%s\" % (index, element) for index, element in enumerate(L)...
[ "0.7348028", "0.6782181", "0.6696202", "0.66823965", "0.66077155", "0.6551032", "0.65074164", "0.63473594", "0.6289376", "0.62325335", "0.61880744", "0.6120585", "0.6110631", "0.6085503", "0.6076761", "0.6076761", "0.594411", "0.5888492", "0.58595353", "0.58571666", "0.58304"...
0.70335406
1
This function reads a segment of datafile (corresponding a cycle) and generates a dataframe with columns 'Potential' and 'Current'
def read_cycle(data): current = [] potential = [] for i in data[3:]: current.append(float(i.split("\t")[4])) potential.append(float(i.split("\t")[3])) zipped_list = list(zip(potential, current)) dataframe = pd.DataFrame(zipped_list, columns=['Potential', 'Current']) return dataf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_frame(dict_cycle, number):\n list1, list2 = (list(dict_cycle.get('cycle_'+str(number)).items()))\n zipped_list = list(zip(list1[1], list2[1]))\n data = pd.DataFrame(zipped_list, columns=['Potential', 'Current'])\n return data", "def load_sep_cycles(file_name, database_name, datatype):\n #...
[ "0.5800998", "0.57862395", "0.56656605", "0.5580664", "0.5480087", "0.54421705", "0.54055905", "0.53888214", "0.5330437", "0.5316921", "0.5250387", "0.5235828", "0.5213562", "0.5127126", "0.5084637", "0.507864", "0.50635403", "0.50632465", "0.5061292", "0.5049956", "0.5040301...
0.76940286
0
This function reads the raw data file, gets the scanrate and stepsize and then reads the lines according to cycle number. Once it reads the data for one cycle, it calls read_cycle function to denerate a dataframe. It does the same thing for all the cycles and finally returns a dictionary, the keys of which are the cycl...
def read_file(file): dict_of_df = {} h_val = 0 l_val = 0 n_cycle = 0 #a = [] with open(file, 'rt') as f_val: print(file + ' Opened') for line in f_val: record = 0 if not (h_val and l_val): if line.startswith('SCANRATE'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_sep_cycles(file_name, database_name, datatype):\n #df_single = pd.read_excel(file_name,1)\n (cycle_ind_col, data_point_col, volt_col, curr_col, dis_cap_col, char_cap_col, charge_or_discharge) = col_variables(datatype)\n\n while '/' in file_name:\n file_name = file_name.split('/', maxsplit ...
[ "0.65068936", "0.60459214", "0.5898123", "0.5829248", "0.5802381", "0.5798535", "0.5600928", "0.55067945", "0.55019885", "0.5468192", "0.5442655", "0.5402407", "0.5380463", "0.535162", "0.53467834", "0.5337483", "0.5331417", "0.53102356", "0.53098416", "0.5296011", "0.5293239...
0.7742191
0
For basic plotting of the cycle data
def plot_fig(dict_cycle, number): for i in range(number): print(i+1) data = data_frame(dict_cycle, i+1) plt.plot(data.Potential, data.Current, label="Cycle{}".format(i+1)) print(data.head()) plt.xlabel('Voltage') plt.ylabel('Current') plt.legend() plt.savefig('cycle.png...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n\t\tself.plotOfLoopVoltage()", "def plot_data(self):", "def plot(self):\n pass", "def plot_graph(self) -> None:", "def multi_cycle_plot(df, cycles, colormap='viridis'):\n import matplotlib.cm as cm\n from matplotlib.colors import Normalize\n\n fig, ax = plt.subplots()\n ...
[ "0.72083366", "0.6998115", "0.6924712", "0.6818845", "0.67426956", "0.66528636", "0.6642367", "0.66289514", "0.65917873", "0.6526204", "0.6482531", "0.64119107", "0.6405369", "0.6392448", "0.638955", "0.6359681", "0.63554764", "0.63265246", "0.62756735", "0.62715703", "0.6266...
0.7004428
1
Ask for the file path to the latest banking data and load the CSV file.
def load_bank_data(): print("\n" * 8) print(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *", "\n") csvpath = questionary.text("Enter a file path to a rate-sheet (.csv):").ask() print("\n","* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self, csv_file):\n pass", "def from_csv_to_database():\r\n for year, path in FileNamePath.items():\r\n # load csv files\r\n with open(path, encoding='cp1251') as dataset:\r\n print(f\"Download {year} data\")\r\n get_curr_data(dataset, year)", "def load...
[ "0.6564447", "0.65159214", "0.6428639", "0.6289074", "0.61714965", "0.6103537", "0.60740215", "0.6071866", "0.60457027", "0.60127985", "0.5915446", "0.59071153", "0.5904035", "0.5896971", "0.5839247", "0.5829717", "0.5804731", "0.5802005", "0.5783648", "0.5783445", "0.5778229...
0.7770881
0
Prompt dialog to get the applicant's financial information.
def get_applicant_info(): credit_score = questionary.text("Enter a credit score between 300 and 850: ").ask() credit_score = number_checker(credit_score) if credit_score == False or credit_score < 300 and credit_score > 850: print("\u001b[31m", "\n") print("Credit score must be a number bet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt_user_account_to_deposit():\n print('What account do you want to deposit to?:')\n return input()", "def prompt_user_account_to_withdrawl():\n print('What account do you want to withdrawl from?:')\n return input()", "def prompt_user_money_to_deposit():\n print('What amount of money do y...
[ "0.61911684", "0.6020045", "0.5912385", "0.58639073", "0.5774324", "0.5674912", "0.5621161", "0.5588697", "0.5453837", "0.54020584", "0.526715", "0.52277637", "0.5223498", "0.52142847", "0.52134585", "0.5163553", "0.51488286", "0.51200247", "0.5119526", "0.51182854", "0.51179...
0.60426086
1
Saves the qualifying loans to a CSV file.
def save_qualifying_loans(qualifying_loans): # Usability dialog for savings the CSV Files. save_file = questionary.confirm("Would you like to save these loans to a file? y or n: ").ask() print("\n") if save_file: output = questionary.text("Please provide a name for your file. Ex: my_loans.csv: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_csv(self):\r\n # Save the read values to a csv file\r\n with open(self.fname, \"a\") as f:\r\n wr = csv.writer(f, dialect='excel')\r\n wr.writerow([self.set_time, self.read_time_P_ac, self.read_time_P_bat,\r\n self.soc0, self.set_val, self.P_a...
[ "0.6966328", "0.6870253", "0.68277895", "0.67218447", "0.6585621", "0.65582293", "0.6475791", "0.64576596", "0.64095336", "0.6373284", "0.6370008", "0.6350625", "0.63475597", "0.6340548", "0.6335227", "0.6317062", "0.62919617", "0.62722164", "0.6265656", "0.62428063", "0.6209...
0.7288751
0
Remove a preference from the config file (deprecation).
def remove(key: str): global PREFERENCES if PREFERENCES.get(key): del PREFERENCES[key] write_config(PREFERENCES)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_config(name):\n db = dbm.open(config_file, 'c')\n del db[name]\n db.close()", "def delsetting(name):\r\n if '__delattr__' in settings.__class__.__dict__:\r\n delattr(settings, name)\r\n else:\r\n delattr(settings._wrapped, name)", "def del_conf(self, path):\n\t\tself.mon...
[ "0.62867635", "0.6272085", "0.61597675", "0.5970315", "0.5912027", "0.5866205", "0.58238983", "0.5774526", "0.57573044", "0.5739794", "0.5707347", "0.56538785", "0.56532514", "0.56481534", "0.5622709", "0.5592793", "0.5589006", "0.5585213", "0.55792993", "0.55208313", "0.5513...
0.66292775
0
Set the 'data_dir' preference to 'path'
def set_data_directory(path): if not os.path.exists(path): return False set("data_dir", path) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_directory(path):\n gdc19.DATA_DIRECTORY = path\n return gdc19.DATA_DIRECTORY", "def set_kale_data_directory(path):\n global KALE_DATA_DIRECTORY\n KALE_DATA_DIRECTORY = path\n # create dir if not exists\n if not os.path.isdir(KALE_DATA_DIRECTORY):\n os.makedirs(KALE_DATA_DIRE...
[ "0.800053", "0.76913375", "0.7490734", "0.7431895", "0.7141615", "0.70857567", "0.7005862", "0.695062", "0.69113535", "0.6862172", "0.6846355", "0.6846355", "0.678642", "0.668388", "0.66111124", "0.6585328", "0.6469561", "0.6453087", "0.64228076", "0.64039373", "0.63982743", ...
0.82967794
0
Given a list of data, return the mean and standard deviation for the population.
def calc_mean_stdev(data): pop_stdev = pstdev(data) pop_mean = mean(data) return pop_mean, pop_stdev
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MeanAndStandardDeviation(data):\n n = len(data)\n if n == 0:\n return 0.0, 0.0\n mean = float(sum(data)) / n\n variance = sum([(element - mean)**2 for element in data]) / n\n return mean, math.sqrt(variance)", "def get_std_dev(self, data):\n mean = 0\n data_arr = []\n for i in da...
[ "0.787826", "0.7444271", "0.72712225", "0.72424185", "0.7205196", "0.72044545", "0.71979964", "0.71734655", "0.71105754", "0.6991602", "0.6858698", "0.68321496", "0.67950445", "0.6756606", "0.6726477", "0.6724127", "0.67069155", "0.66939294", "0.6664016", "0.66629595", "0.665...
0.7527847
1
Given a 1d array (list) of data, return the median and median absolute deviation (MAD) for the population.
def calc_median_mad(data): pop_median = median(data) mad = median([abs(x - pop_median) for x in data]) return pop_median, mad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mad(arr):\n dev = np.array(arr, copy=True)\n med = np.median(dev, overwrite_input=True)\n return np.abs(arr - med)", "def mad(array, axis=None, keepdims=False):\n ad = np.abs(array - np.median(array, axis, keepdims=True))\n mad = np.median(ad, axis, keepdims=keepdims)\n return mad", "def ...
[ "0.74380946", "0.7176177", "0.7115197", "0.70874095", "0.7085121", "0.70457613", "0.7031764", "0.70199966", "0.69804996", "0.69363016", "0.6933873", "0.6841836", "0.68270075", "0.6824112", "0.67681855", "0.67631644", "0.67438763", "0.66553277", "0.6653686", "0.65766096", "0.6...
0.83040637
0
For a given sample, return the column index of the sample in the header.
def get_sample_idx(sample, header): for item in header: if sample in item: return header.index(item) print(sample + " not found in header, check input files.") sys.exit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colnumber(self, header):\n for i in range(0, len(self.data)):\n if self.data[i][0] == header:\n return i\n return None", "def _get_header_index(self, columnname):\n\n return self.headers.index(columnname)", "def _get_header_position(header_row: List[str], ...
[ "0.76551473", "0.7203461", "0.66604096", "0.6617303", "0.64651644", "0.6426487", "0.6422889", "0.6335221", "0.6291486", "0.61781806", "0.6107511", "0.6099734", "0.60810536", "0.6061681", "0.60574603", "0.6048488", "0.5998556", "0.59846556", "0.59677076", "0.59497976", "0.5872...
0.75644857
1
Call systematic commands without return.
def callSys(cmds): for c in cmds: print c try: os.system(c) except: print "ERROR for %s" % c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_sys(cmds):\n for c in cmds:\n logger.info(c)\n try:\n os.system(c)\n except:\n logger.error(c)", "def execute(cmd) :\n return os.system( cmd )", "async def execute_system(self):\n return True", "def system(self,cmd):\n code = 'import...
[ "0.753476", "0.7109839", "0.70645314", "0.6797796", "0.6696888", "0.66589797", "0.6594726", "0.6555924", "0.65522206", "0.6532648", "0.6532648", "0.6532648", "0.6532648", "0.6515407", "0.65128255", "0.64893115", "0.64536023", "0.6442296", "0.64369935", "0.64029336", "0.638965...
0.7443336
1
Adds a plugin's template path to the templating engine
def register(name, templating=True): if name in _plugins: return import template _plugins.append(name) if templating: path = os.path.normpath(os.path.join( os.path.dirname(monkey.__file__), '../plugins/%s/templates' % name)) template.add_template_path(pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_template_renderer(\n self, plugin, template_name, context=default_context\n ):\n self._renderers[plugin] = (template_name, context)", "def render_template(self, tmpl_name, **kwargs):\n tmpl = self.tplenv.get_template(tmpl_name)\n return tmpl.render(plugin_shortname=sel...
[ "0.6625346", "0.6261574", "0.6255176", "0.6226953", "0.61784464", "0.61368513", "0.586182", "0.5861061", "0.5786961", "0.5755639", "0.5717798", "0.57148427", "0.5700025", "0.56565166", "0.5653578", "0.56479716", "0.55910724", "0.55575645", "0.5547902", "0.5537928", "0.5493132...
0.68103945
0
Calculate the intensity of the profile on a line of Cartesian x coordinates. The input xvalues are translated to a coordinate system centred on the Gaussian, using its centre.
def profile_from_xvalues(self, xvalues): transformed_xvalues = xvalues - self.centre return np.multiply( np.divide(self.intensity, self.sigma * np.sqrt(2.0 * np.pi)), np.exp(-0.5 * np.square(np.divide(transformed_xvalues, self.sigma))), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_data_1d_via_xvalues_from(self, xvalues: np.ndarray) -> np.ndarray:\r\n transformed_xvalues = xvalues - self.centre\r\n\r\n return np.multiply(\r\n np.divide(self.normalization, self.sigma * np.sqrt(2.0 * np.pi)),\r\n np.exp(-0.5 * np.square(np.divide(transformed_xvalue...
[ "0.5817927", "0.58009154", "0.5758678", "0.56605244", "0.56605244", "0.56276804", "0.5445396", "0.5339149", "0.5312613", "0.5311276", "0.5290594", "0.5287766", "0.5266982", "0.52203554", "0.52199733", "0.5217667", "0.52032644", "0.51897854", "0.5178143", "0.51761794", "0.5154...
0.7832481
0
Data type of this field. Used by backend database engines to determine proper data type for the field to be used to store the value in database.
def data_type(self): return self._data_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_type(self):\n return self._data_type", "def data_type(self):\n return self._data_type", "def data_type(self):\n return self._data_type", "def datatype(self):\n return self._datatype", "def type(self):\n return self._field.type", "def type(self) -> DataType:\n ...
[ "0.83663696", "0.83663696", "0.83663696", "0.7956471", "0.763357", "0.7620257", "0.760874", "0.7598538", "0.7489782", "0.74279207", "0.7414981", "0.74113166", "0.7327989", "0.72937167", "0.7288935", "0.72805035", "0.7219784", "0.7165743", "0.7105825", "0.6995552", "0.69875944...
0.8423037
0
Whether this field is marked unique field or not.
def is_unique(self): return self._unique
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_unique(self, field):\n return field.scheme.is_unique", "def isUnique(self):\n if self.isPrimaryKey():\n return True\n else:\n return self._unique", "def is_unique(self, field):\n old_length = len(self.archive)\n self.archive.add(self.create_hash(f...
[ "0.8676528", "0.78448015", "0.71603197", "0.69896996", "0.6803769", "0.67469114", "0.6701074", "0.66103786", "0.65689653", "0.6457723", "0.6402424", "0.6388006", "0.63483936", "0.62289506", "0.6191974", "0.6106518", "0.6102066", "0.6072309", "0.60616606", "0.60573006", "0.602...
0.8022057
1
Whether this field is indexed or not.
def is_indexed(self): return self._indexed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_indexed(self):\n return self._index is not UnindexedComponent_set", "def has_index(self):\n return self.index is not None", "def indexed(self):\n return self.properties.get('indexed', None)", "def is_indexed(self, is_indexed):\n\n self._is_indexed = is_indexed", "def has_...
[ "0.7761809", "0.73047614", "0.704352", "0.6702681", "0.65726864", "0.62959194", "0.6294209", "0.62628496", "0.61360717", "0.6107155", "0.6089513", "0.60443485", "0.60149866", "0.5958906", "0.5924591", "0.5873752", "0.58698535", "0.5807403", "0.5796295", "0.5792685", "0.576760...
0.8129757
0
Returns current (now) datetime.
def now(): return datetime.datetime.now()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_datetime ( ) :\n return datetime.datetime.now( )", "def now(self):\n return datetime.datetime.now()", "def now(self):\n return datetime.datetime.now()", "def get_now():\n return datetime.now()", "def get_now():\n return datetime.now()", "def now():\n return dateti...
[ "0.89639217", "0.8777894", "0.8777894", "0.8758675", "0.8758675", "0.87452734", "0.86252713", "0.85248846", "0.8521654", "0.84886837", "0.8479638", "0.8391757", "0.8369979", "0.83554506", "0.8245115", "0.81694186", "0.816558", "0.8131463", "0.8125974", "0.8057586", "0.8038303...
0.8958888
1
Convert a date to a datetime for datastore storage.
def _date_to_datetime(value): assert isinstance(value, datetime.date) return datetime.datetime(value.year, value.month, value.day)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_datetime(self,date):\n\n dt = datetime.datetime(date.year,date.month,date.day)\n return timezone.make_aware(dt, timezone.get_default_timezone())", "def convert_date_to_datetime(date_obj: date) -> datetime:\n # REF: https://stackoverflow.com/a/11619200\n assert isinstance(date_obj, date...
[ "0.7139093", "0.7096733", "0.7047866", "0.70283645", "0.7017522", "0.68610114", "0.68505156", "0.6844209", "0.68437934", "0.6843128", "0.6796456", "0.67830783", "0.6672014", "0.66619533", "0.6587397", "0.6580303", "0.6538514", "0.653111", "0.6497565", "0.641356", "0.64057046"...
0.75674117
0
Convert a time to a datetime for datastore storage.
def _time_to_datetime(value): assert isinstance(value, datetime.time) return datetime.datetime(1970, 1, 1, value.hour, value.minute, value.second, value.microsecond)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_datetime(time):\n split_time = time.split(':')\n hour = int(split_time[0])\n minutes = int(split_time[1])\n now = dt.datetime.now()\n time_as_datetime = dt.datetime(now.year, now.month, now.day,\n hour=hour, minute=minutes)\n\n # Need to change the da...
[ "0.76862586", "0.71638316", "0.7140985", "0.70503753", "0.7001265", "0.69803745", "0.68884057", "0.6877281", "0.67336893", "0.67133236", "0.66956383", "0.65040106", "0.64000684", "0.63857096", "0.63808364", "0.6339152", "0.63245136", "0.6307302", "0.6298653", "0.6283557", "0....
0.77680534
0