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
Initialize first name, last name, age, and gender attributes.
def __init__(self, first_name, last_name, age, gender): self.first_name = first_name self.last_name = last_name self.age = age self.gender = gender
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, f_name, l_name, age, gender, m_number):\n self.f_name = f_name\n self.l_name = l_name\n self.age = age\n self.gender = gender\n self.m_number = m_number", "def __init__(self, first_name, last_name, age):\n\n self.first_name = first_name\n self.l...
[ "0.7688818", "0.75608855", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.72796017", "0.71924347", "0.6994145", "0.6983084", "0.69552344", "0.6938817", "0.6919511", "0.6853096", "0.684336", "0.6801357", "0.67757064",...
0.8197995
0
Prints a summary of the users information.
def describe_user(self): print(self.first_name.title() + " " + self.last_name.title() + " is a " + str(self.age) + " year old who identifies as " + self.gender + ".")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_user(self):\n print(self.first_name + \"\\n\" + self.last_name + \"\\n\" + self.Screen_name)", "def describe_user(self):\r\n print('\\nFirst Name: ' + self.first_name.title(), end='\\n',)\r\n print('Last Name: ' + self.last_name.title(), end='\\n')\r\n print('Address: ' +...
[ "0.7686036", "0.764411", "0.7633761", "0.7598822", "0.75661665", "0.75661665", "0.75358224", "0.74810886", "0.7473855", "0.7462429", "0.7422792", "0.74164706", "0.73984045", "0.73918474", "0.72651684", "0.7172735", "0.7020377", "0.69007635", "0.6849133", "0.68072605", "0.6768...
0.6934623
17
Prints a personlized greeting to the user.
def greet_user(self): print("Welcome, " + self.first_name.title() + "!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greeting(name):\n print(\"\")\n print(\n \"Welcome to Mister Sweet's Mad Lib Story Telling Journey \" + name +\n \" :)\")\n print(\"\")", "def greet_user(self):\n greeting = f\"Hi {self.first_name.title()}, welcome back!\\n\"\n print(greeting)", "def greet_user():\r\n p...
[ "0.7979247", "0.79529935", "0.793578", "0.7930732", "0.7874761", "0.78726554", "0.7837822", "0.783697", "0.78200954", "0.78161484", "0.77571064", "0.7719434", "0.7597742", "0.7597742", "0.7512549", "0.7466066", "0.745762", "0.745762", "0.7451555", "0.7346045", "0.7307862", ...
0.77470785
11
Initializes attributes from the parent class. Then initializes attributes specific to this subclass.
def __init__(self, first_name, last_name, age, gender): super().__init__(first_name, last_name, age, gender) self.priveleges = "can add post", "can delete post", "can ban user"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_attrs(self):\n raise NotImplementedError", "def _init_attributes(self):\n self.attr = {\n 'name': None,\n 'tags': [],\n 'openHours': None,\n 'type': None,\n 'parent': None,\n 'locationId': None,\n 'bannerAbbreviat...
[ "0.7667003", "0.71117824", "0.69872975", "0.677331", "0.67648923", "0.6745417", "0.66914773", "0.6608188", "0.6567776", "0.65150833", "0.65029776", "0.64848316", "0.64557666", "0.638375", "0.63699836", "0.6324615", "0.63119954", "0.62745345", "0.62635255", "0.6254116", "0.623...
0.0
-1
Prints the priveleges granted to this type of User(Admin).
def show_priveleges(self): print("This user:") for privelege in self.priveleges: print(privelege)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showprivelages(self):\r\n\t\tprint (\"An administrator has the following abilities: \")\r\n\t\tfor power in self.powers:\r\n\t\t\tprint (\"- \" + power)", "def show_privileges(self):\n print(\"This admin user has the following privileges:\")\n for item in self.privileges:\n print(f\"...
[ "0.77525014", "0.76014477", "0.7597725", "0.7547358", "0.7508543", "0.74574864", "0.73488426", "0.7288568", "0.5971587", "0.586329", "0.5682209", "0.56727153", "0.56551707", "0.547195", "0.54604584", "0.54411626", "0.5435521", "0.5409437", "0.53908664", "0.5389564", "0.538702...
0.7839699
0
Passes the HTML file to the Markdown parser. Gets the resulting md and stores it in its own property
def parse(self, htmlFile): htmlToMdParser = HtmlToMarkdown() htmlToMdParser.readFile(htmlFile) self.__setMarkdownOutput(htmlToMdParser.getMarkdown())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __html__(self, file_path:str) -> str:\n with open(f\"{file_path}\", \"r\") as mdfile: # Parse markdown file\n text = mdfile.read()\n html = self.md.convert(text) # Convert the markdown content text to hmtl\n return html", "def parse(self, htmlfile):\r\n title_el, summary_el...
[ "0.7806094", "0.75215423", "0.72866136", "0.7171097", "0.71067405", "0.69807774", "0.68494374", "0.6752766", "0.6671119", "0.6567304", "0.6497255", "0.64291793", "0.63721174", "0.6348815", "0.6338439", "0.6311875", "0.6305898", "0.6284648", "0.62832975", "0.6280578", "0.62183...
0.8087815
0
Write selfs markdown data to file
def __writeToFile(self, mdFile): with open(mdFile, 'a') as writer: for line in self.__markdownOutput: writer.write(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_markdown_report(self, **kwargs):\n save_dir = os.path.dirname(self.file_paths[0])\n timestamp = datetime.datetime.utcnow().strftime(\"%Y-%j-%Hh%Mm%Ss\")\n markdown_file_name = \"report_{}.md\".format(timestamp)\n markdown_file_path = os.path.join(save_dir, markdown_file_name)\n...
[ "0.70040005", "0.65243876", "0.6442088", "0.6366318", "0.6351913", "0.63268805", "0.6305234", "0.62839085", "0.62771386", "0.62156075", "0.61913127", "0.6144183", "0.61168224", "0.6007978", "0.60004336", "0.60001224", "0.5982156", "0.59446424", "0.59380436", "0.59365654", "0....
0.7303364
0
Public method to coordinate the writing out of markdown
def outputMarkdown(self, mdFile): if os.path.exists(mdFile): os.remove(mdFile) self.__writeToFile(mdFile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write():\n \n st.title(\"All about me..!!\")\n st.markdown(\n \"\"\"\n\n:large_blue_diamond: **Data Engineer**\\n\nThe current role revolves around working with database management(AWS Redshift), automation of tasks (using Python), and helping out other teams at work with required data ...
[ "0.7164668", "0.6390969", "0.6139194", "0.61002076", "0.60791314", "0.6069406", "0.6055646", "0.6033149", "0.6022967", "0.5998853", "0.59313035", "0.5926876", "0.5887407", "0.5865887", "0.5865716", "0.58579427", "0.58537984", "0.5846108", "0.5844487", "0.58379096", "0.583403"...
0.5605465
34
Generate a Bert wordpiece vocabulary from a `tf.data.Dataset` of texts. ``` import tensorflow_text as text vocab = bert_vocab_from_dataset(dataset, vocab_size, reserved_tokens, bert_tokenizer_params, learn_params) bert_tokenizer = text.BertTokenizer(vocab, bert_tokenizer_params) token_ids = bert_tokenizer.tokenize(text...
def bert_vocab_from_dataset(dataset, vocab_size: int, reserved_tokens: List[str], bert_tokenizer_params=None, learn_params=None) -> List[str]: if bert_tokenizer_params is None: bert_tokenizer_params = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dataset(cls, dataset, col_names, vocab_size, character_coverage, model_type, params):\n\n vocab = SentencePieceVocab()\n root = copy.deepcopy(dataset).build_sentencepiece_vocab(vocab, col_names, vocab_size, character_coverage,\n ...
[ "0.6695434", "0.59435654", "0.57949984", "0.56768864", "0.56709015", "0.5485758", "0.5482027", "0.543974", "0.5393621", "0.5373836", "0.53656673", "0.53424793", "0.53227395", "0.5320037", "0.5311882", "0.5262313", "0.52581626", "0.5236028", "0.5179154", "0.51750255", "0.51681...
0.72508216
0
save all the FLAG values in a config file / xml file
def save_config(FLAGS, logfolder, file_name = "configuration"): print("Save configuration to: {}".format(logfolder)) root = ET.Element("conf") flg = ET.SubElement(root, "flags") flags_dict=FLAGS.__dict__ for f in sorted(flags_dict.keys()): # print f, flags_dict[f] e = ET.SubElement(flg, f, name=f) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_config(logfolder, file_name = \"configuration\"):\n print(\"Save configuration to: \", logfolder)\n root = ET.Element(\"conf\")\n flg = ET.SubElement(root, \"flags\")\n \n flags_dict = FLAGS.__dict__['__flags']\n for f in flags_dict:\n #print f, flags_dict[f]\n ET.SubElement(flg, f, name=f).te...
[ "0.758127", "0.7308489", "0.67504543", "0.67352724", "0.6585914", "0.62659514", "0.62000674", "0.61799616", "0.6170416", "0.6162446", "0.61308473", "0.61104065", "0.61041206", "0.60973454", "0.60634506", "0.60334367", "0.599318", "0.59699816", "0.5965832", "0.59636515", "0.59...
0.76940143
0
save all the FLAG values in a config file / xml file
def load_config(FLAGS, modelfolder, file_name = "configuration"): print("Load configuration from: ", modelfolder) tree = ET.parse(os.path.join(modelfolder,file_name+".xml")) boollist=['auxiliary_depth', 'discrete'] intlist=['n_frames', 'num_outputs'] floatlist=['depth_multiplier','speed','action_bound'] str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_config(FLAGS, logfolder, file_name = \"configuration\"):\n print(\"Save configuration to: {}\".format(logfolder))\n root = ET.Element(\"conf\")\n flg = ET.SubElement(root, \"flags\")\n \n flags_dict=FLAGS.__dict__\n for f in sorted(flags_dict.keys()):\n # print f, flags_dict[f]\n e = ET.SubEle...
[ "0.76940143", "0.758127", "0.7308489", "0.67504543", "0.67352724", "0.6585914", "0.62659514", "0.62000674", "0.61799616", "0.6170416", "0.6162446", "0.61308473", "0.61104065", "0.61041206", "0.60973454", "0.60634506", "0.60334367", "0.599318", "0.59699816", "0.5965832", "0.59...
0.57908255
33
Map natural position to machine code postion
def map_position(pos): posiction_dict = dict(zip(range(1, 17), [i for i in range(30, 62) if i % 2])) return posiction_dict[pos]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_pos_tag(pos):\n\n\tmappings = {'NN': wn.NOUN, 'JJ': wn.ADJ, 'VB': wn.VERB, 'RB': wn.ADV}\n\tpos = pos[:2]\n\tif pos in mappings:\n\t\tpos = mappings[pos]\n\telse:\n\t\tpos = wn.NOUN\n\treturn pos", "def compute_offset_pos(seq, pos):\n \n nogap_seq = transform_seq(seq)\n assert(pos >= 0 and pos <...
[ "0.5799386", "0.56906056", "0.5584939", "0.5500977", "0.54784864", "0.5363552", "0.5348209", "0.525057", "0.52384615", "0.5234695", "0.51939845", "0.5183469", "0.5177587", "0.51565945", "0.51374286", "0.51320094", "0.51159453", "0.51113105", "0.5074599", "0.50590044", "0.5052...
0.6337538
0
Get a snapshot and save it to disk.
def snap(self, path=None): if path is None: path = "/tmp" else: path = path.rstrip("/") day_dir = datetime.datetime.now().strftime("%d%m%Y") hour_dir = datetime.datetime.now().strftime("%H%M") ensure_snapshot_dir(path+"/"+self.cam_id+"/"+day_dir+"/"+hour_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveSnapshot(self, filename): \n\t\tpass", "def snapshot(self):\n self._client.snapshot()", "def snapshot(self) -> Snapshot:\n snapshot = self.open(Snapshot.type).signed\n if not isinstance(snapshot, Snapshot):\n raise RuntimeError(\"Unexpected snapshot type\")\n ...
[ "0.73514926", "0.70761585", "0.66926736", "0.6627929", "0.66162276", "0.6583161", "0.65360063", "0.63850576", "0.63814706", "0.6340474", "0.63032293", "0.6283096", "0.6270011", "0.6243555", "0.6231108", "0.6216452", "0.6180958", "0.6147651", "0.6147121", "0.6104813", "0.60983...
0.7027908
2
Move cam to given preset position. pos must be within 1 to 16.
def move(self, pos): try: payload = {"address":self.address, "user": self.user, "pwd": self.pswd, "pos": map_position(pos)} resp = requests.get( "http://{address}/decoder_control.cgi?command={pos}&user={user}&pwd={pwd}".format(**payload) ) except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPos(self, pos):\n self.cameraNode.setPos(pos)", "def set_position(self, pos, debug=False):\n pos = max(pos, 0)\n pos = min(pos, 1)\n posrange = pos * self.range\n pos = posrange + self.min\n if debug:\n print('Setting Dynamixel {} with posrange {} to po...
[ "0.7138918", "0.64176524", "0.6216379", "0.6157313", "0.60971105", "0.6046289", "0.60182077", "0.59599185", "0.5955653", "0.5935965", "0.5924134", "0.58532727", "0.5846093", "0.5841225", "0.5791711", "0.5789152", "0.5782726", "0.5772265", "0.57623875", "0.57590634", "0.573229...
0.69712156
1
Retrieve some configuration params.
def status(self): resp = requests.get("http://{0}/get_status.cgi".format(self.address)) data = resp.text.replace(";", "") data = data.replace("var", "") data_s = data.split("\n") # Last is an empty line data_s.pop() data_array = [s.split("=") for s in data_s] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParams(self):\n self.logger.info(\"Getting All Params from config file.\")\n self.params = {}\n for interface in self.config.get('agent', 'interfaces'):\n params = self.params.setdefault(interface, {})\n for item in [['intf_reserve', 1000], ['intf_max', 10000], ['l...
[ "0.7338206", "0.7333596", "0.72458017", "0.70778966", "0.70616674", "0.70084393", "0.69818825", "0.69765306", "0.69468594", "0.69468594", "0.69375813", "0.6893419", "0.68922675", "0.6865233", "0.6865233", "0.6865233", "0.68336135", "0.6805127", "0.6796573", "0.67850155", "0.6...
0.0
-1
Return error message in unicode type OR new pair data
def insert_keyword(self, keyword, reply, creator_id, pinned, kw_type, rep_type, linked_word=None, rep_attach_text=None): creator_id_ref = self._uid2ref(creator_id) if keyword.replace(' ', '') == '': return error.main.invalid_thing_with_correct_format(u'關鍵字', u'字數大於0,但小於500字(中文250字)的字串', key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_type_error_text(field_name, field_value, type_name):\n\n\tmessage = ''\n\n\ttry:\n\t\tmessage = (\"Value '{0}' entered for '{1}' could not be parsed as a valid {2}\"\n\t\t\t\t .format(str(field_value),field_name,type_name))\n\texcept TypeError:\n\t\tmessage = (\"A value entered for '{0}' could not b...
[ "0.62162715", "0.6213315", "0.61661386", "0.6143035", "0.6127491", "0.6063554", "0.6040141", "0.59521276", "0.5943248", "0.59175944", "0.5916721", "0.58774024", "0.58451897", "0.5836796", "0.58296627", "0.58269215", "0.5776696", "0.5756682", "0.57526934", "0.5747043", "0.5727...
0.0
-1
Return disabled data list in type pair_data. None if nothing updated.
def disable_keyword(self, keywords, disabler, pinned=False, exclude_id=None): if isinstance(keywords, (str, unicode)): keywords = [keywords] query_dict = { pair_data.KEYWORD: { '$in': [kw.lower() for kw in keywords] } } if exclude_id is not None: query_dict[pair_data.SE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(self):\n for val in data:\n val.disable()\n self.enabled = False", "async def refresh_pairs(self):\n\n summaries = await self.api.get_market_summaries()\n if summaries is None:\n self.log.error('Could not get market summaries data.')\n ...
[ "0.542848", "0.5315378", "0.51291287", "0.509663", "0.50135475", "0.49947545", "0.49913836", "0.49693638", "0.49531627", "0.4946007", "0.49041572", "0.48881", "0.48801425", "0.48505482", "0.4849771", "0.48385632", "0.4810579", "0.481049", "0.4790208", "0.4790183", "0.47853807...
0.0
-1
Return disabled data list in type pair_data. None if nothing updated.
def disable_keyword_by_id(self, id_or_id_list, disabler, pinned=False): if not isinstance(id_or_id_list, list): id_or_id_list = [id_or_id_list] query_dict = { pair_data.SEQUENCE: { '$in': id_or_id_list } } return self._disable(query_dict, disabler, pinned)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(self):\n for val in data:\n val.disable()\n self.enabled = False", "async def refresh_pairs(self):\n\n summaries = await self.api.get_market_summaries()\n if summaries is None:\n self.log.error('Could not get market summaries data.')\n ...
[ "0.5426085", "0.5321331", "0.5129032", "0.5097894", "0.50142515", "0.49939844", "0.49927738", "0.49670318", "0.4954972", "0.4945268", "0.4904914", "0.4892326", "0.48819578", "0.4856891", "0.48528916", "0.48417345", "0.481017", "0.48065466", "0.47947448", "0.47891176", "0.4785...
0.0
-1
Return none if nothing found, else return result in pair_data class
def get_reply_data(self, keyword, kw_type=word_type.TEXT): data_result = self.find_one({ pair_data.KEYWORD: keyword.lower(), pair_data.PROPERTIES + '.' + pair_data.DISABLED: False, pair_data.PROPERTIES + '.' + pair_data.KEYWORD_TYPE: int(kw_type) }, sort=[(pair_data.P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(pair):\n\treturn pair[0]", "def get_uncertain_pair(self):\n\n record_pair = self.uncertain_pairs.pop()\n\n self.print_pair(record_pair)\n\n return record_pair", "def create_pair(self, players_list: list[Player], id_number, already_paired=[]) -> tuple:\n for player_1, playe...
[ "0.57107174", "0.5575479", "0.55203307", "0.5501925", "0.5500681", "0.5489601", "0.54136205", "0.5363637", "0.53393865", "0.53346926", "0.52999115", "0.5282481", "0.5273748", "0.5250695", "0.52297556", "0.52251554", "0.5213558", "0.5200448", "0.5177069", "0.51753825", "0.5154...
0.4736274
89
Add Linked words by ID(s) to specified keyword pair. Keyword pair is specified by ID(s).
def set_pinned_by_index(self, ids, pinned=True): if isinstance(ids, (int, long)): ids = [ids] ids = [int(id) for id in ids] update_result = self.update_many({ '$and': [{ pair_data.SEQUENCE: { '$in': ids } }, { pair_data.PROPERTIES + '.' + pair_data.DISABLED: False }] }, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word_and_label_id(self, word, label_id):\n self.words.append(word)\n self.label_ids.append(label_id)", "def _add_word(self, id_: int, word: str, key: str) -> None:\n node = self.root\n for c in word:\n self._alphabet.add(c)\n node = node[c]\n # we can't ha...
[ "0.68641037", "0.65201336", "0.63025326", "0.6189139", "0.60892147", "0.60643345", "0.6054709", "0.6050733", "0.60165113", "0.6014936", "0.5979364", "0.59585273", "0.5942754", "0.5929582", "0.5904541", "0.58855027", "0.5830861", "0.5762395", "0.5753166", "0.57341135", "0.5724...
0.0
-1
Add Linked words by ID(s) to specified keyword pair. Keyword pair is specified by ID(s).
def set_pinned_by_keyword(self, keywords, pinned=True): if isinstance(keywords, (str, unicode)): keywords = [keywords] update_result = self.update_many({ '$and': [{ pair_data.KEYWORD: { '$in': [kw.lower() for kw in keywords] } }, { pair_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word_and_label_id(self, word, label_id):\n self.words.append(word)\n self.label_ids.append(label_id)", "def _add_word(self, id_: int, word: str, key: str) -> None:\n node = self.root\n for c in word:\n self._alphabet.add(c)\n node = node[c]\n # we can't ha...
[ "0.68639284", "0.65199584", "0.6300855", "0.6188392", "0.6087073", "0.6063204", "0.605348", "0.6049926", "0.60149044", "0.6013106", "0.5977732", "0.59588736", "0.5941377", "0.5927862", "0.59027624", "0.5883227", "0.5829075", "0.5761525", "0.57517624", "0.5732342", "0.5723102"...
0.0
-1
Return none if nothing found, else return result in list of pair_data class
def search_pair_by_keyword(self, keyword, data_exact_same=False): keyword = unicode(keyword).lower() filter_dict = { '$or': [ { pair_data.KEYWORD: keyword if data_exact_same else { '$regex': keyword, '$options': 'i' } }, { pair_data.REPLY: keyword if data_exa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paired(self):\n return Pairs(filter(not_none, self))", "def _get_pairs_simple(self, distance):\n pairs = self.data_kd[0].query_pairs(distance)\n pairs = set(frozenset(p) for p in pairs)\n for kd in self.data_kd[1:]:\n newpairs = set(frozenset(p) for p in kd.query_pairs(...
[ "0.6096052", "0.5926023", "0.58436996", "0.57692224", "0.5673958", "0.5628035", "0.56151766", "0.5612439", "0.5584885", "0.5577176", "0.5573816", "0.5546721", "0.5541174", "0.5510128", "0.5508485", "0.54793435", "0.5476978", "0.5472595", "0.5451191", "0.54276234", "0.5424087"...
0.0
-1
Return none if nothing found, else return result in list of pair_data class
def search_pair_by_index(self, start_id_or_id_list, end_id=None): if not isinstance(start_id_or_id_list, (int, long, list)) or (not isinstance(end_id, (int, long)) and end_id is not None): raise ValueError('Start index must be integer, long or list. End index must be integer or long.') if i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paired(self):\n return Pairs(filter(not_none, self))", "def _get_pairs_simple(self, distance):\n pairs = self.data_kd[0].query_pairs(distance)\n pairs = set(frozenset(p) for p in pairs)\n for kd in self.data_kd[1:]:\n newpairs = set(frozenset(p) for p in kd.query_pairs(...
[ "0.6096052", "0.5926023", "0.58436996", "0.57692224", "0.5673958", "0.5628035", "0.56151766", "0.5612439", "0.5584885", "0.5577176", "0.5573816", "0.5546721", "0.5541174", "0.5510128", "0.5508485", "0.54793435", "0.5476978", "0.5472595", "0.5451191", "0.54276234", "0.5424087"...
0.0
-1
Return none if nothing found, else return result in list of pair_data class
def search_all_available_pair(self): return self._search({})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paired(self):\n return Pairs(filter(not_none, self))", "def _get_pairs_simple(self, distance):\n pairs = self.data_kd[0].query_pairs(distance)\n pairs = set(frozenset(p) for p in pairs)\n for kd in self.data_kd[1:]:\n newpairs = set(frozenset(p) for p in kd.query_pairs(...
[ "0.6096052", "0.5926023", "0.58436996", "0.57692224", "0.5673958", "0.5628035", "0.56151766", "0.5612439", "0.5584885", "0.5577176", "0.5573816", "0.5546721", "0.5541174", "0.5508485", "0.54793435", "0.5476978", "0.5472595", "0.5451191", "0.54276234", "0.5424087", "0.54121107...
0.5510128
13
Return none if nothing found, else return result in list of pair_data class
def search_pair_by_creator(self, uid): filter_dict = { pair_data.STATISTICS + '.' + pair_data.CREATOR: uid } return self._search(filter_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paired(self):\n return Pairs(filter(not_none, self))", "def _get_pairs_simple(self, distance):\n pairs = self.data_kd[0].query_pairs(distance)\n pairs = set(frozenset(p) for p in pairs)\n for kd in self.data_kd[1:]:\n newpairs = set(frozenset(p) for p in kd.query_pairs(...
[ "0.60958713", "0.592484", "0.5841869", "0.5769072", "0.56732744", "0.562842", "0.56133056", "0.56118524", "0.55850166", "0.5577919", "0.55734175", "0.5546835", "0.5540125", "0.55101573", "0.55081344", "0.54785544", "0.54759765", "0.5471472", "0.5451345", "0.5426233", "0.54235...
0.0
-1
Add Linked words by ID(s) to specified keyword pair. Keyword pair is specified by ID(s).
def add_linked_word_by_id(self, target_ids, linked_ids, able_to_mod_pin=False): filter_dict, linked_ids = self._preproc_linked_by_id(target_ids, linked_ids, able_to_mod_pin) return self._postproc_linked(filter_dict, linked_ids, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word_and_label_id(self, word, label_id):\n self.words.append(word)\n self.label_ids.append(label_id)", "def _add_word(self, id_: int, word: str, key: str) -> None:\n node = self.root\n for c in word:\n self._alphabet.add(c)\n node = node[c]\n # we can't ha...
[ "0.68641037", "0.65201336", "0.63025326", "0.6189139", "0.60892147", "0.60643345", "0.6054709", "0.6050733", "0.60165113", "0.6014936", "0.5979364", "0.5942754", "0.5929582", "0.5904541", "0.58855027", "0.5830861", "0.5762395", "0.5753166", "0.57341135", "0.5724238", "0.57221...
0.59585273
11
Delete Linked words from specified keyword pair. Keyword pair is specified by ID(s).
def del_linked_word_by_id(self, target_ids, linked_ids, able_to_mod_pin=False): filter_dict, linked_ids = self._preproc_linked_by_id(target_ids, linked_ids, able_to_mod_pin) return self._postproc_linked(filter_dict, linked_ids, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, keyword, key):", "def delete_link(self, word):\n meaning = self.word2meaning[word]\n print(str(self.unique_id) + \" forgot \" +\n str(word) + \" for \" + str(meaning))\n del self.word2meaning[word]\n del self.meaning2word[meaning]\n del self.wordsu...
[ "0.68989724", "0.6787392", "0.66336787", "0.66126007", "0.6610202", "0.65756625", "0.64265597", "0.63914794", "0.6191663", "0.6145425", "0.6071145", "0.60503215", "0.6015974", "0.5968459", "0.5925361", "0.5912555", "0.58320093", "0.5829038", "0.581899", "0.5680304", "0.566869...
0.60354024
12
Add Linked words by ID(s) to specified keyword pair. Keyword pair is specified by keyword(s).
def add_linked_word_by_word(self, target_words, linked_words, able_to_mod_pin=False): filter_dict, linked_words = self._preproc_linked_by_word(target_words, linked_words, able_to_mod_pin) return self._postproc_linked(filter_dict, linked_words, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word_and_label_id(self, word, label_id):\n self.words.append(word)\n self.label_ids.append(label_id)", "def add(self, word):\n\t\tif word not in self.link_words:\n\t\t\tself.link_words.append(word)", "def insert_keyword(kwd, pkg_id):\n global kwd_index\n try:\n sql = 'INSERT INTO key...
[ "0.664027", "0.6335486", "0.6330179", "0.6327179", "0.621176", "0.61829555", "0.6150729", "0.61346394", "0.6093935", "0.60321534", "0.59955174", "0.5984343", "0.597471", "0.59707475", "0.5912863", "0.5886187", "0.5872698", "0.58481836", "0.5820663", "0.58013463", "0.5750912",...
0.58132297
19
Delete Linked words from specified keyword pair. Keyword pair is specified by keyword.
def del_linked_word_by_word(self, target_words, linked_words, able_to_mod_pin=False): filter_dict, linked_words = self._preproc_linked_by_word(target_words, linked_words, able_to_mod_pin) return self._postproc_linked(filter_dict, linked_words, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, keyword, key):", "def problem_keyword_delete(self, identifier, keyword):\n self._delete(\"problems/%d/keywords/%s\" % (identifier, quote(keyword, safe=\"\")))", "def remove(self, word):\n\t\tif word in self.link_words:\n\t\t\tself.link_words.remove(word)", "def delete_link(self, word)...
[ "0.7170378", "0.68357", "0.68182", "0.6725521", "0.67138326", "0.64427257", "0.63949317", "0.6371659", "0.6353016", "0.62722796", "0.6100241", "0.6067523", "0.5961908", "0.59342724", "0.58869314", "0.58450747", "0.58347297", "0.5744543", "0.5683425", "0.56488854", "0.5644567"...
0.6335577
9
Return empty array if nothing found, else return array of sequence id.
def user_created_id_array(self, uid): result = self.find({ pair_data.STATISTICS + '.' + pair_data.CREATOR: self._uid2ref(uid) }, { pair_data.SEQUENCE: True } ).sort(pair_data.SEQUENCE, pymongo.ASCENDING) if result is not None: return [data[pair_data.SEQUENCE] for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(self) -> List[str]:", "def _id_seq(self):\n return list(self.keys())", "def subseqs_ids(subsequences, sequence):\n return [1 if subsequence in sequence else 0 for subsequence in subsequences]", "def get_seq(self): # -> list[Unknown]:\n ...", "def getIDs():", "def get_seq_ids(...
[ "0.63351494", "0.63165605", "0.6204257", "0.6197235", "0.6129571", "0.6069571", "0.59799623", "0.5919414", "0.5913466", "0.5878638", "0.5865883", "0.5837098", "0.58289546", "0.57959354", "0.5780037", "0.5777107", "0.57456404", "0.5724617", "0.571826", "0.571826", "0.5714811",...
0.6340417
0
Return none if not found
def _ref2uid(self, ref): return self._uid_ref.get_uid(ref)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(found_item, _):\n if found_item:\n return found_item[1]\n else:\n return default", "def lookup():", "def find_exact(self, **kwargs):\n results = list(self.find(**kwargs))\n if len(results) == 1:\n return results[0]\n r...
[ "0.65665185", "0.6487816", "0.6405071", "0.636868", "0.63648057", "0.6285282", "0.6283602", "0.6252866", "0.6241064", "0.6221074", "0.6160002", "0.6154548", "0.612161", "0.6106493", "0.60867506", "0.6037409", "0.6020851", "0.60034883", "0.59787875", "0.5951527", "0.5948574", ...
0.0
-1
Always not none, length will be 0 if nothing inside(empty array).
def linked_words(self): return self[pair_data.PROPERTIES][pair_data.LINKED_WORDS]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _len(self):\n if self.array is not None:\n return len(self.array)\n print(\">>> List is None\")\n return None", "def is_empty(self):\n return self.size == []", "def __len__(self):\n return len(self.array)", "def __len__(self):\n return len(self.array)"...
[ "0.75212395", "0.7021856", "0.6965229", "0.6965229", "0.6914274", "0.684622", "0.68350154", "0.6810869", "0.6810869", "0.67964685", "0.67603344", "0.67090696", "0.6679631", "0.66717803", "0.6670068", "0.66585845", "0.6644336", "0.6640907", "0.66185313", "0.66050905", "0.65966...
0.0
-1
Returns all subclasses of this base class. The dictionary poses as Backend registry.
def get_subclasses(cls) -> dict: return dict(cls._subclasses)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_all(cls):\r\n # BaseProvider does so have __subclassess__. pylint: disable-msg=no-member\r\n return {klass.NAME: klass for klass in BaseProvider.__subclasses__()}", "def get_all_object_classes(cls) -> Dict[str, Type[objects.BaseObject]]:\n cls._refresh_registry()\n return cop...
[ "0.7478175", "0.715127", "0.70746803", "0.70010734", "0.66492534", "0.6618857", "0.6606922", "0.6604169", "0.65711075", "0.65670526", "0.6564629", "0.6552424", "0.6425689", "0.6420186", "0.638971", "0.6376375", "0.6374097", "0.6343866", "0.6304094", "0.62940854", "0.6286731",...
0.7372407
1
Method to wrap the backend strategy.
def detect( self, img: Union[np.ndarray, List[np.ndarray]], *args, **kwargs ) -> Tuple[torch.Tensor, np.ndarray]: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_strategy(self): \n return self._wrap_strategy", "def _backend(self) -> Backend:\n return self.__backend", "def fake_backend_init(obj, *args, **kwargs):\n\n from armstrong.apps.embeds.backends import get_backend\n super(Backend, obj).__init__(*args, **kwargs)\n\n # patching this...
[ "0.7227032", "0.69040304", "0.64009994", "0.6367698", "0.6356445", "0.6216431", "0.61890733", "0.60283273", "0.586486", "0.580149", "0.5751558", "0.5739716", "0.5683213", "0.56797254", "0.5676801", "0.56158113", "0.5596493", "0.55426824", "0.5518247", "0.54800737", "0.5476997...
0.0
-1
Minimum brightness, 0, that is, totally dark, read only
def min_brightness(self): return .0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_brightness(self) -> float:\n return max(self._color)", "def brightness(value):\n value = int(value)\n if value < 1 or value > 254:\n raise ValueError('Minimum brightness is 1, to the maximum 254')\n return value", "def brightness(self) -> float:\n # http://alienryderfl...
[ "0.67517716", "0.66309625", "0.6602429", "0.6565702", "0.65619093", "0.65543157", "0.6543305", "0.64708745", "0.6433429", "0.64129823", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434", "0.6346434...
0.8576602
0
Multichannel short time fourier transform
def wpe_stft(data, frame_size=512, overlap=0.75, window=None): assert(data.ndim == 2) if window == None: window = np.hanning(frame_size) frame_shift = int(frame_size - np.floor(overlap * frame_size)) cols = int(np.ceil((data.shape[1] - frame_size) / frame_shift)) + 1 data = np.concatenate( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_fourier_transform(chunked_audio):\n pass", "def fourier(img):\n return fourierCV(img)", "def _irfft2d(f_x) :", "def fourier(data, temp_freq, axis, output = 'amplitude'):\n\t\t\n\t\n\t# take largest possible multiple of F1 from PSTH.\n\t# Generate freq and fft\n\t# generate amplitude\n\t# ...
[ "0.7064482", "0.66905", "0.65036297", "0.64643455", "0.6447374", "0.6149582", "0.60905504", "0.6070598", "0.59986216", "0.5901727", "0.589078", "0.5863174", "0.5843375", "0.5842394", "0.58308554", "0.5829032", "0.5818499", "0.58096373", "0.58095837", "0.5797135", "0.5791208",...
0.0
-1
Multichannel inverse short time fourier transform
def wpe_istft(data, frame_size=None, overlap=0.75, window=None): assert(data.ndim == 3) real_data = np.fft.irfft(data) if frame_size == None: frame_size = real_data.shape[-1] frame_num = data.shape[-2] frame_shift = int(frame_size - np.floor(frame_size * overlap)) length = (frame_num - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _irfft2d(f_x) :", "def fourier(img):\n return fourierCV(img)", "def apply_fourier_transform(chunked_audio):\n pass", "def IDFT2(fourier_image):\n return IDFT(IDFT(fourier_image).transpose()).transpose()", "def fourier_transform2d(self):\n\n zerofill = np.zeros(1024 * np.array([1...
[ "0.68281204", "0.66871434", "0.6438106", "0.6370882", "0.63578653", "0.6244935", "0.6174011", "0.6111227", "0.59716445", "0.59715253", "0.5963575", "0.5936594", "0.5902908", "0.58940446", "0.58899385", "0.5874245", "0.58656013", "0.5858009", "0.5849362", "0.58263624", "0.5824...
0.0
-1
Frequencydomain variancenormalized delayed liner prediction This is the core part of the WPE method. The variancenormalized linear prediciton algorithm is implemented in each frequency bin separately. Both the input and output signals are in timedomain.
def __fdndlp(self, data): freq_data = wpe_stft( data / np.abs(data).max(), frame_size=self.frame_size, overlap=self.overlap) self.freq_num = freq_data.shape[-1] drv_freq_data = freq_data[0:self.out_num].copy() for i in range(self.freq_num): xk = freq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n np.set_printoptions(threshold=25)\n ts_length = 1000\n window_size = 50\n\n print('\\nSimple single timeseries vector prediction')\n timeseries = np.arange(ts_length) # The timeseries f(t) = t\n evaluate_timeseries(timeseries, window_size)\n\n print('\\nMultiple...
[ "0.60069335", "0.5729496", "0.57247895", "0.56926006", "0.5640804", "0.55693763", "0.5462862", "0.545068", "0.5437306", "0.54234403", "0.54046506", "0.54024243", "0.5400062", "0.53954995", "0.53901184", "0.53728026", "0.5367973", "0.5359561", "0.53073376", "0.5297493", "0.529...
0.5413295
10
Variancenormalized delayed liner prediction Here is the specific WPE algorithm implementation. The input should be the reverberant timefrequency signal in a single frequency bin and the output will be the dereverberated signal in the corresponding frequency bin.
def __ndlp(self, xk): cols = xk.shape[0] - self.d xk_buf = xk[:,0:self.out_num] xk = np.concatenate( (np.zeros((self.p - 1, self.channels)), xk), axis=0) xk_tmp = xk[:,::-1].copy() frames = stride_tricks.as_strided( xk_tmp, shape=(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wvd(fx,nh=2**8-1,tstep=2**5,nfbins=2**10,df=1.0):\r\n \r\n if type(fx) is list:\r\n fx=np.array(fx)\r\n try:\r\n fn,fm=fx.shape\r\n if fm>fn:\r\n fm,fn=fx.shape\r\n except ValueError:\r\n fn=len(fx)\r\n fm=1\r\n if fm>1:\r\n fn=fn[0]\r\n ...
[ "0.58324814", "0.5825792", "0.57535493", "0.5751042", "0.57346576", "0.57223755", "0.56215954", "0.5614654", "0.5592262", "0.5591481", "0.5540872", "0.5534909", "0.55345464", "0.5412012", "0.54105526", "0.5396924", "0.539593", "0.5393846", "0.53916824", "0.5389656", "0.538042...
0.0
-1
Put items randomly on the map and check if it's possible
def put_items(self,*maplist): self.position_x = random.randint(0, (len(maplist) - 1)) self.position_y = random.randint(1, (len(maplist[0]) - 2)) while maplist[self.position_y][self.position_x] == "x": self.position_x = random.randint(0, (len(maplist) - 1)) self.position_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sample_mapped_keys(self):\r\n\r\n # With num_coverage=1 only the keys will be sampled\r\n actual = sample_mapped_keys(self.test_map, 1)\r\n self.assertEqual(actual, {'1': ['1'], '2': ['2']})\r\n\r\n actual = sample_mapped_keys(self.test_map, 3)\r\n for key in actual.keys...
[ "0.6235295", "0.6196126", "0.61928105", "0.6118452", "0.60727566", "0.6048035", "0.6003166", "0.5947445", "0.5936345", "0.59303933", "0.58924127", "0.586839", "0.58570385", "0.58383924", "0.5817358", "0.5806295", "0.58048785", "0.57672346", "0.5725036", "0.5725036", "0.572503...
0.6995374
0
return the current position of the item
def get_position(self): position = (self.position_x * SPRITE_SIZE, self.position_y * SPRITE_SIZE) return position
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPos(self):\n return self.__current_pos", "def get_pos(self):\r\n return self.pos", "def _get_pos(self):\n return self._pos", "def get_pos(self):\n return self.pos", "def position(self):\n return self._position", "def get_next_position(self):", "def pos(self):\n ...
[ "0.7483784", "0.7428687", "0.7375483", "0.7348983", "0.73047084", "0.7303938", "0.7247497", "0.7247497", "0.7199979", "0.715942", "0.71504045", "0.71359575", "0.7133087", "0.7122779", "0.7103176", "0.70612854", "0.70489836", "0.7041392", "0.7037722", "0.70246315", "0.7022811"...
0.0
-1
Creates an AdvObject from the specified properties.
def __init__(self, name, description, location): self._name=name self._description=description self._location = location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *properties):\n self._properties = properties", "def __init__(self, props):\n if props.has_key('tags'):\n for tag in props['tags']:\n self.tags.append(Tag(tag))\n del props['tags']\n\n if props.has_key('impress'):\n for imp i...
[ "0.5741443", "0.54022276", "0.5395443", "0.5392113", "0.53685415", "0.5281179", "0.52164215", "0.5166432", "0.5139286", "0.51178515", "0.51087105", "0.5067166", "0.5053501", "0.49764574", "0.4967905", "0.49215397", "0.49170443", "0.49132085", "0.49040744", "0.49028632", "0.48...
0.0
-1
Converts an AdvObject to a string.
def __str__(self): return self._name+self._description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_str(self, obj):\n if self.pretty:\n return pprint.pformat(obj)\n else:\n return str(obj)", "def value_to_string(self, obj):\n value = self.value_from_object(obj)\n return value", "def value_to_string(self, obj):\n value = self._get_val_from_obj(o...
[ "0.6920051", "0.691676", "0.68165755", "0.68165755", "0.68165755", "0.6777115", "0.6751077", "0.6725503", "0.6705754", "0.6672747", "0.6669665", "0.6566048", "0.6535063", "0.65277386", "0.6492304", "0.6480443", "0.6470456", "0.6397102", "0.6383064", "0.6383064", "0.63526213",...
0.0
-1
Returns the name of this object.
def getName(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n\n\t\treturn self.__name", "def get_object_name(self):\n return self.obj_name", "def get_name(self):\n return self.__name", "def get_name(self):\n return self.__name", "def get_name(self):\n return self.__name", "def get_name(self):\n\t\treturn self.__name...
[ "0.89701015", "0.895701", "0.89562804", "0.89562804", "0.89562804", "0.89102674", "0.8910035", "0.8910035", "0.8910035", "0.8910035", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.886717", ...
0.0
-1
Returns the description of this object.
def getDescription(self): return self._description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description(self):\r\n return self.__description", "def get_description(self):\n return self.__description", "def description(self) -> str:\n raise NotImplementedError", "def description(self) -> str:\n raise NotImplementedError", "def description(self) -> str:\n ...
[ "0.89162534", "0.8913889", "0.8760129", "0.8760129", "0.8760129", "0.87569624", "0.87569624", "0.8748838", "0.8726684", "0.8726684", "0.8726684", "0.8726684", "0.8726684", "0.8726684", "0.8726684", "0.8726684", "0.8683328", "0.8674301", "0.8674301", "0.8674301", "0.86682856",...
0.0
-1
Returns the initial location of this object.
def getInitialLocation(self): return self._location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_alt_loc(self):\n return self.default_alt_loc", "def get_initial_point(self):\r\n return self._studio.get_initial_point()", "def get_origin(self):\n return self.zero", "def start_loc(self) -> str:\n return self._start_loc", "def get_origin(self):\n return s...
[ "0.7558399", "0.73375237", "0.73054683", "0.7235104", "0.71608335", "0.7137725", "0.7113328", "0.7026934", "0.6992983", "0.6913296", "0.68974197", "0.6893482", "0.6890375", "0.6888621", "0.68663657", "0.68411374", "0.68411374", "0.68146896", "0.6788716", "0.6781255", "0.67809...
0.8698698
0
Reads and returns the next object from the file.
def readObject(f): name = f.readline().rstrip() if name == "": name = f.readline().rstrip() if name == "": return None description = f.readline().rstrip() location = f.readline().rstrip() return AdvObject(name, description, location )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_next_file(self):\n\n if self._file_ptr == len(self.files):\n raise pipeline.PipelineStopIteration\n\n # Collect garbage to remove any prior data objects\n gc.collect()\n\n # Fetch and remove the next item in the list\n file_ = self.files[self._file_ptr]\n ...
[ "0.72583795", "0.7027254", "0.68285656", "0.67972666", "0.67273176", "0.6713927", "0.6641655", "0.65415096", "0.64786977", "0.6464034", "0.64639145", "0.64511824", "0.6437354", "0.64324224", "0.6382865", "0.625156", "0.62444645", "0.6218984", "0.6084731", "0.5925621", "0.5919...
0.650625
8
Draws a circle with the given center point and radius.
def drawCircle(t, x, y, radius): t.up() t.goto(x + radius, y) t.setheading(90) t.down() for count in range(120): t.left(3) t.forward(2.0 * math.pi * radius / 120.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circle(self, center, radius, color=(255, 255, 255), width=0):\n center = self._transform(center)\n pygame.draw.circle(self.screen, color, center, radius, width)", "def draw_circle(self, color, center, radius, width):\n _c = self.T.itrans(center)\n pg.draw.circle(self.screen, color...
[ "0.86338115", "0.85009205", "0.83613294", "0.83170444", "0.82574344", "0.82180214", "0.81991607", "0.81948245", "0.81408536", "0.8098403", "0.807575", "0.7977794", "0.7959704", "0.79416144", "0.78637886", "0.77105397", "0.77105397", "0.7669779", "0.7632818", "0.76300377", "0....
0.7293385
30
Allows the user to enter the center point and the radius.
def main(): x = int(input("Enter the x coordinate of the center point: ")) y = int(input("Enter the y coordinate of the center point: ")) radius = int(input("Enter the radius: ")) drawCircle(Turtle(), x, y, radius) sleep(5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, center=None, radius=1):\n if center is None:\n center = Point()\n self.center = center\n self.radius = radius", "def __init__( self , center , radius ):\r\n self.center = center\r\n self.radius = radius", "def objects_radius(self, centre, r...
[ "0.71296966", "0.7125274", "0.67846715", "0.6770878", "0.64596057", "0.6245679", "0.62237734", "0.6174636", "0.6130969", "0.6080135", "0.6042969", "0.59949976", "0.59806263", "0.59674543", "0.5946548", "0.5903731", "0.58795375", "0.5849122", "0.58323336", "0.5830168", "0.5830...
0.64534515
5
Divide trees according to type of topology.
def main(): arg = parse_args() print('Start.') arg.folder = Path(arg.folder) trees = list(arg.folder.glob('*')) trees = [i.absolute() for i in trees] info = parse_info(arg) types = [arg.folder/i for i in info.keys()] types_dict = dict(zip(info.keys(), types)) for i in types: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(root, Dk, maxDepth, minRows, currDepth):\n \n left, right = root['branches']\n del(root['branches'])\n \n# if not left and not right:\n# return\n \n # Check if the node is a leaf\n if not len(left): \n root['left'] = root['right'] = getLeafClass(right)\n ...
[ "0.5453626", "0.5452636", "0.518309", "0.5146686", "0.5118012", "0.51089513", "0.51027083", "0.5078505", "0.5066417", "0.5044864", "0.5033552", "0.50323814", "0.50138044", "0.5011849", "0.49989843", "0.49979243", "0.49885964", "0.49885964", "0.49619004", "0.493714", "0.492690...
0.48425135
32
Create an EasyOCR Reader.
def __init__( self, lang_list: List[str], gpu: bool = True, model_storage_directory: str = None, download_enabled: bool = True ): self._set_device(gpu) self._set_model_lang(lang_list) self._set_character_choices() self._set_lang_char(lang_list) # self.lang_list doesn't seem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reader_instantiates(self):\n cr = CaseReader(self.filename)\n self.assertTrue(isinstance(cr, HDF5CaseReader), msg='CaseReader not'\n ' returning the correct subclass.')", "def runOcr(input, output, verbose):\n pOcr = performOCR()\n pOcr.performOCR(input, output...
[ "0.5260699", "0.50356466", "0.50144494", "0.4956128", "0.49238893", "0.49137166", "0.4909198", "0.4838459", "0.48022503", "0.47904193", "0.47768283", "0.47762477", "0.47688955", "0.47371775", "0.47360316", "0.47072673", "0.46999484", "0.4683058", "0.46523178", "0.46151334", "...
0.44355845
37
Reads the energy. returns energies found in the diracoutput files in filelist.
def readenergy(self, filelist): energy=[] tmpenergy=[] for filename in filelist: if not(os.path.exists(filename)): if self._resultfile: self._resultfile.write('Output file: "'+filename+'" does not exist. Restart your calculation. \n') else: print 'Output file: "'+filename+'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_energy(self, fname):\n outfile = open(fname)\n lines = outfile.readlines()\n outfile.close()\n\n energy = None\n for line in lines:\n if line.find('HEAT OF FORMATION') != -1:\n words = line.split()\n energy = float(words[5])\n ...
[ "0.7086508", "0.708285", "0.6795043", "0.6768917", "0.6695373", "0.6663242", "0.65436995", "0.652793", "0.6472127", "0.6311504", "0.6298959", "0.6152937", "0.61389047", "0.61037445", "0.60946065", "0.59737444", "0.5941638", "0.5932472", "0.5913029", "0.5901953", "0.58484244",...
0.7640516
0
Makes a dictonary with how to read the output files. Returns nothing. For the easy to use character strings in keys the function reads the datafile. With this information a list of dictonaries is built and put into the variable _keydict. The useable names can be listed with the function keynames()
def set_keys(self, keys): self._keydict=[] self._keys=[] # Connect userfriendly keywords to the characters that indicates the energy in Dirac. for key in keys: tmpdat=[] infile=open(self._datafile, 'r') if not infile: if self._resultfile: self._result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DataLoad(filename,path,keys_to_search=['dstr','ORT'],text_file = False):\n\n OUTPUT_DICT = {}\n\n if not text_file:\n\n rdr = EafReader(filename, path, text_file=False)\n\n for key in keys_to_search:\n\n annot, annot_df = rdr.parser(key)\n DF = rdr.dataframe_creator(an...
[ "0.6992537", "0.63537943", "0.63483447", "0.63251376", "0.6192821", "0.60494673", "0.6024493", "0.59666574", "0.59539443", "0.5948677", "0.5942385", "0.59367585", "0.59194607", "0.59025496", "0.5849234", "0.5810317", "0.5801417", "0.5754932", "0.5750282", "0.573261", "0.56992...
0.69034344
1
Writes the names of the keys that could be used to STDOUT or to _resultfile. Returns nothing
def keynames(self): infile=open(self._datafile, 'r') if self._resultfile: self._resultfile.write("Keys in datafile: "+self._datafile+'\n') else: print ("Keys in datafile: "+self._datafile+'\n') for tmpc in infile: for i in range(0, len(tmpc)): if tmpc[i:i+1]=='#': break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_keypoint_results(keypoint_results, gt_folder, pred_folder):", "def export_file(self):\n if self.args.keyfilter:\n self.filter_keys()\n if self.args.datafilter:\n self.filter_values()\n json.dump(self.outputdata, self.outfile, indent=self.args.indent)\n ...
[ "0.672782", "0.62190783", "0.59323156", "0.58724725", "0.58682984", "0.57954323", "0.5761679", "0.5730018", "0.57159007", "0.5712536", "0.5676965", "0.56695795", "0.5650905", "0.564897", "0.5632195", "0.56272215", "0.560844", "0.55824125", "0.55570793", "0.5553363", "0.553443...
0.6835899
0
Returns the keylist. Accessed through .keys
def get_keys(self): return self._keys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self) -> List:\n pass", "def get_key_list(self) -> list:\n return self.key_functs.keys()", "def getkeys(self):\n return list(self.keys)", "def keys(self):\r\n return [k for k in self]", "def keys(self):\n return [ x for x in self ]", "def keys(self):\n retur...
[ "0.86689055", "0.8622244", "0.85591614", "0.83134896", "0.8216067", "0.82127815", "0.82086694", "0.8187642", "0.81670517", "0.81668127", "0.81624645", "0.8070637", "0.8067892", "0.8002373", "0.7960686", "0.7943611", "0.7939778", "0.79254633", "0.79254633", "0.79252243", "0.79...
0.8493084
3
Set the list of files to be read Accessed through .files. Returns nothing.
def setfiles(self, filelist): self._filelist=filelist self._energy=self.readenergy(filelist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_files(self, files: list = None):\n if not is_empty_arr(files):\n self._files = files", "def listFiles(self):\n pass", "def fileset(self):\n pass", "def update(self):\n if os.path.isdir(self.full_path):\n self.file_list = os.listdir(self.full_path)\...
[ "0.7024085", "0.68313926", "0.6823761", "0.6700469", "0.6691884", "0.6609458", "0.6593145", "0.65463704", "0.65022755", "0.64708245", "0.63540703", "0.63521343", "0.6350075", "0.62795043", "0.6271418", "0.62625027", "0.624582", "0.6244804", "0.6167253", "0.61467445", "0.61424...
0.708177
0
Add files to the end of the filelist. Returns their read energies.
def addfiles(self, filelist): for tmpc in filelist: self._filelist.append(tmpc) tmp_energy=self.readenergy(filelist) for tmpdat in tmp_energy: self._energy.append(tmpdat) return tmp_energy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertfiles(self, pos, filelist):\r\n for i in range(0, len(filelist)):\r\n self._filelist.insert(pos+i, filelist[i])\r\n tmp_energy=self.readenergy(filelist)\r\n for i in range(0, len(tmp_energy)):\r\n self._energy.insert(pos+i, tmp_energy[i])\r\n return tmp_energy", "def add_files(sel...
[ "0.6711196", "0.6418432", "0.62716985", "0.6196659", "0.6169911", "0.6086327", "0.59367085", "0.58788455", "0.58760184", "0.57898587", "0.5785641", "0.57034767", "0.57004327", "0.5663165", "0.56618965", "0.5629544", "0.56114274", "0.56029123", "0.55897784", "0.55780524", "0.5...
0.8065469
0
Insert file at position pos in the file list. Returns it's energies/
def insertfile(self, pos, file): self._filelist.insert(pos, file) tmp_energy=self.readenergy([file]) for i in range(0, len(tmp_energy)): self._energy.insert(pos+i, tmp_energy[i]) return tmp_energy[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertfiles(self, pos, filelist):\r\n for i in range(0, len(filelist)):\r\n self._filelist.insert(pos+i, filelist[i])\r\n tmp_energy=self.readenergy(filelist)\r\n for i in range(0, len(tmp_energy)):\r\n self._energy.insert(pos+i, tmp_energy[i])\r\n return tmp_energy", "def addfiles(self...
[ "0.8262362", "0.5946468", "0.5841547", "0.5443106", "0.519077", "0.5129954", "0.5110636", "0.50919867", "0.5073317", "0.5017984", "0.49988976", "0.49755192", "0.49303234", "0.49288973", "0.49170265", "0.48991424", "0.4895956", "0.48913643", "0.48766756", "0.48552522", "0.4853...
0.81386596
1
Insert a list of files at position pos in the file list. Returns their energies.
def insertfiles(self, pos, filelist): for i in range(0, len(filelist)): self._filelist.insert(pos+i, filelist[i]) tmp_energy=self.readenergy(filelist) for i in range(0, len(tmp_energy)): self._energy.insert(pos+i, tmp_energy[i]) return tmp_energy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertfile(self, pos, file):\r\n self._filelist.insert(pos, file)\r\n tmp_energy=self.readenergy([file])\r\n for i in range(0, len(tmp_energy)):\r\n self._energy.insert(pos+i, tmp_energy[i])\r\n return tmp_energy[0]", "def addfiles(self, filelist):\r\n for tmpc in filelist:\r\n self....
[ "0.7297772", "0.62299746", "0.54402405", "0.5370709", "0.53008914", "0.5247944", "0.52219343", "0.51347685", "0.5120666", "0.50602365", "0.50350565", "0.4997518", "0.49373466", "0.48963982", "0.4895969", "0.48752096", "0.48604277", "0.48215386", "0.48195642", "0.47813186", "0...
0.8478526
0
Delete the named files in filelist from the _filelist.
def delfiles(self, filelist=[]): for tmpc in filelist: i=index(tmpc, self._filelist) if i: del self._filelist[i] del self._energy[i] else: if self._resultfile: self._resultfile.write('WARNING (parsedirac.py): File not a member of previously read files. Fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_files(file_list):\n###############################################################################\n for fpath in file_list:\n if os.path.exists(fpath):\n os.remove(fpath)\n # End if\n # End for", "def remove_old_files(filelist):\n\n for filename in filelist:\n ...
[ "0.7808194", "0.7382932", "0.73729557", "0.73168314", "0.7110893", "0.6884143", "0.6740297", "0.6702584", "0.63560486", "0.6355671", "0.623873", "0.6167311", "0.6138595", "0.6092599", "0.60532045", "0.603099", "0.6018269", "0.6012796", "0.6004903", "0.6002885", "0.5966825", ...
0.69262415
5
Delete all files between max and min from the _filelist.
def delfiles(self, max=0, min=0): # Removes the files from min up to max for i in range(max-1, min-1, -1): if i<len(self._filelist): del self._filelist[i] if i<len(self._energy): del self._energy[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_files(file_list):\n###############################################################################\n for fpath in file_list:\n if os.path.exists(fpath):\n os.remove(fpath)\n # End if\n # End for", "def DeleteFiles(self, min_size=0):\n\n ndeleted = 0\n for f...
[ "0.6221175", "0.6209422", "0.60798913", "0.6001565", "0.59255946", "0.5850927", "0.5819805", "0.58054554", "0.579091", "0.5698838", "0.5651804", "0.5651673", "0.56408966", "0.5640656", "0.56275594", "0.5618696", "0.5604296", "0.55829805", "0.5527234", "0.547274", "0.546802", ...
0.78210205
0
Returns the current _filelist. Accessed through .files
def get_files(self): return self._filelist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listFiles(self):\n pass", "def get_file_list(self):\n try:\n for filename in os.listdir(SHARED_DIR):\n self.file_list.append(filename)\n except Exception as e:\n print \"Error: retriving file list, %s\" % e", "def __init__(self):\n self.filel...
[ "0.7358803", "0.734229", "0.71822", "0.70319045", "0.702763", "0.70001733", "0.69906056", "0.69851583", "0.68934256", "0.68574464", "0.6807691", "0.6791865", "0.67466885", "0.6745575", "0.66323113", "0.6553671", "0.65483415", "0.6502841", "0.64942795", "0.6484744", "0.6462570...
0.8797185
0
Returns the current energies corresponding to the files in _filelist. Accessed through .energy
def get_energy(self): return self._energy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readenergy(self, filelist):\r\n \r\n energy=[]\r\n tmpenergy=[]\r\n for filename in filelist:\r\n if not(os.path.exists(filename)):\r\n if self._resultfile: self._resultfile.write('Output file: \"'+filename+'\" does not exist. Restart your calculation. \\n')\r\n else: print 'Outp...
[ "0.726632", "0.7143525", "0.68418056", "0.6825345", "0.66456926", "0.6384233", "0.63572055", "0.6276068", "0.623991", "0.6229059", "0.6221391", "0.61953986", "0.61786455", "0.6164679", "0.6097344", "0.609421", "0.6084577", "0.603048", "0.6016905", "0.5996694", "0.59754694", ...
0.6180556
12
Change the resultfile. Accessed through .resultfile
def set_resultfile(self, file): self._resultfile=file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_result(self, file_name):\n f = file(file_name, \"w\")\n f.write(self.m_result)\n f.close()", "def set_result_file(self, file_name):\n if file_name is not None:\n self.opts[\"result_file_name\"] = file_name\n else:\n self.opts[\"result_file_name\"...
[ "0.72395635", "0.70098424", "0.6764218", "0.66742396", "0.6625944", "0.6565123", "0.6525431", "0.64383346", "0.63236547", "0.6314388", "0.62754613", "0.62360525", "0.61103517", "0.61034817", "0.59743166", "0.5973691", "0.59708005", "0.5964662", "0.592152", "0.58801514", "0.58...
0.7958902
0
Return the current resultfile. Accessed through .resultfile
def get_resultfile(self): return self._resultfile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetResultFile(self):\n\n file_path = self.configfile.map['ResultFilePath']\n\n # Check if several entrie\n if file_path is not None:\n if len(file_path) > 1:\n warning(\n 'Many path for the result file are setted ({}), I will take the first one'...
[ "0.7389495", "0.68382645", "0.6615491", "0.64539397", "0.6348082", "0.63120145", "0.6282585", "0.62605387", "0.6229086", "0.6192739", "0.61694807", "0.6115375", "0.60991883", "0.6087382", "0.6084712", "0.60831773", "0.6068043", "0.6031894", "0.60297304", "0.6025069", "0.60184...
0.88122743
0
This method returns a list with the names of all the files contained in the folder received by parameter.
def get_files(folder="", extension=""): return sorted(glob.glob(folder + "*" + extension), reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_files_in_given_folder(path_to_folder):\r\n file_names_list = []\r\n for file_name in glob.glob(path_to_folder+\"/*\"):\r\n file_names_list.append(file_name)\r\n assert file_names_list != [], \"failed to populate folder\"+path_to_folder\r\n return file_names_list", "def get_files(folde...
[ "0.81181633", "0.7643659", "0.7529215", "0.74416965", "0.7414604", "0.74022275", "0.7395162", "0.73642397", "0.7356729", "0.73449916", "0.73329365", "0.73275936", "0.7327072", "0.726896", "0.7265691", "0.72462016", "0.72434044", "0.7230354", "0.7224685", "0.72200924", "0.7214...
0.69553655
48
load class name from a file. id is the index, i.e. the line number.
def read_class_names(class_file_name): names = {} with open(class_file_name, 'r') as f: for idx, name in enumerate(f): names[idx] = name.strip('\n') return names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, file_id):\n pass", "def load(cls, file_id):\n if not isinstance(file_id, file):\n handle = open(\n \"{:s}{:s}-{:d}.pckl\".format(\n DUMP_PATH,\n cls.__name__,\n file_id\n ),\n ...
[ "0.6877691", "0.63064736", "0.62377626", "0.5860321", "0.58437896", "0.5836224", "0.57929134", "0.5779981", "0.57380307", "0.56598276", "0.56458116", "0.5641869", "0.55397636", "0.55302477", "0.55169445", "0.54928064", "0.54847777", "0.54553765", "0.5414059", "0.5370731", "0....
0.0
-1
Load the anchors from a file.
def get_anchors(anchors_path): with open(anchors_path) as f: anchors = f.readline() anchors = np.array(anchors.split(','), dtype=np.float32) return anchors.reshape(3, 3, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_anchors_blocks(path):\t\t\n\t#TODO : automatization\n\tleft = Building_Block(abbrev=\"l\", num_atoms=2,origin=0, para_pos=0, para_angle=0, meta_pos=0 , meta_angle = 0., ortho_pos=0, ortho_angle=-2.*np.pi/3, fixed_left = 0,complexity=1, path=path+\"/anchor_small_left.xyz\")\n\tright = Building_Block(abbrev...
[ "0.6599627", "0.6420055", "0.60779434", "0.6073252", "0.6073252", "0.5879717", "0.58786225", "0.5859779", "0.5848837", "0.58253086", "0.58215725", "0.5762048", "0.5753838", "0.565818", "0.56508386", "0.5645677", "0.56223", "0.56137466", "0.56039727", "0.55983424", "0.5587017"...
0.61724406
2
Ensures that the provided object path conforms to the DBus standard. Throws a L{error.MarshallingError} if nonconformant
def validateObjectPath(p): if not p.startswith('/'): raise MarshallingError('Object paths must begin with a "/"') if len(p) > 1 and p[-1] == '/': raise MarshallingError('Object paths may not end with "/"') if '//' in p: raise MarshallingError('"//" is not allowed in object paths"') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pathlib_obj(self):\n \"\"\"\n We do this because pygame functions internally use pg_EncodeString\n to decode the filenames passed to them. So if we test that here, we\n can safely assume that all those functions do not have any issues\n with pathlib objects\n \"\"...
[ "0.54732823", "0.5256893", "0.5144109", "0.4995298", "0.49384198", "0.4835352", "0.478868", "0.47768828", "0.4728277", "0.47244215", "0.471736", "0.47147894", "0.46644646", "0.4659947", "0.465669", "0.4590839", "0.45773673", "0.45689", "0.45658988", "0.45398143", "0.4528572",...
0.59882015
0
Verifies that the supplied name is a valid DBus Interface name. Throws an L{error.MarshallingError} if the format is invalid
def validateInterfaceName(n): try: if '.' not in n: raise Exception('At least two components required') if '..' in n: raise Exception('".." not allowed in interface names') if len(n) > 255: raise Exception('Name exceeds maximum length of 255') if n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateBusName(n):\n try:\n if '.' not in n:\n raise Exception('At least two components required')\n if '..' in n:\n raise Exception('\"..\" not allowed in bus names')\n if len(n) > 255:\n raise Exception('Name exceeds maximum length of 255')\n i...
[ "0.6249034", "0.6138677", "0.5944746", "0.5854724", "0.5783322", "0.5767728", "0.5706411", "0.5702007", "0.5684922", "0.5588679", "0.55774987", "0.5547274", "0.5466605", "0.5456653", "0.544468", "0.54201376", "0.5366448", "0.5361167", "0.5352273", "0.534587", "0.5299094", "...
0.7287379
0
Verifies that the supplied name is a valid DBus Bus name. Throws an L{error.MarshallingError} if the format is invalid
def validateBusName(n): try: if '.' not in n: raise Exception('At least two components required') if '..' in n: raise Exception('".." not allowed in bus names') if len(n) > 255: raise Exception('Name exceeds maximum length of 255') if n[0] == '.': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _verify_name(name):\n if isinstance(name, str):\n name = name.encode(\"utf-8\")\n\n if not isinstance(name, bytes):\n raise TypeError(\n \"Name {!r} is not a string or byte string\".format(name)\n )\n\n if b\".\" in name:\n raise V...
[ "0.6328239", "0.60769504", "0.6054338", "0.6011703", "0.5934793", "0.5782472", "0.57623523", "0.574703", "0.57247126", "0.5692703", "0.5543336", "0.55390483", "0.5524516", "0.5497659", "0.54381436", "0.543146", "0.539284", "0.5378268", "0.53725094", "0.53675413", "0.5350507",...
0.7423474
0
Verifies that the supplied name is a valid DBus member name. Throws an L{error.MarshallingError} if the format is invalid
def validateMemberName(n): try: if len(n) < 1: raise Exception('Name must be at least one byte in length') if len(n) > 255: raise Exception('Name exceeds maximum length of 255') if n[0].isdigit(): raise Exception('Names may not begin with a digit') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValidDataTypeName(name: unicode) -> bool:\n ...", "def validateBusName(n):\n try:\n if '.' not in n:\n raise Exception('At least two components required')\n if '..' in n:\n raise Exception('\"..\" not allowed in bus names')\n if len(n) > 255:\n ...
[ "0.6429723", "0.62362033", "0.6177577", "0.6054941", "0.6011524", "0.58804786", "0.58333224", "0.58264023", "0.57906777", "0.57682234", "0.5758976", "0.57252425", "0.57006663", "0.5695194", "0.5691282", "0.56714183", "0.56466067", "0.56451", "0.564391", "0.560903", "0.5603861...
0.77475756
0
Returns the DBus signature type for the argument. If the argument is an instance of one of the type wrapper classes, the exact type signature corresponding to the wrapper class will be used. If the object has a variable named 'dbusSignature', the value of that variable will be used. Otherwise, a generic type will be us...
def sigFromPy(pobj): sig = getattr(pobj, 'dbusSignature', None) if sig is not None: return sig elif isinstance(pobj, bool): return 'b' elif isinstance(pobj, int): return 'i' elif isinstance(pobj, int): return 'x' elif isinstance(pobj, float): return 'd' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type ( self, object ):\n return self.type", "def get_type ( self, object ):\n return self.type", "def type_signature(self) -> computation_types.Type:\n raise NotImplementedError", "def serialize_to_signature(value):\n serialization_cls = _get_serializer_for_value(value, serializin...
[ "0.5474694", "0.5474694", "0.5409444", "0.5328905", "0.52887535", "0.521691", "0.51724213", "0.5155565", "0.51536465", "0.51384646", "0.50888366", "0.50765437", "0.5045696", "0.49954993", "0.49776474", "0.49498105", "0.49469578", "0.49323153", "0.49192646", "0.4914251", "0.49...
0.629868
0
Generator function used to iterate over each complete,
def genCompleteTypes(compoundSig): i = 0 end = len(compoundSig) def find_end(idx, b, e): depth = 1 while idx < end: subc = compoundSig[idx] if subc == b: depth += 1 elif subc == e: depth -= 1 if depth == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completion_processor(self):\n while True:\n _ = (yield)\n self.solve_completed = True", "def iterator(self):\n yield", "def __iter__(self):\n for x in self.seq: yield x", "def __iter__(self):\n yield from self.gen", "def __iter__():", "def __iter__():...
[ "0.6746244", "0.66019744", "0.6573459", "0.6568486", "0.6484661", "0.6484661", "0.6484661", "0.6484661", "0.6419667", "0.6364976", "0.63338614", "0.63023585", "0.62807107", "0.6278938", "0.62711823", "0.6243261", "0.6229426", "0.6216627", "0.61497426", "0.61286175", "0.609107...
0.0
-1
Encodes the Python objects in variableList into the DBus wireformat matching the supplied compoundSignature. This function retuns a list of binary strings is rather than a single string to simplify the recursive marshalling algorithm. A single string may be easily obtained from the
def marshal(compoundSignature, variableList, startByte=0, lendian=True, oobFDs=None): chunks = [] bstart = startByte if hasattr(variableList, 'dbusOrder'): order = variableList.dbusOrder variableList = [getattr(variableList, attr_name) for attr_name in or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_list(list_raw):\n list_serialized = []\n for value in list_raw:\n if isinstance(value, list):\n list_serialized.append(serialize_list(value))\n elif isinstance(value, dict):\n list_serialized.append(serialize_dict(value))\n else:\n list_seri...
[ "0.5918284", "0.5918284", "0.5766241", "0.550993", "0.54382807", "0.5433743", "0.53844094", "0.5381437", "0.53691435", "0.5350298", "0.52913684", "0.52551824", "0.5226429", "0.5210715", "0.52086335", "0.51800555", "0.51722974", "0.51387507", "0.512357", "0.51076096", "0.50836...
0.7213802
0
Unmarshals DBus encoded data.
def unmarshal(compoundSignature, data, offset=0, lendian=True, oobFDs=None): values = [] start_offset = offset for ct in genCompleteTypes(compoundSignature): tcode = ct[0] offset += len(pad[tcode](offset)) nbytes, value = unmarshallers[tcode](ct, data, offset, lendian, oobFDs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(data): #@NoSelf", "def decode(data):\n raise NotImplementedError", "def decode_raw(data):\n return RawWire().decode(data)", "def deserialize(self, data):", "def unmarshal(self):\n ...", "def unpack_from(self, data, is_hexen): \n \n raise Exception('Undefined unp...
[ "0.6241722", "0.61459947", "0.6119787", "0.5970028", "0.59508336", "0.5886634", "0.5710169", "0.57082635", "0.5660874", "0.56222504", "0.56127256", "0.5612168", "0.5533577", "0.5531806", "0.5487332", "0.5375555", "0.5372124", "0.53650254", "0.53354865", "0.52957386", "0.52777...
0.51850396
30
Yield successive nsized chunks from l.
def __chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, l, n):\r\n for i in range(0, len(l), n):\r\n yield l[i:i+n]", "def chunks(...
[ "0.80379355", "0.79237956", "0.78840584", "0.7876208", "0.78144675", "0.77643776", "0.77544284", "0.7743112", "0.7730491", "0.772761", "0.7723601", "0.7701434", "0.768797", "0.768797", "0.7662925", "0.765581", "0.765473", "0.765473", "0.76447", "0.76447", "0.76447", "0.7635...
0.7922027
2
The method returns dictionary contains degree each vertex in graph.
def vertice_degree(self): if(self.is_empty()): raise ValueError("Graph is empty.") else: if(self.__directed): degrees = {} l = list(self.__graph_dict.values()) flatter = [] for x in l: fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_degrees_dictionary(edges):\n dd = {} # degrees dictionary for vertexes\n\n def append_vertex(vertex, edge_index):\n if vertex not in dd.keys():\n dd[vertex] = [1, edge_index]\n else:\n dd[vertex][0] += 1\n dd[vertex].append(edge_index)\n\n e = edges\...
[ "0.7764501", "0.75081825", "0.74249536", "0.73860043", "0.7194386", "0.7127516", "0.70553905", "0.70345974", "0.70215124", "0.6976104", "0.6976104", "0.6976104", "0.69607127", "0.6951132", "0.69395113", "0.69182175", "0.6895664", "0.68444467", "0.6802162", "0.6783748", "0.673...
0.81927633
0
Visualization of the result.
def display_graph(self, color_of_vertex): import matplotlib.pyplot import networkx G = networkx.Graph() color_set = ['#FF0000', '#32CD32', '#FFD700', '#6B8E23', '#40E0D0', '#BA55D3', '#C0C0C0', '#A0522D', '#6A5ACD'] color_map = [] for k in self.__graph_dict.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n pass", "def visualize(self):\n\n self.check_model()\n show(prepare(self.model, self.vectorized_data, self.vectorizer, mds='tsne'))", "def show_plot(self):\n if self.result is None:\n print('目前無結果。')\n else:\n self.plot_output_result.set...
[ "0.7273451", "0.7236823", "0.7192504", "0.7152819", "0.71324956", "0.7096867", "0.7055198", "0.70482737", "0.694442", "0.6910525", "0.68705297", "0.66824", "0.66695374", "0.6665365", "0.66381747", "0.6632695", "0.662455", "0.66179216", "0.6610647", "0.6606984", "0.6605635", ...
0.0
-1
This function returns dictionary of vertices and their color, the function uses SL algorithm and greedily coloring. The Result visualization uses the networkx and matplotlib libraries.
def vertex_coloring(self, display = False): stack = self.SL_algorithm() color_of_vertex = self.greedily_coloring(stack) if(display): self.display_graph(color_of_vertex) return color_of_vertex else: return color_of_vertex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_colors(vertex):\n\n def calculate_colors(v):\n \"\"\"\n Calculate the color for name of the given vertex v.\n :param v: Name of vertex to be hashed.\n :return: Tuple of (hue, saturation, lightness) values.\n \"\"\"\n\n # Define constant color values\n li...
[ "0.62638813", "0.6236624", "0.6217388", "0.61086094", "0.60408974", "0.6028744", "0.601162", "0.58705133", "0.5859937", "0.58007324", "0.57782114", "0.57776314", "0.5769344", "0.5746869", "0.57331896", "0.573234", "0.57293206", "0.57200795", "0.5713795", "0.5711248", "0.56534...
0.6867616
0
Removes tags from post title and adds them to a set. Any tags such as [FRESH], (feat. JBobby), etc. will be removed from the title and placed in a set (without surrounding punctuation). Titles are also lowercased and any dashes/extra white space are removed.
def filter_tags(title): tags = set() filtered_title = [] # separate tags from title # assumes there are no erroneous parentheses/brackets # ex. [FRESH] Lil Pump - Nice 2 Yeet ya [prod. by D4NNY] # there may be issues if song name contains parentheses tag = [] last_pun = None add_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_title(self):\n # split into tokens by white space\n tokens = self.title.split(\" \")\n # remove punctuation from each token\n table = str.maketrans('', '', punctuation)\n tokens = [w.translate(table) for w in tokens] # type: List[Any]\n # remove remaining tokens...
[ "0.6937355", "0.66450447", "0.64621973", "0.6377635", "0.6275683", "0.6235725", "0.6164819", "0.61293006", "0.60720676", "0.6012441", "0.5995282", "0.59429306", "0.59248", "0.5892935", "0.5872065", "0.58714795", "0.58687013", "0.58097196", "0.5798257", "0.5796392", "0.5791276...
0.7703674
0
Get the first Spotify track url from a given search. Extended description of function.
def extract_track_url(search): if 'tracks' in search: tracks = search['tracks'] if 'items' in tracks: items = tracks['items'] # take the first url we can find for item in items: if 'external_urls' in item: external_urls = item[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_song(title, artist):\n\ttitle = quote(title, safe='')\n\tartist = quote(artist, safe='')\n\tbase_url = SPOTIFY_API_HOST + 'search/' + '?q=track:{0}+artist:{1}&type=track&limit=1'\n\turl = base_url.format(title, artist)\n\tresults = requests.get(url).json()\n\n\ttry:\n\t\tif results['tracks']['total'] ==...
[ "0.6630882", "0.61365277", "0.6100608", "0.60191", "0.59961325", "0.5867838", "0.58076715", "0.5792723", "0.5750998", "0.568006", "0.56769896", "0.567169", "0.5664377", "0.560161", "0.55912936", "0.5582274", "0.5577718", "0.5554772", "0.55373526", "0.553512", "0.5527581", "...
0.81856936
0
Main routine to execute to download, extract, reconstruct and plot COVID data
def Main_script(X_axis_inc = 1, Y_axis_inc = 7, Z_axis_inc = 12, Date_start = None, Date_end = None): Timer_start = time.perf_counter() print('Collecting data from Our World in Data') COVID_data, Date_start_raw_data, Date_end_raw_data = Extract_data() # Download and extract raw COVID data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self, verbose):\n # Download datasets\n if verbose:\n print(\"Retrieving datasets from Our World In Data https://github.com/owid/covid-19-data/\")\n # Vaccinations\n v_rec_cols = [\n \"date\", \"location\", \"iso_code\", \"total_vaccinations\", \"peopl...
[ "0.676124", "0.66143477", "0.6422769", "0.6366506", "0.63597494", "0.63453686", "0.63231117", "0.6260672", "0.6257344", "0.62265724", "0.6193278", "0.6168252", "0.6147743", "0.6106444", "0.6098195", "0.6088481", "0.6082504", "0.6042868", "0.60369", "0.60305005", "0.59734946",...
0.64706695
2
Extracts and formats data in dictionnaries from Our World in Data CSV files
def Extract_data(): chdir(Datafiles_directory) # Empty the datafiles directory File_list = listdir() for File in File_list: remove(File) COVID_data_path = Datafiles_directory + '\\OWID COVID data %s.csv' % (date.today().isoformat()) # String with path of COVID data (wher...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_trick_ascii(csv_file):\n data_file = csv.DictReader(open(csv_file))\n single_run_data_dict = {'altitude' : [0.0],\n 'latitude' : [0.0],\n 'longitude' : [0.0]}\n # Your code here\n # ...\n # return the dict\n return single_run_data_di...
[ "0.65972245", "0.65949285", "0.657538", "0.6556348", "0.65216136", "0.639683", "0.6318729", "0.62956554", "0.62589234", "0.62322074", "0.61776733", "0.61724085", "0.615015", "0.6124557", "0.6119837", "0.61124694", "0.6111998", "0.61089385", "0.6104878", "0.61042136", "0.61000...
0.6641062
0
Reconstructs missing chunks of data by linear interpolation
def Reconstruct_COVID_data(COVID_data): COVID_data_reconstructed = {} COVID_data_reconstructed['_Country'] = COVID_data['_Country'] Countries_list = list(COVID_data.keys())[1:] for Country in Countries_list: # For each country... COVID_data_single_country = list(COVID_data[Count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_missing_data_points(data):\n return data.interpolate()", "def pad(input_data):\n # source : https://stackoverflow.com/questions/6518811/interpolate-nan-values-in-a-numpy-array \n data = input_data.copy()\n bad_indexes = np.isnan(data)\n good_indexes = np.l...
[ "0.70413935", "0.687088", "0.66340077", "0.6370503", "0.6215303", "0.61976016", "0.61492", "0.614894", "0.6125289", "0.6101999", "0.60120773", "0.5932861", "0.58526456", "0.5823751", "0.5819537", "0.57982516", "0.57957566", "0.57912254", "0.5780939", "0.5774986", "0.5719053",...
0.5555438
34
Exports the raw and reconstructed data in seperate files
def Export_in_files(COVID_data, COVID_data_reconstructed): F_data_file = open(Datafiles_directory + '\\OWID COVID data %s formatted.csv' % (date.today().isoformat()), 'w') FR_data_file = open(Datafiles_directory + '\\OWID COVID data %s formatted reconstructed.csv' % (date.today().isoformat()), 'w') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_file(self):\n if self.args.keyfilter:\n self.filter_keys()\n if self.args.datafilter:\n self.filter_values()\n json.dump(self.outputdata, self.outfile, indent=self.args.indent)\n self.outfile.write('\\n')", "def write_data_files(self):\n # build our...
[ "0.6854881", "0.65517116", "0.64988494", "0.6373401", "0.6348319", "0.633782", "0.62861234", "0.6257868", "0.6209314", "0.61787605", "0.6174007", "0.6167421", "0.61625797", "0.6160978", "0.6130941", "0.6127147", "0.6127147", "0.6126146", "0.60960144", "0.6093455", "0.6092773"...
0.66929203
1
Extract data from recontructed COVID data in order to only keep data that will be plotted
def Extract_data_for_plotting(COVID_data, X_Axis_inc, Y_Axis_inc, Z_Axis_inc, Date_start, Date_end, Keep_no_PR = True): Date_start_obj = datetime.strptime(Date_start, '%Y-%m-%d') # Create a list of all the dates to extract Date_end_obj = datetime.strptime(Date_end, '%Y-%m-%d') Date_difference = (Date_end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_data():\n raw_data = pd.read_csv(\"../../../resource/DataVisualization/vaccinations.csv\")\n raw_data = raw_data[[\"location\", \"date\", \"people_fully_vaccinated_per_hundred\"]]\n raw_data.date = pd.to_datetime(raw_data.date, format=\"%Y-%m-%d\")\n min_date = raw_data.date.min()\n raw_...
[ "0.57332987", "0.55896175", "0.5566017", "0.5560256", "0.5542593", "0.5458466", "0.5445852", "0.5408674", "0.5361703", "0.53353846", "0.5209567", "0.5194203", "0.5185767", "0.5149763", "0.5145616", "0.5144321", "0.51424706", "0.5139271", "0.512649", "0.5118692", "0.5095719", ...
0.58592325
0
Tells which countries to annotate and which not to. Since the lists in parameters are sorted by descending order of positivity rate, the countries with higher positivity rates will be examined first and thus annotatd with more priority
def Annotations_frame(Points_to_display, Countries_displayed, Frame_limits): X_list_frame, Y_list_frame = zip(*Points_to_display) # Transform tuples of (X, Y) into 2 distinct lists of X and Y coordinates Frame_limits_log = list(map(np.log10, Frame_limits)) X_min_log, X_max_log, Y_min_log, Y_max_log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_hint(self, value):\n return None", "def SuggestGeoTargetConstants(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", "def annotate(self, op_list=None):\n...
[ "0.5223514", "0.47812617", "0.47808456", "0.47056314", "0.46838796", "0.46759918", "0.4672632", "0.466754", "0.4616049", "0.46070912", "0.46006083", "0.45805907", "0.4577782", "0.45505515", "0.45467195", "0.45305893", "0.45272925", "0.45201805", "0.45035627", "0.44953334", "0...
0.48259857
1
Plots data entered in parameters
def Scatter_graph(COVID_data_scatter, Display_annotations_mask = False): COVID_data_scatter_names = COVID_data_scatter.pop('0Date')['Country'] # Extract names of columns plotted X_axis, Y_axis, Z_axis = [], [], [] # Separate the axes in COVID_data_scatter in order to find the minimum and maximum along e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_data(self):", "def plot(self, *args, **kwargs):\n pass", "def display_plot(self, parameter):\n values = list(self.dataframe[parameter])\n #Begining and ending date of the dataset\n beg = self.beg\n end = self.end\n #Settings of the plot\n if parameter =...
[ "0.7607247", "0.74195784", "0.7169947", "0.71379995", "0.70588946", "0.68634605", "0.68371975", "0.678551", "0.6773931", "0.67145234", "0.66850895", "0.6678228", "0.6637928", "0.6627586", "0.66084194", "0.65903", "0.6587534", "0.65140045", "0.6475009", "0.64048374", "0.640192...
0.0
-1
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8221727", "0.8220911", "0.8220911", "0.8220911", "0.8220911", "0.81940746", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", ...
0.7126684
66
Selects the given stream ID for output.
def select(self, stream): if stream not in self._selectedStreams: self._selectedStreams.append(stream)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self, stream):\n\n # TODO: Ensure section 10.2.4, so that while stream 1 is selected,\n # the only text printed to it is that of the player's commands and\n # keypresses (as read by read_char). Not sure where this logic\n # will ultimately go, however.\n\n self._selectedStream = stream", ...
[ "0.6556641", "0.57983565", "0.57682925", "0.5695478", "0.5601869", "0.5586684", "0.5173582", "0.5119291", "0.50920683", "0.5044393", "0.50269234", "0.50198567", "0.5000961", "0.4981254", "0.4974197", "0.49709654", "0.49602035", "0.49532992", "0.49346712", "0.49329248", "0.490...
0.625652
1
Unselects the given stream ID for output.
def unselect(self, stream): if stream in self._selectedStreams: self._selectedStreams.remove(stream)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsetId(self):\n return _libsbml.Output_unsetId(self)", "def unsetId(self):\n return _libsbml.Port_unsetId(self)", "def unsetId(self):\n return _libsbml.Input_unsetId(self)", "def unsubscribe(id, userId):\n db = core.connect()\n theUser = db[userId]\n if id in theUser[\"stre...
[ "0.617944", "0.5672837", "0.55219626", "0.54870343", "0.5482912", "0.5464178", "0.53850687", "0.5304198", "0.52740335", "0.5231818", "0.52296126", "0.5224535", "0.51276076", "0.51187307", "0.50885695", "0.5000303", "0.5000303", "0.49989292", "0.49881366", "0.49865478", "0.497...
0.71225864
0
Retrieves the given stream ID.
def get(self, stream): return self._streams[stream]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream_id(self) -> str:\n return self.id", "def get_stream_id(self) -> str:", "def get(self, id_stream):\n\n session = current_app.session\n\n stream = session.query(StreamDao).filter(StreamDao.id == id_stream).first()\n\n if stream is None:\n return None, 204\n\n...
[ "0.7862512", "0.7689381", "0.72383416", "0.6438061", "0.632346", "0.6052766", "0.5950043", "0.58918774", "0.58647907", "0.5814538", "0.56721425", "0.56676686", "0.56534684", "0.56308675", "0.56229955", "0.5555997", "0.5555997", "0.5523179", "0.54925346", "0.5450699", "0.54480...
0.69341683
3
Writes the given unicode string to all currently selected output streams.
def write(self, string): # TODO: Implement section 7.1.2.2 of the Z-Machine Standards # Document, so that while stream 3 is selected, no text is # sent to any other output streams which are selected. (However, # they remain selected.). # TODO: Implement section 7.1.2.2.1, so that newlines are writ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, ucs, encoding='ascii'):\n self.lock.acquire()\n self.oqueue.send(('output', (ucs, encoding)))\n self.lock.release()", "def write(self, string):\n\n if not self.enabled:\n return\n\n try:\n print(string, end=\"\", file=self.fp)\n exce...
[ "0.6019549", "0.58811754", "0.5840764", "0.58179307", "0.56729674", "0.55562913", "0.54668236", "0.546056", "0.54414606", "0.5426918", "0.5381758", "0.53490806", "0.53453517", "0.5334099", "0.52888536", "0.5281868", "0.52776235", "0.5273485", "0.5263722", "0.52095383", "0.520...
0.67882425
0
Selects the given stream ID as the currently active input stream.
def select(self, stream): # TODO: Ensure section 10.2.4, so that while stream 1 is selected, # the only text printed to it is that of the player's commands and # keypresses (as read by read_char). Not sure where this logic # will ultimately go, however. self._selectedStream = stream
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self, stream):\n\n if stream not in self._selectedStreams:\n self._selectedStreams.append(stream)", "def getSelected(self):\n\n return self._streams[self._selectedStream]", "def select_stream(self, index=None, name=None, raw_name=None, update=True):\r\n stream = None\r\n try...
[ "0.7090956", "0.63077545", "0.5944891", "0.56851655", "0.5507112", "0.5483096", "0.53433263", "0.53100574", "0.52421796", "0.52342975", "0.5193063", "0.517651", "0.5166759", "0.5165178", "0.51437676", "0.5016381", "0.50112075", "0.4981479", "0.49758804", "0.49596596", "0.4958...
0.7003565
1
Returns the input stream object for the currently active input stream.
def getSelected(self): return self._streams[self._selectedStream]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream(self):\n self.lock.acquire()\n stream=self.stream\n self.lock.release()\n return stream", "def set_input(self, in_stream):\n self._in = self._wrap_stream(in_stream, 'in')\n return self._in", "def stream(self) -> interface.Stream:\n return cast(int...
[ "0.6819047", "0.67934316", "0.6680337", "0.6518098", "0.6492424", "0.6492424", "0.6459986", "0.64151335", "0.63618785", "0.6321766", "0.6298022", "0.62467617", "0.60943204", "0.60503983", "0.6026703", "0.5984099", "0.59127194", "0.5908785", "0.5908785", "0.5908785", "0.590878...
0.5414463
50
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lat1, lon1, lat2, lon2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) r ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.8146062", "0.78638023", "0.7632202", "0.7604661", "0.7595527", "0.75950956", "0.7592873", "0.757031", "0.7564319", "0.75560796", "0.75300086", "0.7516366", "0.7493803", "0.746558", "0.7450864", "0.7432722", "0.7391925", "0.7355981", "0.7347892", "0.7330029", "0.73271745", ...
0.0
-1
Converts all occurrences of Complexes (resp. sub trees named agent) with its vector representation. These are directly replaced within the tree expression. Moreover, in the process parameters are replaces with their values (if given).
def vectorize(self, ordering: SortedList, definitions: dict) -> list: vec = Vectorizer(ordering, definitions) self.expression = vec.transform(self.expression) return vec.visited
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def express(expr, system, system2=None, variables=False):\n\n if expr in (0, Vector.zero):\n return expr\n\n if not isinstance(system, CoordSys3D):\n raise TypeError(\"system should be a CoordSys3D \\\n instance\")\n\n if isinstance(expr, Vector):\n if system2 i...
[ "0.5212036", "0.52045906", "0.51515454", "0.5148588", "0.51139396", "0.50830597", "0.50787544", "0.5040814", "0.50208473", "0.50208473", "0.50208473", "0.50208473", "0.50208473", "0.50208473", "0.50208473", "0.4996494", "0.4929204", "0.48569438", "0.4855723", "0.48394084", "0...
0.52657586
0
Evaluates all occurrences of States to a float using Evaluater. It is done as intersection of particular state with given state and sum of resulting elements. If the result is nan, None is returned instead.
def evaluate(self, state) -> float: evaluater = Evaluater(state) result = evaluater.transform(self.expression) try: value = sympy.sympify("".join(tree_to_string(result)), locals=evaluater.locals) if value == sympy.nan: return None return value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state):\n\n fitness = np.sum(state)\n self.num_evals += 1\n #print(self.num_evals)\n return fitness", "def evaluate(self, state):\n\n if self.is_coords and len(state) != len(self.coords):\n raise Exception(\"\"\"state must have the same length as c...
[ "0.63039607", "0.6107048", "0.6043089", "0.59678954", "0.59345084", "0.59076506", "0.5898974", "0.5843427", "0.5723326", "0.5705815", "0.5685411", "0.5680647", "0.5665845", "0.56275225", "0.55861384", "0.5577219", "0.5554043", "0.554357", "0.55327356", "0.55058116", "0.550581...
0.670078
0
Translates rate from vector representation to symbolic one as a sum of particular components. e.g. [1, 0, 1] > (x_0 + x_2)
def to_symbolic(self): transformer = SymbolicAgents() self.expression = transformer.transform(self.expression)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExpU(x):\n\treturn sum(x * lambdas)", "def relative_rate(self):\n return _add_vector_swig.add_vector_2_cpp_sptr_relative_rate(self)", "def _eval(self, v):\n if v.dtype == np.complex64 or v.dtype == np.complex128:\n return ne.evaluate('sum(real(v * conj(v)))')\n else:\n ...
[ "0.58277977", "0.5783349", "0.57700616", "0.57329583", "0.56626755", "0.5629675", "0.5581536", "0.55512124", "0.54802674", "0.5467065", "0.5376773", "0.5362954", "0.5352122", "0.53469217", "0.5333205", "0.53328913", "0.5313943", "0.5284388", "0.52732974", "0.52684164", "0.526...
0.0
-1