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
Send messages from socket queue to socket.
def send(self, s): try: next_msg = self.mq[s.fileno()].get_nowait() except QueueEmpty: #print >>sys.stderr, 'output queue for', s.getpeername(), 'is empty' # No messages waiting so stop checking for writability. self.outputs.remove(s) except Socket...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send(self):\n while self.socket is not None:\n try:\n data = self._get_data_from_send_queue()\n if self.socket is not None:\n header = self._create_data_header(data)\n with self.socket_lock:\n self.soc...
[ "0.7570823", "0.7434461", "0.7400673", "0.736733", "0.7216632", "0.7153784", "0.7150297", "0.6992216", "0.69611615", "0.692399", "0.6897112", "0.6851757", "0.6817943", "0.68100935", "0.6747445", "0.6745317", "0.672771", "0.6702367", "0.66685253", "0.66651344", "0.6663716", ...
0.74609864
1
Takes a route function and applies pretty_errors to it, ensuring that if the function fails when called it will throw an appropriate exception.
def make_route(*route_args, **route_kwargs): def config_pretty_errors(fn): """ :param fn: func :return: func <pretty_errors> """ fn.route_args = route_args fn.route_kwargs = route_kwargs return pretty_errors(fn) return config_pretty_errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def catch_errors(f):\n\n @functools.wraps(f)\n def func(*args, **kwargs):\n try:\n return f(*args, **kwargs)\n except HorizonError as exception:\n print_failure(f\"{str.upper(f.__name__)} request failed to successfully execute. {exception.status_code if exception else None...
[ "0.646833", "0.6162938", "0.60064167", "0.59349936", "0.5697101", "0.5608123", "0.56056154", "0.558898", "0.5550731", "0.5529519", "0.5516675", "0.5480708", "0.54793113", "0.5434496", "0.5430767", "0.5355389", "0.533879", "0.53027284", "0.528631", "0.52726746", "0.5265935", ...
0.65817827
0
Checks config of route, returning the route if authorization passes and returning an exception if not.
def requires_admin(original_route): @functools.wraps(original_route) def wrapper(config, *args, **kwargs): if "Authorization" not in request.headers: raise MissingAuthorization() auth_header_value = request.headers["Authorization"] if not auth_header_value.startswith("Bearer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_authorized(f):\n @functools.wraps(f)\n def wrapper(self, addr, request):\n if not self.sessions[addr].get(\"authorized\"):\n return Header.ERROR, Error.FORBIDDEN_REQUEST\n else:\n return f(self, addr, request)\n\n return wrapper", ...
[ "0.5924331", "0.5677408", "0.5673498", "0.5611696", "0.5605074", "0.54552543", "0.54456705", "0.5437622", "0.5402217", "0.5393605", "0.5388714", "0.5376963", "0.5369662", "0.53387743", "0.53348774", "0.53269184", "0.5319198", "0.53161675", "0.52916414", "0.5267928", "0.525631...
0.6329581
0
Will tell the user what is the level of markup available in a uniformized way. Takes as argument the level, being full / rich / basic / none To avoid making page looking strange, we will put that only on textarea where it is supposed to be the most useful
def info(level): if level == 'basic': string = _("Basic markup") text = _("Only basic text tags are available in this input field.") elif level == 'rich': string = _("Rich markup") text = _("Rich and basic text tags are available in this input field.") elif level == 'fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_to_display(level):\n if level == \"html\":\n return html_answers, html_text\n elif level == \"css\":\n return css_answers, css_text\n elif level == \"python\":\n return python_answers, python_text", "def readability(target_text):\n\n nb1 = total_words(target_text)\n n...
[ "0.6541411", "0.59189075", "0.588361", "0.5685282", "0.5556694", "0.5506273", "0.5398678", "0.537253", "0.5259121", "0.5254447", "0.522227", "0.51589924", "0.50934595", "0.50596815", "0.5027844", "0.50271535", "0.5017934", "0.50091934", "0.5007883", "0.500059", "0.50002885", ...
0.6965915
0
Internal function for recognizing and formatting headings This function is a helper for _full_markup() and should not be used otherwise.
def _headings(line, context_stack, start_paragraph): matches = re.search( # find one to four '=' signs at the start of a line '^(={1,4})' # followed by exactly one space + ' ' # followed by any character + '(.+)' # followed by exactly one space + ' ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _HandleHeading(self, input_line, match, output_stream):\n match = match.strip()\n\n # Count the equals on the left side.\n leftequalcount = 0\n for char in match:\n if char != \"=\":\n break\n leftequalcount += 1\n\n # Count the equals on the right side.\n rightequalcount = 0...
[ "0.68117684", "0.6703448", "0.6686388", "0.6641036", "0.6569948", "0.65361214", "0.6381924", "0.63551927", "0.6309079", "0.63004845", "0.6290214", "0.6246954", "0.6241416", "0.62322277", "0.6224916", "0.619095", "0.610838", "0.6089141", "0.60846764", "0.6083716", "0.6078289",...
0.7195238
0
Internal function for recognizing and formatting lists This function is a helper for _full_markup() and should not be used otherwise.
def _lists(line, context_stack, start_paragraph): matches = re.search('^\s?([*0]+) (.+)$', line) if matches is not None: # determine the list level currently in use current_list_level = 0 for context in context_stack: if context == '</ul>' or context == '</ol>': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleList(self, _): # pylint: disable=invalid-name", "def setup_list(self) -> None:\n style = self.current_line.next_line.line_parts[0].style.copy()\n\n if self.list_style is None:\n self.list_style = {}\n elif isinstance(self.list_style, str):\n self.list_style =...
[ "0.625572", "0.6235757", "0.6144444", "0.6115993", "0.61062497", "0.6073675", "0.5992033", "0.5986289", "0.59715676", "0.5956412", "0.59061575", "0.58841556", "0.5840704", "0.5832542", "0.57787555", "0.5772048", "0.57643884", "0.5758637", "0.5734864", "0.5729983", "0.57268584...
0.6597641
0
Internal function for recognizing and formatting inline tags and links This function is a helper for _full_markup() and should not be used otherwise.
def _inline(line): if len(line) == 0: return '' # Regexp of protocols supported in hyperlinks (should be protocols that # we can expect web browsers to support) protocols = "https?|ftp|sftp|file|afs|nfs" # Prepare usual links: prefix every "www." with "http://" # unless there is a // ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_links(self, text):\r\n MAX_LINK_TEXT_SENTINEL = 3000 # markdown2 issue 24\r\n\r\n # `anchor_allowed_pos` is used to support img links inside\r\n # anchors, but not anchors inside anchors. An anchor's start\r\n # pos must be `>= anchor_allowed_pos`.\r\n anchor_allowed_pos...
[ "0.57991374", "0.5778433", "0.56992257", "0.5589757", "0.5430655", "0.5376251", "0.5374833", "0.53722954", "0.53425616", "0.5325182", "0.53235716", "0.52952796", "0.5279214", "0.52436084", "0.51851094", "0.51743567", "0.51424706", "0.51421195", "0.5134545", "0.51161426", "0.5...
0.64185977
0
Creates a new password
def new_password(self): # create new password return password_generator.create_password() # have password reset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_password():\n new_pass = generate_password()\n entry_pass.delete(0, END)\n entry_pass.insert(0, new_pass)", "def create_password(self):\r\n alphabet = string.ascii_letters + string.digits\r\n password = ''.join(secrets.choice(alphabet) for i in range(30))\r\n\r\n QtWidgets.Q...
[ "0.7812141", "0.73570216", "0.7317928", "0.70469546", "0.70222723", "0.70207393", "0.7015751", "0.7004244", "0.6982175", "0.69231737", "0.68888825", "0.68539685", "0.6784342", "0.67792207", "0.67678064", "0.67359525", "0.6710755", "0.6703852", "0.6692514", "0.66761273", "0.66...
0.77939874
1
Handles a new email event
def handle_new_email(self): email = self.__email_handler.get_most_recent_email() message = self.__email_handler.get_email_body(email['id']) sender = self.__email_handler.get_email_sender(email['id']) if 'COMMAND' in message: if 'test' in message: print(f'{se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def handle_email(self, email):\n\t\tif 'logdir' in self.log_settings:\n\t\t\tfilename = 'email_%s_%s.eml' % (datetime.datetime.utcnow().isoformat(), str(uuid.uuid4()))\n\t\t\twith open(str(Path(self.log_settings['logdir'], 'emails', filename).resolve()), 'wb') as f:\n\t\t\t\tf.write(email.email.as_bytes())\n...
[ "0.69614106", "0.641426", "0.63397574", "0.62871844", "0.62519395", "0.61346054", "0.60729545", "0.6032336", "0.60047245", "0.59550864", "0.5944151", "0.5934481", "0.5925262", "0.59202504", "0.5915834", "0.59125566", "0.5903289", "0.58379304", "0.58089226", "0.57496667", "0.5...
0.77442443
0
! Clamp angles between (pi, pi] angle The angle Clamped angle
def clamp(angle): while angle > np.pi: angle -= 2 * np.pi while angle <= -np.pi: angle += 2 * np.pi return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_angle(angle):\n\n angle = (angle + np.pi) % (2 * np.pi) - np.pi\n\n return angle", "def simplify_angle(angle):\n if angle > math.pi:\n return math.pi - angle\n return angle", "def wrap_angles(angle):\n return (angle + pi) % (2 * pi) - pi", "def _confined_angle_pi(a):\n while...
[ "0.7253713", "0.7211587", "0.71298516", "0.712739", "0.7106415", "0.70632184", "0.7024957", "0.7020985", "0.7001495", "0.6973188", "0.6972748", "0.696525", "0.69315684", "0.6906103", "0.6902425", "0.6859615", "0.68486387", "0.6762119", "0.6724876", "0.6715224", "0.6715224", ...
0.7882026
0
! Gets the pose from T.
def get_pose_from_T(T): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPose(self):\n\t\treturn self.__subs['pose'].getData()", "def get_pose(self, joint_angles: dict, query_node: str) -> SE3:\n kinematic_map = self.kinematic_map\n parents = self.parents\n T_ref = self.T_zero\n T = T_ref[\"p0\"]\n for node in kinematic_map[\"p0\"][query_node...
[ "0.7187253", "0.6933531", "0.672665", "0.65035844", "0.6450835", "0.62265545", "0.6220612", "0.6193213", "0.6180652", "0.61510414", "0.61258614", "0.61116815", "0.6047407", "0.6039513", "0.5990924", "0.59187305", "0.5886028", "0.58447236", "0.5842025", "0.58301324", "0.580211...
0.8583743
0
! Convert to s matrix.
def to_s_matrix(w,v): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_matrix(self) -> types.Matrix:", "def get_stain_matrix(I):", "def convert(self, s, numRows):\n \n if numRows == 1:\n return s\n \n matrix = []\n for i in range(numRows):\n\n # Change from storing matrices of letter to strings\n # matrix....
[ "0.68945247", "0.6642457", "0.6603314", "0.6522115", "0.6472364", "0.64635885", "0.6433777", "0.6428377", "0.63919264", "0.63550717", "0.6309325", "0.6300631", "0.62582445", "0.6221067", "0.6177143", "0.61561906", "0.61437947", "0.6129541", "0.6115956", "0.61145544", "0.60799...
0.81369454
0
Returns the lowest rank approximation of A with error less than e with respect to the induced 2norm.
def lowest_rank_approx(A,e): U,s,Vh=la.svd(A,full_matrices=False) t=s.copy() t[t>e]=0 i=t.nonzero()[0][0] return U[:,:i].dot(np.diag(s[:i])).dot(Vh[:i,:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_rank_approx(A,e):", "def lowest_rank_approx(A, err):\n \n #Is this not just problem 1 repeated, just with different returns?\n \n u, d, v = compact_svd(A)\n \n s = len(d)\n for i in range(0, len(d)):\n if d[i] < err:\n s = i\n break\n \n v = v.co...
[ "0.7423881", "0.6019328", "0.6006175", "0.5983821", "0.58116776", "0.58109677", "0.57976466", "0.5749795", "0.5728308", "0.56952167", "0.56908226", "0.56268173", "0.5626445", "0.56208396", "0.5615378", "0.5576524", "0.55443656", "0.5530991", "0.5524992", "0.55179006", "0.5516...
0.68139
1
Returns `num` angles from start to end angle in degrees in counter clockwise order. All angles are normalized in the range from [0, 360).
def angles(self, num: int) -> Iterable[float]: if num < 2: raise ValueError("num >= 2") start = self.dxf.start_angle % 360 stop = self.dxf.end_angle % 360 if stop <= start: stop += 360 for angle in linspace(start, stop, num=num, endpoint=True): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_angle(n):\n return n % 360 if n > 360 else (n * 180) / PI", "def calculate_angle(start: tuple, end: tuple):\n radians = -math.atan2(end[0] - start[0], end[1] - start[1])\n return math.degrees(radians) % 360", "def degree_range(n, start=0, end=180):\n start_ = np.linspace(start, end, n+1, en...
[ "0.69789016", "0.6480122", "0.64355767", "0.63461417", "0.61619854", "0.6121664", "0.6098144", "0.60696733", "0.60160345", "0.58649814", "0.58536875", "0.5849952", "0.57118773", "0.56563556", "0.5630533", "0.5594795", "0.5569927", "0.5524123", "0.55092126", "0.55007035", "0.5...
0.7683883
0
Creates a YML file to be used as a custom exclusions template, so users can fill out the fields without needing to look up the required format.
def create_exclusions_file(output_file: str, verbosity: int) -> None: set_log_level(verbosity) with open(output_file, "a") as file_obj: for line in EXCLUSIONS_TEMPLATE: file_obj.write(line) utils.print_green(f"Success! Exclusions template file written to: {output_file}") print( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_exclusions(proteins):\n pass", "def test__create_excl_file_2(self):\n rsync = RsyncMethod(self.settings, self.meta, self.log, self.comms, False)\n rsync.settings.set('debug-level', 1)\n rsync.exclude_file = os.path.join(os.environ['HOME'],\"temp/myocp_excl\")\n rsync._...
[ "0.58035815", "0.53256804", "0.53069764", "0.5283049", "0.52198035", "0.51952946", "0.51761174", "0.5160965", "0.5155543", "0.51421845", "0.5109539", "0.51084596", "0.50987554", "0.50949365", "0.5078183", "0.50466263", "0.50214356", "0.4995813", "0.49698544", "0.4954272", "0....
0.61798495
0
Iterate over a cropped mask for each instance in an instance segmentation
def instance_submasks(gti): rc_locs = np.where(gti > 0) grouped_cc_rcs = util.group_items( np.ascontiguousarray(np.vstack(rc_locs).T), gti[rc_locs], axis=0 ) def bounding_box(rcs): rc1 = rcs.min(axis=0) rc2 = rcs.max(axis=0) return rc1, rc2 for label, rcs in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bg_mask(query_imgs, method):\n print(\"Obtaining masks\")\n segmentation_method = get_method(method)\n return [segmentation_method(img) for img in query_imgs]", "def img_process(fgMask):\n backSub = cv.createBackgroundSubtractorKNN()\n kernel1 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE,...
[ "0.63669485", "0.62147236", "0.61084807", "0.6079566", "0.60006905", "0.5989203", "0.5969494", "0.5966395", "0.591953", "0.5907332", "0.58997315", "0.5882974", "0.58462447", "0.5816596", "0.58141476", "0.58063954", "0.5799162", "0.57579124", "0.57267785", "0.5714815", "0.5706...
0.64390075
0
compute the len dp of lcs
def _lcs_dp(a, b): dp = [[0 for _ in range(0, len(b) + 1)] for _ in range(0, len(a) + 1)] # dp[i][j]: lcs_len(a[:i], b[:j]) for i in range(1, len(a) + 1): for j in range(1, len(b) + 1): if a[i - 1] == b[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lcs_len(a, b):\n dp = _lcs_dp(a, b)\n return dp[-1][-1]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m = len(x), len(y)\n return table[n, m]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m = len(x), len(y)\n return table[n, m]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m =...
[ "0.7369952", "0.72339016", "0.72339016", "0.7178741", "0.66930044", "0.65075463", "0.6326829", "0.6310558", "0.6306825", "0.6279071", "0.6263366", "0.62361485", "0.62065816", "0.61543864", "0.61426204", "0.61426204", "0.6130789", "0.6125237", "0.610565", "0.6093229", "0.60821...
0.7251978
1
compute the length of longest common subsequence between a and b
def _lcs_len(a, b): dp = _lcs_dp(a, b) return dp[-1][-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longestCommonSubsequence(self, text1: str, text2: str) -> int:\n if len(text1) == 0 or len(text2) == 0:\n return 0\n if text1[0] == text2[0]:\n return 1 + self.longestCommonSubsequence(text1[1:], text2[1:])\n else:\n return max(self.longestCommonSubsequence...
[ "0.77036387", "0.7551531", "0.7479743", "0.74269044", "0.74152994", "0.739756", "0.7195203", "0.71844494", "0.70629114", "0.7058059", "0.7053145", "0.7036421", "0.69795805", "0.69477475", "0.69437826", "0.69384384", "0.6936886", "0.69272065", "0.6915973", "0.68329513", "0.680...
0.7914411
0
Takes a list of WebElements and a search string, looks for string in the text of each WebElement, and press the option if found. Returns Boolean for found status
def _refine_search(search_str, options): search_str = search_str.upper() logging.info(f'Looking for \'{search_str}\'') try: for option in options: option_text = option.text.upper() logging.info(f'Option Checked: {option_text}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_search(self):\n html_element = self.find_element_by_xpath(\n '/html/body').get_attribute('outerHTML')\n soup = Scraper(html_element)\n\n elms_obj = soup.find_search_enable_btn()\n\n for tag, target in elms_obj.items():\n if len(target) > 0:\n ...
[ "0.6565995", "0.6007825", "0.5899171", "0.588052", "0.58556384", "0.5773957", "0.5702507", "0.5661538", "0.56134385", "0.5523983", "0.5489346", "0.5425644", "0.5402936", "0.53933203", "0.5385448", "0.5371235", "0.53526896", "0.53496426", "0.53259146", "0.53237027", "0.5322532...
0.74813646
0
Gathers the data that is deeper within the website by calling self._deep_data(url) for each record found during the general search in self.get_data()
def _gather_deep_data(self): cleaned_data_from_website = list() for i, search_result in self.data_from_website.iterrows(): cleaned_data_from_website.append(self._deep_data(search_result.url)) cleaned_data_from_website = pd.DataFrame(cleaned_data_from_website) if len(cleane...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deep_data(self, url):\n def _nested_persons(persons):\n _persons = list()\n for person_ in persons:\n person_ = [r.text.split(', ') for r in person_.find_all(class_='default-text')]\n person = {'name': person_[0][0].title()}\n if len(pe...
[ "0.6764181", "0.6504204", "0.6407108", "0.6405198", "0.6028385", "0.6017134", "0.60075647", "0.5994258", "0.5978083", "0.59313196", "0.588016", "0.5875708", "0.58599573", "0.58480936", "0.5798911", "0.57943964", "0.5777602", "0.57580256", "0.5734268", "0.5704545", "0.5704199"...
0.7611993
0
Attempts to find the github config file.
def _github_config(self, config_file_name): home = os.path.abspath(os.environ.get('HOME', '')) config_file_path = os.path.join(home, config_file_name) return config_file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findconfigfile():\n\n # A ordered list of possible config files\n configfiles = [\"~/.githubhooksrc\",\n \"/etc/githubhooks\"]\n\n for configfile in configfiles:\n if os.path.isfile(os.path.expanduser(configfile)):\n return os.path.expanduser(configfile)\n\n # N...
[ "0.78150916", "0.7267893", "0.6513972", "0.64564544", "0.64560837", "0.640976", "0.63672173", "0.62919074", "0.6254891", "0.6234435", "0.62150365", "0.6196737", "0.6164332", "0.614716", "0.61321723", "0.61281306", "0.60862803", "0.606665", "0.60641634", "0.6059604", "0.605909...
0.7761752
1
Take a URL, generate a unique filename, save the image to said file and return the filename.
def save_image(url): ext = url.split('.')[-1] filename = IMAGEDIR+os.sep+hashlib.md5(url.encode('utf-8')).hexdigest()+'.'+ext if os.path.exists(filename): return filename try: content = urlopen(url).read() f = open(filename,'wb') f.write(content) f.close() ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_image(filename: str, img_url: str) -> None:\n\n if not (os.path.isfile(filename)): # Check if the file already exists\n print('Downloading image {}...'.format(img_url))\n res = requests.get(img_url) # Download the image.\n res.ra...
[ "0.7339656", "0.72139686", "0.7092204", "0.7006235", "0.69701207", "0.68517417", "0.6776711", "0.67724454", "0.6753113", "0.6721219", "0.6714699", "0.67063594", "0.66669434", "0.6656108", "0.6643168", "0.66106606", "0.65638", "0.6506329", "0.6501225", "0.6394256", "0.63756764...
0.8284375
0
Extract all the profile page links from this index page.
def enumerate_profiles(inhandle, page): html = inhandle.read() soup = BeautifulSoup(html, 'html.parser') urls = [ node.find('a')['href'] for node in soup.findAll('h1', {'class':'entry-title'})] return urls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles_search(pages: list, session: requests.Session):\n result = []\n for page in pages:\n sleep(1)\n soup = BeautifulSoup(session.get(page).text, \"lxml\")\n table = soup.find(\"table\", class_=\"seaman-list-table va-top seaman-list-table-2\")\n for rows in table.find_all(...
[ "0.5955885", "0.5873089", "0.58373713", "0.5822768", "0.5612937", "0.5595032", "0.55749434", "0.55528224", "0.55278695", "0.55123425", "0.5501893", "0.5496583", "0.5495312", "0.5468743", "0.54336965", "0.54304", "0.54241014", "0.54207915", "0.5416719", "0.539653", "0.5382196"...
0.68228364
0
Walk the index pages, harvesting the profile URLs, and then download and process all the profiles stored under this year and month.
def gather_all_profiles(year, month): page = 1 urls = [] print("{}-{} : Begin indexing.".format(year, month)) while (page > 0): urlstring = "http://scamdigger.com/{}/{}/page/{}".format(year,month,page) jitter = random.choice([0,1]) try: urlhandle = urlopen(urlstring) urls += enumer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape(startyear, startmonth, endyear, endmonth):\n year = startyear\n month = startmonth\n while (not (year == endyear and month == endmonth)):\n ys = \"{}\".format(year)\n ms = \"{:02d}\".format(month)\n gather_all_profiles(ys,ms) \n if month == 12:\n year += 1\n month = 0\n month...
[ "0.64442813", "0.62138397", "0.58489907", "0.56789356", "0.5665456", "0.56577927", "0.5597599", "0.55777854", "0.5560226", "0.5555722", "0.55447924", "0.55403745", "0.552134", "0.5456203", "0.5386207", "0.53852963", "0.5349402", "0.53458893", "0.5320046", "0.52948135", "0.529...
0.795587
0
Tests if the constructor handles JSON correctly. That is, set the content of each language to the value given in the serialized JSON.
def test_constructor_serialized_json(self): content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(content, use_default_for_empty=True) self.assertEqual(structure["nb"], "test-nb") self.assertEqual(structure["en"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json(self, inputfile):\n transtransfile = json.load(inputfile)\n self.language = transfile['lang']\n self.translations = transfile['strings']", "def __init__(self, langConf: str) -> None:\n with open(r\"localization\\localization.json\", \"rt\", encoding=\"utf-8\") as lang:\n ...
[ "0.6162473", "0.60640824", "0.59679496", "0.5962652", "0.59325093", "0.5919701", "0.5907977", "0.5876794", "0.5847541", "0.5780988", "0.5777279", "0.57638365", "0.57590663", "0.57392234", "0.56996155", "0.5672908", "0.5637319", "0.5626917", "0.56231356", "0.5613871", "0.55942...
0.73586935
0
Tests the ``__str__()`` method. It should return the value of the current language of the thread.
def test_str(self): previous_language = translation.get_language() content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(content, use_default_for_empty=True) translation.activate("nb") self.assertEqual(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unicode(self):\n thread = mommy.prepare('connectmessages.Thread')\n self.assertEqual(str(thread), \"Thread %s\" % thread.subject)", "def test_i18n11(self):\n output = self.engine.render_to_string('i18n11', {'bool': True})\n self.assertEqual(output, 'ja')", "def language(sel...
[ "0.63634586", "0.59879065", "0.5887455", "0.5887455", "0.5860573", "0.5837954", "0.58233184", "0.5784177", "0.5774993", "0.57586485", "0.5745439", "0.5724829", "0.5685965", "0.56742054", "0.56568784", "0.56481004", "0.56409115", "0.5639232", "0.5605423", "0.56049037", "0.5604...
0.6393691
0
Tests the ``to_python()`` method. It should return ``None`` (if ``None`` given), the object if ``MultiLingualTextStructure``, or the object converted to ``MultiLingualTextStructure`` otherwise.
def test_to_python(self): field = MultiLingualTextField() self.assertEqual(None, field.to_python(None), "to_python of None should always return None.") content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_db_value(self):\n field = MultiLingualTextField()\n\n result_none = field.from_db_value(None, None, None)\n self.assertEqual(MultiLingualTextStructure, type(result_none),\n \"from_db_value should always be of type MultiLingualTextStructure\")\n self...
[ "0.57009166", "0.56299824", "0.55680037", "0.5488348", "0.5338049", "0.53207386", "0.5283834", "0.51322764", "0.5092174", "0.50363445", "0.5033038", "0.502039", "0.4997337", "0.49939436", "0.49646625", "0.4963914", "0.4873973", "0.4870973", "0.48417282", "0.48417282", "0.4840...
0.8195778
0
Tests the ``get_prep_value()`` method. This should return ``None`` (if ``None`` given), serialized JSON of its content if ``MultiLingualTextStructure`` is given, or just the value otherwise.
def test_get_prep_value(self): field = MultiLingualTextField() self.assertEqual(None, field.get_prep_value(None), "get_prep_value of None should always return None.") content = { "nb": "test-nb", "en": "test-en", } structure = MultiLingualTextStructure(js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_db_value(self):\n field = MultiLingualTextField()\n\n result_none = field.from_db_value(None, None, None)\n self.assertEqual(MultiLingualTextStructure, type(result_none),\n \"from_db_value should always be of type MultiLingualTextStructure\")\n self...
[ "0.66328865", "0.6586675", "0.64637977", "0.6134948", "0.610983", "0.606463", "0.6057703", "0.60523206", "0.60322195", "0.60241705", "0.59964967", "0.58020043", "0.5756462", "0.575159", "0.5704311", "0.566441", "0.56615865", "0.5536008", "0.5517607", "0.5486199", "0.54026115"...
0.835836
0
Tests the ``from_db_value()`` method. Which should always return a ``MultiLingualTextStructure``.
def test_from_db_value(self): field = MultiLingualTextField() result_none = field.from_db_value(None, None, None) self.assertEqual(MultiLingualTextStructure, type(result_none), "from_db_value should always be of type MultiLingualTextStructure") self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_python(self):\n field = MultiLingualTextField()\n self.assertEqual(None, field.to_python(None), \"to_python of None should always return None.\")\n\n content = json.dumps({\n \"nb\": \"test-nb\",\n \"en\": \"test-en\",\n })\n\n structure = MultiL...
[ "0.66070205", "0.65070033", "0.5828789", "0.5672591", "0.55029804", "0.5491402", "0.5434026", "0.53811914", "0.5304458", "0.5277097", "0.5271622", "0.52714705", "0.526597", "0.52633446", "0.52534556", "0.5252944", "0.5239474", "0.52332056", "0.52197295", "0.5208889", "0.51865...
0.8323718
0
Tests the ``compress()`` method. We can assume that the data passed is valid data, as the data is cleaned for each individual field before being passed to the method.
def test_compress(self): form_field = MultiLingualFormField() compressed_data = form_field.compress(["test-nb", "test-en"]) self.assertEqual(MultiLingualTextStructure, type(compressed_data)) self.assertEqual(compressed_data['nb'], "test-nb") self.assertEqual(compressed_data['en']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress():\n print('Testing compress')\n\n # Cases given to test this problem\n assert_equals('c1o17l1k1a1n1g1a1r1o2',\n hw1.compress('cooooooooooooooooolkangaroo'))\n assert_equals('a3', hw1.compress('aaa'))\n assert_equals('', hw1.compress(''))\n\n # Additional cases ...
[ "0.7139627", "0.66479385", "0.6284567", "0.62130433", "0.60791487", "0.5939703", "0.5841159", "0.5840814", "0.5834568", "0.5802215", "0.57965", "0.57555175", "0.5736981", "0.5707062", "0.56178164", "0.56031865", "0.55972594", "0.5589935", "0.555559", "0.5528295", "0.54627", ...
0.7089348
1
Converts old style lists to the new easier to understand format.
def convert_old_style_list(list_): if not isinstance(list_, (tuple, list)) or len(list_) != 2: return list_, False first_item, second_item = list_ if second_item == []: return [first_item], True try: # see if second item is iterable iter(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_parser(self, old_list):\n for i, item in enumerate(old_list):\n if isinstance(item, dict):\n old_list[i] = Yaco(item)\n elif isinstance(item, list):\n old_list[i] = self._list_parser(item)\n else:\n pass\n return ...
[ "0.6803961", "0.67613524", "0.6736399", "0.65787864", "0.6547683", "0.63027596", "0.6184645", "0.61626476", "0.6118478", "0.5990201", "0.5983553", "0.5979835", "0.58792496", "0.58595496", "0.5827031", "0.5819523", "0.5810015", "0.58020484", "0.58003056", "0.57974803", "0.5787...
0.6782985
1
Sets the preview_vendor_hash of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def preview_vendor_hash(self, preview_vendor_hash): self._preview_vendor_hash = preview_vendor_hash
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor_reference(self, vendor_reference):\n\n self._vendor_reference = vendor_reference", "def vendor(self, vendor):\n\n self._vendor = vendor", "def __init__(self, preview_vendor_hash=None, preview_action_string=None, derived_item_categories=None): # noqa: E501 # noqa: E501\n\n self...
[ "0.54515517", "0.49631733", "0.4793878", "0.469866", "0.45657286", "0.43995756", "0.43969625", "0.43132776", "0.4206586", "0.41582528", "0.41371256", "0.41370988", "0.41018575", "0.40580624", "0.40572527", "0.40495327", "0.40088585", "0.40035468", "0.399779", "0.39702928", "0...
0.8130399
0
Sets the preview_action_string of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def preview_action_string(self, preview_action_string): self._preview_action_string = preview_action_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_previewable(self, previewable):\n self._is_previewable = bool(previewable)", "def __previewEditor(self, checked):\n Preferences.setUI(\"ShowFilePreview\", checked)\n self.previewStateChanged.emit(checked)", "def __init__(self, preview_vendor_hash=None, preview_action_string=None, d...
[ "0.49170393", "0.48936027", "0.48737937", "0.46655303", "0.45847452", "0.45847452", "0.44724616", "0.44220495", "0.44209763", "0.44209763", "0.44209763", "0.44209763", "0.44209763", "0.44209763", "0.4420819", "0.43746156", "0.43392828", "0.42996767", "0.4286542", "0.4258411", ...
0.8190341
0
Sets the derived_item_categories of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def derived_item_categories(self, derived_item_categories): self._derived_item_categories = derived_item_categories
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(self, categories):\n self._categories = categories", "def fill_tab_categories(self):\n self.category.fill_tab_categories(self.list_categories, self.mycursor, self.my_database)", "def on_category(self):\n super(ToolSettings, self).on_category()\n selItems = self.tw_cat...
[ "0.42504486", "0.41763225", "0.41738588", "0.4147597", "0.4145194", "0.41436017", "0.41436017", "0.41436017", "0.41436017", "0.41305125", "0.41266572", "0.41144997", "0.40753424", "0.40561587", "0.38878268", "0.38473186", "0.3840825", "0.38260534", "0.38147235", "0.37995836", ...
0.7910564
0
Return list of recIDs matching query for PVALUE and FVALUE.
def get_recids_matching_query(pvalue, fvalue): rec_id = list(search_pattern(p=pvalue, f=fvalue, m='e') - INTBITSET_OF_DELETED_RECORDS) return rec_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_values(self, value):\n return [\n obj for obj in self if obj == value\n ]", "def values(self):\n if '%' in self.starid:\n query = \"\"\"SELECT * from ngc2236 where starid like '%s'\"\"\" % self.starid\n else:\n query = \"\"\"SELECT * from ngc22...
[ "0.5373899", "0.51960784", "0.51567584", "0.5128959", "0.5087617", "0.50727177", "0.49959168", "0.49717903", "0.49696368", "0.49286002", "0.49211693", "0.4917529", "0.48955002", "0.48827276", "0.48814398", "0.48741", "0.48672736", "0.4864506", "0.48131928", "0.48071274", "0.4...
0.7764384
0
return the last excution date of bibrank method
def get_bibrankmethod_lastupdate(rank_method_code): query = """select last_updated from rnkMETHOD where name ='%s'""" % rank_method_code last_update_time = run_sql(query) r = last_update_time[0][0] if r is None: return "0000-00-00 00:00:00" return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lastdate(self):\n if hasattr(self, \"_lastdate\"):\n return self._lastdate\n else:\n return None", "def _format_last_br_date(self, data):\n raise NotImplementedError", "def _get_eur_gbp_last_daily(self) -> None:\n data = _get_ecb_data(FREQUENCY_DAILY, _ten_...
[ "0.62563515", "0.6135235", "0.5993334", "0.59568703", "0.58971405", "0.5813312", "0.58071977", "0.57964516", "0.577513", "0.576336", "0.5753354", "0.57206935", "0.5710407", "0.5695503", "0.56912684", "0.56911653", "0.56623274", "0.5656828", "0.56515944", "0.5618803", "0.56027...
0.6489557
0
Create a list of record ids out of RECIDS. The result is expected to have ascending numerical order.
def create_recordid_list(rec_ids): rec_list = [] for row in rec_ids: rec_list.append(row[0]) return rec_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_recordIds(self):\n record_ids = []\n for item in self.order_items:\n record_ids.append(item.get_recordId())\n \n return record_ids", "def get_rsids(input_file: str) -> list:\n\n column_names: list = [\"rsid\", \"chr\"]\n # catching the error if the file do...
[ "0.71660554", "0.6755276", "0.6567358", "0.6502151", "0.6431556", "0.6394535", "0.6390275", "0.6199647", "0.61650753", "0.603711", "0.5996257", "0.5975088", "0.5970256", "0.5936337", "0.5927022", "0.58693117", "0.5824793", "0.58174443", "0.5816194", "0.5816194", "0.58141625",...
0.7744344
0
scans the collections searching references (999C5x fields) and citations for items in the recid_list returns a 4 list of dictionaries that contains the citation information of cds records
def get_citation_informations(recid_list, config): begin_time = os.times()[4] d_reports_numbers = {} #dict of recid -> institute-given-report-code d_references_report_numbers = {} #dict of recid -> ['astro-ph/xyz'] d_references_s = {} #dict of recid -> list_of_the_entries_of_this_recs_bibliography d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_references(cls, pmids):\n\n references = cls.query.filter(cls.pmid.in_(pmids)).all()\n citations = {}\n\n for reference in references:\n citation_text = reference.authors + \". (\" + str(\n reference.year) + \"). \" + reference.title + \" \" + reference.journa...
[ "0.64813673", "0.6178384", "0.60846525", "0.6077381", "0.6043557", "0.59674054", "0.59034324", "0.58734137", "0.58487546", "0.58361", "0.5798192", "0.5778596", "0.57374436", "0.563813", "0.5604259", "0.5579555", "0.556315", "0.5559273", "0.5546832", "0.5529941", "0.5516851", ...
0.690522
0
Traverses citedbydict in order to build "which author is quoted where" dict. The keys of this are author names. An entry like "Apollinaire">[1,2,3] means Apollinaire is cited in records 1,2 and 3.
def get_author_citations(updated_redic_list, citedbydict, initial_author_dict, config): #sorry bout repeated code to get the tags tags = ['first_author', 'additional_author', 'alternative_author_name'] tagvals = {} for t in tags: try: x = config.get(config.get("rank_method", "functi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_citedby_author(self):\n inv_search = 'citedby:author:doggy'\n spi_search = 'find citedby author doggy'\n self._compare_searches(inv_search, spi_search)", "def get_publications_by_author(cached_list, cached_set, author_name):\n publications = { 'dblp': [], 'cdblp':...
[ "0.5992074", "0.59668666", "0.5799877", "0.57464516", "0.5611583", "0.5566841", "0.5525199", "0.55247015", "0.548933", "0.5444908", "0.54439306", "0.53777725", "0.533273", "0.53153", "0.5309737", "0.5296748", "0.5278362", "0.5263696", "0.5235916", "0.5218292", "0.520415", "...
0.63774025
0
Insert the reference and citation list into the database
def insert_cit_ref_list_intodb(citation_dic, reference_dic, selfcbdic, selfdic, authorcitdic): insert_into_cit_db(reference_dic,"reversedict") insert_into_cit_db(citation_dic,"citationdict") insert_into_cit_db(selfcbdic,"selfcitedbydict") insert_into_cit_db(selfdic,"selfci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_into_citation_table(citations):\n cursor = connection.cursor()\n cursor.execute(\n 'DROP TABLE IF EXISTS Citations;'\n 'CREATE TABLE Citations(sourcePaperId INT, targetPaperId INT, citationId INT NOT NULL AUTO_INCREMENT PRIMARY KEY);'\n )\n cursor.close()\n i = 0\n\n for ...
[ "0.6965884", "0.68262", "0.6096341", "0.5778446", "0.5740313", "0.5732281", "0.5607799", "0.5572235", "0.55622476", "0.5558603", "0.5553385", "0.5523789", "0.5512726", "0.5501871", "0.54990745", "0.54926753", "0.5489177", "0.54863644", "0.547148", "0.5466431", "0.54623103", ...
0.7009089
0
get a named citation dict from the db
def get_cit_dict(name): cdict = {} try: cdict = run_sql("select object_value from rnkCITATIONDATA where object_name = %s", (name,)) if cdict and cdict[0] and cdict[0][0]: dict_from_db = deserialize_via_marshal(cdict[0][0]) return dict_from_db ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_citation(cit):\n if cit is not None:\n if cit['citation-type'] == \"BIBTEX\":\n return pybtex.database.parse_string(cit['citation-value'], \"bibtex\")\n return None", "def get_author_by_name(self, name):\n\n cur = self.conn.cursor()\n query = 'SELECT author_id , n...
[ "0.6046626", "0.5950197", "0.5847985", "0.58434343", "0.56926155", "0.5684362", "0.5674185", "0.5558614", "0.5495795", "0.54895663", "0.54638165", "0.5446902", "0.5430732", "0.53450066", "0.53339255", "0.53142464", "0.5296164", "0.5265383", "0.5264633", "0.525944", "0.5246737...
0.7352711
0
read author>citedinlist dict from the db
def get_initial_author_dict(): adict = {} try: ah = run_sql("select aterm,hitlist from rnkAUTHORDATA") for (a, h) in ah: adict[a] = deserialize_via_marshal(h) return adict except: register_exception(prefix="could not read rnkAUTHORDATA", alert_admin=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def popAuthors(self):\r\n# cur = self.dbConn.execute(\"SELECT * FROM People WHERE PersonID>0 ORDER BY Lastname\")\r\n# res = cur.fetchall()\r\n res = self.dbConn.execute(\"SELECT * FROM People WHERE PersonID>0 ORDER BY Lastname\").fetchall()\r\n\r\n self.authorList = [formatNameSQL(ln) ...
[ "0.62463015", "0.61490846", "0.61244714", "0.60036224", "0.5967608", "0.5937393", "0.59214526", "0.58278465", "0.57877076", "0.5739218", "0.56823266", "0.5649391", "0.5615111", "0.5582629", "0.5582394", "0.55806595", "0.5542368", "0.551917", "0.5470549", "0.5453344", "0.54351...
0.62780523
0
put the referingrecordnumpublicationstring into the "we are missing these" table
def insert_into_missing(recid, report): report.replace('"','\'') try: srecid = str(recid) wasalready = run_sql("select id_bibrec from rnkCITATIONDATAEXT where id_bibrec = %s and extcitepubinfo = %s", (srecid,report)) if not wasalready: run_sql("i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_NR(self, w2, row):\n row['NR'] = None\n return True", "def addMissingData():\n\n conn = sqlite3.connect(\"./transactions.db\")\n\n person = pd.read_sql(\n \"\"\"\n select * from person;\n \"\"\",\n conn,\n )\n\n record = pd.read_sql(\n \"\"\"\n sel...
[ "0.53357", "0.5239754", "0.50661397", "0.5053511", "0.50410986", "0.5036657", "0.49877408", "0.49684855", "0.4958167", "0.4932847", "0.49291137", "0.49014091", "0.48973417", "0.4891694", "0.48872414", "0.48609567", "0.48588482", "0.48420462", "0.4841088", "0.4835849", "0.4823...
0.5318926
1
Print the contents of rnkCITATIONDATAEXT table containing external records that were cited by NUM or more internal records. NUM is by default taken from the E command line option.
def print_missing(num): if not num: num = task_get_option("print-extcites") write_message("Listing external papers cited by %i or more internal records:" % num) res = run_sql("SELECT COUNT(id_bibrec), extcitepubinfo FROM rnkCITATIONDATAEXT \ GROUP BY extcitepubinfo HAVING COUNT(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_icd(self):\n wiki = wikipediaapi.Wikipedia('en') # may as well declare this here so I don't need to call it every query\n supplemental_articles = []\n with open(ICD10_DESC_PATH, 'r') as f:\n current_family = [] # list of lists of descriptions within the current family ...
[ "0.5283312", "0.47920322", "0.47803637", "0.46489966", "0.46426672", "0.46010867", "0.45646727", "0.4531334", "0.45046958", "0.4470535", "0.44359282", "0.44248855", "0.4385767", "0.43826196", "0.43532607", "0.43172917", "0.43149775", "0.43144825", "0.43024385", "0.4301603", "...
0.6221545
0
Change the default mute channel
async def mutechannel(self, ctx, channel: str): self.data_check(ctx) server = ctx.message.server self.riceCog2[server.id]["mutechannel"] = channel dataIO.save_json(self.warning_settings, self.riceCog2) await self.bot.say("Mute channel is now: **{}**".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mute():\n request_command(tv_command=TVCommand.mute)", "def default_channel(self) -> int:\r\n ...", "def set_mute(self, track, xclip, ident, value = None):\n if track in self.song().tracks + self.song().return_tracks:\n if value in KEYWORDS:\n track.mute = KEYWORD...
[ "0.7295328", "0.6866574", "0.6760169", "0.6758767", "0.6718204", "0.6717659", "0.6620619", "0.66025364", "0.6576043", "0.6554529", "0.65053433", "0.6501649", "0.63496584", "0.63457906", "0.6340219", "0.6328525", "0.63152057", "0.6284532", "0.62723064", "0.6257629", "0.6211458...
0.70745873
1
Enable/disable poop emojis per warning.
async def poop(self, ctx): self.data_check(ctx) server = ctx.message.server true_msg = "Poop emojis per warning enabled." false_msg = "Poop emojis per warning disabled." if 'poop' not in self.riceCog2[server.id]: self.riceCog2[server.id]['poop'] = True msg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(msg):\n click.secho(msg, fg='yellow')", "def setwarnings(self, on):\n # diese Funktion macht eigentlich nichts, ist aber wegen der Kombatibilitaet vorhanden\n print(f\"setwarnings: {on}\")", "def set_warning_message(msg):\n set_message(msg, TYPE_WARNING)", "def has_off_hoo...
[ "0.63431257", "0.6311446", "0.621013", "0.6048843", "0.5918886", "0.58901507", "0.5880735", "0.5856378", "0.58473855", "0.5842127", "0.57939774", "0.57764214", "0.570237", "0.5690204", "0.5689262", "0.5648402", "0.5623375", "0.5589387", "0.5582981", "0.5559005", "0.55539805",...
0.6676167
0
Sets the max amount of warnings before banning.
async def max(self, ctx, limit: int): self.data_check(ctx) server = ctx.message.server self.riceCog2[server.id]["max"] = limit dataIO.save_json(self.warning_settings, self.riceCog2) await self.bot.say("Warn limit is now: \n{}".format(limit))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_limit(self, errors):\n self.limit = errors", "def fail_max(self, number: int) -> None:\n self._fail_max = number", "def _set_maximum(self):\n self._level_gen.maximum_length = self._maximum_length_spinbox.value()\n self._refresh_view()", "def setMaxValue(self, max_value):\r...
[ "0.654042", "0.6494923", "0.63911724", "0.6374496", "0.6374496", "0.6314424", "0.6293381", "0.6276372", "0.6223776", "0.6200474", "0.61566263", "0.61486197", "0.6118835", "0.61178505", "0.60785073", "0.60785073", "0.6045971", "0.5990604", "0.59866846", "0.5978304", "0.5973961...
0.6651524
0
Resets all the warnings settings for this server
async def reset(self, ctx): self.data_check(ctx) server = ctx.message.server author = ctx.message.author channel = ctx.message.channel await self.bot.say("Are you sure you want to reset all warn settings" "for this server?\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_vo_warnings():\n from . import converters, xmlutil\n\n # -----------------------------------------------------------#\n # This is a special variable used by the Python warnings #\n # infrastructure to keep track of warnings that have #\n # already been seen. Since we want to ...
[ "0.68874204", "0.65978855", "0.6572569", "0.6325455", "0.63219196", "0.62956953", "0.6222221", "0.61653787", "0.61171895", "0.6100748", "0.6072838", "0.60411966", "0.60370195", "0.60248387", "0.6020337", "0.6015415", "0.5992785", "0.59782493", "0.5889527", "0.5887495", "0.587...
0.66391146
1
Denies a user from the channel
async def deny(self, ctx, user: discord.Member, *, reason: str=None): self.data_check(ctx) server = ctx.message.server try: defchannel = self.riceCog2[server.id]["defchannel"] except: defchannel = default_channel try: channelmute = self.riceCog...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def disable_channel(self, ctx, *channels: discord.TextChannel):\n channels = channels or (ctx.channel, )\n await ctx.guild_profile.permissions.disable_channels(channels)\n await ctx.send_line(f\"{ctx.emotes.web_emotion.galka} Bot commands and messages has been disabled in specified ch...
[ "0.69338185", "0.68326753", "0.682705", "0.6726867", "0.6698459", "0.6673625", "0.66391855", "0.6590681", "0.65880615", "0.65470666", "0.64331543", "0.6412375", "0.6392064", "0.6370616", "0.63519317", "0.6321365", "0.62852055", "0.6254562", "0.6250523", "0.62453526", "0.61793...
0.74400556
0
Removes punish data entry and cancels any present callback
def _unpunish_data(self, member): sid = member.server.id if sid in self.json and member.id in self.json[sid]: del(self.json[member.server.id][member.id]) self.save() if sid in self.handles and member.id in self.handles[sid]: self.handles[sid][member.id].cance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel():", "def cancel(self):", "def cancel(self):", "def cancel(self):", "def cancel_callback(self):\n pass", "def cancel(self, membership, callback=None):", "def do_uncancel(self):\r\n self.write({'cancelled': False})", "def cancel(self):\n pass", "def cancel(self):\n ...
[ "0.6778489", "0.6743055", "0.6743055", "0.6743055", "0.6619101", "0.64514035", "0.6446926", "0.64341253", "0.6416389", "0.6308036", "0.624216", "0.61661917", "0.6153994", "0.61392665", "0.61392665", "0.612689", "0.6091708", "0.6091708", "0.6056875", "0.6044779", "0.6020259", ...
0.67897874
0
Run when new channels are created and set up role permissions
async def on_channel_create(self, channel): if channel.is_private: return role = await self.get_role(channel.server) if not role: return await self.setup_channel(channel, role)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setup(self, ctx):\n\n role = discord.utils.get(ctx.guild.roles, name=\"Muted\")\n if role is None:\n return await ctx.send(\"Please create a role named Muted first.\")\n\n for channel in ctx.guild.channels:\n if isinstance(channel, CategoryChannel) or not channe...
[ "0.7146165", "0.68709385", "0.6730583", "0.6636552", "0.6552904", "0.65434235", "0.65048385", "0.64970624", "0.6481724", "0.6449556", "0.62814", "0.6266619", "0.6255693", "0.61546755", "0.60685056", "0.6037555", "0.5989652", "0.59686875", "0.595024", "0.5941272", "0.5921272",...
0.7162985
0
Check username is valid or not
def _check_username(self, username): if self.username_regex.search(username) is not None: print("Correct username") return True else: print("Wrong username") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_username(u):\n return u and USER_RE.match(u)", "def verify_username(entered_username):\n return USER_RE.match(entered_username)", "def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, username)", "def validate_username(username):\r\n\r\n\t\tmi...
[ "0.8540924", "0.84600514", "0.8454873", "0.8400678", "0.8395739", "0.8378274", "0.835083", "0.8337027", "0.833407", "0.8324205", "0.8316021", "0.8305803", "0.8281563", "0.82359076", "0.8227417", "0.81931025", "0.81915444", "0.81847", "0.8122291", "0.8110087", "0.8095193", "...
0.8756299
0
Compute the transition / transversion ratio between 2 sequences.
def transition_transversion_ratio(sequences): transitions, transversions = 0, 0 for a1, a2 in zip(*sequences): if a1 != a2: #  Transition if a1 in "AG" and a2 in "AG" or a1 in "CT" and a2 in "CT": transitions += 1 # Transversion else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition_transversion_ratio(dna1: str, dna2: str):\n transition, transversion = transition_transversion(dna1, dna2)\n return transition / transversion", "def exchange_ratio(delta_x, salience, power, dominator):\n\treturn (delta_x * salience * power) / dominator", "def _transition_prob(self, s1, a, ...
[ "0.8323357", "0.62570876", "0.6213251", "0.61981666", "0.6193696", "0.61392045", "0.61392045", "0.6120389", "0.6106429", "0.6084141", "0.6046681", "0.6008842", "0.60011595", "0.59921587", "0.598164", "0.5934761", "0.589579", "0.58842206", "0.5883075", "0.5879665", "0.5867718"...
0.7914035
1
Generates the mask of the word from the given user_guesses
def calculate_mask(user_guesses, word_to_guess): global mask mask = "" for x in range(0, len(word_to_guess)): if (user_guesses.find(word_to_guess[x]) >= 0): mask += " " + word_to_guess[x] + " " else: mask += " _ " return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_game(secret_words):\n\n\tattempts=0\n\tword_index = random.randint(0,5)\n\tword_to_guess = secret_words[word_index]\n\tglobal mask\n\tmask = \" _ \" * len(secret_words[word_index])\n\tget_input(mask, word_to_guess, user_guesses, attempts, valid_characters, secret_words)\n\treturn", "def word_dropout_mask...
[ "0.6145267", "0.55371237", "0.5457871", "0.544683", "0.5324564", "0.5304264", "0.5295999", "0.5285798", "0.5249013", "0.5234574", "0.5182182", "0.51685196", "0.51628315", "0.51548034", "0.51431024", "0.51308537", "0.5128906", "0.5116537", "0.51101696", "0.50996196", "0.502091...
0.8276276
0
Alter the point stored in the location while preserving the labware. This returns a new Location and does not alter the current one. It should be used like
def move(self, point: Point) -> "Location": return Location(point=self.point + point, labware=self._given_labware)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_new_location(self, xPos, yPos):", "def modifyPoint(self, *args, **kwargs):\n ...", "def m_location_set(self, x: int, y: int):\n pass", "def location(self, value: 'Point'):\n self.geometry.location = value", "def recenter(self, point=(0, 0)):\n self.center = Point(*point)...
[ "0.661706", "0.63484883", "0.6068533", "0.5985974", "0.59611905", "0.5945547", "0.58425283", "0.5842109", "0.581971", "0.5759998", "0.5724651", "0.5713874", "0.5662971", "0.56431365", "0.56431365", "0.5604625", "0.5598623", "0.5560133", "0.55441254", "0.5518262", "0.5507544",...
0.65251315
1
Convert from Mount to MountType.
def from_hw_mount(mount: Mount) -> MountType: mount_map = {Mount.LEFT: MountType.LEFT, Mount.RIGHT: MountType.RIGHT} return mount_map[mount]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mount(self, pipette_id: str) -> MountType:\n return self.get(pipette_id).mount", "def getmount_fstype(mypath):\n\n mountpoint = getmount(mypath)\n return get_fs_type(mountpoint)", "def _map_disk_type(cls, str_, bytes_):\n if cls._disk_type is str:\n return str_\n e...
[ "0.5845511", "0.5704253", "0.5299916", "0.52844036", "0.5283897", "0.52315843", "0.5139465", "0.50554425", "0.49810398", "0.49688968", "0.49646065", "0.49543053", "0.49525708", "0.4931082", "0.49108684", "0.48887324", "0.4857151", "0.4855912", "0.4779727", "0.47393698", "0.47...
0.6864618
0
Return this deck slot as an OT2style integer. For example, `SLOT_5.as_int()` and `SLOT_C2.as_int()` are both `5`.
def as_int(self) -> int: return int(self.to_ot2_equivalent().value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_int2(self):\n pass", "def to_int(self) -> int:\n return self.as_int", "def _to_int(self, int_or_card):\r\n if isinstance(int_or_card, Card):\r\n return int_or_card.rank\r\n return int_or_card", "def as_int(self):\n return self.as_type(int)", "def __int_...
[ "0.6547093", "0.63039523", "0.6207353", "0.6067822", "0.59474325", "0.58910245", "0.58675194", "0.572092", "0.5703209", "0.56286436", "0.55955744", "0.5529529", "0.54366064", "0.54061234", "0.53951293", "0.53948313", "0.53841794", "0.5375675", "0.53724205", "0.5355614", "0.53...
0.6906462
0
Return the OT2 deck slot that's in the same place as this one. For example, `SLOT_C2.to_ot3_equivalent()` is `SLOT_5`. If this is already an OT2 deck slot, returns itself.
def to_ot2_equivalent(self) -> DeckSlotName: return _ot3_to_ot2.get(self, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ot3_equivalent(self) -> DeckSlotName:\n return _ot2_to_ot3.get(self, self)", "def slot(self):\n if self.__slot in ApexAP1000.SLOTS:\n return self.__slot\n else:\n raise ValueError('Bad slot number !')", "def get_slot_component(cls, game_object: GameObject) -> U...
[ "0.6851262", "0.58110386", "0.5605592", "0.5500018", "0.5497896", "0.5495197", "0.54897475", "0.54409796", "0.5350285", "0.532955", "0.5259792", "0.51436996", "0.513631", "0.5116294", "0.5075363", "0.5049088", "0.5044446", "0.4984714", "0.4939728", "0.49273053", "0.49171132",...
0.74479717
0
Return the OT3 deck slot that's in the same place as this one. For example, `SLOT_5.to_ot3_equivalent()` is `SLOT_C2`. If this is already an OT3 deck slot, returns itself.
def to_ot3_equivalent(self) -> DeckSlotName: return _ot2_to_ot3.get(self, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ot2_equivalent(self) -> DeckSlotName:\n return _ot3_to_ot2.get(self, self)", "def get_slot_definition(self, slot: DeckSlotName) -> SlotDefV3:\n deck_def = self.get_deck_definition()\n\n for slot_def in deck_def[\"locations\"][\"orderedSlots\"]:\n if slot_def[\"id\"] == slot...
[ "0.6961423", "0.5790581", "0.5603988", "0.5503632", "0.54033476", "0.53143436", "0.5178085", "0.5116715", "0.5105875", "0.50771475", "0.5001423", "0.49345815", "0.49188447", "0.4890326", "0.48857033", "0.4864505", "0.48465264", "0.47963408", "0.4761921", "0.47075292", "0.4696...
0.7585782
0
Return the deck slot, for the given robot type, that's in the same place as this one. See `to_ot2_equivalent()` and `to_ot3_equivalent()`.
def to_equivalent_for_robot_type(self, robot_type: RobotType) -> DeckSlotName: if robot_type == "OT-2 Standard": return self.to_ot2_equivalent() elif robot_type == "OT-3 Standard": return self.to_ot3_equivalent()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ot2_equivalent(self) -> DeckSlotName:\n return _ot3_to_ot2.get(self, self)", "def to_ot3_equivalent(self) -> DeckSlotName:\n return _ot2_to_ot3.get(self, self)", "def get_card(self, slot):\n return self._starting_card[slot]", "def slot(self):\n if self.__slot in ApexAP1000....
[ "0.57639176", "0.5484779", "0.5414658", "0.5228143", "0.52212596", "0.5173648", "0.51055133", "0.5066155", "0.50325835", "0.5013481", "0.49902755", "0.49877372", "0.4972233", "0.4970885", "0.49407965", "0.4862588", "0.4862588", "0.48622948", "0.48213482", "0.48135367", "0.472...
0.7401026
0
This slot's unique ID, as it appears in the deck definition. This can be used to look up slot details in the deck definition. This is preferred over `.value` or `.__str__()` for explicitness.
def id(self) -> str: return self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slot(self):\n if self.__slot in ApexAP1000.SLOTS:\n return self.__slot\n else:\n raise ValueError('Bad slot number !')", "def unique_id(self) -> str:\n return self.get_unique_id(wallet=self.wallet_id, nonce=self.nonce)", "def unique_id(self):\n return _spac...
[ "0.699074", "0.6705826", "0.66845423", "0.66596943", "0.665877", "0.66267174", "0.65879273", "0.6586923", "0.65740407", "0.652181", "0.6519821", "0.6513885", "0.65122163", "0.6506125", "0.6506125", "0.6482951", "0.6482902", "0.6473385", "0.6457439", "0.6447112", "0.6447112", ...
0.68129075
1
Initilize a Neural Network with Relu activation
def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1): super(ReluNet, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.hidden_dim = hidden_dim self.num_laye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_relu_activation(self):\n self.assertEqual([0, 0.5], list(\n af.Relu().output(np.array([-0.5, 0.5]))))\n self.assertEqual([0, 1], list(\n af.Relu().derivative(np.array([-0.5, 0.5]))))", "def setUp(self):\n self.OR_Neuron = Neuron([12, 12], Sigmoid().activate, bi...
[ "0.7209816", "0.68366754", "0.68006027", "0.6610276", "0.66101855", "0.65917623", "0.656505", "0.65629226", "0.65553737", "0.65376914", "0.6473628", "0.64719105", "0.6467027", "0.64669657", "0.6407283", "0.6388062", "0.6372672", "0.63701034", "0.6360551", "0.6339228", "0.6334...
0.7240907
0
Test that the deck is created properly
def deckCreated(self): deck = self.deckLoader.loadDeck() self.assertTrue(all([item in deck for item in self.items]), "Each item in the deck initializer should be in the deck")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDeckInit(self):\n # Test Deck getter and itialization\n cardObj = Card('5','s')\n deckObj = Deck()\n deck = deckObj.get_deck()\n self.assertEquals(str(cardObj), str(deck[4]))", "def create_uno_deck():\r\n pass", "def test_get_deck(self):\n my_deck = get_deck...
[ "0.78386056", "0.78181976", "0.7817289", "0.7801003", "0.75754887", "0.75214285", "0.7520781", "0.7493928", "0.74697274", "0.7254102", "0.72316784", "0.7188871", "0.7113905", "0.7106764", "0.7088169", "0.7034932", "0.698655", "0.6961691", "0.69396377", "0.6931241", "0.6816131...
0.791016
0
Function to retry a DB API call if connection error was received.
def _retry_on_connection_error(exc): if isinstance(exc, db_exception.DBConnectionError): LOG.warning("Connection error detected. Retrying...") return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retry(self, f):\n count = 0\n while True:\n try:\n return f()\n # http://initd.org/psycopg/docs/module.html#psycopg2.DatabaseError\n # handle operational error - memory allocation, unexpected disconnect\n except psycopg2.OperationalError...
[ "0.73419887", "0.6960886", "0.69570464", "0.6805043", "0.6794781", "0.6770773", "0.6732037", "0.67143106", "0.6712517", "0.6708021", "0.66556174", "0.6591946", "0.65695596", "0.649803", "0.6485051", "0.6459989", "0.6438161", "0.6438161", "0.64346737", "0.64284915", "0.6415064...
0.78459245
0
Count the number of artifacts for the tenant.
def count_artifact_number(self, context, type_name=None): session = api.get_session() return api.count_artifact_number(context, session, type_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_deployments_count(self):\n pass", "async def count(self) -> int:\n return (\n await self.document_model.get_motor_collection().count_documents(\n self.get_filter_query()\n )\n )", "def get_datasets_count(request):\n organization_id = req...
[ "0.70028967", "0.6253097", "0.62479025", "0.61345184", "0.6010261", "0.5917181", "0.58992636", "0.58735883", "0.58410645", "0.58410645", "0.58410645", "0.58410645", "0.5840967", "0.5840093", "0.58336943", "0.581419", "0.5799123", "0.5788795", "0.57787454", "0.5770824", "0.576...
0.6987582
1
Calculate the amount of uploaded data for tenant.
def calculate_uploaded_data(self, context, type_name=None): session = api.get_session() return api.calculate_uploaded_data(context, session, type_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_storage(self):\n return self._total_storage", "def total_files_to_process(self) -> float:\n return pulumi.get(self, \"total_files_to_process\")", "def calculate_total_size(apps, schema_editor):\n Data = apps.get_model(\"flow\", \"Data\")\n for data in Data.objects.all():\n ...
[ "0.64483", "0.63534814", "0.62647516", "0.61787975", "0.5975532", "0.5971462", "0.59702533", "0.59611386", "0.5929874", "0.591614", "0.5898222", "0.58712864", "0.5854661", "0.582835", "0.58092016", "0.5807339", "0.57871646", "0.57760394", "0.5766214", "0.5758709", "0.57416147...
0.6580297
0
Transmits a message across the socket
def transmit(self, msg): # send our message to the client self.conn.sendall(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self, message):\r\n\t\tself.__tcpSocket.write(message.encode('utf8'))", "def send(message):\n\tmessage = message.encode()\n\tconn.send(message)", "def transmit(self, message):\n pass", "def send(self, message):\n self.sock.send(message)", "def send_message(self, message):\n\n...
[ "0.798556", "0.7861458", "0.7852766", "0.78308", "0.7751874", "0.765345", "0.76362926", "0.7619916", "0.7607291", "0.7594528", "0.7582208", "0.7561715", "0.7410909", "0.7372731", "0.7353522", "0.7350811", "0.7322519", "0.7300317", "0.7277413", "0.725539", "0.72407967", "0.7...
0.8276167
0
Endpoint triggering plant watering on user request
def post_watering() -> Response: try: payload = request.get_json() response = activate_watering( env_vars["twilio_account_sid"], env_vars["twilio_auth_token"], env_vars["twilio_supersim_sid"], payload["quantity_ml"], ) with get_cursor(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n policies = json.loads(self.request.get('policies'))\n request = json.loads(self.request.get('request_json'))\n response = json.loads(self.request.get('response_json'))\n\n maybe_notify_backend('LEASED', response['hostname'], policies)\n maybe_notify_lessee(request, response)", "d...
[ "0.5578581", "0.5462895", "0.5353694", "0.5348839", "0.5341505", "0.5335219", "0.5324055", "0.5320257", "0.52994764", "0.5296214", "0.52925473", "0.52828044", "0.52616644", "0.5255552", "0.5255112", "0.52539307", "0.52539307", "0.52539307", "0.52539307", "0.52539307", "0.5253...
0.55854774
0
Endpoint receiving an image and querying Plant.id to identify the plant species
def identify_plant(): if "file" not in request.files: return jsonify( message=f"Bad Request: file missing", status_code=400, error_type="Bad Request", ) file = request.files["file"] # if user does not select file, browser also # submit a empty part wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equipment_by_id_image(self):\n pass", "def cmd_image_id(client, args):\n image = client.get_image(args.image_id)\n data = image.__dict__\n generate_output({'image': data})", "def testimage_handler(self):\n\t\t\n\t\tthings = Thing.objects.all()\n\t\tif len( things ):\n\t\t\tthing = thin...
[ "0.5888729", "0.58802485", "0.5856984", "0.57904935", "0.56651866", "0.5609407", "0.55560356", "0.5510127", "0.5479047", "0.5466157", "0.54660016", "0.5436323", "0.5421763", "0.54160196", "0.54146", "0.5403488", "0.5400763", "0.53866816", "0.5370986", "0.53696334", "0.5364186...
0.70259756
0
Set up a manager with an empty L{Listener} L{WeakKeyDictionary}, an empty eventQueue, and a timer used for timestamps.
def __init__(self,eventTimer,debugger): from weakref import WeakKeyDictionary self.listeners = WeakKeyDictionary() self.eventTypesToListeners = WeakKeyDictionary() self.eventQueue = [] self.eventTimer = eventTimer self.debugger = debugger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, timer: Timer):\n self.all_event_notifier = AllEventNotifier()\n self.empty_queue_event_notifier = EmptyQueueEventNotifier(self.all_event_notifier)\n self.end_trading_event_notifier = EndTradingEventNotifier(self.all_event_notifier)\n self.scheduler = Scheduler(timer)"...
[ "0.67159414", "0.63050383", "0.626442", "0.6218855", "0.6203074", "0.6143775", "0.6116397", "0.5990086", "0.5908518", "0.59002894", "0.5810577", "0.575337", "0.5748086", "0.57281965", "0.5724485", "0.56653446", "0.5642506", "0.55996543", "0.5587808", "0.5581674", "0.5570367",...
0.6799975
0
Registers a listener with the event manager to be nofitied when the events in the attribute eventTypes of the listener are received.
def registerListener( self, listener ): for evType in listener.eventTypes: self.eventTypesToListeners.setdefault(evType,[]).append(listener) self.listeners[ listener ] = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, event_type, listener, priority=50):\n if type(event_type) not in [int, str]:\n event_type = fqcn(event_type)\n\n if event_type not in self.listeners:\n self.listeners[event_type] = 99 * [None]\n\n if not self.listeners[event_type][priority]:\n ...
[ "0.66918576", "0.64830554", "0.644387", "0.644145", "0.6406527", "0.63426816", "0.6330731", "0.62404734", "0.62347907", "0.6183672", "0.6178377", "0.61638117", "0.59902275", "0.59348255", "0.5913496", "0.5893763", "0.58693016", "0.57966113", "0.5740057", "0.5663427", "0.56596...
0.7047778
0
loop for print bates men personal score.
def personal_scores(self,BATESMEN): for team in BATESMEN: print("\n"+team) for batesmen in BATESMEN[team]: print(batesmen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_score():", "def print_scores(self):\n ### FILL IN ###", "def score_display():\n data = score_reader()\n for index, datum in enumerate(data):\n score_format = \"%s ...... %s/%s\" % (datum[0].capitalize(), datum[1], datum[2])\n print(score_format)", "def print_scores(self):\...
[ "0.7387781", "0.67674154", "0.65090066", "0.643027", "0.6418636", "0.6384892", "0.63276595", "0.6233606", "0.62122846", "0.618866", "0.6184044", "0.61717796", "0.6169131", "0.613882", "0.6125767", "0.60773987", "0.60144097", "0.5996277", "0.5973306", "0.5938897", "0.5928707",...
0.7688414
0
Computes the immediate counterfactual regret at each information set for each player. This is defined as 1 / T max_a \sum_{t=1}^T \sum_{h \in I} u_i^{sigma^t}(ha) u_i^{sigma^t}(h), where u_i^sigma(h) is the counterfactual value to player i = player(I) of being in node h.
def compute_immediate_regret(game: extensive_game.ExtensiveGame, strategies: List[extensive_game.Strategy]) -> \ (List[float], List[Dict[Any, float]]): all_info_set_regrets = [] for t, strategy in enumerate(strategies): node_regrets = collections.defaultdict(dict) # This function fills i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_player_score():\n\n progress_bar = ProgressBar(label=\"Computing universes\")\n\n survivals_count = 0\n for i in range(PARALLEL_UNIVERSES_COUNT):\n if simulate_universe():\n survivals_count += 1\n progress_bar.set_progression((i + 1) / PARALLEL_UNIVERSES_COUNT)\n\n ...
[ "0.53083366", "0.50491804", "0.503973", "0.5003304", "0.5000362", "0.49662566", "0.4949448", "0.4948674", "0.4944811", "0.49384162", "0.4934841", "0.49127766", "0.49112374", "0.49108008", "0.48997846", "0.48962733", "0.48750165", "0.4851145", "0.48397088", "0.48348284", "0.48...
0.556017
0
Computes the expected utility of the given node for each player. This is defined as v_i(sigma, h) = sum_{z in Z_h} u_i(z) pi^sigma(h, z), where Z_h is the set of terminal nodes with h as a prefix, and pi^sigma(h, z) is the product of all probabilities in the strategy profile sigma on the route from h to z.
def compute_expected_utility_recursive( game: extensive_game.ExtensiveGame, node: extensive_game.ExtensiveGameNode, sigma_1: extensive_game.Strategy, sigma_2: extensive_game.Strategy, expected_utility_1: Dict[extensive_game.ExtensiveGameNode, float], expected_utility_2: D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_utility(sim,sol,par):\n\n # unpack\n u = sim.utility\n \n for t in range(par.T):\n for i in prange(par.simN):\n \n if par.do_2d:\n u[i] += par.beta**t*utility.func_2d(sim.c[t,i],sim.d1[t,i],sim.d2[t,i],par)\n else:\n u[i] +=...
[ "0.5732998", "0.5646686", "0.56003314", "0.55983436", "0.54921854", "0.54629326", "0.5456845", "0.53569305", "0.53542536", "0.5327965", "0.5269349", "0.5227534", "0.51743656", "0.51472896", "0.514705", "0.5138735", "0.5131935", "0.50796586", "0.50725347", "0.5044816", "0.5044...
0.7044944
0
Returns the reachable boards from the given board brd. The return value is a tuple (new board state, column number where last token was added).
def get_successors(self, brd): # Get possible actions freecols = brd.free_cols() # Are there legal actions left? if not freecols: return [] # Make a list of the new boards along with the corresponding actions succ = [] for col in freecols: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_successors(self, brd):\n # Get possible actions\n freecols = brd.free_cols()\n # Are there legal actions left?\n if not freecols:\n return []\n # Make a list of the new boards along with the corresponding actions\n succ = []\n for col in freecols:...
[ "0.63505876", "0.58677834", "0.5781971", "0.57273066", "0.5699906", "0.5691483", "0.56231874", "0.55608493", "0.55115855", "0.5491904", "0.54474413", "0.5417632", "0.5368523", "0.5334432", "0.5326626", "0.5321706", "0.53070617", "0.5301228", "0.52538997", "0.5232307", "0.5210...
0.6339619
1
Return whether or not there are previous pages from the currently displayed page.
def has_previous(self): return self.page > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_previous(self):\n return self.current_page > 1", "def has_prev(self):\n return self.page > 1", "def has_prev(self):\n return self.page > 1", "def has_previous(self) -> bool:\n return self.published_before().count() != 0", "def previous_page(self):\n\n\t\tif not self.is_p...
[ "0.882928", "0.85812926", "0.85812926", "0.7818793", "0.757213", "0.74441236", "0.72574216", "0.70782685", "0.69289106", "0.68758", "0.6799423", "0.6752267", "0.66575694", "0.66365916", "0.66365916", "0.66365916", "0.65581673", "0.6478808", "0.6467624", "0.6420017", "0.641290...
0.87382364
1
Return the previous page object if the page exists.
def previous(self): if self.has_previous: previous_id = self.page - 1 if self._cached_previous and self._cached_previous.id == previous_id: return self._cached_previous self._cached_previous = Page(previous_id) return self._cached_previous
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_page(self):\r\n if self.page.has_previous():\r\n previous = self.page.previous_page_number()\r\n if previous == 1:\r\n if 'page' in self.query_dict:\r\n del self.query_dict['page']\r\n else:\r\n self.query_dict['p...
[ "0.7538804", "0.7452312", "0.7428078", "0.7344983", "0.72339845", "0.7119872", "0.7118858", "0.70535684", "0.7038007", "0.7024775", "0.6851784", "0.6807013", "0.67470986", "0.6734867", "0.6686041", "0.66336405", "0.6593018", "0.65825015", "0.656229", "0.656229", "0.654805", ...
0.84087425
0
Return the next page object if another page exists.
def next(self): if self.has_next: next_id = self.page + 1 if self._cached_next and self._cached_next.id == next_id: return self._cached_next self._cached_next = Page(next_id) return self._cached_next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_page(browser):\n pages = browser.find(class_='pages')\n for page in pages:\n if page.string == NEXT_PAGE:\n return page\n return None", "def _get_next_page(questionnaire, page):\n pages = PageDB(questionnaire).get_pages()\n i = 0\n nr_of_pages = PageDB(questionnaire)....
[ "0.72533864", "0.7130815", "0.6885224", "0.6694369", "0.6602497", "0.6595447", "0.65267885", "0.65267885", "0.64323646", "0.63298297", "0.619076", "0.6183238", "0.6151279", "0.6151279", "0.6151279", "0.6146552", "0.6146552", "0.61445075", "0.61284256", "0.6117008", "0.6081957...
0.75209236
0
The total amount of pages to be displayed based on the number of results and the limit being displayed.
def pages(self): if not self.limit: return 0 # pragma: no cover else: return int(ceil(self.total / float(self.limit)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pagecount(self):\r\n \r\n return len(self.results) // self.perpage + 1", "def pages(self):\n if self.total > 0 and self.limit > 0:\n return int(ceil(self.total / float(self.limit)))\n return 1", "def paging_results(self):\n\n return 30", "def get_total_page(s...
[ "0.84447044", "0.8412819", "0.81260425", "0.8078535", "0.8027013", "0.80233735", "0.80150545", "0.7710515", "0.7700835", "0.7603633", "0.7562372", "0.7547492", "0.7488338", "0.7451107", "0.73773104", "0.72934484", "0.7266558", "0.72562885", "0.72224087", "0.7176976", "0.70799...
0.85739416
0
Convert a parsed QREL entry to string.
def qrelEntry2Str(qrelEntry): return genQrelStr(qrelEntry.queryId, qrelEntry.docId, qrelEntry.relGrade)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseQrelEntry(line):\n\n line = line.strip()\n parts = line.split()\n if len(parts) != 4:\n raise Exception('QREL entry format error, expecting just 4 white-space separted field in the entry: ' + line)\n\n return QrelEntry(queryId=parts[0], docId=parts[2], relGrade=int(parts[3]))", "def f...
[ "0.617721", "0.61493593", "0.61304563", "0.5781973", "0.5565379", "0.54844826", "0.5433155", "0.53735805", "0.5332001", "0.52714926", "0.525061", "0.5247311", "0.5247303", "0.5220838", "0.5220101", "0.51887167", "0.51810044", "0.5169519", "0.5159208", "0.51539856", "0.5140406...
0.7916747
0
Parse one QREL entry
def parseQrelEntry(line): line = line.strip() parts = line.split() if len(parts) != 4: raise Exception('QREL entry format error, expecting just 4 white-space separted field in the entry: ' + line) return QrelEntry(queryId=parts[0], docId=parts[2], relGrade=int(parts[3]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_result_entry(result):\n entry = ParsedEntry()\n\n if \"content\" in result and len(result.content) > 0:\n entry.content = result.content[0].value\n # if not html, have to escape\n if result.content[0].type not in HTML_MIME_TYPES:\n entry.content = cgi.escape(entry.c...
[ "0.57672024", "0.5712222", "0.5657319", "0.5631491", "0.5623684", "0.55867475", "0.55786633", "0.55580145", "0.5541458", "0.55277073", "0.5502825", "0.54569316", "0.53761744", "0.53471315", "0.5338925", "0.53375584", "0.53002876", "0.52926755", "0.52745557", "0.52745557", "0....
0.73139864
0
Read and parse QRELs.
def readQrels(fileName): ln = 0 res = [] with open(fileName) as f: for line in tqdm(f, desc='loading qrels (by line)', leave=False): ln += 1 line = line.strip() if not line: continue try: e = parseQrelEntry(line) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseQrelEntry(line):\n\n line = line.strip()\n parts = line.split()\n if len(parts) != 4:\n raise Exception('QREL entry format error, expecting just 4 white-space separted field in the entry: ' + line)\n\n return QrelEntry(queryId=parts[0], docId=parts[2], relGrade=int(parts[3]))", "def r...
[ "0.6319746", "0.5800978", "0.5731543", "0.5555555", "0.54871035", "0.5411078", "0.5388917", "0.53783035", "0.53458947", "0.53004533", "0.5274036", "0.5265533", "0.5158059", "0.5128103", "0.50959504", "0.5082703", "0.50777197", "0.5048843", "0.5048156", "0.50440925", "0.502144...
0.65417624
0
Take a dictionary of document scores indexed by the document id and produce a list of (document id, score tuples) sorted in the order of decreasing scores.
def getSorteScoresFromScoreDict(queryRunDict): return list(sorted(queryRunDict.items(), key=lambda x: (x[1], x[0]), reverse=True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_score_ordered(scores, idx):\t\n\treturn [x[1][idx] for x in sorted(scores.items())]", "def sorted_scores(scores):\n\treturn sorted(scores, key=lambda sailor: (total_score(sailor), sailor[1][0]))", "def sort_words(word_dic):\n word_list = []\n for key, value in word_dic.items():\n word = ...
[ "0.6941447", "0.6244914", "0.6080136", "0.60571605", "0.5880722", "0.5799608", "0.5676046", "0.5656475", "0.5655577", "0.55775243", "0.5570335", "0.5536112", "0.5528473", "0.5525277", "0.55218947", "0.5503588", "0.54912657", "0.5486251", "0.54857135", "0.54733294", "0.5434229...
0.72268873
0
Write a dictionarystored run to a file. The input is actually a dictionary of dictinoary. The outer dictionary is a set of queryspecific results indexed by the query id. And the internal dictionary is a set of document scores indexed by the document id. Before writing data, it is resorted within each query.
def writeRunDict(runDict, fileName): with open(fileName, 'wt') as runfile: for qid in runDict: scores = getSorteScoresFromScoreDict(runDict[qid]) for i, (did, score) in enumerate(scores): runfile.write(genRunEntryStr(qid, did, i + 1, score, FAKE_RUN_ID) + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_results_to_disk(self, result_path,results):\n with open(result_path+\"/results.txt\",\"w+\") as out:\n\n for query_num in results:\n for doc_num in results[query_num]:\n out.write(str(query_num)+\" 0 \"+doc_num+\" 1 42.38 mt\\n\")\n out.close...
[ "0.64149755", "0.6323092", "0.63185096", "0.623392", "0.6117135", "0.60469115", "0.60431457", "0.6037959", "0.6010059", "0.5962368", "0.594754", "0.5893706", "0.58609116", "0.5851925", "0.58096147", "0.58084553", "0.580037", "0.56999785", "0.5693484", "0.5654092", "0.56539285...
0.7100081
0
Write a list of QRELs to a file.
def writeQrels(qrelList, fileName): with open(fileName, 'w') as f: for e in qrelList: f.write(qrelEntry2Str(e)) f.write('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(lst):\n # TODO", "def write_to_databse(fileName):\n f = open(fileName)\n queries = eval(open(fileName).read())\n for q in queries:\n site.write(q)\n print \"Quries are saved:)\"", "def store_list( q_frame, final, path_out):\n if not os.path.exists( path_out ):\n os.mak...
[ "0.6659388", "0.65668094", "0.64353186", "0.64146936", "0.63622636", "0.6266605", "0.62355745", "0.6232225", "0.6223006", "0.6174213", "0.6137193", "0.6118019", "0.61159784", "0.61075747", "0.61021453", "0.6097921", "0.60946554", "0.60937405", "0.60883534", "0.6078855", "0.60...
0.82695436
0
A simple function to generate one run entry.
def genRunEntryStr(queryId, docId, rank, score, runId): return f'{queryId} Q0 {docId} {rank} {score} {runId}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_run(arn=None):\n pass", "def exe():\n e = entry()\n if e:\n return load(e)", "def DistEntry():\n flags.StartMain(main)", "def console_entry():\n #main()", "def pretty_runlist_entry(num, max_num, command, arguments):\n basename = os.path.splitext(os.path.basename(command))[0]\...
[ "0.61637896", "0.60849404", "0.59185123", "0.5910822", "0.58969253", "0.5850631", "0.58331966", "0.58331966", "0.58331966", "0.5811054", "0.5810959", "0.5786089", "0.5732439", "0.5696852", "0.56688386", "0.5663584", "0.56446594", "0.56446594", "0.56446594", "0.56446594", "0.5...
0.60984117
1
Read QRELs in the form of a dictionary where keys are query IDs.
def readQrelsDict(fileName): result = {} for e in readQrels(fileName): result.setdefault(e.queryId, {})[e.docId] = int(e.relGrade) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_list(query_id, qrels):\n rel_list = []\n for query_dict in qrels:\n if int(query_dict['query_num']) == query_id:\n rel_list.append(query_dict)\n\n return rel_list", "def query(self, q):\n for key in self.metadb.query(q):\n yield key, self.datadb[key]", "def...
[ "0.6835832", "0.6125994", "0.58958644", "0.58423054", "0.5777831", "0.57507735", "0.5653117", "0.5650223", "0.5610089", "0.5573849", "0.55595124", "0.5454953", "0.5450803", "0.5422582", "0.5393296", "0.53765213", "0.53625804", "0.53055394", "0.52981114", "0.5297954", "0.52837...
0.73858917
0
Read a run file in the form of a dictionary where keys are query IDs.
def readRunDict(fileName): result = {} with FileWrapper(fileName) as f: for ln, line in enumerate(tqdm(f, desc='loading run (by line)', leave=False)): line = line.strip() if not line: continue fld = line.split() if len(fld) != 6: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_run_info_from_file(file):\n\n with open(file) as f:\n raw = f.read()\n\n lines = raw.split('\\n')\n runs = []\n for line in lines:\n if line == '':\n continue\n comma_splits = line.split(',')\n train_acc = float(comma_splits[0].strip())\n test_acc ...
[ "0.6355188", "0.59160393", "0.5847533", "0.58188874", "0.58029336", "0.5780881", "0.5759118", "0.57484883", "0.56860626", "0.56709135", "0.565064", "0.5644731", "0.5634812", "0.55844283", "0.55820817", "0.55554515", "0.5534645", "0.5521943", "0.5497889", "0.54698205", "0.5465...
0.7821929
0
Sort itemsets by list of ordered indices. Returns ranked itemsets.
def sort_itemsets(indices, data, itemsets, custom_index_values=None, return_values=False): values = [] custom_index_id = 0 for (name, order) in indices: if name == 'custom': try: values.append([order * v for v in custom_index_values[custom_index_id]]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder_sets(sets):\n\n if len(sets) == 1:\n return sets\n\n s = set([])\n\n for ss in sets:\n for i in ss:\n s.add(i)\n\n tree = P(sets)\n\n\n for i in s:\n tree.set_contiguous(i)\n tree = flatten(tree)\n\n return tree.ordering()", "def sort_indices(s...
[ "0.59840685", "0.5871088", "0.58037066", "0.5756595", "0.56122243", "0.5593702", "0.55214834", "0.5464931", "0.5447365", "0.5439025", "0.54177094", "0.5398739", "0.5395633", "0.5359991", "0.52936673", "0.5288645", "0.5272867", "0.5250649", "0.51981884", "0.5194961", "0.516619...
0.75688815
0
Creates the python script necessary to submit the MEM jobs to the batch system
def createScript_sbatch(self): tools_createScript_sbatch( sbatch_script_file_name = self.sbatchFile_addMEM, executable = self.executable_addMEM, command_line_parameters = self.cfgFiles_addMEM_modified, input_file_names = self.inputFiles, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scriptGen(self,tmpd='/tmp/jose',libRev='last',submode='qsub',\n redirect=1,PBSoptions=''):\n jobname=self.name\n outdir=self.outd\n qsubdir=scratchdir+'/qsub/'+todayDate() #subdirectory to deposit the script\n if not os.path.exists(qsubdir): pastry('/bin/mkdir -p '...
[ "0.6900363", "0.6724484", "0.654995", "0.64530903", "0.6366503", "0.63467556", "0.6325721", "0.63027", "0.6214599", "0.6161553", "0.6147396", "0.6122376", "0.61184967", "0.606868", "0.60532546", "0.6047774", "0.6047245", "0.5977596", "0.59358174", "0.59101474", "0.59067476", ...
0.7109882
0
Adds the commands to Makefile that are necessary for running the MEM code
def addToMakefile_addMEM(self, lines_makefile): if self.is_sbatch: lines_makefile.append("sbatch_addMEM:") lines_makefile.append("\t%s %s" % ("python", self.sbatchFile_addMEM)) lines_makefile.append("") for key_file, output_file in self.outputFiles.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __instructions(self):\n\n self += comment('Intel Parallel Studio XE')\n self += packages(ospackages=self.__ospackages)\n self += copy(src=self.__tarball,\n dest=posixpath.join(self.__wd, self.__tarball_name))\n if self.__license and not '@' in self.__license:\n ...
[ "0.5848315", "0.5823324", "0.57588905", "0.56961876", "0.5667787", "0.55985594", "0.55985594", "0.55985594", "0.55985594", "0.5595643", "0.557142", "0.55572766", "0.55293703", "0.5514112", "0.545637", "0.53870964", "0.536825", "0.5344839", "0.53177613", "0.5304923", "0.527652...
0.64476264
0
Add hadd targets to the Makefile
def addToMakefile_hadd(self, lines_makefile): for hadd_out, hadd_in in self.hadd_records.iteritems(): hadd_in_files = hadd_in['output_files'] hadd_fileset_id = hadd_in['fileset_id'] process_name = hadd_in['process_name'] sbatch_hadd_file = os.path.join( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hadd_ex(new_name, files):\n \n l = len(files)\n if l == 1:\n print 'only one file specified, copying %s to %s' % (files[0], new_name)\n assert os.system('cp -p %s %s' % (files[0], new_name)) == 0 # JMTBAD check return code\n print '1 file copied to %s' % new_name\n return T...
[ "0.5552721", "0.5400419", "0.53885555", "0.5352961", "0.53026015", "0.521227", "0.5189179", "0.5171282", "0.5132894", "0.508693", "0.5052858", "0.50106657", "0.49353966", "0.49309725", "0.49256998", "0.48918346", "0.48828074", "0.4844602", "0.48313728", "0.4828164", "0.481639...
0.708559
0
Creates all necessary config files and runs the MEM either locally or on the batch system
def create(self): for key in self.dirs.keys(): if type(self.dirs[key]) == dict: for dir_type in self.dirs[key].keys(): create_if_not_exists(self.dirs[key][dir_type]) else: create_if_not_exists(self.dirs[key]) # read the file i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work(self):\n self.config_file = self.args.config\n self.init_config()\n self.init_db()\n\n self.kickoff()", "def init(_config, _run):\n sacred.commands.print_config(_run)\n dump_config_and_makefile()\n\n print()\n print('Initialized storage dir. Now run these commands...
[ "0.61811984", "0.5962312", "0.5945038", "0.5930454", "0.5915416", "0.58961785", "0.58747905", "0.58591765", "0.5837817", "0.58329153", "0.5831141", "0.5814066", "0.58040845", "0.58010054", "0.5763761", "0.5734302", "0.5733068", "0.57085186", "0.56866676", "0.5675613", "0.5667...
0.64692366
0
Find available devices to run EGL on. It will return the minor numbers, The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number]. Avail able only on Linux platform.
def get_available_devices(): executable_path = os.path.join(os.path.dirname(__file__), 'build') try: num_devices = int(subprocess.check_output( ["{}/query_devices".format(executable_path)])) except subprocess.CalledProcessError as e: return [0] FNULL = open(os.devnull, 'w') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gpus():\n try:\n re = subprocess.check_output([\"nvidia-smi\", \"-L\"], universal_newlines=True)\n except OSError:\n return []\n return range(len([i for i in re.split('\\n') if 'GPU' in i]))", "def androidDetectDevices():\n\tdevices = []\n\ttry:\n\t\tif (sys.platform == 'win32'):\n...
[ "0.6562714", "0.65426177", "0.64418447", "0.6440465", "0.64399284", "0.64399284", "0.64344305", "0.6399175", "0.6397971", "0.6376035", "0.6363725", "0.63479066", "0.6269277", "0.6267697", "0.62502813", "0.62355644", "0.61364883", "0.6132447", "0.6094917", "0.6072684", "0.6059...
0.77780443
0
Get the device index to use in pytorch The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number]. Avail able only on Linux platform.
def get_cuda_device(minor_idx): executable_path = os.path.join(os.path.dirname(__file__), 'build') try: num_devices = int(subprocess.check_output( ["{}/query_devices".format(executable_path)])) except subprocess.CalledProcessError as e: return 0 for i in range(num_devices):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_index(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"device_index\")", "def device_num(self) -> str:\n return pulumi.get(self, \"device_num\")", "def _current_device_index(self) -> int:\n device = PArray._get_current_device()\n if device is None: # not called in...
[ "0.72570884", "0.72109413", "0.71451735", "0.68671006", "0.68392485", "0.68228555", "0.68183947", "0.6812957", "0.6802684", "0.6722583", "0.67002505", "0.6601767", "0.6532514", "0.6519109", "0.6505232", "0.6494063", "0.6482684", "0.6395324", "0.6358353", "0.634921", "0.632758...
0.8265997
0
This function provides correcting wrong paths to files and directories. It's a slot which called when both of edit lines is changing. If one of the paths is incorrect, then the error will be removed.
def correct_wrong_path(self): sender = self.sender() # This block provides removing an error under the edit line of the map's filename if sender == self.mapsDirectoryLine and self.incorrect_map_filename: self.VLayout.removeWidget(self.error_maps_lbl) self.error_maps_lbl....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_paths(self):\r\n\t\tself.check_line_edits_and_refresh_filestate()\r\n\t\t# paths\r\n\t\tsource_img_filename = self.source_img_entry.text().replace(\"\\\\\", \"/\")\r\n\t\tsink_dir_name = self.sink_dir_entry.text().replace(\"\\\\\", \"/\")\r\n\t\tsink_db_name_entry_text = self.sink_db_name_entry.text()\r\...
[ "0.6434743", "0.5851415", "0.5772642", "0.57233256", "0.57132787", "0.5556546", "0.5547998", "0.55355173", "0.5520772", "0.5487168", "0.5478769", "0.5449815", "0.54244477", "0.54151076", "0.5398201", "0.5370582", "0.53543586", "0.53484815", "0.5334684", "0.5310021", "0.529975...
0.84562945
0
This module enables or disables the accept button for this dialog window depending on whether there is text in the edit lines.
def enable_accept_button(self): if self.mapsDirectoryLine.text() and self.troopsDirectoryLine.text(): self.acceptButton.setEnabled(True) else: self.acceptButton.setEnabled(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_okButton_clicked(self):\n self.accept=True", "def on_buttonBox_accepted(self):\n if len(self.lineInput.text()) == 0:\n self.reject()\n else:\n self.input = self.lineInput.text() \n self.accept()", "def acceptClicked(self):\n if len(...
[ "0.7059548", "0.66216075", "0.64704233", "0.63764644", "0.62911826", "0.61641425", "0.61585987", "0.61297405", "0.59587705", "0.5951562", "0.5920374", "0.58046377", "0.57752407", "0.57732236", "0.5757981", "0.5731169", "0.56851196", "0.5679839", "0.566154", "0.5607326", "0.56...
0.72327644
0
It's a slot which is called when the setting button is pressed This method opens the file manager and if a directory or a file is chosen, it fills edit lines
def files_manage(self): sender = self.sender() if sender == self.mapsDirectoryButton: path_to_map, _ = QFileDialog.getOpenFileName(self, caption="Открыть", directory="/", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_File1_toolButton_clicked(self):\n my_file = QtWidgets.QFileDialog.getOpenFileName(self, u'打开文件', '/')\n if my_file[0]:\n self.File1_lineEdit.setText(my_file[0])\n else:\n QtWidgets.QMessageBox.warning(self, u'警告', u'请选择输入文件')", "def onLoad (self):\n #productiv...
[ "0.7056106", "0.69966835", "0.68940663", "0.68738866", "0.6866713", "0.6858465", "0.6858465", "0.685267", "0.6840944", "0.6735564", "0.67051214", "0.6688198", "0.668139", "0.66708505", "0.6670207", "0.66078514", "0.6606934", "0.6594669", "0.657698", "0.65762657", "0.65483475"...
0.7185551
0
It's slot which is called when the accept button is pressed, if it's enabled This method checks that a specified directory or a file is correct and calls the method of creating central widget in the parent widget. Else this method prints an error about that trouble under the edit line and sets particular flags, specify...
def accept(self): map_filename = self.mapsDirectoryLine.text() troops_directory = self.troopsDirectoryLine.text() # This index will be a measure to insert error label under an edit line if an error will be occurred index_map_label = self.VLayout.indexOf(self.map_label) if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept(self, *args, **kwargs):\n QtGui.QApplication.setOverrideCursor(QtGui.QCursor(Qt.WaitCursor))\n \n mneRoot = self.ui.lineEditMneRoot.text()\n if str(mneRoot) is '':\n messageBox = QtGui.QMessageBox()\n messageBox.setText(\"Environment variables MNE_ROOT \...
[ "0.6549283", "0.65129936", "0.6496964", "0.6342729", "0.63302416", "0.62414056", "0.62278897", "0.62035453", "0.617841", "0.61445165", "0.6141491", "0.6070426", "0.6044493", "0.596154", "0.5927395", "0.5913186", "0.5898482", "0.58805674", "0.58754504", "0.5850688", "0.5835647...
0.7866559
0
Generate an array of all days with prices for every ticker. Some symbols may not have trading data on some days. This filters out those days, and creates and array of all prices and tickers.
def _getFilteredPrices(self): # Create dict of dates to tickers to prices. date_dict = {} for stock in self.stock_dict.values(): for date in stock.ordered_date_dict.keys(): if date not in date_dict: date_dict[date] = {} date_dict[da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _construct_all_prices(self):\n d = dict([(s+'-', 0.0) for s in self.symbol_list] +\n [(s+'+', 0.0) for s in self.symbol_list])\n d['datetime'] = self.backtest_date\n return [d]", "def gather_stock_data(tickers, save=True):\n prices = pd.DataFrame()\n ts = TimeSeries...
[ "0.67409295", "0.67202425", "0.6456439", "0.64514035", "0.62389207", "0.62224364", "0.60535693", "0.601309", "0.60105884", "0.59593356", "0.59551656", "0.5949486", "0.593729", "0.5920068", "0.5865663", "0.5824194", "0.57976747", "0.57489455", "0.5708646", "0.5707145", "0.5706...
0.7080781
0