query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Given a question ID, returns a tuple containing a list of the reference answers, human answers (Answer objects), and the canonical answer id
def __getitem__(self, qid): ref = [] if qid in self._reference: ref = self._reference[qid] hum = [] if qid in self._human: hum = self._human[qid] aid = [-1, ""] if qid in self._id: aid = self._id[qid] else: logger.warning("Answer ID %s missing" % qid) return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_answer(self, answer_id):\n return self.answers[answer_id]", "def get_answers_by_answer_id(self, answer_id):\n return self._answers_by_id.get(answer_id)", "def get(self, question_id):\n response = Answers.get_all_answers(question_id)\n\n return response", "def get_question_...
[ "0.63491833", "0.6239461", "0.6170823", "0.59454125", "0.5801377", "0.57446605", "0.5685475", "0.5676668", "0.56612366", "0.565792", "0.56460077", "0.5644257", "0.5625713", "0.5581985", "0.5564018", "0.55500376", "0.55474454", "0.5515793", "0.5485804", "0.5477037", "0.5423716...
0.67215127
0
Returns a string reprentation of this object.
def __repr__(self): dictionary = {"Question Text": self.text, "Answers": " ".join(self.answers), \ "Referers": " ".join(self.referers), "Named entities": " ".join(self.named_entities) } return repr(dictionary)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_string(self):\n return self.__repr__()", "def __repr__(self):\n return str(self)", "def __repr__(self):\n return str(self)", "def __repr__(self):\n return str(self)", "def __repr__(self):\n return str(self)", "def __repr__(self):\n return str(self)", "de...
[ "0.82876116", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.8179296", "0.816321", "0.8133825", "0.8133825", "0.8133825", "0.8133825", "0.8127164", "0.8127164", "...
0.0
-1
An iterator over the features present in a question.
def features(self, db=None, vocab=None): if not self._features: if not db: raise ValueError("Must provide a database if we haven't already loaded the features.") self._load_features(db) if vocab: yield 0, vocab[START_SYMBOL] else: yield 0, START_SYMBOL for index, feat ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_features(self):\n features = self.features\n if (features is not None):\n yield from features", "def __iter__(self):\n for feature in self.features:\n yield feature", "def iter_specified(self):\n for feat in self.features:\n val = self[feat]...
[ "0.77522475", "0.7168614", "0.6852249", "0.6648104", "0.6443734", "0.6215832", "0.61635226", "0.61368996", "0.60666883", "0.59896314", "0.596312", "0.5958954", "0.587679", "0.5817688", "0.57588", "0.5757595", "0.57539994", "0.571182", "0.5708972", "0.5697524", "0.5671339", ...
0.60794765
8
Given a question, find where "ftp" occurs. Assumes features have been preprocessed.
def find_ftp(features): ftp_pos = -1 for ii in xrange(len(features)): index, word = features[ii] if word == 'ftp': ftp_pos = index return ftp_pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_question(message, unique_users, q):\n \n line = get_tagged_user(message['text'], unique_users)[1]\n\n if '?' in line:\n return line\n\n START_WORDS = ['can', 'do', 'will', 'how', 'when', 'what', 'where',\n 'why', 'is', 'does', \"doesn't\", 'if', 'for', 'did', 'is']\n\n for word ...
[ "0.5377158", "0.5220282", "0.5132496", "0.50776434", "0.49986395", "0.4923811", "0.48578218", "0.4798723", "0.4798723", "0.4798723", "0.475099", "0.46580526", "0.46575606", "0.46463495", "0.46400103", "0.46125606", "0.46123046", "0.46002674", "0.45936626", "0.45734656", "0.45...
0.7341822
0
Creates a more compact set of categories.
def category_reducer(category): if not "--" in category: if category in BAD_CATEGORIES: return "Unknown" return category main, sub = category.split("--") main = main.strip() if main in ["Science"]: return sub.strip() else: return main
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Categories():\n cat = {\n \t \"Featured\": 0,\n \t \"All\": 1,\n \t \"Collectibles\": 2,\n \t \"Clothing\": 3,\n \t \"BodyParts\": 4,\n \t \"Gear\": 5,\n \t \"Models\": 6,\n \t \"Plugins\": 7,\n\t \"Decals\": 8,\n \t \"Audio\": 9,\n \t \...
[ "0.6852812", "0.6594555", "0.64615446", "0.64615446", "0.64615446", "0.6195984", "0.6194372", "0.6184744", "0.6180193", "0.6178912", "0.6160463", "0.6158433", "0.6127569", "0.6071825", "0.60502726", "0.5985825", "0.59815055", "0.59707147", "0.5958753", "0.5945456", "0.5938579...
0.0
-1
The set of words that are ignored (e.g. stopwords)
def censored(self): if not self._vocab: self.vocab() return self._censored
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interestingWords(self):\n words = set([])\n for token in self.importantTokenList():\n if token.isStopWord() == False:\n words.add(token.text.lower())\n return words", "def retrieveIgnoredWords(self):\n words = self.con.getIgnoredWords()\n guilds = self.con.getGuildsInfo()\n...
[ "0.7929255", "0.7721634", "0.76417553", "0.7594571", "0.7561156", "0.7558134", "0.75047934", "0.74923915", "0.7464799", "0.74498874", "0.74433726", "0.7439269", "0.7437416", "0.74312687", "0.74305564", "0.7424451", "0.7424451", "0.7424451", "0.7424451", "0.73937154", "0.73705...
0.0
-1
Return the vocab dictionary
def vocab(self): num_words = -1 if not self._vocab: c = self._conn.cursor() c.execute('select feature, censored, word_id from vocab') d = {} for ww, cc, ii in c: d[ii] = ww d[ww] = ii if cc == 1: self._censored.add(ww) num_words = max(ii, num_wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vocab():\n symbols = DEFAULT_SPECIAL_SYMBOLS + [\"mouse\", \"dog\", \"tree\"]\n return Vocabulary(symbols)", "def get_vocab(self):\n\n\t\tself.parse_transcript() \n\t\tself.purge_words()\n\t\tself.analyze_words()\n\t\tself.sort_word_analysis()", "def get_input_vocab():\n vocab = set()\n vocab.u...
[ "0.7800878", "0.75961435", "0.7437031", "0.7317012", "0.73040634", "0.72950774", "0.7268286", "0.7198509", "0.7144368", "0.71350545", "0.7107896", "0.705793", "0.70412797", "0.7035426", "0.70024836", "0.69716805", "0.69458526", "0.69275844", "0.68653035", "0.68614393", "0.684...
0.74990356
2
Returns a cursor for the database.
def cursor(self): return self._conn.cursor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor():\n dbh = handle()\n return dbh.cursor()", "def cursor(self):\r\n if self._closed:\r\n raise Error('The connection to the database has been closed.')\r\n return Cursor(self)", "def get_cursor(self):\n self.cur = self.dbcon.cursor()\n return self.cur", ...
[ "0.85609347", "0.81622225", "0.8138117", "0.81377214", "0.81331956", "0.80447465", "0.8032037", "0.8028613", "0.80081725", "0.8007939", "0.7987564", "0.79268324", "0.79174066", "0.7829249", "0.779893", "0.7798929", "0.7747831", "0.7738102", "0.77090776", "0.7692559", "0.76889...
0.80994606
5
Return all of the cannonical answers
def answers(self): assert self._answer_count for ii in self._answer_count: yield ii
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solutions(self):\n answers = []\n for y in reversed(xrange(0, self.y)):\n answer = self.retrieve(y,self.y)\n i = 0\n for x in reversed(xrange(y+1, self.y)):\n answer -= self.retrieve(y,x)*answers[i]\n i += 1\n answers.appen...
[ "0.609404", "0.6010378", "0.5729069", "0.5677856", "0.56382644", "0.56348956", "0.5619385", "0.5593957", "0.5493538", "0.543574", "0.5434167", "0.5382548", "0.5365517", "0.53629106", "0.53097373", "0.5294162", "0.5255414", "0.52265984", "0.521358", "0.521358", "0.52093536", ...
0.48988533
70
If get_features is true, loads all features in addition to just returning questions.
def questions(self, limit=-1, get_features=True, restrict_to_dupes=True): if not self._answers_loaded: self.load_answers() if (limit, get_features, restrict_to_dupes) in self._questions_cache: # Found in cache, no need to hit database. cached = self._questions_cache[(limit, get_features, rest...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_features(self, features):\n pass\n # self.features = features", "def get_features(self, request, **kwargs):\n raise NotImplementedError()", "def get_all_features(self) :\n raise NotImplementedError", "def loadall(bot) :\n for feature in features :\n load(bot, fe...
[ "0.6723377", "0.6359551", "0.6243489", "0.6227682", "0.6172373", "0.6133171", "0.6023984", "0.6023984", "0.6023984", "0.60045356", "0.598698", "0.59664726", "0.5957916", "0.5923912", "0.59142065", "0.5889934", "0.5841669", "0.5839664", "0.58363163", "0.5785984", "0.5785721", ...
0.5132664
91
For a dictionary of question objects, return all of the features associated with those questions.
def _batch_get_features(self, cache): c = self._conn.cursor() c.execute('select * from features order by question_id, offset') questions_seen = set() last_id = -1 for id, offset, feature in c: if id in cache: questions_seen.add(id) cache[id]._features.append((offset, feature))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_question_features(self, text):\n features = {}\n\n # A list of all words from the known sentences\n all_words = \" \".join(self.positive + self.negative).split()\n\n # A list of the first word in each of the known sentence\n all_first_words = []\n for sentence in ...
[ "0.60289574", "0.5897056", "0.5824344", "0.5788743", "0.57177365", "0.5543057", "0.55286676", "0.5500827", "0.54975367", "0.5494057", "0.54748386", "0.54655945", "0.5453107", "0.5445957", "0.54359865", "0.5433835", "0.5429624", "0.5417899", "0.5414851", "0.5404463", "0.540113...
0.0
-1
Internal function. For mpaths_get() only.
def __init__(self, path): for key, value in path.items(): setattr(self, "_%s" % key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcPath(self):\n return None", "def test_get_path():\n mock = MagicMock(return_value={\"vdata\": \"C:\\\\Salt\"})\n with patch.dict(win_path.__utils__, {\"reg.read_value\": mock}):\n assert win_path.get_path() == [\"C:\\\\Salt\"]", "def _safe_split_mgm(self, path, mgm=None):\n i...
[ "0.5624135", "0.5182827", "0.5094239", "0.5092605", "0.5016625", "0.49684885", "0.49617955", "0.49576756", "0.49495986", "0.494796", "0.49099115", "0.48931587", "0.4887689", "0.4854401", "0.47833332", "0.477192", "0.4762432", "0.47423002", "0.47263235", "0.47125283", "0.46845...
0.0
-1
Internal function. For mpaths_get() only.
def __init__(self, pg): self._paths = [] for key, value in pg.items(): if key == "paths": for path in pg["paths"]: self._paths.append(DMMP_path(path)) else: setattr(self, "_%s" % key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcPath(self):\n return None", "def test_get_path():\n mock = MagicMock(return_value={\"vdata\": \"C:\\\\Salt\"})\n with patch.dict(win_path.__utils__, {\"reg.read_value\": mock}):\n assert win_path.get_path() == [\"C:\\\\Salt\"]", "def _safe_split_mgm(self, path, mgm=None):\n i...
[ "0.5624135", "0.5182827", "0.5094239", "0.5092605", "0.5016625", "0.49684885", "0.49617955", "0.49576756", "0.49495986", "0.494796", "0.49099115", "0.48931587", "0.4887689", "0.4854401", "0.47833332", "0.477192", "0.4762432", "0.47423002", "0.47263235", "0.47125283", "0.46845...
0.0
-1
Integer. Group ID of current path group. Could be used for switching active path group.
def id(self): return self._group
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_id(self) -> int:\n return self._group_id", "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self):\n return self._id", "def group_id(self):\n return self._gr...
[ "0.787597", "0.7829336", "0.7829336", "0.776296", "0.7749905", "0.7749905", "0.7749905", "0.7592762", "0.74955857", "0.7440735", "0.734738", "0.734646", "0.7330007", "0.7330007", "0.7330007", "0.7271022", "0.70585907", "0.7036965", "0.70027983", "0.70027983", "0.70027983", ...
0.77427405
7
Integer. Priority of current path group. The enabled path group with highest priority will be next active path group if active path group down.
def priority(self): return self._pri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priority(self):\n # type: () -> GroupPriority\n if self._priority is not None:\n return self._priority\n if self.group_name == get_constant(\"MAGPIE_ANONYMOUS_GROUP\"):\n self._priority = -1 # lowest of all for *special* public group\n elif self.group_name == ...
[ "0.668511", "0.6173557", "0.60094124", "0.60094124", "0.60094124", "0.59904546", "0.59904546", "0.59904546", "0.59904546", "0.59904546", "0.59904546", "0.59595186", "0.5942457", "0.59423125", "0.59260696", "0.59260696", "0.5913694", "0.5822935", "0.5822935", "0.5822935", "0.5...
0.5999465
5
String. Selector of current path group. Path group selector determines which path in active path group will be use to next I/O.
def selector(self): return self._selector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self, group):\n return", "def get_group_selector(*args):\n return _ida_segment.get_group_selector(*args)", "def select_path(self):\r\n pass", "def build_path(self):\r\n return self.selmgr.select_path()", "def set_group_selector(*args):\n return _ida_segment.set_group_selector(*args...
[ "0.64250207", "0.6143256", "0.6095452", "0.59830743", "0.57778186", "0.5769308", "0.5540597", "0.54764575", "0.54764575", "0.5355067", "0.53290826", "0.522171", "0.52134025", "0.5175387", "0.5168265", "0.51633954", "0.51424783", "0.5118612", "0.511272", "0.5078855", "0.505106...
0.57455444
6
List of DMMP_path objects.
def paths(self): return self._paths
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths(self):\n rc = []\n for pg in self.path_groups:\n rc.extend(pg.paths)\n return rc", "def path(self) -> List[Path]:\n return self._path", "def paths(self):\r\n return self._paths", "def listPaths():\n try:\n paths = [x[1] for x in parseFstab(FST...
[ "0.72847533", "0.7182085", "0.6842506", "0.68181956", "0.67926395", "0.67880744", "0.6735054", "0.6717666", "0.6675892", "0.66327596", "0.6613229", "0.65570676", "0.6546488", "0.64794725", "0.6449635", "0.64489675", "0.63583595", "0.6355992", "0.633996", "0.6317348", "0.62813...
0.6741573
7
Internal function. For mpaths_get() only.
def __init__(self, mpath): self._path_groups = [] for key, value in mpath.items(): if key == "path_groups": for pg in mpath["path_groups"]: self._path_groups.append(DMMP_pathgroup(pg)) else: setattr(self, "_%s" % key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcPath(self):\n return None", "def test_get_path():\n mock = MagicMock(return_value={\"vdata\": \"C:\\\\Salt\"})\n with patch.dict(win_path.__utils__, {\"reg.read_value\": mock}):\n assert win_path.get_path() == [\"C:\\\\Salt\"]", "def _safe_split_mgm(self, path, mgm=None):\n i...
[ "0.56241137", "0.518281", "0.5094269", "0.50926024", "0.5016643", "0.49685216", "0.49618253", "0.49576533", "0.49496496", "0.49479398", "0.48931497", "0.4887676", "0.48543885", "0.47833565", "0.47719523", "0.47624433", "0.47423357", "0.47263166", "0.4712535", "0.4684541", "0....
0.49099514
10
String. WWID of current mpath.
def wwid(self): return self._uuid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self) -> str:\n return '_'.join(['wavin', self._controller_id, str(self._name), 'battery'])", "def getPath(self):\n uid = str(self._result.uid)\n if not uid.startswith('/zport/dmd'):\n uid = '/zport/dmd/' + uid\n return uid", "def device_path(self):\n re...
[ "0.6177691", "0.60953784", "0.60286385", "0.59536564", "0.59037435", "0.58918136", "0.58785886", "0.58785886", "0.58731186", "0.5863684", "0.58540994", "0.5815289", "0.5815289", "0.5808639", "0.57726943", "0.57599044", "0.5754434", "0.5745627", "0.57430816", "0.57271993", "0....
0.73362756
0
String. Name(alias) of current mpath.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_name(self):\n return self.full_name", "def full_path_to_name(self):\n return self._full_path_to_name", "def get_name(self) -> str:\n return os.path.split(os.getcwd())[-1]", "def name(self):\n return self.path.stem", "def path(self):\n return '/%s' % (self.full_na...
[ "0.77035654", "0.7319351", "0.7256524", "0.7229156", "0.6969239", "0.69421214", "0.69341344", "0.6929062", "0.68289804", "0.6770708", "0.6738319", "0.6721124", "0.6713408", "0.6673698", "0.66492337", "0.66490865", "0.6598826", "0.65729296", "0.65674853", "0.6560648", "0.65606...
0.0
-1
List of DMMP_mpath objects.
def path_groups(self): return self._path_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mps_by_device(self, devpath):\n mps = []\n mounts = self.read_mounts()\n for m in mounts:\n if devpath == m.device:\n mps.append(m.mountpoint)\n return mps", "def get_mounts(self):\n return [m.split()[0] for m in self.xlist(\"get-mounts\")[1]]"...
[ "0.6262625", "0.57818997", "0.5664515", "0.547284", "0.5466374", "0.5382272", "0.5359383", "0.535148", "0.5316523", "0.52730924", "0.5256024", "0.51935726", "0.5149534", "0.5080365", "0.5072454", "0.50651854", "0.5028563", "0.5024082", "0.50062305", "0.5006047", "0.49944177",...
0.0
-1
List of DMMP_path objects
def paths(self): rc = [] for pg in self.path_groups: rc.extend(pg.paths) return rc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self) -> List[Path]:\n return self._path", "def listPaths():\n try:\n paths = [x[1] for x in parseFstab(FSTAB)]\n return paths\n except DMException:\n return []", "def _get_path_objs(self, path_list):\n objs = []\n for path in path_list:\n obj...
[ "0.6900828", "0.6837692", "0.6773243", "0.67213434", "0.6628229", "0.65846545", "0.6583305", "0.65332806", "0.64887327", "0.64887327", "0.64698523", "0.6450161", "0.64455634", "0.64354306", "0.642966", "0.6352989", "0.63092613", "0.6308861", "0.6287949", "0.6274879", "0.62295...
0.7038104
0
The string for DEVNAME used by kernel in uevent.
def kdev_name(self): return self._sysfs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_name(self):\n name = self._device[\"name\"]\n if not name or name == \"--\":\n name = self._mac\n\n return name", "def name(self):\n return self.devname", "def name(self):\n return f\"{get_device_name(self._data, 0, self._name)}\"", "def device_nam...
[ "0.7653964", "0.7651574", "0.7606604", "0.75387293", "0.75387293", "0.7465343", "0.7465343", "0.7457964", "0.743613", "0.73530847", "0.73530847", "0.73530847", "0.727464", "0.7246561", "0.7210606", "0.7110714", "0.7101008", "0.70763487", "0.70535266", "0.7051693", "0.7044535"...
0.77354324
0
Returns n points evenly spaced along the perimeter of a circle of diameter d centered at the origin, if type = 'int' the coordinates are rounded to the neares integer
def perimeter_points(d,n,type = 'int'): rimpointsx = np.sin(np.linspace(0,2*np.pi,num=n,endpoint = False)) + 1 rimpointsy = np.cos(np.linspace(0,2*np.pi,num=n,endpoint = False)) + 1 rimpoints = (((d-1)/2))*np.array([rimpointsy,rimpointsx]) if type == 'int': rimpoints = np.round(rimpoints) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, n):\n perimeter = 2 * math.pi\n return Point(math.cos(n / perimeter), math.sin(n / perimeter))", "def discretized_circle(radius, n_pts):\n x1 = np.zeros(n_pts)\n y1 = np.zeros(n_pts)\n for i in range(0, n_pts):\n x1[i] = np.cos(2 * np.pi / n_pts * i) * radius\n ...
[ "0.73338", "0.7235277", "0.70930624", "0.697346", "0.69107336", "0.6859915", "0.6700372", "0.6552774", "0.64891666", "0.6395865", "0.63475925", "0.6329089", "0.6323116", "0.6279683", "0.6203975", "0.61838937", "0.61728275", "0.617129", "0.6138173", "0.6136083", "0.6120699", ...
0.81103927
0
returns the image specified as a numpy array in grayscale Images cropped to squares
def get_image(filepath,size): image = Image.open(filepath) newimage = image.resize((size,size)).convert('LA') pixels = np.asarray(newimage,dtype = np.float32)[:,:,0] return pixels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_to_square(self, image):\n orig_height, orig_width, orig_channels = image.shape\n if orig_height > orig_width:\n return image[:orig_width, ...]\n elif orig_height < orig_width:\n return image[:, :orig_height, ...]\n return image", "def _get_crops(im):\n # Convert to grayscale\n ...
[ "0.70498043", "0.6712822", "0.648864", "0.63568527", "0.63323677", "0.627534", "0.6262594", "0.6244694", "0.62393683", "0.6237831", "0.62079406", "0.6206653", "0.6179326", "0.6160937", "0.61507726", "0.61032444", "0.608336", "0.60813206", "0.60772306", "0.6073886", "0.6061323...
0.570519
98
returns the gradient of an image, and does basic preprocessing
def get_gradient(pixels,processing = 'normalize'): horgradient = ndimage.sobel(pixels, axis = 1) vergradient = ndimage.sobel(pixels, axis = 0) gradient = np.array((vergradient,horgradient)) if processing == 'normalize': """Normalizing the gradient""" gradnorm = 0.2*np.max(np.linalg.no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(img):\n nx, ny = np.gradient(unshape(img))\n return reshape(nx), reshape(ny)", "def gradient(img):\n G = np.zeros(img.shape)\n theta = np.zeros(img.shape)\n\n #####################################\n # START YOUR CODE HERE #\n #####################################\n ...
[ "0.7586268", "0.6972738", "0.6935653", "0.68607026", "0.68142897", "0.6806551", "0.67301935", "0.6725793", "0.66751134", "0.667408", "0.6661592", "0.65987915", "0.6586055", "0.6528661", "0.65153956", "0.64846945", "0.6466763", "0.6448171", "0.6410009", "0.64030516", "0.637263...
0.68905056
3
Making an array of coordinates
def coordinate_matrix(n): xcoordinates = np.zeros((n,n)) xcoordinates = xcoordinates + np.arange(0,worksize) #broadcasting trick ycoordinates = xcoordinates.T return np.array([ycoordinates,xcoordinates])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_simple_coords():\n \n x = np.array([144, 124, 97, 165, 114, 60, 165, 0, 76, 50, 147])\n y = np.array([ 0, 3, 21, 28, 34, 38, 51, 54, 58, 56, 61])\n coords = np.vstack((x,y)).T\n return coords", "def coordinates(self):\n return np.array([[f.x, f.y] for f in self])", "def coordinat...
[ "0.7861782", "0.7624699", "0.740865", "0.7363488", "0.72561747", "0.7240629", "0.72085065", "0.7199131", "0.71890455", "0.7092392", "0.7023159", "0.6998691", "0.6987628", "0.683606", "0.68330365", "0.68114585", "0.6789206", "0.67608094", "0.67176217", "0.6712654", "0.6708797"...
0.6520873
38
Outputs the matrix with with to adjust the gradient after adding the line between p1 and p2
def line_contribution(p1,p2,alpha = 1): adjust = np.zeros((worksize,worksize,2)) x1 = p1[0] y1 = p1[1] x2 = p2[0] y2 = p2[1] coordinates = coordinate_matrix(worksize) numerator = np.sum(np.multiply(coordinates,np.reshape(np.array(((y2-y1,-(x2-x1)))),(2,1,1))),axis = 0) + x2*y1 - y2*x1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_gradient(p1, p2):\n # Ensure that the line is not vertical\n if p1[0] == p2[0]:\n return None\n m = (p1[1] - p2[1]) / (p1[0] - p2[0])\n return m", "def calc_gradu_gradv_p1_partly(topo,x,y):\n ndofs = max(x.shape)\n\n (rows,cols)= la_utils.get_sparsity_pa...
[ "0.64249635", "0.5964822", "0.58919156", "0.5855966", "0.5814256", "0.57597506", "0.57327527", "0.5700635", "0.5680193", "0.5670194", "0.5667574", "0.56395584", "0.56350654", "0.56335413", "0.5621072", "0.5597152", "0.559362", "0.55905247", "0.55903786", "0.55802053", "0.5572...
0.59735805
1
Given two points in a grid, returns a list of all grid cells meeting the line between the points
def discrete_line(p1,p2,alg = 'homebrew'): if alg=='homebrew': numpixels = abs(p2[0] - p1[0]) + abs(p2[1] - p1[1]) + 1 #Taxicap metric distance xline = np.rint(np.linspace(p1[0],p2[0],numpixels)).astype(int) yline = np.rint(np.linspace(p1[1],p2[1],numpixels)).astype(int) return np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbors(grid, x, y):\n out = []\n if x > 0:\n out.append(grid[x-1, y])\n if y > 0:\n out.append(grid[x, y-1])\n if y < grid.shape[1] - 1:\n out.append(grid[x, y+1])\n if x < grid.shape[0] - 1:\n out.append(grid[x+1, y])\n return out", "def getGridPoints(x, ...
[ "0.68051696", "0.6638735", "0.6442276", "0.64085144", "0.64050704", "0.63556564", "0.6281879", "0.6255675", "0.6218219", "0.6217675", "0.6170721", "0.6161145", "0.6152249", "0.612991", "0.6090198", "0.60775316", "0.60721445", "0.60552007", "0.60552007", "0.6026698", "0.601415...
0.0
-1
Return the loss assigned to the line between the two points
def lineloss(endpoints,gradient): l = discrete_line(endpoints[0],endpoints[1]) direction = endpoints[1]-endpoints[0] dperp = np.array((-direction[1],direction[0])) #Perpendicular vector to the direction dperp = dperp/np.linalg.norm(dperp) lpoints = gradient[:,l[0],l[1]] return -np.sum(np.abs(np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss(self, x, y):\n return x", "def calc_loss(self, x: np.ndarray, y: np.ndarray) -> float:\n return self.descent.calc_loss(x, y)", "def loss(self, x, y):\n\n return self.loss_fn(x, y)", "def loss(self, x, y):\n raise NotImplementedError", "def loss_mse(x, y):\n error = (...
[ "0.7284146", "0.7234958", "0.71114844", "0.6931073", "0.68393904", "0.67613167", "0.6687321", "0.6684187", "0.6655055", "0.66463375", "0.66390735", "0.659856", "0.6597544", "0.6554526", "0.65452504", "0.6539369", "0.6537667", "0.6530421", "0.64941925", "0.6464455", "0.6461041...
0.6545975
14
M,N are two matrices of vectors, returns a matrix which is M if M,N have positive dot product, and 0 otherwise
def clip_at_zero(M,N): dotprod = np.sum(np.multiply(M,N),axis = 0) if (np.any(np.logical_and(dotprod <= 0, np.all(M == np.array((0,0)).reshape((2,1,1)), axis=0)))): print('clipping happened') return np.where(dotprod<=0,np.zeros_like(M),M)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def naive_matrix_dot(x, y):\n assert len(x.shape) == 2\n assert len(y.shape) == 2\n assert x.shape[1] == y.shape[0]\n\n z = np.zeros((x.shape[0], y.shape[1]))\n for i in range(x.shape[0]):\n for j in range(y.shape[1]):\n row_x = x[i, :]\n column_y = y[:, j]\n ...
[ "0.72495085", "0.7174039", "0.71379566", "0.6967614", "0.6911988", "0.68983024", "0.6875445", "0.6848363", "0.6824717", "0.6817393", "0.6791111", "0.6785556", "0.6755931", "0.6749309", "0.6747172", "0.6725255", "0.67065775", "0.66520125", "0.66332483", "0.65919644", "0.659113...
0.0
-1
has an anagram in word list when combined with one letter
def hasAnagramPlusOne(word): c = AnagramDB.charcount(word) ref = np.array(c) mDiff = AnagramDB._charmatrix - ref gt = np.all(mDiff >= 0, 1) sm = np.sum(mDiff, 1) == 1 return np.any(gt & sm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anagrams(word):\n\t# Question 4b: Generates all permutations of word and filters it to contain only valid words\n\treturn word_perms(word) & word_sets[len(word)]", "def valid_anagram(phrase):\n words = []\n series_of_words = phrase.split(' ')\n words.append(''.join(sorted(series_of_words.pop())))\n ...
[ "0.7905959", "0.7879602", "0.7704681", "0.75770694", "0.7564823", "0.75044084", "0.7491436", "0.7480878", "0.74474674", "0.7409213", "0.7388124", "0.7386171", "0.7349177", "0.7325466", "0.7324369", "0.72890925", "0.72514504", "0.71973234", "0.71911204", "0.7182583", "0.716590...
0.67131454
50
has an anagram in word list when combined with two letters
def hasAnagramPlusTwo(word): c = AnagramDB.charcount(word) ref = np.array(c) mDiff = AnagramDB._charmatrix - ref gt = np.all(mDiff >= 0, 1) sm = np.sum(mDiff, 1) == 2 return np.any(gt & sm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anagram(s1, s2):\n pass", "def anagrams(word):\n\t# Question 4b: Generates all permutations of word and filters it to contain only valid words\n\treturn word_perms(word) & word_sets[len(word)]", "def valid_anagram(phrase):\n words = []\n series_of_words = phrase.split(' ')\n words.append(''.joi...
[ "0.77784854", "0.77640766", "0.7753556", "0.77450216", "0.7643453", "0.76099306", "0.75898474", "0.75881165", "0.7521585", "0.749232", "0.7467466", "0.74578816", "0.7447025", "0.73757446", "0.733657", "0.72575104", "0.72335804", "0.72315633", "0.7229648", "0.72107047", "0.720...
0.67706805
45
`clicked on board | || yes No | | selected from where nothing to do | | | | selection_bar Board no selection | | | is clicked on valid position is clicked on valid position(Rajan) clicked on empty slot | | | (it returns pgn) | | | | | | | yes no yes no | | | | | | place it (if his piece) does move contain 'x' (capture)...
def main_board_maintenance(self,x_cor,y_cor): for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.display.quit() pygame.quit() quit() if event.type == pygame.MOUSEBUTTONDOWN: x_adjusted,y_adjusted = Helping_Class.convert_coordinate(x_cor,y_cor,from_where...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selection_board_maintenance(self,x_cor,y_cor):\t\t\r\n\t\tfor event in pygame.event.get():\r\n\t\t\tif event.type == pygame.QUIT:\r\n\t\t\t\tpygame.display.quit()\r\n\t\t\t\tpygame.quit()\r\n\t\t\t\tquit() \r\n\r\n\t\t\tif event.type == pygame.MOUSEBUTTONDOWN:\r\n\t\t\t\t#print(\"mouse is pressed\")\r\n\t\...
[ "0.7565643", "0.66341156", "0.6557111", "0.6449328", "0.63517064", "0.6219487", "0.61956", "0.61922944", "0.6161466", "0.6128278", "0.61244667", "0.6082774", "0.6044222", "0.60180783", "0.5978442", "0.5978442", "0.59686", "0.5960028", "0.59480584", "0.5931471", "0.58620036", ...
0.6903945
1
clicked on selection_bar | | | Yes No | | selected from where or not selected is it his piece | | | | | | | selection_bar board nothing selected yes no \ | / | | \ | / blit cover nothing to do \ | / (if clicked piece is his piece == True) else nothing to do and if its availability is their \ / | \ / | \ / | \ / | \/ | ...
def selection_board_maintenance(self,x_cor,y_cor): for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.display.quit() pygame.quit() quit() if event.type == pygame.MOUSEBUTTONDOWN: #print("mouse is pressed") #everything begins here x_adjusted,y_adjusted...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_me(self, mouse_pos):\r\n\t\t#self.active = self.rect.collidepoint(mouse_pos)\r\n\t\tself.active = True", "def menuSelection(self):\n \n self.selection = int(input(\"\\nWhere do you want to go? Make a selection: \"))\n \n while self.selection not in self.menu.index:\n ...
[ "0.65026367", "0.64400166", "0.63710815", "0.63659126", "0.62468314", "0.62162787", "0.62162787", "0.6215016", "0.61831117", "0.61701834", "0.6158669", "0.6151914", "0.6135659", "0.61340016", "0.6130133", "0.61174387", "0.6027609", "0.60263383", "0.60083646", "0.60067785", "0...
0.7832845
0
Update the Qvalues, then take an action
def act(self, observation, reward, done): if self._not_restarted(observation): # not the first action, remember it and update model self._remember(self.prev_action, reward, observation, done) if len(self.replay_memory) > self.batch_size: self._replay() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_Q(self):", "def act(self, q_values, *args, **kwargs):\n pass", "def updateQValue(self, state, action, old_q, reward, future_rewards):\n self.q[(tuple(state), action)] = old_q + self.alpha * (reward + future_rewards - old_q)", "def update_q_values(self, state, value):\n if self...
[ "0.7905159", "0.7449504", "0.7192174", "0.71399486", "0.7046978", "0.70189166", "0.700207", "0.69521886", "0.6898642", "0.68610793", "0.67248416", "0.67002743", "0.6616998", "0.6561065", "0.65476024", "0.6529153", "0.6528751", "0.6525281", "0.65039825", "0.6494379", "0.648365...
0.0
-1
Returns the scheduling actions based on highest Qvalues. This requires the model weights to be already saved.
def get_best_schedule(self): # load the model weights self.models = [load_model(f'dqn_{task_id}.h5') for task_id in range(len(self.models))] actions = [] is_scheduled = [0] * len(self.models) while (not all(is_scheduled)): observation = OrderedDict([('is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bestAction(self):\n get_q = self.getQFunction()\n maxq = -5000\n best_actions = []\n for (state, action), q in get_q.items():\n if q > maxq:\n maxq = q\n best_actions = [action]\n elif q == maxq:\n best_actions.appen...
[ "0.767564", "0.71033466", "0.69351465", "0.6854587", "0.68315357", "0.6827179", "0.68225276", "0.67966247", "0.67770445", "0.67721236", "0.67721236", "0.67337626", "0.67147684", "0.6710782", "0.66831255", "0.6642326", "0.66293216", "0.6593363", "0.65867025", "0.65508795", "0....
0.7105697
1
Splits a longer list to respect batch size
def chunks(lst, chunk_size=MAX_BATCH_SIZE): for i in range(0, len(lst), chunk_size): yield lst[i : i + chunk_size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]", "def ghetto_split(list_, chunk_size=100):\n logging.debug(f\"Splitting list of {len(list_)} length, chunk size = {chunk_size}\")\n split_lists = []\n for i in range(0,len(lis...
[ "0.75917864", "0.75681007", "0.7379371", "0.7313012", "0.72504157", "0.7228511", "0.7125443", "0.7111731", "0.7098357", "0.706227", "0.7031203", "0.7005405", "0.69943714", "0.6993998", "0.6941382", "0.69374204", "0.6936441", "0.6932338", "0.6922199", "0.6912759", "0.68996865"...
0.7232765
5
Function to preprocess text
def preprocess(text): return text.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, text):\r\n return text", "def preprocess(text):\n text = remove_space(text)\n text = clean_special_punctuations(text)\n text = handle_emojis(text)\n text = clean_number(text)\n text = spacing_punctuation(text)\n text = clean_repeat_words(text)\n text = remove_spac...
[ "0.8704046", "0.8427587", "0.83973235", "0.82091516", "0.7752192", "0.7749735", "0.76222825", "0.75518227", "0.7480304", "0.7444428", "0.7371285", "0.73551714", "0.73531806", "0.73359823", "0.7331296", "0.7309535", "0.7223363", "0.7209169", "0.71901906", "0.7183196", "0.71748...
0.77093273
6
Calculates embeddings from a given dataframe assume dataframe has title and abstract in the columns
def calculate_embeddings(df, option="lsa", n_papers=MAX_BATCH_SIZE, n_components=30): assert option in ["lsa", "sent_embed"] if len(df) < n_components: print( "Length of dataframe is less than number of projected components, \ set option to sent_embed instead" ) o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_embeddings(xdf, cat, emb, w, verbose):\n if verbose:\n print(\"embeddings category: '%s' embeddings shape %s\" % (cat, np.shape(w)))\n if cat not in list(xdf.columns):\n print(\"categorical variable '%s' not found in data-frame\" % cat)\n print(type(xdf), np.shape(xdf), list(xd...
[ "0.60098046", "0.58753", "0.5867118", "0.5841953", "0.5804004", "0.57337356", "0.5729218", "0.57054985", "0.5680929", "0.563684", "0.5633486", "0.56218636", "0.560861", "0.55656105", "0.5543683", "0.55378395", "0.55248564", "0.54824895", "0.5471733", "0.5426145", "0.54256785"...
0.6808147
0
Uses the unicode of an input kanji to find the corresponding stroke order gif in mistval's collection
def get_gif_uri(kanji): fileName = kanji.encode("unicode-escape").decode("utf-8").replace("\\u", '') + '.gif' animationUri = f'https://raw.githubusercontent.com/mistval/kanji_images/master/gifs/{fileName}' return animationUri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singleglyph(x):\n return [glyph(x)]", "def lcd_string_kana(self, message, line):\n codes = u'線線線線線線線線線線線線線線線線          '\\\n u'       !\"#$%&()*+,-./0123456789:;<=>?@ABCDEFG'\\\n u'HIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{'\\\n u'|}→←        ...
[ "0.5736218", "0.55576307", "0.5534901", "0.54400593", "0.53849167", "0.53792924", "0.53267854", "0.53198653", "0.529424", "0.526523", "0.5261577", "0.52349937", "0.5214417", "0.5189843", "0.5167919", "0.5137147", "0.5071565", "0.5069392", "0.49859008", "0.4958913", "0.4954960...
0.6089763
0
Take a word completely in hiragana or katakana and translate it into romaji
def kana_to_halpern(untrans): halpern = [] while untrans: if len(untrans) > 1: first = untrans[0] second = untrans[1] else: first = untrans[0] second = None if first in hiragana: if second and second in ["ゃ", "ゅ", "ょ"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correctWord (w):\r\n if len(re.findall(r\"[а-я]\",w))>len(re.findall(r\"[a-z]\",w)):\r\n return w.translate(eng_rusTranslateTable)\r\n else:\r\n return w.translate(rus_engTranslateTable)", "def correctWord (w):\n\n if len(re.findall(ur\"[а-я]\",w))>len(re.findall(ur\"[a-z]\",w)):\n ...
[ "0.6710166", "0.66199934", "0.66092587", "0.6596311", "0.6582797", "0.65425485", "0.6520034", "0.6464642", "0.64478225", "0.64389616", "0.6421912", "0.64149904", "0.6321421", "0.6312032", "0.6281646", "0.6239316", "0.62266237", "0.61641186", "0.6144072", "0.6119749", "0.61135...
0.0
-1
Takes a word and returns true if there are hiragana or katakana present within the word
def contains_kana(word): for k in word: if k in hiragana or k in katakana or k in small_characters: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_japanese(x):\n pattern = re.compile(r'[\\p{IsHira}\\p{IsKatakana}]', re.UNICODE)\n ret = bool(pattern.search(x))\n return ret", "def isValid(text):\n\n\n return any(word in text for word in [u\"我好看么\", u\"称赞\"])", "def is_british_english_term(word: str) -> bool:\n word = process_word(word...
[ "0.6930642", "0.68723994", "0.66538167", "0.6580591", "0.6552416", "0.65398663", "0.64157027", "0.6405542", "0.6381708", "0.6371139", "0.6359613", "0.63581526", "0.6336159", "0.6310224", "0.63045526", "0.6291132", "0.628089", "0.6279967", "0.6273224", "0.6266891", "0.625361",...
0.87406576
0
Directly use Jisho's official API to get info on a phrase (can be multiple characters)
def search_for_phrase(self, phrase): uri = uriForPhraseSearch(phrase) return json.loads(requests.get(uri).content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def jisho(self, ctx, word: str):\r\n search_args = await self.dict_search_args_parse(ctx, word.lower())\r\n if not search_args:\r\n return\r\n limit, query = search_args\r\n message = urllib.parse.quote(query, encoding='utf-8')\r\n url = \"http://jisho.org/api/v1...
[ "0.6383143", "0.62670934", "0.60265064", "0.5882855", "0.5850151", "0.58406603", "0.5805289", "0.5768935", "0.5695436", "0.5689113", "0.568847", "0.5662847", "0.5660174", "0.56477916", "0.5562004", "0.5547414", "0.55439466", "0.55421555", "0.5507159", "0.54866064", "0.5482057...
0.67336345
0
Return lots of information for a single character
def search_for_kanji(self, kanji, depth = "shallow"): uri = uri_for_search(kanji, filter="kanji") self._extract_html(uri) return self.parse_kanji_page_data(kanji, depth)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_char_info(self, c):\n\n index = c - self.smallest_character_code\n bytes = self._read_four_byte_numbers_in_table(\n tables.character_info, index)\n\n width_index = bytes[0]\n height_index = bytes[1] >> 4\n depth_index = bytes[1] & 0xF\n italic_index = ...
[ "0.7179715", "0.70204085", "0.68486726", "0.65411425", "0.63258415", "0.6280738", "0.6244535", "0.62056214", "0.60945004", "0.6085681", "0.5998127", "0.5975675", "0.59639347", "0.59632957", "0.5955575", "0.59515536", "0.59307986", "0.5917358", "0.5907966", "0.586734", "0.5862...
0.0
-1
With the response, extract the HTML and store it into the object.
def _extract_html(self, url): self.response = requests.get(url, timeout=5) self.html = BeautifulSoup(self.response.content, "lxml") if self.response.ok else None # return self.html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, response: BeautifulSoup):\n raise NotImplementedError", "def parse(self, response):\n yield{\n 'url': response.url,\n 'title': response.css(\"h1.article-main-title::text\").get(),\n 'sub_title': response.css(\"h2.article-sub-title::text\").get(),\n ...
[ "0.7155325", "0.6815259", "0.6661986", "0.66527045", "0.65676737", "0.65462565", "0.652491", "0.6482208", "0.6459295", "0.64440024", "0.64043", "0.6329705", "0.63162", "0.63162", "0.62707376", "0.6270195", "0.62326896", "0.62191874", "0.62183607", "0.6180285", "0.6169138", ...
0.732518
0
Take a japanese word and spit out wellformatted dictionaries for each entry.
def search_for_word(self, word, depth="shallow"): # self._get_search_response(word) self._extract_html(uri_for_search(word)) results = self.html.select(".concept_light.clearfix") # print(results) fmtd_results = [] if depth == "shallow": for r in results: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def japanese():\n return render_template('japanese.html',\n\n title='日语学习轨迹',\n year=datetime.now().year,\n message='记录下我日语学习的进程')", "def split_japanese_text(self, text):\n\n for match in self.word_pattern.finditer(text):\n word = match.group(0)\n got_japanese...
[ "0.6403405", "0.6237616", "0.5627468", "0.56240886", "0.5615955", "0.559674", "0.55401033", "0.53921825", "0.53093743", "0.53013974", "0.5270286", "0.5234885", "0.51820177", "0.51729184", "0.51708233", "0.51235855", "0.506858", "0.5027429", "0.5005299", "0.50010526", "0.49943...
0.0
-1
Take the meanings list from the DOM and clean out noninformative meanings.
def _isolate_meanings(self, meanings_list): index = self._get_meaning_cutoff_index(meanings_list) if index: return [m for i, m in enumerate(meanings_list) if i < index] else: return meanings_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_descriptions(descriptions):\n for key, desc_list in descriptions.items():\n for i in range(len(desc_list)):\n desc = desc_list[i]\n # Tokenize.\n desc = desc.split()\n # Convert to lower case.\n desc = [word.lower() for word in desc]\n ...
[ "0.54715055", "0.5397452", "0.5360758", "0.53188324", "0.5145506", "0.51151055", "0.51028174", "0.5073956", "0.5072407", "0.5066381", "0.5064213", "0.5051223", "0.50442636", "0.5030571", "0.5029992", "0.50089633", "0.5005092", "0.49978328", "0.4987968", "0.4981853", "0.497821...
0.5666595
0
Takes a meaning list and extracts all the non Wiki, note, or nondefinition entries.
def _get_meaning_cutoff_index(self, meanings_list): try: wiki_index = [m.text == "Wikipedia defintiion" for m in meanings_list].index(True) except ValueError: wiki_index = False try: other_forms_index = [m.text == "Other forms" for m in meanings_list].index(T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_mentions_or_lists_with_indices(self, transform = lambda x: x):\r\n if not REGEXEN['at_signs'].search(self.text):\r\n return []\r\n\r\n possible_entries = []\r\n for match in REGEXEN['valid_mention_or_list'].finditer(self.text):\r\n try:\r\n ...
[ "0.5681382", "0.55737865", "0.5390762", "0.5369432", "0.52998537", "0.5218269", "0.52073264", "0.51946306", "0.5158843", "0.51329166", "0.5113607", "0.5104712", "0.5102426", "0.5095653", "0.5090763", "0.507698", "0.5075207", "0.5073804", "0.5056159", "0.5029667", "0.50159496"...
0.51685643
8
Take a dictionary entry from Jisho and return all the necessary information.
def _extract_dictionary_information(self, entry): # Clean up the furigana for the result furigana = "".join([f.text for f in entry.select(".kanji")]) # Cleans the vocabulary word for the result vocabulary = self._get_full_vocabulary_string(entry) if not entry.select(".concept_light-repr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info(self) -> Optional[Dict[str, Any]]:", "def info() -> Dict[str, Any]:", "def dict(dict: Dict[str, Pin], /) -> None:", "def get_value(self) -> Dict[str, any]:", "def info_from_entry(self, entry):\n info = super().info_from_entry(entry)\n return info", "def define_info_dict():\n\n ...
[ "0.6224687", "0.60592717", "0.59495497", "0.57163745", "0.5668498", "0.56661296", "0.5663474", "0.56373096", "0.56356984", "0.5632979", "0.5556252", "0.55270034", "0.54797757", "0.5339577", "0.53295577", "0.53264076", "0.5320593", "0.5297739", "0.5295712", "0.52907723", "0.52...
0.56768185
4
Return the full furigana of a word from the html.
def _get_full_vocabulary_string(self, html): # The kana represntation of the Jisho entry is contained in this div text_markup = html.select_one(".concept_light-representation") upper_furigana = text_markup.select_one(".furigana").find_all('span') # inset_furigana needs more formatting ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_of_the_day():\n r = requests.get(\"http://www.urbandictionary.com\") # link is always homepage\n soup = BeautifulSoup(r.content, features=\"html.parser\") # sets up soup\n def_header = \"**\" + soup.find(\"div\", attrs={\"class\": \"def-header\"}).text.replace(\"unknown\",\n ...
[ "0.6115667", "0.5743542", "0.55236655", "0.53933805", "0.5346994", "0.5319101", "0.5280804", "0.5258494", "0.5191958", "0.5186769", "0.5165909", "0.51648223", "0.5127701", "0.5116987", "0.51016253", "0.50996876", "0.50930995", "0.5036981", "0.502899", "0.5027194", "0.5025558"...
0.6967511
0
Render a template with context to a Response. Adds a few items to the context, then returns a TemplateResponse.
def template_context_render(template_name, request, context) -> Response: context["request"] = request context["messages"] = get_messages(request) context["irrd_internal_migration_enabled"] = get_setting("auth.irrd_internal_migration_enabled") context["auth_sources"] = [ name for name, settings...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_to_response(self, request, context, **response_kwargs):\n return TemplateResponse(\n request=request,\n template=self.get_template_name(),\n context=context,\n **response_kwargs\n )", "def render_to_response(self, context, **response_kwargs):\n...
[ "0.82421523", "0.785903", "0.7600642", "0.7592935", "0.7493206", "0.74454516", "0.73948944", "0.7329926", "0.72929937", "0.7235171", "0.71244043", "0.71067244", "0.70252717", "0.69505185", "0.69402665", "0.6859314", "0.67864096", "0.6717012", "0.6714318", "0.66441727", "0.660...
0.7136877
10
Render the form in a nice horizontal format.
def render_form(form: wtforms.Form) -> Markup: # the defaults for checkboxes and submits are weird and the API limited, # hence this hacky fix checkboxes = [field.name for field in form if isinstance(field.widget, wtforms.widgets.CheckboxInput)] submits = [field.name for field in form if isinstance(fiel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_form():", "def render(self):\n\n sep = '+'.join('-' * w for w in self._widths)\n sep = f'+{sep}+'\n\n to_draw = [sep]\n\n def get_entry(d):\n elem = '|'.join(f'{e:^{self._widths[i]}}' for i, e in enumerate(d))\n return f'|{elem}|'\n\n to_draw.ap...
[ "0.6247414", "0.60871595", "0.6022289", "0.60026765", "0.596677", "0.5953268", "0.5855015", "0.58536017", "0.58020973", "0.5775744", "0.57299644", "0.5710525", "0.56864727", "0.5686367", "0.56197023", "0.54001427", "0.5389983", "0.5386723", "0.5385895", "0.5385895", "0.536839...
0.5433534
15
Function return Fizz, Buzz or FizzBuzz
def fizz_buzz(value): if not value % 15: return "FizzBuzz" if not value % 5: return "Buzz" if not value % 3: return "Fizz" else: return str(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizz_buzz(n):\n\n\tif n % 3 == 0 and n % 5 ==0:\n\t\treturn 'fizzbuzz'\n\n\telif n % 3 ==0:\n\t\treturn 'Fizz'\n\telif n % 5 ==0:\n\t\treturn 'buzz'", "def fizz_buzz(number: int):\n if number % 3 == 0 and number % 5 == 0:\n return 'fizz buzz!'\n elif number % 3 == 0:\n return 'fizz'\n ...
[ "0.7448633", "0.73555106", "0.7193669", "0.7182621", "0.7145736", "0.7085973", "0.7029065", "0.69819033", "0.6980108", "0.6774766", "0.67018825", "0.65110123", "0.65101916", "0.6493871", "0.64486504", "0.63575494", "0.63551235", "0.63295746", "0.6314349", "0.622801", "0.62132...
0.7079904
6
Changes values from the given tree in appliance with fizz_buzz func
def fizz_buzz_tree(tree): new_tree = BinaryTree() if not tree.root: return new_tree def recursive(current): """Func to go recursively through each element in given tree and return a new tree""" node = Node(fizz_buzz(current.value)) if current.left: node.left =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzztree(tree):\n tree.in_order(fizz_the_buzz)\n return tree", "def fizz_buzz_tree(tree):\n\n new_tree = BinaryTree()\n\n if not tree.root:\n return new_tree\n\n def replace_node(current):\n node = Node(fizz_buzz(current.value))\n\n if current.left:\n node.l...
[ "0.7186673", "0.69893754", "0.68174803", "0.62860036", "0.6199422", "0.6018725", "0.57565373", "0.5561288", "0.54404104", "0.5340044", "0.52967304", "0.5240528", "0.52139944", "0.52043754", "0.5188785", "0.51449543", "0.51364225", "0.50929594", "0.50743073", "0.50398874", "0....
0.685073
2
Func to go recursively through each element in given tree and return a new tree
def recursive(current): node = Node(fizz_buzz(current.value)) if current.left: node.left = recursive(current.left) if current.right: node.right = recursive(current.right) return node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_tree(tree: dict, func: Callable, args: Optional[Tuple] = None, kwargs: Optional[Mapping] = None) -> None:\n if args is None:\n args = ()\n if kwargs is None:\n kwargs = {}\n frontier = []\n explored = set()\n for uid, item in tree.items():\n frontier.append((uid, item)...
[ "0.67651725", "0.6634226", "0.658713", "0.65578026", "0.6379958", "0.63447267", "0.62933624", "0.62565976", "0.62436295", "0.61932963", "0.6187411", "0.6177289", "0.6154103", "0.6135427", "0.6118883", "0.6111558", "0.6086576", "0.60851705", "0.6080475", "0.6077281", "0.605692...
0.0
-1
Prefetch the approvals, so that we don't do a query perprescription on the regional summary page.
def queryset(self, request): qs = super(PrescriptionAdmin, self).queryset(request) qs.prefetch_related('approval_set') return qs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prefetched_queryset(self, *args, **kwargs):\n return (\n super()\n .get_prefetched_queryset(*args, **kwargs)\n .select_related(\"user\", \"poll\")\n .prefetch_related(\"votes\")\n )", "def get_prefetched_queryset(self, *args, **kwargs):\n\n ...
[ "0.54367656", "0.5391246", "0.5300379", "0.52060467", "0.5086948", "0.50608206", "0.5014186", "0.50046194", "0.4998559", "0.49390295", "0.49279544", "0.49236992", "0.48870006", "0.48863047", "0.48823196", "0.48582858", "0.48275545", "0.4819519", "0.48050737", "0.4800241", "0....
0.6178668
0
Add some extra views for handling the prescription summaries and a page to handle selecting Regional Fire Coordinator objectives for a burn.
def get_urls(self): from django.conf.urls import patterns, url def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.model._meta.app_label, self.model._meta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_view( *args, **kwargs ):", "def get(self, request):\n about_persons = AboutPerson.objects.all()\n funders = about_persons.filter(funder_or_adviser='funder').order_by('position')\n advisers = about_persons.filter(funder_or_adviser='adviser').order_by('position')\n architects = ...
[ "0.57753986", "0.5340488", "0.53365904", "0.5322739", "0.5311705", "0.5212307", "0.5187701", "0.51857364", "0.51724756", "0.51651466", "0.51623344", "0.5156172", "0.512286", "0.5107484", "0.50994337", "0.50859976", "0.50857466", "0.5078334", "0.5068414", "0.50569636", "0.5049...
0.0
-1
Override the redirect url after successful save of a new burn plan.
def response_post_save_add(self, request, obj): # a simple hack to set the default prescribing officer if obj is not None and obj.prescribing_officer is None: obj.prescribing_officer = request.user obj.save() if obj is not None and obj.creator_id == 1: obj.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_success_url(self):\n return reverse('warehouse-list')", "def response_post_save_change(self, request, obj):\n url = reverse('admin:prescription_prescription_detail',\n args=[str(obj.id)])\n return HttpResponseRedirect(url)", "def edit_redirect_url(self):\n ...
[ "0.666625", "0.65918213", "0.6264983", "0.62574774", "0.6206971", "0.6206971", "0.618034", "0.61408806", "0.6119933", "0.6114445", "0.61095846", "0.61095846", "0.610071", "0.610071", "0.60620487", "0.6043722", "0.6040068", "0.6008337", "0.5983989", "0.59721994", "0.59662867",...
0.5495357
59
Override the redirect url after successful save of an existing burn plan.
def response_post_save_change(self, request, obj): url = reverse('admin:prescription_prescription_detail', args=[str(obj.id)]) return HttpResponseRedirect(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_success_url(self):\n return reverse('warehouse-list')", "def edit_redirect_url(self):\n return url_for(self.edit_redirect_to_view)", "def get_success_url(self):\n if self.success_url:\n url = self.success_url % self.object.__dict__\n elif hasattr(self.object,'url'...
[ "0.66047686", "0.6257987", "0.6155057", "0.6155057", "0.61462444", "0.61178875", "0.61144376", "0.6113364", "0.60519975", "0.6047323", "0.6047323", "0.6019146", "0.6019146", "0.59772176", "0.5965734", "0.5944104", "0.59375286", "0.591943", "0.59057283", "0.58903694", "0.58812...
0.6583407
1
Tweak fieldsets based on whether the user is creating a new prescription or editing an existing one.
def get_fieldsets(self, request, obj=None): if obj: return (('Corporate Burn Attribute Summary', { "fields": ('name', 'description', ('financial_year', 'planned_season'), ('last_year', 'last_season', 'last_year_unknown', 'last_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_tweaks(self):\n pass", "def form_valid(self, form):\n\n action = self.get_object()\n \n self.request.user.assert_can_edit_action(action)\n\n question = action.question \n\n title = form.cleaned_data['title']\n #theese tags will be replaced to the old ones...
[ "0.57284695", "0.55701387", "0.55596006", "0.5456526", "0.5361087", "0.52569866", "0.51682544", "0.5168043", "0.5154395", "0.51173204", "0.5104445", "0.5089623", "0.50706154", "0.50656986", "0.50316", "0.4991277", "0.49874654", "0.49826753", "0.49731532", "0.49685943", "0.495...
0.51591355
8
Populate some of the foreign keys with initial data.
def formfield_for_foreignkey(self, db_field, request, **kwargs): profile = request.user.get_profile() if db_field.name == 'region' and profile.region is not None: kwargs['initial'] = profile.region.pk return db_field.formfield(**kwargs) if db_field.name == 'district' and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_foreign_keys(self, keys):\n # make this final once set\n if self._foreign_keys:\n raise AlreadySetError()\n\n self._foreign_keys = self._prepare_keys(keys)", "def populate_db():\n\n populate_table(db, models.Department, departments_data)\n populate_table(db, models....
[ "0.6309452", "0.61602986", "0.6133915", "0.61306214", "0.61230487", "0.6096589", "0.6025868", "0.5932543", "0.5864428", "0.5854126", "0.584458", "0.57203335", "0.571769", "0.5700302", "0.5688855", "0.56537133", "0.5620991", "0.56176937", "0.5569731", "0.55570775", "0.55327004...
0.0
-1
Replace the widget for the burn purposes with our own checkbox select.
def formfield_for_manytomany(self, db_field, request, **kwargs): if db_field.name == 'purposes': kwargs['widget'] = CheckboxSelectMultiple() return super(PrescriptionAdmin, self).formfield_for_manytomany( db_field, request, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_type_widget(self):\n self._chb_bool = QtWidgets.QCheckBox()\n return self._chb_bool", "def new_varEnabledWidget():\n newWidget = QtGui.QCheckBox()\n newWidget.setChecked(True)\n return newWidget", "def setSelectWidget(browser, name, labels):\n control = browser....
[ "0.6065487", "0.60620207", "0.5921661", "0.5912414", "0.5761602", "0.566816", "0.56664306", "0.564094", "0.56157845", "0.55999786", "0.55923605", "0.5565391", "0.55543464", "0.5515639", "0.55150855", "0.54477555", "0.54293567", "0.542039", "0.54176813", "0.5414378", "0.541437...
0.5028383
95
Returns a Form class for use in the admin add view. This is used by add_view and change_view.
def get_form(self, request, obj=None, **kwargs): if self.declared_fieldsets: fields = flatten_fieldsets(self.get_fieldsets(request, obj)) else: fields = None if self.exclude is None: exclude = [] else: exclude = list(self.exclude) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_class(self):\n form_options = self.get_form_options()\n # If a custom form class was passed to the EditHandler, use it.\n # Otherwise, use the base_form_class from the model.\n # If that is not defined, use WagtailAdminModelForm.\n model_form_class = getattr(self.mod...
[ "0.81933784", "0.7942996", "0.78254306", "0.775345", "0.7538829", "0.74290466", "0.7422751", "0.7369174", "0.7369174", "0.7212445", "0.7203951", "0.71476364", "0.71261346", "0.7111991", "0.7109258", "0.70100105", "0.6982766", "0.6945724", "0.6937545", "0.69295835", "0.6912629...
0.65677464
34
View to manage corporate approval of an ePFP.
def corporate_approve(self, request, object_id, extra_context=None): obj = self.get_object(request, unquote(object_id)) if request.method == 'POST': url = reverse('admin:prescription_prescription_detail', args=[str(obj.id)]) if request.POST.get('_cancel'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def office_edit_process_view(request):\n status = ''\n success = True\n # admin, analytics_admin, partner_organization, political_data_manager, political_data_viewer, verified_volunteer\n authority_required = {'verified_volunteer'}\n if not voter_has_authority(request, authority_required):\n ...
[ "0.60776347", "0.59112906", "0.58727604", "0.57528615", "0.57168037", "0.56779003", "0.5671841", "0.5618632", "0.55696684", "0.55305827", "0.551526", "0.55147535", "0.54409975", "0.54267627", "0.5425578", "0.5413403", "0.5285814", "0.5261875", "0.5244001", "0.5226627", "0.521...
0.66895914
0
View to manage endorsement of an ePFP.
def endorse(self, request, object_id, extra_context=None): obj = self.get_object(request, unquote(object_id)) title = "Endorse this ePFP" if obj.endorsement_status == obj.ENDORSEMENT_DRAFT: title = "Submit for endorsement" form = AddEndorsementForm(request.POST or None, req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enterprise_edit(request):\r\n action = tool.get_param_by_request(request.GET, 'action', \"add\", str)\r\n career_id = tool.get_param_by_request(request.GET, 'careerId', 0, int)\r\n\r\n enterprise = APIResult()\r\n c = None\r\n if action == \"add\":\r\n c = {\"career_id\": career_id, \"act...
[ "0.60825455", "0.56893605", "0.5541821", "0.55269986", "0.5434012", "0.54181087", "0.5341557", "0.5296141", "0.52757007", "0.5231355", "0.52184767", "0.5189548", "0.5168149", "0.51590496", "0.5138254", "0.51100785", "0.5106903", "0.5091372", "0.5052076", "0.5046529", "0.50167...
0.72415787
0
View to manage determining additional endorsement roles in an ePFP.
def endorsing_roles(self, request, object_id, extra_context=None): class AdminEndorsingRoleForm(EndorsingRoleForm): formfield_callback = partial( self.formfield_for_dbfield, request=request) def __init__(self, *args, **kwargs): super(AdminEndorsingRoleFor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRoles(self):", "def get_roles(self, principal_id):", "def get_roles():\n check_admin()\n roles = Role.query.all()\n\n return render_template('admin/roles/roles.html', roles=roles, title=\"Roles\")", "def present_roles(self):\n print(\"User\" + str(self.unique_id) + \": roles=\")\n ...
[ "0.6207049", "0.6087879", "0.6083007", "0.60107946", "0.5969155", "0.59481686", "0.59077245", "0.58865803", "0.57749194", "0.5726471", "0.56653243", "0.5581845", "0.5547623", "0.55232686", "0.55214936", "0.5508699", "0.55046487", "0.54698545", "0.5464508", "0.5414008", "0.539...
0.5450215
19
View to manage corporate approval of an ePFP.
def approve(self, request, object_id, extra_context=None): obj = self.get_object(request, unquote(object_id)) title = self._approve_title(obj) AdminAddApprovalForm = self._approve_approval_form(request) form = AdminAddApprovalForm(initial={'prescription': obj}) if request.metho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corporate_approve(self, request, object_id, extra_context=None):\n obj = self.get_object(request, unquote(object_id))\n if request.method == 'POST':\n url = reverse('admin:prescription_prescription_detail',\n args=[str(obj.id)])\n if request.POST.get...
[ "0.66895914", "0.60776347", "0.59112906", "0.58727604", "0.57168037", "0.56779003", "0.5671841", "0.5618632", "0.55696684", "0.55305827", "0.551526", "0.55147535", "0.54409975", "0.54267627", "0.5425578", "0.5413403", "0.5285814", "0.5261875", "0.5244001", "0.5226627", "0.521...
0.57528615
4
View to manage closure of an ePFP.
def sitemap(self, request, object_id, extra_context=None): obj = self.get_object(request, unquote(object_id)) title = "Sitemap" context = { 'title': title, 'current': obj, } return TemplateResponse(request, "admin/prescription/prescription/" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view(self):", "def view(self):\n raise NotImplementedError", "def mapviewer(request):\n\n precip_layer1 = geeutils.getPrecipMap(accumulation=1)\n precip_layer3 = geeutils.getPrecipMap(accumulation=3)\n precip_layer7 = geeutils.getPrecipMap(accumulation=7)\n #flood_viir = 'None' #geeutils...
[ "0.5681804", "0.5587177", "0.5174407", "0.5012681", "0.501", "0.49960294", "0.4940252", "0.49289963", "0.48889145", "0.4866486", "0.48502752", "0.48241204", "0.4819989", "0.48148638", "0.480015", "0.47965047", "0.47866288", "0.47800702", "0.47731075", "0.4756039", "0.47170666...
0.0
-1
View to manage closure of an ePFP.
def close(self, request, object_id, extra_context=None): obj = self.get_object(request, unquote(object_id)) title = "Close this ePFP" if request.method == 'POST': url = reverse('admin:prescription_prescription_detail', args=[str(obj.id)]) if req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view(self):", "def view(self):\n raise NotImplementedError", "def mapviewer(request):\n\n precip_layer1 = geeutils.getPrecipMap(accumulation=1)\n precip_layer3 = geeutils.getPrecipMap(accumulation=3)\n precip_layer7 = geeutils.getPrecipMap(accumulation=7)\n #flood_viir = 'None' #geeutils...
[ "0.56795317", "0.5585007", "0.5173896", "0.50117266", "0.5010866", "0.4994253", "0.49394262", "0.492645", "0.48868957", "0.48653427", "0.48510844", "0.4824532", "0.481887", "0.48153132", "0.4799649", "0.47953394", "0.4784013", "0.47807014", "0.47734725", "0.47549215", "0.4716...
0.45864856
46
Custom view to allow the user to select which objectives from the prescription's region fit.
def add_objectives(self, request, object_id): # TODO: make a form to handle this... obj = self.get_object(request, unquote(object_id)) if request.method == "POST": selected = request.POST.getlist('objectives') added, removed = False, False for objective in Reg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_ROI(self):\n self.dialog.show()", "def __init__(self):\n\n # GUI constructor\n super().__init__()\n\n # graphics scene\n #self.scene = RoiScene(500, 200)\n #self.scene.add_roi(QGraphicsEllipseItem(0, 0, 60, 30), 20, 30)\n #self.scene.add_roi(QGraphicsRe...
[ "0.57087606", "0.55752957", "0.55460197", "0.5391482", "0.53537536", "0.5254327", "0.5244704", "0.5220837", "0.5211813", "0.5162023", "0.5098962", "0.5068828", "0.506844", "0.50563973", "0.50515777", "0.50476235", "0.50354385", "0.5026545", "0.5025789", "0.4986071", "0.498007...
0.48236713
36
A custom view to display section A1 of an ePFP.
def summary(self, request, object_id): obj = self.get_object(request, unquote(object_id)) if obj is None: raise Http404(_('%(name)s object with primary key %(key)r' ' does not exist.') % {'name': force_text(self.opts.verbose_name), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_section(name):\n assert all((GENERAL, TRAINING, DETECTION, EVALUATION))\n section_frame = pd.DataFrame(eval(name)).T.fillna('-')\n section_frame['flags'] = section_frame.index.values\n section_frame['flags'] = section_frame['flags'].apply(lambda c: f'--{c}')\n section_frame = section_fra...
[ "0.5641974", "0.5529326", "0.54315877", "0.5220913", "0.51875925", "0.5175778", "0.5133844", "0.50168186", "0.50119936", "0.4998252", "0.49607658", "0.49605", "0.49263296", "0.49115452", "0.4908795", "0.4876377", "0.48537728", "0.48259333", "0.48237932", "0.4818766", "0.48137...
0.0
-1
A custom view to display section A1 of an ePFP.
def pre_summary(self, request, object_id): obj = self.get_object(request, unquote(object_id)) AdminPrescriptionSummaryForm = self.get_form(request, obj) funding_choices = FundingAllocation._meta.get_field('allocation').choices # I have not been able to pass this queryset in as a keyword...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_section(name):\n assert all((GENERAL, TRAINING, DETECTION, EVALUATION))\n section_frame = pd.DataFrame(eval(name)).T.fillna('-')\n section_frame['flags'] = section_frame.index.values\n section_frame['flags'] = section_frame['flags'].apply(lambda c: f'--{c}')\n section_frame = section_fra...
[ "0.5641974", "0.5529326", "0.54315877", "0.5220913", "0.51875925", "0.5175778", "0.5133844", "0.50168186", "0.50119936", "0.4998252", "0.49607658", "0.49605", "0.49263296", "0.49115452", "0.4908795", "0.4876377", "0.48537728", "0.48259333", "0.48237932", "0.4818766", "0.48137...
0.0
-1
View to manage PDF created.
def pdf_summary(self, request, object_id, extra_context=None): obj = self.get_object(request, unquote(object_id)) title = "PDFs" cmd = ['fexsend', '-l', '-v'] run = subprocess.Popen(' '.join(cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) fex_tokens = run.com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vantechy(request):\n return FileResponse(open('/files/presentation.pdf', 'rb'))", "def create_pdf(request):\n\n contact_info = ContactDetails.objects.iterator()\n\n # Create a file-like buffer to receive PDF data.\n buffer = io.BytesIO()\n\n # Create the PDF object, using the buffer as its \"f...
[ "0.6903555", "0.67144954", "0.6668836", "0.66344255", "0.65155375", "0.649571", "0.6446106", "0.6344496", "0.6316485", "0.63031816", "0.6227344", "0.6219949", "0.6206408", "0.61425453", "0.6141424", "0.6112751", "0.6112731", "0.6090481", "0.60816264", "0.60662836", "0.6060616...
0.6602638
4
Find the substring between the first and last chars/strings
def __find_between(self, s, first, last): try: start = s.index(first) + len(first) end = s.index(last, start) return s[start:end] except ValueError: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_string(begin, end, string):\n b = string.find(begin) + len(begin)\n e = string.find(end, b)\n\n return string[b:e]", "def find_between(s, first, last):\n try:\n start = s.index(first) + len(first)\n end = s.index(last, start)\n return s[start:end]\n except ValueErr...
[ "0.75524485", "0.7417657", "0.7238031", "0.7159151", "0.7050701", "0.6868164", "0.67760736", "0.66350746", "0.6626501", "0.661806", "0.6558184", "0.65289724", "0.6459214", "0.64507204", "0.6400073", "0.63390535", "0.6337741", "0.62925154", "0.6251687", "0.62035304", "0.618484...
0.7477597
1
A custom view to display the summary of Part B of an ePFP.
def day_summary(self, request, object_id): obj = self.get_object(request, unquote(object_id)) if obj is None: raise Http404(_('%(name)s object with primary key (%key)r' ' does not exist.') % { 'name': force_text(self.opts.verbose_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self, mode='BIC', b=0.0):\n if self.summary_object is None:\n if mode is None:\n mode = self.BFmode\n summ = dict()\n summ['logbayesfactor'] = self.get_log_Bayes_factor(mode)\n summ['evidence'] = \\\n {'mc': self.CModel.get_lo...
[ "0.53438354", "0.5318527", "0.52125865", "0.51925784", "0.51489896", "0.5103749", "0.5083956", "0.5080988", "0.5001087", "0.49766684", "0.49700698", "0.49577278", "0.49387634", "0.49242926", "0.4916054", "0.4908887", "0.48986304", "0.4875552", "0.4875552", "0.4875552", "0.487...
0.0
-1
A custom view to display the summary of Part C of an ePFP.
def post_summary(self, request, object_id): obj = self.get_object(request, unquote(object_id)) if obj is None: raise Http404(_('%(name)s object with primary key (%key)r' ' does not exist.') % { 'name': force_text(self.opts.verbose_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partdetails(request, code):\n\n # Render the HTML template partdetails.html with the data in the context variable.\n # The part code is passed as a URL parameter.\n return render(\n request,\n 'partdetails.html',\n context={'part': PartType.objects.filter(code=code)[0]},\n )", ...
[ "0.5932203", "0.5589986", "0.52368885", "0.5215868", "0.52055806", "0.52004063", "0.51925254", "0.51867265", "0.5162258", "0.5151842", "0.514735", "0.5119547", "0.51022637", "0.509134", "0.508896", "0.5078333", "0.5059541", "0.5047101", "0.50357866", "0.50163805", "0.4992672"...
0.0
-1
Returns an instance matching the primary key provided. ``None`` is returned if no match is found (or the object_id failed validation against the primary key field).
def get_prescription(self, request, object_id): queryset = Prescription.objects model = Prescription try: object_id = model._meta.pk.to_python(object_id) self.prescription = queryset.get(pk=object_id) except (Prescription.DoesNotExist, ValidationError, ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _object_get(self, pk):\n try:\n return self.model.objects.get(pk=pk)\n except self.model.DoesNotExist:\n raise DoesNotExist(self.model.__name__.lower(), primary_key=pk)", "def get_by_id(self, pkId: int):\n if not self.model:\n raise NameError('database model has no...
[ "0.75468266", "0.7208044", "0.72011304", "0.71523726", "0.7143048", "0.71035826", "0.70429134", "0.7027398", "0.6973815", "0.69303226", "0.69193214", "0.69085777", "0.6846072", "0.6835896", "0.68294036", "0.6800614", "0.67967004", "0.6699243", "0.66763586", "0.6593959", "0.65...
0.0
-1
For any of our ePFP related admins, do not allow editing if the ePFP has been submitted for endorsement, has been endorsed, or has been approved. If the user is part of the ePFP Application Administrator, allow editing even after the ePFP has been locked.
def get_readonly_fields(self, request, obj=None): if request.user.has_perm('prescription.can_admin'): return super(PrescriptionMixin, self).get_readonly_fields(request, obj) current = self.prescription if current and not current.is_draft: return self.list_editable ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_to_edit(user):\n return allow_to_edit_well(user)", "def can_edit(self, user):\n if user.has_perm('funding.make_application_decisions'):\n # Funding manager can update things later, if required\n return True\n # Applicants can only edit the application before the f...
[ "0.7200479", "0.6984972", "0.68840176", "0.6878846", "0.6833236", "0.6817774", "0.66914916", "0.6690192", "0.6604833", "0.6540319", "0.6473457", "0.63523585", "0.630722", "0.6300873", "0.6296802", "0.629619", "0.6292098", "0.62804836", "0.62732214", "0.62557745", "0.6219214",...
0.0
-1
Allow the use of the current request inside our remove function. This lets us check if the current user has permission to delete a particular object.
def get_list_display(self, request): delete = partial(self.remove, request=request) delete.short_description = "" delete.allow_tags = True list_display = list(self.list_display) for index, field_name in enumerate(list_display): field = getattr(self.model, field_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_delete_permission(self, request, obj=None):\r\n return False", "def has_delete_permission(self, request, obj=None):\n return False", "def has_delete_permission(self, request, obj=None):\n return False", "def has_delete_permission(self, request, obj=None, *args, **kwargs):\n ...
[ "0.7800161", "0.77150315", "0.77150315", "0.76746064", "0.75013053", "0.7370601", "0.73557854", "0.7296094", "0.7235806", "0.7185168", "0.71700805", "0.7166786", "0.7087016", "0.70188355", "0.695021", "0.69353366", "0.69052243", "0.6898739", "0.68513787", "0.67897356", "0.677...
0.0
-1
This will not work without a custom get_list_display like above in this class.
def remove(self, obj, **kwargs): request = kwargs.pop('request') if self.has_delete_permission(request, obj): info = obj._meta.app_label, obj._meta.module_name delete_url = reverse('admin:%s_%s_delete' % info, args=(quote(obj.pk), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_display(self, request):\n list_display = self.list_display\n\n if 'admin_created' not in list_display:\n list_display += ('admin_created', )\n if 'admin_modified' not in list_display:\n list_display += ('admin_modified', )\n\n return list_display", "...
[ "0.70577025", "0.6927377", "0.66999084", "0.6534128", "0.64029056", "0.628276", "0.6270378", "0.624227", "0.62053436", "0.6156714", "0.6134453", "0.6120991", "0.60684335", "0.60230035", "0.59291345", "0.5821806", "0.5819571", "0.57768136", "0.5720156", "0.571882", "0.5710598"...
0.0
-1
Figure out where to redirect after the 'Save' button has been pressed when adding a new object.
def response_post_save_add(self, request, obj): opts = self.model._meta if "next" in request.GET: return HttpResponseRedirect(request.GET['next']) if self.has_change_permission(request, None): post_url = reverse('admin:%s_%s_changelist' % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_add(self, request, obj, post_url_continue='../%s/'):\n opts = obj._meta\n pk_value = obj._get_pk_val()\n\n msg = '\"%s\" was successfully added to the \"%s\" menu.' % (\n force_unicode(obj),\n obj.menu_item.menu\n )\n\n if \"_continue\" in reque...
[ "0.64924026", "0.6153812", "0.61309814", "0.59334826", "0.591273", "0.5899871", "0.56958824", "0.5689271", "0.5634287", "0.55540913", "0.5533874", "0.55007654", "0.55007654", "0.55007654", "0.55007654", "0.55007654", "0.5483759", "0.5469536", "0.5456317", "0.54537416", "0.544...
0.68166924
0
Figure out where to redirect after the 'Save' button has been pressed when editing an existing object.
def response_post_save_change(self, request, obj): opts = self.model._meta if "next" in request.GET: return HttpResponseRedirect(request.GET['next']) if self.has_change_permission(request, None): post_url = reverse('admin:%s_%s_changelist' % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_successful_edit(self):\n pass", "def __get_redirect_url(self):\n if self.get_submit_save_and_continue_edititing_button_name() not in self.request.POST:\n return self.request.cradmin_app.reverse_appindexurl()\n return self.request.cradmin_app.reverse_appurl(\n ...
[ "0.64501905", "0.6394968", "0.6315125", "0.6232479", "0.61115974", "0.6062854", "0.60600847", "0.5989455", "0.5982005", "0.596592", "0.5851798", "0.57778186", "0.57569486", "0.5704585", "0.56700426", "0.566466", "0.5661673", "0.5661105", "0.5653229", "0.5640077", "0.5629799",...
0.6066536
5
Restrict editing when the ePFP reaches certain stages of completion. If the user is part of the ePFP Application Administrator, allow them to edit anyway.
def get_list_editable(self, request): current = self.prescription if request.user.has_perm('prescription.can_admin') or self.lock_after == 'never': return self.list_editable if (self.lock_after == 'endorsement' and not current.is_draft) or (self.lock_after == 'closure' and current.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_to_edit(user):\n return allow_to_edit_well(user)", "def _onchange_restrict_access(self, stage_id):\n print('----------',self.env.uid)\n # if self.env.uid != 1 :\n raise exceptions.Warning('You are not allowed to change the stages, Please contact the Administrator')\n retu...
[ "0.71233034", "0.70981425", "0.700336", "0.6641883", "0.65009236", "0.64907235", "0.6471095", "0.6402252", "0.63364124", "0.6318202", "0.6303898", "0.6303464", "0.62358683", "0.61524713", "0.6134583", "0.610175", "0.60109353", "0.6007445", "0.596982", "0.5965106", "0.59541845...
0.0
-1
Save the model and assign delete permissions to particular objects. Also save user to object if an audit object
def save_model(self, request, obj, form, change): try: obj.prescription = self.prescription except AttributeError: pass if not obj.pk: obj.creator = request.user obj.modifier = request.user obj.save() # If can_delete is set, allow the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model( self, request, obj, form, change ):\n obj.save()", "def on_model_delete(self, model):\n if not current_user.is_active or not current_user.is_authenticated:\n abort(403)\n if not user_has_permission(current_user, 'can_delete','updates'):\n abort(403)", ...
[ "0.64432746", "0.6320202", "0.63064605", "0.6246145", "0.62002057", "0.60748917", "0.60741484", "0.6067784", "0.60301447", "0.5991352", "0.5975772", "0.59583265", "0.5951502", "0.5950179", "0.59379965", "0.59379965", "0.59276307", "0.5916935", "0.5892021", "0.58640754", "0.58...
0.727388
0
Override to default the region to the user's profile region.
def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == 'region': if request.user.profile.region is not None: kwargs['initial'] = request.user.profile.region.pk return db_field.formfield(**kwargs) return super(RegionalObjectiveAdmin, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self):\n return self.config.region", "def set_default_region(profile=None):\n if os.getenv('AWS_DEFAULT_REGION'):\n return os.getenv('AWS_DEFAULT_REGION')\n elif profile is not None:\n return awscli_region(profile_name=profile)\n return awscli_region(profile_name='default...
[ "0.6674411", "0.65948874", "0.6539426", "0.6539426", "0.6539426", "0.6539426", "0.6539426", "0.6539426", "0.6532454", "0.65130454", "0.65130454", "0.65130454", "0.65130454", "0.64127284", "0.6336552", "0.6322187", "0.6308277", "0.6253582", "0.6200991", "0.6195054", "0.6139514...
0.0
-1
Fix up the display of the criteria so that it looks a bit nicer.
def criteria_display(self, obj): return markdownify(obj.criteria)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_active_criteria(conv_status, conv_requirements):\n conv_str = f\"\\n\\t {'===> Final Convergence Report <===': ^76}\\n\"\n conv_str += \"\\n\\t\" + \"-\" * 76\n conv_str += f\"\\n\\t|{'Required Criteria': ^24}|{'One or More Criteria': ^24}|{'Alternate Criteria': ^24}|\"\n conv_str += \"\\n\\...
[ "0.6004934", "0.5642903", "0.5641137", "0.56178117", "0.5541909", "0.5533003", "0.55291677", "0.5502816", "0.5482058", "0.54708695", "0.5310582", "0.5297918", "0.52971756", "0.52587277", "0.5255082", "0.5253097", "0.5229677", "0.52207726", "0.5216699", "0.5201825", "0.5198934...
0.730556
0
The main function only describes both graphical and comunication parts of the app. It creates and initializes all necessary widgets. At the end the function calls doc.add_root to display the objects on a browser
def main( ): # Quasi constant FrequencyRange = np.logspace( 0, 5, 1000 ) doc = curdoc() # ========================== GRAPHICAL PART ================================ # CREATE ALL PLOTS: Input = figure( title = "", tools = "", width = 500, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(self):\n self.validate()\n self.root.mainloop()", "def main(self):\n self.root.mainloop()", "def main():\n\n root = tk.Tk()\n root.title(\"Exploring US Bikeshare Data\")\n app = Application(master=root)\n print(\"Application loaded! Please use the GUI window to continu...
[ "0.7455249", "0.7298225", "0.7211526", "0.71217674", "0.71216154", "0.7106735", "0.6857547", "0.6838019", "0.68365437", "0.6780663", "0.67422074", "0.67369497", "0.67369497", "0.6695142", "0.6666636", "0.6623035", "0.65466887", "0.64836466", "0.6483262", "0.6444723", "0.64380...
0.0
-1
At the begining the function reads the layers thickness of a composite material and converts its properties to the property of the isotropic one. Then the properties of the isotropic material are assigned to the tables if necessary. Additionally the function tests the input parameters of the isotropic material on consi...
def updateData( Tables, Graph, LayersInfo, WarningMessage ): # clean the warning message LayersInfo.clean() WarningMessage.clean() LayerThicknessBuffer = Tables[ "GeometryProperties" ].getValue( 0, 2 ) try: Layers = getLayersFromString( Tables[ "GeometryProperties" ].getValue( 0, 2 ) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_material_info(TABLE_info):\n \"\"\"\n 1 Get info from TABLE_info.\n \"\"\"\n width = TABLE_info[0]\n height = TABLE_info[1]\n t_m = TABLE_info[2]\n\n \"\"\"\n 2 Get material info.\n \"\"\"\n z_m = 3 * t_m\n\n m_width = rs.GetInteger(\"Put the width of material\", z_m, N...
[ "0.6475344", "0.5682321", "0.5672466", "0.5636607", "0.552437", "0.5461393", "0.53857917", "0.527137", "0.5246535", "0.5223118", "0.5219347", "0.51697445", "0.51493186", "0.5122936", "0.51042575", "0.5100329", "0.50907505", "0.5060393", "0.5043993", "0.504055", "0.5037686", ...
0.59535277
1
The function calls an appropriate plotfunction based on the mode (value) of the radiobutton
def updateGraph( Graph, GraphNumber ): # Update the graph ID ( GraphNumber - it's a built-in bohek variable that # belongs to the RadioButton widget ) Graph.setPlottingGraphNumber( GraphNumber ) plotEigenfrequenciesPlate( Graph ) # Depict coresponding lines based on the graph chosen by the user ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_radioButton_clicked(self):\r\n # TODO: not implemented yet\r", "def on_radioButton_clicked(self):\n # TODO: not implemented yet\n raise NotImplementedError", "def plot_changed(self):\n self.plotType = self.ui.selectPlotType.currentText()\n self.value_changed()", "def...
[ "0.661575", "0.62839025", "0.62129223", "0.61920446", "0.6134543", "0.60358584", "0.60340613", "0.59854", "0.59655166", "0.5960823", "0.59232825", "0.5860865", "0.5842031", "0.582448", "0.5785097", "0.57452774", "0.5739104", "0.5735265", "0.5720617", "0.5703972", "0.5698229",...
0.0
-1
The function saves the current state of the tables and calls "cangeMode" function
def updateMode( Tables, WarningMessage, Graph, Properties ): WarningMessage.clean( ) Graph.setMode( Properties ) #WarningMessage.printMessage( "Click on the Apply button to update grapths..." ) if Properties == 0: Tables[ "ElasticModulus" ].fillT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alterTableMode(database: str, table: str, mode: str) -> int:\n\n try:\n\n bd = _database(database)\n\n if bd:\n\n tb = _table(database, table)\n\n if tb:\n\n if tb[\"modo\"] == mode or mode not in [\"avl\", \"b\", \"bplus\", \"dict\", \"hash\", \"isam\", \"...
[ "0.60449374", "0.5693288", "0.5666721", "0.563098", "0.5616466", "0.5605347", "0.55648464", "0.5559937", "0.5443037", "0.5381708", "0.53650904", "0.5321684", "0.53107697", "0.52835166", "0.52474654", "0.5224185", "0.5222314", "0.51933074", "0.51613885", "0.5130906", "0.512630...
0.5883549
1
The function performs the following modification to the talbes if the user switches to
def cangeMode( Tables, WarningMessage, Mode ): if ( Mode == 1 ): UniformValue = Tables[ "ElasticModulus" ].getValue( 0, 0 ) Tables[ "ElasticModulus" ].setValue( 0, 1, UniformValue ) Tables[ "ElasticModulus" ].setValue( 0, 2, UniformValue ) UniformValue = Tables[ "ElasticModulus" ]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch(self, context):\n return", "def activated(self):", "def transact(self):", "def transact(self):", "def change():", "def swint(self) -> None:", "def change_status(self):\n if self.status == \"Still Loaned\":\n self.status = \"Given Back\"\n else:\n se...
[ "0.6464244", "0.6392257", "0.6380355", "0.6380355", "0.6305444", "0.6204111", "0.595714", "0.5851011", "0.5849885", "0.5843833", "0.5843833", "0.583103", "0.5804874", "0.5800507", "0.5766461", "0.5763643", "0.5755627", "0.57187295", "0.5698654", "0.5691442", "0.56914", "0.5...
0.0
-1
The function sets up the default values for the tables
def setDefaultSettings( Tables, Graph, LayersInfo, WarningMessage ): WarningMessage.clean() if Graph.getMode() == 0: Tables[ "ElasticModulus" ].fillTableWithBufferData( "DefaultOrthotropic" ) Tables[ "ShearModulus" ].fillTableWithBufferData( "DefaultOrthotropic" ) Tables[ "PoissonRati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_defaults(self, db, dest, kvargs, lines):\n table = db.get_table(kvargs['table'])\n default_text = kvargs['default_text']\n table.find_default_from_allowable_range_descriptions(default_text)\n # Log the defaults\n logging.info(\"Defaults for table: {}\".format(tab...
[ "0.6979111", "0.66858476", "0.6388122", "0.638788", "0.634403", "0.6321579", "0.6306757", "0.6227833", "0.62228143", "0.61651176", "0.61014634", "0.6100866", "0.60913914", "0.6053301", "0.6027364", "0.599786", "0.5985838", "0.5938768", "0.59275645", "0.59099567", "0.59004194"...
0.6570799
2
The function restores the inrormation of the tables that was modified during the homogenization procedure. It allows the user to look at the original input date
def showInput( Tables, LayersInfo ): Tables[ "ElasticModulus" ].fillTableWithBufferData( "Input" ) Tables[ "ShearModulus" ].fillTableWithBufferData( "Input") Tables[ "PoissonRatios" ].fillTableWithBufferData( "Input" ) Tables[ "MaterialProperties" ].fillTableWithBufferData( "Input" ) Tables[ "Geome...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate(table_name, date):\n\tlog_msg3(\"Populando \" + table_name)\n\n\twsq_to_txt(table_name, date)\n\n\t# si es un nuevo año se crea una nueva tabla\n\tif(is_new_year(table_name) and not new_tables_created):\n\t\tcreate_tables()\n\n\ttxt_to_table(table_name)\n\n\tlog_msg_ok3()", "def date_cleaner(dataset...
[ "0.5725001", "0.55079174", "0.5295723", "0.52912056", "0.5260399", "0.5199887", "0.5155249", "0.5083524", "0.50647897", "0.50604945", "0.504374", "0.504045", "0.5034033", "0.49910957", "0.49592826", "0.49518517", "0.49411488", "0.49143445", "0.4892477", "0.4885201", "0.488480...
0.0
-1
The function gets the current data from the table and stores them into the corresponding tables buffers to allow the user to retrieve the old info back. The function distinguishes the modes and stores the info into either isotropic or orthotropic buffes
def makeMask( Tables, Mode ): # get data from the corresponding tables ElasticModulusData = Tables[ "ElasticModulus" ].getRawData( ) ShearModulusData = Tables[ "ShearModulus" ].getRawData( ) PoissonRatiosData = Tables[ "PoissonRatios" ].getRawData( ) MaterialPropertiesData = Tables[ "MaterialProper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateData( Tables, Graph, LayersInfo, WarningMessage ):\n\n # clean the warning message\n LayersInfo.clean()\n WarningMessage.clean()\n\n LayerThicknessBuffer = Tables[ \"GeometryProperties\" ].getValue( 0, 2 )\n try:\n\n\n Layers = getLayersFromString( Tables[ \"GeometryProperties\" ].g...
[ "0.5223058", "0.51871973", "0.5132997", "0.5109608", "0.51093423", "0.5094055", "0.5003754", "0.4979883", "0.49577233", "0.4945544", "0.4938093", "0.49264395", "0.48937312", "0.48656425", "0.484769", "0.48144352", "0.48140258", "0.4807093", "0.47993505", "0.47795317", "0.4776...
0.4760833
22
The function gets the current data from the table and stores them into the corresponding tables buffers to allow the user to retrieve the old info back
def makeMultiLayerMask( Tables ): # get data from the corresponding tables ElasticModulusData = Tables[ "ElasticModulus" ].getRawData( ) ShearModulusData = Tables[ "ShearModulus" ].getRawData( ) PoissonRatiosData = Tables[ "PoissonRatios" ].getRawData( ) MaterialPropertiesData = Tables[ "MaterialPr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loaddata(self):\n # Connect to the db\n self.conn, self.c = self.connect_db(self.dbname)\n # create the bdefile table to \n self.c.execute(oeeutil.sql_create_bdefile_table)\n # Delete any previous records\n self.c.execute('DELETE FROM bdefile')\n # hold the cont...
[ "0.60423696", "0.59732026", "0.5971113", "0.5908701", "0.58803993", "0.5876313", "0.5794542", "0.5793433", "0.57820636", "0.5757899", "0.5739334", "0.57090044", "0.570231", "0.5694598", "0.5674014", "0.56739885", "0.5661785", "0.56413114", "0.562504", "0.55980164", "0.5571242...
0.0
-1
Returns the metrics from the registry in latest text format as a string.
def generate_latest(registry=Registry): def sample_line(line, metric_type): if line.labels: labelstr = '{{{0}}}'.format(','.join( ['{0}="{1}"'.format( k, v.replace('\\', r'\\').replace('\n', r'\n').replace('"', r'\"')) for k, v in sorted(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def generate_latest_metrics(client):\n resp = await client.get(prometheus.API_ENDPOINT)\n assert resp.status == HTTPStatus.OK\n assert resp.headers[\"content-type\"] == CONTENT_TYPE_TEXT_PLAIN\n body = await resp.text()\n body = body.split(\"\\n\")\n\n assert len(body) > 3\n\n return bod...
[ "0.6561686", "0.65185255", "0.64778507", "0.6407903", "0.6371694", "0.6371694", "0.6159014", "0.6076035", "0.59855705", "0.5963776", "0.5963161", "0.58073926", "0.57971", "0.57738096", "0.57541287", "0.57380533", "0.57340425", "0.5730773", "0.56887656", "0.5684547", "0.568445...
0.65264964
1
limited to top wear and full body dresses (wild and studio working)
def get_dress(self,stack=False): """takes input rgb----> return PNG""" name = self.imageid file = cv2.imread(name) file = tf.image.resize_with_pad(file,target_height=512,target_width=512) rgb = file.numpy() file = np.expand_dims(file,axis=0)/ 255. seq = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isDeboutHandCoded( sk, bOnlyTorso = False, bVerbose = False ):\n \n neck = sk.listPoints[Skeleton.getNeckIndex()]\n \n if bVerbose: print(\"neck: %s\" % str(neck))\n \n legsInfo = sk.getLegs()\n if bVerbose: print(\"legs: %s\" % str(legsInfo))\n \n bb = sk.getBB_Size()\n sto = sk....
[ "0.56223756", "0.5531606", "0.54126066", "0.5349849", "0.52679425", "0.52650297", "0.5240198", "0.5218181", "0.51940006", "0.5188224", "0.5187894", "0.51870036", "0.5175216", "0.5146676", "0.51461977", "0.5143194", "0.5112056", "0.5092569", "0.50863653", "0.5086186", "0.50720...
0.0
-1
Generates a random colour in RGB given a random number generator
def random_colour(rng: random.Random) -> TupleInt3: r = rng.randint(0, 255) g = rng.randint(0, 255) b = rng.randint(0, 255) return r, g, b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]", "def _genRandomColor():\n b = random.randint(0, 255)\n g = random.randint(0, 255)\n r = random.randint(0, 255)\n return (b, g, r)", "def random_color():\n colormode(255)\n ...
[ "0.876414", "0.82941365", "0.8153552", "0.80209553", "0.80185115", "0.7916255", "0.7839317", "0.7759831", "0.7708956", "0.7654475", "0.7641203", "0.76346093", "0.76312876", "0.7543077", "0.75332016", "0.7528536", "0.74128366", "0.72863585", "0.7281916", "0.7276023", "0.725758...
0.75866765
13
Generates a list of random colours in RGB given a random number generator and the size of this list
def generate_random_colours_list(rng: random.Random, size: int) -> List[TupleInt3]: return [random_colour(rng) for _ in range(size)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]", "def _random_color() -> List[float]:\n return [np.random.uniform(), np.random.uniform(), np.random.uniform()]", "def get_color_list(cluster_count):\n color_list = []\n for i in xr...
[ "0.7871541", "0.748539", "0.7485229", "0.74038225", "0.72706544", "0.71166867", "0.70931363", "0.7082866", "0.7052505", "0.696605", "0.6933918", "0.69295365", "0.6914378", "0.6914372", "0.6912016", "0.6897092", "0.6876162", "0.68433", "0.68433", "0.68433", "0.6812373", "0.6...
0.8515019
0