query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Load strategy class from module file. | def load_strategy_class_from_module(self, module_name: str):
try:
module = importlib.import_module(module_name)
for name in dir(module):
value = getattr(module, name)
if (isinstance(value, type) and issubclass(value, CtaTemplate) and value is not CtaTempl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_strategy_class(self):\n path2 = Path(__file__).parent.parent.joinpath(\"strategies\")\n self.load_strategy_class_from_folder(path2, \"vnpy.app.cta_strategy.strategies\")",
"def load_strategy_class_from_folder(self, path: Path, module_name: str = \"\"):\n for dirpath, dirnames, filen... | [
"0.81998193",
"0.71635723",
"0.63292944",
"0.6267503",
"0.62557054",
"0.6214737",
"0.61812496",
"0.6143429",
"0.6064527",
"0.60596937",
"0.6052271",
"0.6039287",
"0.5998328",
"0.5950787",
"0.5950787",
"0.5950787",
"0.5950599",
"0.59185237",
"0.5903587",
"0.5886092",
"0.587768... | 0.7205787 | 1 |
Retrieves authentication string from string or file. | def get_auth_string(auth_or_path):
if ":" in auth_or_path:
return auth_or_path
try:
with open(auth_or_path) as stream:
content = stream.read()
content = content.strip()
if ":" in content:
return content
except FileNotFoundError:
pas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_auth_string(self):",
"def _auth():\n with open('api-credentials.txt', 'r') as f:\n lines = f.read().splitlines()\n credentials = lines[0] + ':' + lines[1]\n return 'Basic ' + base64.b64encode(credentials.encode()).decode()",
"def get_basic_auth(user=\"\", key=\"\"):\n s = user + \":... | [
"0.7317391",
"0.6477555",
"0.64539844",
"0.6413232",
"0.6413232",
"0.633992",
"0.63181716",
"0.6291578",
"0.62228745",
"0.61477184",
"0.6102186",
"0.60440284",
"0.6034179",
"0.6001892",
"0.60002124",
"0.5978378",
"0.5917228",
"0.58746547",
"0.5870686",
"0.5843792",
"0.5775289... | 0.7740775 | 1 |
goes to the first page | async def first_page(self):
await self.show_page(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def go_to_first_page(self, payload):\n await self.show_page(0)",
"def get_first_page(self):\n return 1",
"def first_page(self):\n if self._start == 0:\n raise ValueError('Already at the first page.')\n self._start = 0",
"def test_first_page_passes(self):\n\n ... | [
"0.8262319",
"0.77821577",
"0.7702882",
"0.72091836",
"0.7135327",
"0.69205546",
"0.6817158",
"0.65184915",
"0.64742994",
"0.64742994",
"0.6417681",
"0.63743246",
"0.62692386",
"0.62685406",
"0.62576616",
"0.6254293",
"0.6248977",
"0.6227804",
"0.62091523",
"0.6182544",
"0.61... | 0.8312497 | 0 |
goes to the next page | async def next_page(self):
await self.checked_show_page(self.current_page + 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_next(self):\n if self._pos >= self._npages - 1:\n # exit if we are already at the end\n self.page_quit()\n else:\n self._pos += 1\n self._display()",
"def page_next(self):\n if self._npos >= self._npages - 1:\n # exit if we are ... | [
"0.77977556",
"0.7740631",
"0.770163",
"0.7695761",
"0.76865476",
"0.7636571",
"0.7601572",
"0.754302",
"0.74219704",
"0.7409429",
"0.73759663",
"0.7173831",
"0.71300894",
"0.70486206",
"0.70486206",
"0.7034142",
"0.69195825",
"0.6886133",
"0.6867094",
"0.677051",
"0.67591655... | 0.78053415 | 0 |
goes to the previous page | async def previous_page(self):
await self.checked_show_page(self.current_page - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goToPrevLink():\n if wikiPageStackTrace[-2].getUrl() != \"\":\n oldpage = wikiPageStackTrace[-2]\n print(\"going back to \", oldpage.getUrl())\n titleStackTrace.append(oldpage.getTitle())\n urlStackTrace.append(oldpage.getUrl())\n del wikiPageStackTrace[-1]\n update... | [
"0.82448536",
"0.78836346",
"0.7694317",
"0.7625073",
"0.7552749",
"0.7430316",
"0.7419049",
"0.74046093",
"0.73494124",
"0.73279506",
"0.7291041",
"0.726867",
"0.72345847",
"0.715785",
"0.715785",
"0.7150545",
"0.7150545",
"0.71310234",
"0.7116425",
"0.7109296",
"0.7104777",... | 0.8048292 | 1 |
stops the interactive pagination session | async def stop_pages(self):
await self.message.delete()
self.paginating = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stopPaging(self):\n self._stillPaging = 0",
"def __stopScrolling(self):\n self.__view.inputWidget().releaseMouse()\n QApplication.restoreOverrideCursor()\n \n self.__indicator.hide()\n self.__indicator.setParent(None)\n self.__scroller.stopScrolling()",
"def... | [
"0.7443031",
"0.6542925",
"0.65421",
"0.63108504",
"0.62598443",
"0.6253554",
"0.6253554",
"0.62461007",
"0.6245877",
"0.6241",
"0.62232953",
"0.62232953",
"0.61937237",
"0.61552423",
"0.6136211",
"0.6136211",
"0.6136211",
"0.6136211",
"0.6136211",
"0.6136211",
"0.6136211",
... | 0.7571803 | 0 |
Downloads the dataset in compressed format. This function does not return anything | def download_compressed_dataset(url):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _download_and_uncompress_dataset(dataset_dir):\n filename = _DATA_URL.split('/')[-1]\n filepath = os.path.join(dataset_dir, filename)\n\n if not os.path.exists(filepath):\n def _progress(count, block_size, total_size):\n sys.stdout.write('\\r>> Downloading %s %.1f%%' % (\n filename, float(c... | [
"0.7406725",
"0.70859474",
"0.7018932",
"0.68021536",
"0.67304015",
"0.6579586",
"0.65106225",
"0.6479735",
"0.6475977",
"0.6422988",
"0.6409934",
"0.6400974",
"0.63962024",
"0.63925934",
"0.63781285",
"0.6347889",
"0.6322267",
"0.6320342",
"0.6314137",
"0.6310004",
"0.630669... | 0.8312236 | 0 |
Prepare the dataset form the download file. This function takes the filepath of the download file and prepares the data | def prepare_dataset(fpath):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_data(self) -> None:\n if (self.root).is_dir():\n logger.info(\"Found the dataset.\")\n else:\n download_and_extract(self.root, DOWNLOAD_INFO)",
"def prep_data(dataset_config=None):\n \n\n data_struct = DataStruct(dataset_config)\n\n data_name = data_st... | [
"0.6945789",
"0.64754957",
"0.64664316",
"0.64090407",
"0.6365517",
"0.63464",
"0.63419765",
"0.6305324",
"0.61647195",
"0.6158651",
"0.61167526",
"0.61118156",
"0.6107789",
"0.60439557",
"0.6039679",
"0.5992119",
"0.5987985",
"0.5978328",
"0.5968726",
"0.596167",
"0.594318",... | 0.73216677 | 0 |
Return the directory of data files. | def data_dir():
return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_directory(self):\n\n return self.get_raw(\"data_directory\")",
"def data_dir(self) -> Path:\n return self._data_dir",
"def get_data_dir(self):\n return self.data_dir",
"def data_dir(self):\n return self._data_dir",
"def data_dir(self):\n return self._data_dir",
... | [
"0.86678046",
"0.8487896",
"0.8462572",
"0.84176695",
"0.84176695",
"0.84165275",
"0.83920074",
"0.83725977",
"0.8331892",
"0.82320046",
"0.82109785",
"0.8151315",
"0.8066355",
"0.8062088",
"0.8061976",
"0.8047895",
"0.80455387",
"0.8033556",
"0.8001184",
"0.79925346",
"0.798... | 0.87103015 | 0 |
Finds a tweet with a two certain words\phrases in it. | def two_word_finder(word1,word2,text):
word1 = word1.lower()
word2 = word2.lower()
text = str(text).lower()
if word1 and word2 in text:
return True #return text to see specific tweets
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_find_word2(self):\n self.assertEqual(find_word2('GREEN'), [(1, 1), (1, 1), (0, 9)])\n self.assertEqual(find_word2('ABSENT'), [])\n self.assertEqual(find_word2('PW'), [(1, 7), (3, 7), (0, 8)])",
"def find_matches(id1, id2, adj_list_ids, adj_list_words):\n\n # combine words from tw... | [
"0.66810614",
"0.6470443",
"0.64452493",
"0.6327239",
"0.6325929",
"0.62813",
"0.6242157",
"0.6022817",
"0.5993105",
"0.59915686",
"0.5970261",
"0.59592956",
"0.5947485",
"0.5912819",
"0.59032536",
"0.5885848",
"0.5885848",
"0.58524436",
"0.5829877",
"0.58000016",
"0.5756215"... | 0.8225031 | 0 |
convert all items in array to dotdict | def list_to_dotdict(array):
if isinstance(array, list):
result = []
for item in array:
try:
_dotdict = dotdict(item)
except Exception as e:
raise e
result.append(_dotdict)
return result
return array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rec_to_dict(arr):\n\n return dict(zip(arr.dtype.names, arr))",
"def to_dotdict(data):\n\n if isinstance(data, dict):\n\n return dotdict(data)\n elif isinstance(data, list):\n return list_to_dotdict(data)",
"def todict(self):\n return dict(self.array)",
"def array_to_dict(sel... | [
"0.66079587",
"0.6452924",
"0.64230466",
"0.6418053",
"0.6131111",
"0.61046916",
"0.59780544",
"0.5972151",
"0.5918459",
"0.5807685",
"0.573434",
"0.56638986",
"0.5656732",
"0.5625367",
"0.56216025",
"0.5572649",
"0.55410963",
"0.55249137",
"0.54466385",
"0.54345655",
"0.5380... | 0.7825808 | 0 |
return dotdict object or list | def to_dotdict(data):
if isinstance(data, dict):
return dotdict(data)
elif isinstance(data, list):
return list_to_dotdict(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n\n return DotDict(self.__iter__())",
"def test_dotwiz_plus_get_item():\n dd = DotWizPlus()\n dd.a = [{'one': 1, 'two': {'key': 'value'}}]\n\n item = dd['a'][0]\n assert isinstance(item, DotWizPlus)\n assert item['one'] == 1\n\n assert item['two']['key'] == 'value'",
... | [
"0.5945943",
"0.5873352",
"0.5810061",
"0.5800588",
"0.5748407",
"0.57315344",
"0.5581501",
"0.5569949",
"0.5481885",
"0.5452426",
"0.54393417",
"0.540381",
"0.53734374",
"0.5339806",
"0.5307873",
"0.5281563",
"0.5272191",
"0.5243142",
"0.5223164",
"0.5220962",
"0.51968324",
... | 0.6615638 | 0 |
Converts decimal number into sexagesimal number parts. ``deci`` is the decimal number to be converted. ``precision`` is how close the multiple of 60 and 3600, for example minutes and seconds, are to 60.0 before they are rounded to the higher quantity, for example hours and minutes. | def decimal_to_base60(deci,precision=1e-8):
sign = "+" # simple putting sign back at end gives errors for small
# deg. This is because -00 is 00 and hence ``format``,
# that constructs the delimited string will not add '-'
# sign. So, carry it as a character.
if deci < 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n string = self.ask('od;E;') # get the actual output\n i1 = string.find('.')\n # find the indices of the dot before the decimal part and the E before\n # the exponent\n i2 = string.find('E', i1)\n # calculate the number of digit in the... | [
"0.5545609",
"0.54595983",
"0.5409595",
"0.5327562",
"0.5315469",
"0.52859825",
"0.52043194",
"0.519569",
"0.5193756",
"0.51741165",
"0.515108",
"0.515045",
"0.5112662",
"0.500345",
"0.49701056",
"0.49647292",
"0.4951426",
"0.49483728",
"0.49165738",
"0.48891824",
"0.4876071"... | 0.62166643 | 0 |
Given mjd return calendar date. Retrns a tuple (year,month,day,hour,minute,second). The last is a floating point number and others are integers. The precision in seconds is about 1e4. To convert jd to mjd use jd 2400000.5. In this module 2400000.5 is stored in MJD0. | def caldate(mjd):
MJD0 = 2400000.5 # 1858 November 17, 00:00:00 hours
modf = math.modf
a = long(mjd+MJD0+0.5)
# Julian calendar on or before 1582 October 4 and Gregorian calendar
# afterwards.
if a < 2299161:
b = 0
c = a + 1524
else:
b = long((a-1867216.25)/36524.25)
c = a+ b - long(modf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmjd_to_mjd( cmjd):\n # only accurate to digits\n days = (cmjd.real+EPSILON) * FACTOR\n days = np.round(days, decimals=0)\n idays = np.int(days)\n fdays = np.float(idays)/FACTOR\n partdays = cmjd.imag # rest of days is in the hours part\n mjd = fdays + partdays\n return mjd",
"def ge... | [
"0.7360819",
"0.73290575",
"0.7209902",
"0.7089714",
"0.7082776",
"0.7072075",
"0.7059237",
"0.7000371",
"0.6946869",
"0.693835",
"0.69068015",
"0.68661994",
"0.6851522",
"0.6851298",
"0.67647004",
"0.6752787",
"0.6722145",
"0.6657841",
"0.65992653",
"0.6596479",
"0.6561866",... | 0.7805427 | 0 |
Parse an AIML text version of an aiml file and return all the cateogeries found in the file | def parse_from_text(self, text):
start = datetime.datetime.now()
aiml = ET.fromstring(text)
_, namespace = AIMLParser.check_aiml_tag(aiml)
num_categories = self.parse_aiml(aiml, namespace)
stop = datetime.datetime.now()
diff = stop - start
YLogger.info(self, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_cuewords(self, cuewords, xml_file_path):\n\n # Create output files\n if not os.path.exists(CUEWORDS_DATA_PATH):\n self.create_directories(CUEWORDS_DATA_PATH)\n try:\n file_output = open(CUEWORDS_DATA_PATH+CUEWORDS_FILE, 'w', encoding='utf8')\n file_... | [
"0.57388943",
"0.57380986",
"0.5733026",
"0.5705951",
"0.5672007",
"0.56505924",
"0.56093127",
"0.5518221",
"0.5507609",
"0.5495509",
"0.5464741",
"0.54594886",
"0.5425296",
"0.53971124",
"0.5390651",
"0.5387091",
"0.53832227",
"0.53830737",
"0.5381347",
"0.53734255",
"0.5347... | 0.62207997 | 0 |
Check that the interaction accepts a 'name' argument and has a 'name' attribute. | def test_interaction_accepts_name():
dmi = DMI(1)
assert hasattr(dmi, 'name') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_interaction_accepts_name():\n demag = ThinFilmDemag()\n assert hasattr(demag, 'name')",
"def _check_name(self):\n\t\tpass",
"def test_should_name_field(self):\n self.assertIn(\"name\", self.fields)",
"def test_name(self):\n self.assertTrue(type(x.name) == str)",
"def test_name_... | [
"0.75773394",
"0.7110944",
"0.6599535",
"0.6579234",
"0.6573439",
"0.6570425",
"0.6569371",
"0.65498203",
"0.65390664",
"0.6503915",
"0.649423",
"0.64581394",
"0.64467174",
"0.64241993",
"0.6411254",
"0.6389162",
"0.6389162",
"0.63616997",
"0.6347092",
"0.6335511",
"0.6291245... | 0.7530854 | 1 |
This method used for display add team /player button | def add_team_player():
if request.form['add_template'] == 'Add Team':
return render_template('addteam.html')
elif request.form['add_template'] == 'Add Player':
teams = get_team()
return render_template('addplayer.html', teams=teams)
else:
return getAllPlayers() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_player_button():\r\n global state\r\n if not state == \"add\":\r\n clear_frames()\r\n\r\n \"\"\"Changing state global variable and subtitle and showing on screen\"\"\"\r\n state = \"add\"\r\n sub_title[\"text\"] = \"ADD PLAYER\"\r\n sub_title.pack()\r\n \"\"\... | [
"0.70463204",
"0.6276204",
"0.6261729",
"0.62551904",
"0.62009877",
"0.61738485",
"0.6087262",
"0.6075263",
"0.60548",
"0.5982238",
"0.59647626",
"0.5960139",
"0.5945807",
"0.59443206",
"0.59304005",
"0.5914881",
"0.58859",
"0.58651036",
"0.5848743",
"0.5823961",
"0.58157766"... | 0.7212078 | 0 |
This method used for edit team information | def team_edit(team_id):
if request.method == 'GET':
team = Team.query.filter_by(team_id=team_id).one()
return render_template('edit_team.html', team=team) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_owners_can_edit_team_data(self):\n\n data = {\n 'description': 'Edited description',\n 'name': 'Edited Name'\n }\n response = self.client.patch(reverse('api:teams-detail', kwargs={'pk': self.team.id}), data)\n self.assertEqual(response.status_code, status.... | [
"0.7191018",
"0.709394",
"0.7048175",
"0.680195",
"0.66895694",
"0.6678483",
"0.6646838",
"0.66090715",
"0.64634645",
"0.6432834",
"0.6409257",
"0.6398768",
"0.63267934",
"0.6316041",
"0.63043207",
"0.6287093",
"0.62806153",
"0.6216511",
"0.6209136",
"0.61889",
"0.61805123",
... | 0.7488611 | 0 |
Display selected team Details | def display_selected_team(team_id):
if request.method == 'GET':
result_dict = {}
teams = get_team()
players = Player.query.join(Team, Player.team_id==team_id).\
add_columns(Player.player_fname,Player.player_lname,Team.team_name,Player.player_id)
result_dict['teams'] = teams
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_team_page(request, team_pk):\n\t\n\tselected_team = ChallengeTeam.objects.get(pk = team_pk)\n\t\n\tusers = selected_team.team_members.all()\n\t\n\tteam_name = selected_team.team_name\n\t\n\tall_results = get_team_results(users, selected_team.challenge.schedule)\n\tteam_consistency = all_results[\"consiste... | [
"0.7378892",
"0.7202127",
"0.7011595",
"0.6845789",
"0.6786297",
"0.6735039",
"0.6540119",
"0.64731157",
"0.6464473",
"0.6359951",
"0.6321422",
"0.6250159",
"0.62016064",
"0.6165804",
"0.61371464",
"0.61025214",
"0.6068967",
"0.60541105",
"0.6038926",
"0.60297716",
"0.6023512... | 0.7938968 | 0 |
This method used for edit player information | def player_edit(player_id):
if request.method == 'GET':
result = {}
player = Player.query.filter_by(player_id=player_id).one()
player.player_image = b64encode(player.player_image)
teams = get_team()
result['player'] = player
result['teams'] = teams
return rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, player_info):\n self.seat = player_info.get(\"seat\", -1)\n self.name = player_info.get(\"name\", \"unknown\")\n self.sit_out = player_info.get(\"sit_out\", True)",
"def edit_user(self):\n from editWindow import EditPlayer\n self.edit = EditPlayer(self.lang, se... | [
"0.70508623",
"0.691375",
"0.6630395",
"0.6581151",
"0.6499907",
"0.6449183",
"0.64047134",
"0.63949656",
"0.6385882",
"0.6316389",
"0.63095105",
"0.63081056",
"0.62880075",
"0.6282538",
"0.6196724",
"0.6143135",
"0.6126377",
"0.61088145",
"0.6087335",
"0.6076133",
"0.6074033... | 0.7211967 | 0 |
This method return all team information | def get_all_team_info():
# hit this url in browser or postman like http://127.0.0.1:5000/getAllTeamInfo and it will return json data
final_team_list = []
if request.method == 'GET':
teams = Team.query.all()
for rec in range(len(teams)):
final_team = {}
final_team['Te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_teams():",
"def getAllTeams(self):\n return []",
"def getTeam(self):\n return [\"The A-Team\", \"some other bloke\"]",
"def get_people(team):",
"def get_teams(self):\n url = 'teams'\n result = self.get(url)\n return result.get('teams', result)",
"def get_team_li... | [
"0.8226794",
"0.75884455",
"0.7483768",
"0.74514127",
"0.73995537",
"0.7057975",
"0.7048445",
"0.70254403",
"0.6986613",
"0.6854374",
"0.67867225",
"0.67421323",
"0.6741827",
"0.67249024",
"0.66893196",
"0.668395",
"0.6670714",
"0.6653283",
"0.6628329",
"0.6627309",
"0.662307... | 0.7789952 | 1 |
This method used for display all player information for read only user | def display_read_only_user():
# hit this url in browser.
if request.method == 'GET':
result_dict = {}
teams = get_team()
players = db.session.query(Player, Team).join(Team, Player.team_id == Team.team_id)
for each in players:
if each.Player.player_image is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_player_info(self):\n\t\tclear_screen()\n\n\t\tprint(\"# PLAYER INFO #\\n\")\n\t\tprint(\"Name{:.>17} \".format(self.info['Name']))\n\t\tprint(\"Race{:.>17} \".format(self.info['Race']))\n\t\tprint(\"Level{:.>16} \".format(self.stats['Level']))\n\t\tprint(\"Hit Points{:.>11} \".format(self.stats['HP... | [
"0.6989941",
"0.68834287",
"0.6581664",
"0.65732765",
"0.6539903",
"0.6517564",
"0.64415467",
"0.64375114",
"0.6384573",
"0.63242304",
"0.6293608",
"0.62828076",
"0.62666297",
"0.624345",
"0.6231377",
"0.6223611",
"0.61990607",
"0.61758673",
"0.61674625",
"0.6142857",
"0.6140... | 0.753156 | 0 |
Creates a Cell from a JSON dictionary. | def from_json(self, _json: Dict) -> "Cell":
cell = Cell(content=_json["content"], data=_json["data"])
cell.id = _json["id"]
return cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, _json: Dict) -> \"Page\":\n\n page = cls(\n cells=[Cell.from_json(cell_json) for cell_json in _json[\"cells\"]],\n data=_json[\"data\"],\n )\n page.id = _json[\"id\"]\n return page",
"def from_dict(self, d):\n return Grid(**d)",
"def f... | [
"0.6552123",
"0.6535798",
"0.6277082",
"0.6269054",
"0.6266621",
"0.61997414",
"0.61492914",
"0.6125334",
"0.5983177",
"0.5935195",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.5... | 0.82266605 | 0 |
Converts the Cell to a JSON dictionary. | def json(self) -> CellJson:
return {"id": self.id, "content": self.content, "data": self.data} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_dict(self) -> Dict[str, Any]:\n return {\n column_title: cell.get_value()\n for column_title, cell in self.column_title_to_cell.items()\n }",
"def as_dict(self) -> Dict[str, Any]:\n return {\n column_title: cell.value\n for column_title, cel... | [
"0.6867866",
"0.67923075",
"0.66359794",
"0.6611153",
"0.64058787",
"0.6400758",
"0.6392397",
"0.6365426",
"0.6365426",
"0.6365426",
"0.6361674",
"0.63474494",
"0.63334906",
"0.63334906",
"0.6331991",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032... | 0.80724275 | 0 |
Does smoothing and outlier removal work? | def test_smoothing():
spec = IGRINSSpectrum(file=file)
new_spec = spec.remove_outliers(threshold=3)
assert len(new_spec.flux) > 0
assert new_spec.shape[0] <= spec.shape[0]
assert new_spec.shape[0] > 0
assert new_spec.mask is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outlier(arr, as_nan=True, thresh=0.05, show=False, report=False):\n if len(arr) < 3:\n return arr\n if show:\n plt.subplot(1,2,1) # Plot part 1 first\n plt.plot(np.random.random(len(arr)), thing1, 'o', color='blue',\n markeredgecolor='none', alpha=0.4)\n plt.title('With outliers')\n ... | [
"0.69179946",
"0.6402754",
"0.63572776",
"0.62770617",
"0.62203604",
"0.61959535",
"0.6186184",
"0.6164992",
"0.6164357",
"0.61016166",
"0.6089655",
"0.60500485",
"0.60478014",
"0.6020404",
"0.6016225",
"0.6007301",
"0.6002241",
"0.597885",
"0.5976333",
"0.5957397",
"0.594395... | 0.6860557 | 1 |
\brief Default constructor, it initializes the databaseWiki variable. | def __init__(self):
##type:databaseWiki = access to the database
self.db = databaseWiki() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, host='localhost', user='wikiwsd', passwd='wikiwsd', database='wikiwsd3'):\n self._host = host\n self._user = user\n self._passwd = passwd\n self._database = database",
"def __init__(self, wiki_conn=None):\n self.wiki_conn = wiki_conn\n if self.wiki_con... | [
"0.708437",
"0.69342434",
"0.69288975",
"0.6805751",
"0.6754723",
"0.65667826",
"0.6545131",
"0.65421885",
"0.65306705",
"0.6463664",
"0.6458318",
"0.6417798",
"0.6396213",
"0.6387407",
"0.6325784",
"0.6324736",
"0.6317163",
"0.62913865",
"0.62650484",
"0.62550473",
"0.622171... | 0.83109426 | 0 |
\brief The function computes the vector representation for all the Wikipedia pages contained in the dataset. \return dict = Dictionary containing the vectors representaion of the pages. | def getVectors(self):
vectors = dict()
i = 0
N = len(self.db.invertedIndex)
for w, (idf, docs) in self.db.invertedIndex.items():
for doc, tf in docs.items():
try:
vectors[doc][i] = tf * idf
except KeyError as k:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVector(self, p):\n vector = {}\n i = 0\n tr = ParseDumpWiki.normName(p)\n if(self.db.isInPage(tr)):\n for w, (idf, docs) in self.db.invertedIndex.items():\n if (p in docs):\n vector[i] = idf * docs[p]\n i += 1\n e... | [
"0.6587773",
"0.58068377",
"0.57203215",
"0.5535077",
"0.5424847",
"0.53094625",
"0.5303565",
"0.5172667",
"0.5141664",
"0.514158",
"0.5138805",
"0.5123758",
"0.5084756",
"0.5056258",
"0.5039636",
"0.5034146",
"0.503222",
"0.50316185",
"0.5027339",
"0.5025092",
"0.5025092",
... | 0.58590835 | 1 |
\brief The function create all the centroids of the categories with at least inferior_limit number of pages. | def getAllCentroids(self, inferior_limit = 5, withPrint = True, saveFile = True, test = []):
i = 0
if(withPrint):
print("I'm creating the page-categories dictionary")
pageCat = self.db.getAllCategoriesGivenAllPages(inferior_limit)
if(len(test) > 0):
for p in test:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_clusters(self):\n ex = 0\n print 'Iter - Purity Gini Index'\n while ex < self.MAX_ITERATION:\n new_clusters = np.zeros(self.centroids.shape)\n distances = euclidean_distances(self.vectors, self.centroids).argmin(axis=1)\n for i in ran... | [
"0.591679",
"0.58336884",
"0.58054376",
"0.5760245",
"0.5747278",
"0.5706009",
"0.5687512",
"0.56336176",
"0.56279874",
"0.5624772",
"0.559929",
"0.55759454",
"0.5550014",
"0.5542134",
"0.5538682",
"0.55276316",
"0.5519205",
"0.55120516",
"0.5507998",
"0.55051845",
"0.5486359... | 0.80864805 | 0 |
\brief The function receives as input p which is a Wikipedia page name and it computes its vector representation. | def getVector(self, p):
vector = {}
i = 0
tr = ParseDumpWiki.normName(p)
if(self.db.isInPage(tr)):
for w, (idf, docs) in self.db.invertedIndex.items():
if (p in docs):
vector[i] = idf * docs[p]
i += 1
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vector(word, model):\n return model.wv[word]",
"def geo2vec(p):\n ra, dec = map(radians, p)\n return numpy.array([cos(dec) * cos(ra),\n cos(dec) * sin(ra),\n sin(dec)])",
"def compute_paraphrase_vector(w1, w2, paraphrase, model, word2index, UNK):\n... | [
"0.5726636",
"0.5670378",
"0.56148446",
"0.5528788",
"0.55178714",
"0.54855853",
"0.5459716",
"0.5454969",
"0.5435176",
"0.5347205",
"0.5257061",
"0.5244839",
"0.5174825",
"0.5163313",
"0.5160711",
"0.5157782",
"0.51471853",
"0.5105118",
"0.5097582",
"0.50825983",
"0.5060565"... | 0.7949694 | 0 |
\brief The function receives as input actual, top and nSugg which are the real categories, the suggested categories and the number of suggested categories. Then, it returns the boolean, fractional and hierarchical measures. | def measures(self, actual, top, nSugg):
m2 = 0.0
m3 = 0.0
for categorySug, count in top:
if categorySug in actual:
m2 += 1.0
else:
for cR in actual:
if self.getFatherSon(cR, categorySug) != None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printStats(m2, m3, actual, top):\n print(\"\\nThe actual categories for this page are: %s\" % \", \".join(sorted(actual)))\n print(\"\\nThe suggested categories for this page are: %s\" % \", \".join(sorted([v for v, count in top])))\n print(\"\\nBOOLEAN MEASURE = %s\" %(m2 != 0))\n ... | [
"0.6279863",
"0.5812435",
"0.57591397",
"0.5720849",
"0.56757563",
"0.55937576",
"0.55148196",
"0.545167",
"0.54158485",
"0.53934085",
"0.53467155",
"0.5326005",
"0.529815",
"0.52958894",
"0.5240811",
"0.5219415",
"0.52064973",
"0.5205301",
"0.5186157",
"0.5183564",
"0.516829... | 0.7087484 | 0 |
\brief The function receives as input m2, m3, actual and top which are the fractional measure, the hierarchical measure, the real categories and the recommended categories. Then, it prints the reccomendation results. | def printStats(m2, m3, actual, top):
print("\nThe actual categories for this page are: %s" % ", ".join(sorted(actual)))
print("\nThe suggested categories for this page are: %s" % ", ".join(sorted([v for v, count in top])))
print("\nBOOLEAN MEASURE = %s" %(m2 != 0))
print("FRACTIONAL MEAS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measures(self, actual, top, nSugg):\n m2 = 0.0\n m3 = 0.0\n for categorySug, count in top:\n if categorySug in actual:\n m2 += 1.0\n else:\n for cR in actual:\n if self.getFatherSon(cR, categorySug) != None:\n ... | [
"0.6225919",
"0.6079369",
"0.60408586",
"0.58891267",
"0.58619076",
"0.5833258",
"0.58032775",
"0.57549334",
"0.5747019",
"0.57380384",
"0.57230663",
"0.56918466",
"0.56778634",
"0.560007",
"0.55710596",
"0.55510956",
"0.5533128",
"0.55227405",
"0.5505769",
"0.5481364",
"0.54... | 0.7809993 | 0 |
\brief The function receives as input catR and catS which are the name of the real and suggested category respectively. Then, it returns a list containing the brother categories. | def getBrothers(self, catR, catS):
c = self.db.db.cursor()
c.execute('SELECT * FROM catsub WHERE ? IN (SELECT cat_name FROM cat_name_sub WHERE cat_name_sub = ?)', [catS, catR])
return c.fetchall() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFatherSon(self, catR, catS):\n c = self.db.db.cursor()\n c.execute('SELECT * FROM catsub WHERE (cat_name_sub = ? AND cat_name = ?) OR (cat_name_sub = ? AND cat_name = ?)', [catS, catR, catR, catS])\n return c.fetchall()",
"def get_categories(race_name, event_discipline):\n # FIXME ... | [
"0.594012",
"0.591181",
"0.58667684",
"0.5775641",
"0.56613356",
"0.56484073",
"0.56390023",
"0.5602293",
"0.5578761",
"0.5563652",
"0.553586",
"0.551049",
"0.5499992",
"0.54530984",
"0.54503536",
"0.542002",
"0.54172385",
"0.5377499",
"0.5368948",
"0.53368497",
"0.53361046",... | 0.73143184 | 0 |
\brief The function receives as input catR and catS which are the name of the real and suggested category respectively. Then, it returns a list containing the father/son category. | def getFatherSon(self, catR, catS):
c = self.db.db.cursor()
c.execute('SELECT * FROM catsub WHERE (cat_name_sub = ? AND cat_name = ?) OR (cat_name_sub = ? AND cat_name = ?)', [catS, catR, catR, catS])
return c.fetchall() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBrothers(self, catR, catS):\n c = self.db.db.cursor()\n c.execute('SELECT * FROM catsub WHERE ? IN (SELECT cat_name FROM cat_name_sub WHERE cat_name_sub = ?)', [catS, catR])\n return c.fetchall()",
"def getCatParent(mode, cat):\n rta = set([])\n if mode == 'n':\n cat = ge... | [
"0.62573487",
"0.6106083",
"0.60577494",
"0.56528056",
"0.5651913",
"0.558147",
"0.5531332",
"0.55153984",
"0.54351413",
"0.54163444",
"0.53731084",
"0.53554934",
"0.5351091",
"0.5313431",
"0.5312579",
"0.5300816",
"0.52691513",
"0.5245465",
"0.52395195",
"0.52258575",
"0.522... | 0.67822933 | 0 |
\brief The function receives as input npages which is the number of Wikipedia pages to be evaluated and pageWeb which is the page to be recommended. It computes the boolean, fractional and hierarchical measures and prints them. | def evaluation(self, npages, centroids = None, randomWeb = False, pageWeb = None):
if(centroids is None):
try:
centroids = self.readFile("centroids.pickle")
except:
centroids = self.getAllCentroids(5)
if(randomWeb):
pages = [pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _huge_math_page_to_pages( env_dict ):\n import _math\n wiki_xml_math_output = env_dict[\"wiki\"][\"xml_math_output_big\"]\n #wiki_xml_math_output = env_dict[\"wiki\"][\"xml_math_output_test\"]\n\n from indexer.egomath.interface import egomath_inst\n\n egomath_inst.reset_logging()\n\n wiki_pag... | [
"0.59357786",
"0.5932471",
"0.5842498",
"0.578283",
"0.57478404",
"0.5516917",
"0.5436369",
"0.5406314",
"0.5350473",
"0.53293777",
"0.5325934",
"0.53164136",
"0.52994996",
"0.5296685",
"0.5255585",
"0.52087426",
"0.520245",
"0.51963955",
"0.5173262",
"0.5158161",
"0.5156993"... | 0.6455389 | 0 |
\brief The function receives as input nPageRacc and percentageTest which are the number of pages to be recommended for each step and the dataset fraction to use as test set. It computes several test recommending every time nPageRacc pages. For each step it considers a different number of categories. Specifically, it st... | def measurements(self, minPag = 4, maxPag = 50, nPagesRacc = 100, percentageTest = 0.20):
allPages = self.db.getPages()
test = random.sample(allPages, int(len(allPages) * percentageTest))
avg = []
centroids = self.getAllCentroids(inferior_limit = minPag, withPrint = False, saveFile = Fal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluation(self, npages, centroids = None, randomWeb = False, pageWeb = None):\n if(centroids is None):\n try:\n centroids = self.readFile(\"centroids.pickle\")\n except:\n centroids = self.getAllCentroids(5)\n \n if(randomWeb):\n ... | [
"0.6586228",
"0.54735696",
"0.5389025",
"0.53873664",
"0.5326797",
"0.52404207",
"0.52213144",
"0.5221267",
"0.52032757",
"0.5190112",
"0.51853114",
"0.5179685",
"0.5139516",
"0.5075939",
"0.5066819",
"0.5063224",
"0.5048917",
"0.4999439",
"0.49959165",
"0.4967029",
"0.495851... | 0.7285168 | 0 |
Return the last values of all state variables in a SimState object. | def last_state(self):
return self._simstate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_final_state(self):\n state = {}\n s = self.copy()\n clip = not np.isscalar(self['t'])\n if clip:\n # only get results for the last timepoint\n s.set_state(self.state[:, -1])\n \n for k in self.difeq_vars:\n state[k] = s[k]\n ... | [
"0.70501053",
"0.68264186",
"0.6813396",
"0.67094797",
"0.66886044",
"0.6674428",
"0.6615974",
"0.6521614",
"0.6480747",
"0.64383215",
"0.6368001",
"0.6361215",
"0.63596594",
"0.63395506",
"0.6314231",
"0.6235604",
"0.6213478",
"0.6176815",
"0.61695874",
"0.6163223",
"0.61559... | 0.7101281 | 0 |
SimObjects are organized in a hierarchy. This method returns an ordered dictionary of all enabled SimObjects in this branch of the hierarchy, beginning with self. | def all_objects(self):
objs = OrderedDict()
objs[self.name] = self
for o in self._sub_objs:
if not o.enabled:
continue
objs.update(o.all_objects())
return objs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_all_objects(self):\n level_objects = Group()\n mobs_objects = Group()\n for sprite_group in self.sprite_level_blocks:\n for object_ in sprite_group:\n if str(object_) == 'Mob':\n mobs_objects.add(object_)\n elif str(object_) ... | [
"0.61496246",
"0.61296856",
"0.608513",
"0.5893054",
"0.5893054",
"0.58513844",
"0.58347917",
"0.576784",
"0.5687896",
"0.5657026",
"0.56417245",
"0.55909324",
"0.5588757",
"0.55806464",
"0.55752224",
"0.5573823",
"0.5544128",
"0.5508163",
"0.54780394",
"0.54708326",
"0.54590... | 0.6703417 | 0 |
Return derivatives of all state variables. Must be reimplemented in subclasses. This is used by the ODE solver to integrate during the simulation; should be as fast as possible. | def derivatives(self, state):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _derivatives(self, state, forces_moments):\n # extract the states\n pn = state.item(0)\n pe = state.item(1)\n pd = state.item(2)\n u = state.item(3)\n v = state.item(4)\n w = state.item(5)\n e0 = state.item(6)\n e1 = state.item(7)\n e2 = sta... | [
"0.7683193",
"0.7318128",
"0.7000159",
"0.68565035",
"0.67524266",
"0.67374635",
"0.6591703",
"0.6397337",
"0.6300758",
"0.6288592",
"0.6209557",
"0.6207909",
"0.618478",
"0.61518556",
"0.61518556",
"0.6109665",
"0.6108",
"0.60804623",
"0.6070026",
"0.6070026",
"0.5987634",
... | 0.78107053 | 0 |
The Sim instance in which this object is being used. | def sim(self):
return self._sim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sim(self) -> Sim:\n\n return self._sim",
"def get_simulator(self) -> Game:\n return self.__sim",
"def sim(self):\n return self.mujoco_simulation.sim",
"def sim_info(self) -> SimInfo:\n return self._sim_info",
"def getSimulation(self):\r\n raise NotImplementedError()",... | [
"0.8274302",
"0.76091176",
"0.74165684",
"0.7305126",
"0.6934737",
"0.6901099",
"0.6809698",
"0.6788061",
"0.6562603",
"0.65560406",
"0.65333664",
"0.64729905",
"0.64492494",
"0.64492494",
"0.63692015",
"0.63296455",
"0.6318461",
"0.63045615",
"0.62786096",
"0.62221605",
"0.6... | 0.79484886 | 1 |
Given a pair of dates, creates iterator that returns (aMonday,theNextMonday) such that the first returned pair defines an interval holding minDate the last returned pair defines an interval holding maxDate if minDate or maxDate are not instances of datetime.date, raises TypeError if maxDate > minDate, raises ValueError | def mondayPairsIteratorFactory(minDate, maxDate):
if not (isinstance(minDate,dt.date) and isinstance(maxDate,dt.date)):
raise TypeError("minDate and maxDate must be instances of datetime.date")
if maxDate < minDate:
raise ValueError("minDate must be <= maxDate")
def anIterator():
oneWeek = dt.timedelt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daterange(date1, date2):\n for n in range(int ((date2 - date1).days)+1):\n yield date1 + timedelta(n)",
"def iter_dates(start, end):\n one_day = timedelta(days=1)\n date = start\n while date <= end:\n yield date\n date += one_day",
"def _drange(start: Da... | [
"0.6606035",
"0.6605835",
"0.64703006",
"0.63616943",
"0.62733585",
"0.6229436",
"0.62277454",
"0.6221993",
"0.61602044",
"0.6106471",
"0.60732347",
"0.6054331",
"0.603127",
"0.5957231",
"0.58339053",
"0.5806204",
"0.57963264",
"0.57677",
"0.5739298",
"0.56889385",
"0.5613047... | 0.8523642 | 0 |
A helper function to get the correct order to create tables during setup. whichTables is a list of Tables, possibly empty, or None If not whichTables, then all the known tables are visited | def getOrderedSetupList(whichTables = None):
# if whichTables is None, then databaseDependenciesForSetup.keys() is used
return socorro_pri.dependencyOrder(databaseDependenciesForSetup,whichTables) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOrderedPartitionList(whichTables):\n if not whichTables:\n return []\n order = socorro_pri.dependencyOrder(databaseDependenciesForPartition,whichTables)\n return order",
"def create_all_tables(self):\n pass",
"def create_tables( self ) :\n return self._create_tables",
"def init_tab... | [
"0.6438581",
"0.6068337",
"0.5827515",
"0.5818468",
"0.57141715",
"0.5701556",
"0.5697819",
"0.5639476",
"0.5597376",
"0.5596786",
"0.5568101",
"0.5547983",
"0.55355597",
"0.55066556",
"0.54814607",
"0.54805577",
"0.54765683",
"0.5469697",
"0.53908694",
"0.5388238",
"0.537485... | 0.7382621 | 0 |
A helper function to get the needed PartionedTables for a given set of PartitionedTables | def getOrderedPartitionList(whichTables):
if not whichTables:
return []
order = socorro_pri.dependencyOrder(databaseDependenciesForPartition,whichTables)
return order | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_partitions(self, table_name):\n partition_result = self.query(\n sql.fetch_partition,\n (\n self._current_db,\n table_name,\n ),\n )\n # If a table doesn't have partition schema the \"PARTITION_NAME\"\n # will be s... | [
"0.6315098",
"0.6028243",
"0.58734983",
"0.58222467",
"0.5769109",
"0.57545966",
"0.56962395",
"0.56682754",
"0.5640412",
"0.5635037",
"0.5578057",
"0.55250573",
"0.5516319",
"0.5486221",
"0.548598",
"0.5465969",
"0.53857803",
"0.5384892",
"0.5357559",
"0.5334161",
"0.5330704... | 0.65810615 | 0 |
Helper function to examine partitionCreationHistory | def partitionWasCreated(partitionTableName):
return partitionTableName in partitionCreationHistory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markPartitionCreated(partitionTableName):\n global partitionCreationHistory\n partitionCreationHistory.add(partitionTableName)",
"def _get_partition_list(self):\n raise NotImplementedError('Must be implemented in subclasses.')",
"def partition_book(self):\n ...",
"def _createOwnPartition(... | [
"0.65855694",
"0.59157133",
"0.5605107",
"0.5602883",
"0.5564097",
"0.55443454",
"0.5337288",
"0.53309625",
"0.5256756",
"0.511385",
"0.50445294",
"0.5031911",
"0.5025408",
"0.5014135",
"0.5008548",
"0.5005736",
"0.5003711",
"0.4998482",
"0.49464095",
"0.4941047",
"0.49375242... | 0.73551816 | 0 |
Helper function to update partitionCreationHistory | def markPartitionCreated(partitionTableName):
global partitionCreationHistory
partitionCreationHistory.add(partitionTableName) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partitionWasCreated(partitionTableName):\n return partitionTableName in partitionCreationHistory",
"def on_partition_change(self, new_partitions):\n if new_partitions is None:\n self.conn.create(self.partition_path, value=self.partitions)\n return\n\n if new_partitions !=... | [
"0.6277444",
"0.5867328",
"0.5753557",
"0.57449204",
"0.5468491",
"0.54188854",
"0.5398478",
"0.5376595",
"0.5308092",
"0.52885246",
"0.52048874",
"0.5138754",
"0.5134442",
"0.51240784",
"0.5119822",
"0.49873483",
"0.49679628",
"0.49415168",
"0.4938052",
"0.49107817",
"0.4885... | 0.7366289 | 0 |
Internal method that assumes all precursor partitions are already in place before creating this one. Called from createPartitions(same parameters) to avoid bottomless recursion. Creates one or more partitions for this particular table, (more if uniqueItems has more than one element) | def _createOwnPartition(self, databaseCursor, uniqueItems):
self.logger.debug("%s - in createOwnPartition for %s",threading.currentThread().getName(),self.name)
for x in uniqueItems:
#self.logger.debug("DEBUG - item value is %s",x)
partitionCreationParameters = self.partitionCreationParameters(x)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createPartitions(self, databaseCursor, iterator):\n self.logger.debug(\"%s - in createPartitions\", threading.currentThread().getName())\n partitionTableClasses = getOrderedPartitionList([self.__class__])\n #self.logger.debug(\"DEBUG - Classes are %s\",partitionTableClasses)\n uniqueItems = [x for ... | [
"0.64606357",
"0.5514394",
"0.5317253",
"0.5310833",
"0.5189379",
"0.51807606",
"0.5172232",
"0.51274365",
"0.50877345",
"0.5060848",
"0.49768895",
"0.49730808",
"0.49422514",
"0.49221748",
"0.49219945",
"0.49001914",
"0.48978415",
"0.48882595",
"0.48838842",
"0.48623025",
"0... | 0.7701096 | 0 |
Create this table's partition(s) and all the precursor partition(s) needed to support this one | def createPartitions(self, databaseCursor, iterator):
self.logger.debug("%s - in createPartitions", threading.currentThread().getName())
partitionTableClasses = getOrderedPartitionList([self.__class__])
#self.logger.debug("DEBUG - Classes are %s",partitionTableClasses)
uniqueItems = [x for x in iterator... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _createOwnPartition(self, databaseCursor, uniqueItems):\n self.logger.debug(\"%s - in createOwnPartition for %s\",threading.currentThread().getName(),self.name)\n for x in uniqueItems:\n #self.logger.debug(\"DEBUG - item value is %s\",x)\n partitionCreationParameters = self.partitionCreationPar... | [
"0.72625685",
"0.6556742",
"0.64865416",
"0.64796466",
"0.6260575",
"0.6234208",
"0.6183316",
"0.6067094",
"0.6047013",
"0.60348827",
"0.59451205",
"0.592884",
"0.5903982",
"0.58994883",
"0.58899176",
"0.58500534",
"0.57829833",
"0.57518965",
"0.5745148",
"0.5699041",
"0.5686... | 0.72230065 | 1 |
Create a set of partitions for all the tables known to be efficient when they are created prior to being needed. see the list databaseObjectClassListForWeeklyParitions above | def createPartitions(config, logger):
databaseConnection, databaseCursor = connectToDatabase(config, logger)
try:
for aDatabaseObjectClass in databaseObjectClassListForWeeklyPartitions:
weekIterator = mondayPairsIteratorFactory(config.startDate, config.endDate)
aDatabaseObject = aDatabaseObjectClass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createPartitions(self, databaseCursor, iterator):\n self.logger.debug(\"%s - in createPartitions\", threading.currentThread().getName())\n partitionTableClasses = getOrderedPartitionList([self.__class__])\n #self.logger.debug(\"DEBUG - Classes are %s\",partitionTableClasses)\n uniqueItems = [x for ... | [
"0.78974897",
"0.6525179",
"0.6408025",
"0.6380735",
"0.62772876",
"0.6232555",
"0.6150809",
"0.60966617",
"0.60484344",
"0.59169513",
"0.59100777",
"0.5902835",
"0.5898807",
"0.5858238",
"0.58435506",
"0.58283883",
"0.57975763",
"0.5755997",
"0.5744674",
"0.57172894",
"0.571... | 0.7650467 | 1 |
Register a new strategy for generating data for specific string "format". | def register_string_format(name: str, strategy: st.SearchStrategy) -> None:
if not isinstance(name, str):
raise TypeError(f"name must be of type {str}, not {type(name)}")
if not isinstance(strategy, st.SearchStrategy):
raise TypeError(f"strategy must be of type {st.SearchStrategy}, not {type(str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_data_format(format_name,parser):\n\n data_format_parser[format_name] = parser",
"def register_str_format(\n tag: Tag, conformer: Optional[Conformer] = None\n) -> Callable[[ValidatorFn], ValidatorFn]:\n\n def create_str_format(f: ValidatorFn) -> ValidatorFn:\n with _STR_FORMAT_LOCK:\n... | [
"0.67097753",
"0.56974983",
"0.55908847",
"0.55496186",
"0.5468228",
"0.5330458",
"0.52871567",
"0.5243602",
"0.52405083",
"0.51500815",
"0.51046956",
"0.51046956",
"0.5070095",
"0.4967492",
"0.4967349",
"0.49556667",
"0.49543664",
"0.49472272",
"0.49290946",
"0.49174467",
"0... | 0.7103577 | 0 |
A strategy that creates `Case` instances. Explicit `path_parameters`, `headers`, `cookies`, `query`, `body` arguments will be used in the resulting `Case` object. | def get_case_strategy( # pylint: disable=too-many-locals
draw: Callable,
endpoint: Endpoint,
hooks: Optional[HookDispatcher] = None,
feedback: Optional[Feedback] = None,
data_generation_method: DataGenerationMethod = DataGenerationMethod.default(),
path_parameters: Any = NOT_SET,
headers: A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_case(self, casenum, case):\n # Anonymous or authenticated session?\n is_mod_request = case['method'].upper() in self.modification_methods\n needs_user = case.get('user', is_mod_request)\n if needs_user:\n session = self.user_session\n else:\n ses... | [
"0.575196",
"0.57027084",
"0.5673386",
"0.5494484",
"0.54804766",
"0.5334432",
"0.5334432",
"0.52071553",
"0.51731235",
"0.51614434",
"0.51614434",
"0.50898486",
"0.50793946",
"0.5054101",
"0.5024315",
"0.5018465",
"0.50131065",
"0.50022775",
"0.49648806",
"0.49112797",
"0.48... | 0.5888172 | 0 |
Create a new strategy for the case's component from the endpoint parameters. | def get_parameters_strategy(
endpoint: Endpoint, to_strategy: Callable[[Dict[str, Any]], st.SearchStrategy], location: str
) -> st.SearchStrategy:
parameters = getattr(endpoint, LOCATION_TO_CONTAINER[location])
if parameters:
schema = parameters_to_json_schema(parameters)
strategy = to_strat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_case_strategy( # pylint: disable=too-many-locals\n draw: Callable,\n endpoint: Endpoint,\n hooks: Optional[HookDispatcher] = None,\n feedback: Optional[Feedback] = None,\n data_generation_method: DataGenerationMethod = DataGenerationMethod.default(),\n path_parameters: Any = NOT_SET,\n ... | [
"0.6418826",
"0.5800213",
"0.5728096",
"0.5714733",
"0.5632045",
"0.5582534",
"0.55530953",
"0.5522158",
"0.5477194",
"0.53526986",
"0.5237057",
"0.5194271",
"0.5176202",
"0.512805",
"0.5121639",
"0.5117651",
"0.51095563",
"0.510309",
"0.50945157",
"0.5078439",
"0.5024108",
... | 0.6061061 | 1 |
Apply URL quotation for all values in a dictionary. | def quote_all(parameters: Dict[str, Any]) -> Dict[str, Any]:
return {key: quote_plus(value) if isinstance(value, str) else value for key, value in parameters.items()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urllib_quote_parameters(inputdictionary):\r\n if type(inputdictionary) is not dict:\r\n raise TypeError(\"urllib_quote_parameters' inputstringdictionary parameter must be a dict, not '\"+str(type(inputstring))+\"'\")\r\n\r\n quoted_keyvals = []\r\n for key, val in inputdictionary.items():\r\n quoted_k... | [
"0.62306243",
"0.5637293",
"0.5618359",
"0.55986035",
"0.555752",
"0.55488056",
"0.5539878",
"0.5492487",
"0.548568",
"0.54376",
"0.5426715",
"0.5394386",
"0.53836554",
"0.53630733",
"0.5343481",
"0.5332934",
"0.5330379",
"0.53290695",
"0.5296179",
"0.5293168",
"0.5288468",
... | 0.5998401 | 1 |
Apply all `before_generate_` hooks related to the given location & dispatcher. | def _apply_hooks(
context: HookContext, hooks: HookDispatcher, strategy: st.SearchStrategy[Case], location: str
) -> st.SearchStrategy[Case]:
container = LOCATION_TO_CONTAINER[location]
for hook in hooks.get_all_by_name(f"before_generate_{container}"):
strategy = hook(context, strategy)
return s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_hooks(self):\n pass",
"def process_before_request_hooks(self):\n\n hooks = []\n\n if self.resource:\n hooks.extend(self.resource.api.before_all_hooks)\n hooks.extend(self.resource.before_all_hooks)\n\n hooks.extend(self.before_all_hooks)\n hooks.... | [
"0.56037354",
"0.5500859",
"0.5223152",
"0.52164966",
"0.5215929",
"0.5108552",
"0.5066924",
"0.5015762",
"0.49975643",
"0.4935562",
"0.49342433",
"0.49167737",
"0.48724824",
"0.48304024",
"0.48257065",
"0.48113218",
"0.48091397",
"0.4805462",
"0.47963923",
"0.47690478",
"0.4... | 0.6157746 | 0 |
Enables enriching test items with more properties to be used for grouping or other purposes. The goal is for whoever needs to be able to add item.test_group field | def pytest_before_group_items(session, config, items): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_test_inline_additional_properties(self):\n pass",
"def pytest_after_group_items(session, config, items):",
"def pytest_collection_modifyitems(config, items):\n # check if studio tests myst be skipped\n run_study = config.getoption(\"--runstudy\")\n # 'all' will match all studies, '' wi... | [
"0.5947742",
"0.5900158",
"0.5774352",
"0.573061",
"0.5615433",
"0.55916494",
"0.5568033",
"0.5543221",
"0.55160785",
"0.55160785",
"0.55108106",
"0.54705465",
"0.5394397",
"0.5350562",
"0.5348308",
"0.5344149",
"0.52992165",
"0.5255538",
"0.52473474",
"0.5215013",
"0.5209653... | 0.668921 | 0 |
Function to get activation code for the given email id from SQLite3 database | def get_activation_code(self, email):
from registration.models import RegistrationProfile
return RegistrationProfile.objects.get(user__email=email).activation_key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_active_code(email):\n key = 9\n encry_str = '%s|%s' % (email, time.strftime('%Y-%m-%d', time.localtime(time.time())))\n active_code = encrypt(key, encry_str)\n return active_code",
"def get_email_code():\n try:\n if check_magic_cookie(current_app.config):\n eppn = request... | [
"0.7783734",
"0.6583201",
"0.63923746",
"0.63744974",
"0.6349737",
"0.6197634",
"0.619453",
"0.6177607",
"0.61225206",
"0.6034107",
"0.59878886",
"0.59654486",
"0.59224087",
"0.5918931",
"0.5893357",
"0.58384615",
"0.5756389",
"0.5736205",
"0.5704148",
"0.5697767",
"0.5692908... | 0.7825948 | 0 |
Function to set the SMS telephone number for the organization | def set_sms_telephone_number(self, telephone_number, email):
ngo_user_profile = NGOUserProfile.objects.get(user__email=email)
org_setting = OrganizationSetting.objects.get(organization__org_id=ngo_user_profile.org_id)
smsc = SMSC(vumi_username="smsc")
smsc.save()
outgoing_number ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sms_phone_number(self, sms_phone_number):\n\n self._sms_phone_number = sms_phone_number",
"def telephone(self, telephone: str):\n\n self._telephone = telephone",
"def telephone(self, telephone):\n\n self._telephone = telephone",
"def setPhone(self,phone):\r\n self.phone = phon... | [
"0.7111448",
"0.7108275",
"0.69927394",
"0.6978297",
"0.69381905",
"0.6781706",
"0.6633915",
"0.65183043",
"0.6491202",
"0.6484134",
"0.6484134",
"0.6484134",
"0.6484134",
"0.64426327",
"0.6379249",
"0.6379249",
"0.6379249",
"0.6379249",
"0.6379249",
"0.6274541",
"0.62223303"... | 0.8054854 | 0 |
Function to delete all the organization related details | def delete_organization_all_details(self, email):
from django.contrib.auth.models import User
user = User.objects.get(email = email)
ngo_user_profile = NGOUserProfile.objects.get(user=user)
org = Organization.objects.get(org_id = ngo_user_profile.org_id)
org_setting = Organizatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_organization(self):\n pass",
"def delete_organization_buildings(request):\n org_id = request.GET.get('org_id', '')\n return tasks.delete_organization_buildings(org_id)",
"def organization_del_no_login(self, client, id):\n assert client.delete('/organizations/' + id, headers=... | [
"0.7227863",
"0.6669952",
"0.65060586",
"0.64845306",
"0.64831233",
"0.64286613",
"0.636024",
"0.6312484",
"0.6202136",
"0.61951476",
"0.6182339",
"0.6164368",
"0.60052854",
"0.5990238",
"0.5983369",
"0.59587985",
"0.59122294",
"0.58964324",
"0.5870292",
"0.58384836",
"0.5828... | 0.75068665 | 0 |
Reads signal coming from button input and makes sure it is valid Raises KeyboardInterrupt error when pressing Ctrl+C to escape infinite loop | def read_signals(self):
last_state_BTN = 0
stop = 0
try:
while True:
time.sleep(0.01)
input = GPIO.input(PIN_BTN)
input_check = GPIO.input(PIN_BTN) #Compare two button inputs to lower c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catch_keyboard_interrupt() -> Callable:\n return signal.signal(signal.SIGINT, keyboard_interrupt_handler)",
"def signal_handler(self, signum, frame):\n if signum == signal.SIGINT:\n self.terminate = True\n elif signum == signal.SIGALRM:\n self.button_handler(self.BUTTON... | [
"0.68630767",
"0.66138023",
"0.6591542",
"0.65760833",
"0.6262444",
"0.62043595",
"0.62043595",
"0.61973286",
"0.6095569",
"0.6094475",
"0.6085296",
"0.6064025",
"0.60463226",
"0.60421455",
"0.60175776",
"0.5980073",
"0.59134895",
"0.5882914",
"0.5869988",
"0.5858536",
"0.583... | 0.726642 | 0 |
The name of the Event. | def event_name(self):
return dict.get(self, 'event_name', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_name(self):\n return self._event_name",
"def getName(self):\n return _libsbml.Event_getName(self)",
"def cal_name(self):\n return self.event_name",
"def event_name(self, event_name):\n self['event_name'] = event_name",
"def setName(self, *args):\n return _libsbm... | [
"0.914251",
"0.8779574",
"0.8218363",
"0.7748643",
"0.7721498",
"0.771181",
"0.75794125",
"0.7545769",
"0.7544376",
"0.7417364",
"0.7392395",
"0.73624647",
"0.7352431",
"0.72882885",
"0.72882885",
"0.72882885",
"0.72882885",
"0.72882885",
"0.72882885",
"0.72882885",
"0.728828... | 0.88853073 | 1 |
Set the event name. | def event_name(self, event_name):
self['event_name'] = event_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_name(self, event_name):\n\n self._event_name = event_name",
"def setName(self, *args):\n return _libsbml.Event_setName(self, *args)",
"def set_name(self, _name):\n self.name = _name",
"def event_def_name(self, event_def_name):\n\n self._event_def_name = event_def_name",
... | [
"0.8554447",
"0.8545698",
"0.7631831",
"0.76218736",
"0.76011735",
"0.7582119",
"0.7563849",
"0.7563849",
"0.75514656",
"0.75162405",
"0.7503605",
"0.7490394",
"0.7490394",
"0.7490394",
"0.7490394",
"0.7490394",
"0.7444846",
"0.7444846",
"0.74408394",
"0.7368176",
"0.7335487"... | 0.87372917 | 0 |
Grabs (the number, the string, etc.) and returns its FimVariableType and length | def GrabVariableInitializerType(line: str) -> (FClass.FiMVariableTypes,int):
# Boolean
if line.startswith( FGlobal.Methods['Variable Boolean Array'] ):
length = len( _findFirst(FGlobal.Methods['Variable Boolean Array'], lambda x: line.startswith(x)) )
return FClass.FiMVariableTypes.BOOL_ARRAY, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variable_info(self, variable_info):\n \n try:\n # Take the data type associated to the variable\n t = self.fmu.get_variable_data_type(variable_info.name)\n \n # According to the data type read, select one of these methods to get the information\n ... | [
"0.64187276",
"0.6326492",
"0.61455476",
"0.5973403",
"0.59730524",
"0.59331995",
"0.5925267",
"0.5854947",
"0.5836881",
"0.57892615",
"0.5777393",
"0.5727039",
"0.57248425",
"0.57117987",
"0.56861895",
"0.5674377",
"0.56599545",
"0.56452334",
"0.56042564",
"0.55989367",
"0.5... | 0.7007432 | 0 |
Parse array variable line. Returns the variable name and 0based index | def GetVariableArrayDetails(line: str, variables: dict, report) -> (str, int):
if re.sub(r" (\d+)$", "", line ) in variables:
var_name = re.sub(r" (\d+)$", "", line )
if not var_name in variables:
raise Exception(f"Couldn't find variable {var_name}")
if not variables[ var_name ]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_of_var(v):\n name = v.varName\n indices = name[2:].split(',')\n i, j = int(indices[0]), int(indices[1])\n return i, j",
"def convert_to_array(line):\n line = line.strip()\n #VPR doesn't handle names that start with \"_\"\n if VPR_SAFE and line.startswith(\"_\"):\n... | [
"0.6036696",
"0.58602184",
"0.5832068",
"0.5821593",
"0.578838",
"0.56220657",
"0.5594634",
"0.55855143",
"0.55632436",
"0.5492416",
"0.53304476",
"0.5276537",
"0.5265253",
"0.5260184",
"0.5254695",
"0.52503854",
"0.5199804",
"0.51745635",
"0.516934",
"0.51369214",
"0.5134181... | 0.70073694 | 0 |
Test check_price with price above min_price. | def test_check_price_ok() -> None:
data = check_price(min_price=1, data={'p': 2.0})
assert data == {'p': 2.0} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_min_value(self, tracked_price):\n if tracked_price < self.min_value and self.warning_calls <= 2:\n print(f'Warning! Price dropeed under {self.min_value} pln {tracked_price}')\n self.make_phone_call()\n self.warning_calls += 1\n elif tracked_price < self.min_... | [
"0.74070835",
"0.70297384",
"0.6977393",
"0.6955922",
"0.6880591",
"0.67013264",
"0.66409075",
"0.65952086",
"0.6568215",
"0.640399",
"0.63509536",
"0.62894654",
"0.6214502",
"0.6202996",
"0.61953896",
"0.6140859",
"0.6129352",
"0.6083786",
"0.6081506",
"0.6043964",
"0.597165... | 0.70343876 | 1 |
Load peak definitions. The method must assign a peak definition dictionary to the self._peak_definitions attribute. The dictionary must have the keys 'center', 'sigma', 'amplitude', 'gamma', with value of [value_P1, bounds_P1, (fraction, distance) wrt P1 for P2, ... (fraction, distance) wrt P1 for Pn] Examples self._pe... | def _read_peak_definitions(self, *args, **kwargs):
raise NotImplementedError("This method must be implemented when sub-classing") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_peak_def_high():\n\n high_cf_opts = np.arange(50, 90, 1)\n\n # Generate peak definitions\n while True:\n\n cur_cen = np.random.choice(high_cf_opts)\n cur_pw = np.random.choice(PW_OPTS, p=PW_PROBS)\n cur_bw = np.random.choice(BW_OPTS, p=BW_PROBS)\n\n peak = [cur_cen, cur... | [
"0.63168603",
"0.6046201",
"0.5977809",
"0.58854425",
"0.58608097",
"0.58536106",
"0.5828217",
"0.5789251",
"0.5698267",
"0.56628263",
"0.56188095",
"0.56003404",
"0.5578688",
"0.55731547",
"0.556175",
"0.5560203",
"0.5547177",
"0.5529511",
"0.5503513",
"0.5497738",
"0.548399... | 0.7050395 | 0 |
Tests the ParseOptions function. | def testParseOptions(self):
options = cli_test_lib.TestOptions()
options.storage_format = 'sqlite'
options.task_storage_format = 'sqlite'
test_tool = tools.CLITool()
storage_format.StorageFormatArgumentsHelper.ParseOptions(options, test_tool)
self.assertEqual(test_tool._storage_format, options... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testParseOptions(self):\n options = cli_test_lib.TestOptions()\n\n output_module = MockOutputModule()\n server_config.ServerArgumentsHelper.ParseOptions(options, output_module)\n\n with self.assertRaises(errors.BadConfigObject):\n server_config.ServerArgumentsHelper.ParseOptions(options, None)... | [
"0.76278573",
"0.7261784",
"0.6988826",
"0.6817748",
"0.67921877",
"0.67795414",
"0.6500902",
"0.6449844",
"0.6420433",
"0.64187175",
"0.64091617",
"0.63865316",
"0.62818694",
"0.62485826",
"0.6245095",
"0.6241722",
"0.62382",
"0.62180233",
"0.620515",
"0.6143495",
"0.6136967... | 0.7682984 | 0 |
Test Queue's repr or str. fn is repr or str. expect_id is True if we expect the Queue's id to appear in fn(Queue()). | def _test_repr_or_str(self, fn, expect_id):
def gen():
when = yield
self.assertAlmostEqual(0.1, when)
when = yield 0.1
self.assertAlmostEqual(0.2, when)
yield 0.1
loop = self.new_test_loop(gen)
q = asyncio.Queue(loop=loop)
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_values_dequeue_in_correct_order():\n queue = Queue('ab')\n assert queue.dequeue() == 'a'",
"def test_queue_enqueue_command(runner, tmpworkdir, queue, target_factory): # pylint: disable=unused-argument\n\n atarget = target_factory.build(queue=queue)\n apath = Path('ips.txt')\n apath.write... | [
"0.5626087",
"0.5512492",
"0.5478984",
"0.5464747",
"0.54113114",
"0.5356273",
"0.52189934",
"0.5200133",
"0.5196002",
"0.51892626",
"0.5184694",
"0.5144224",
"0.51123935",
"0.50581205",
"0.50434726",
"0.5043352",
"0.5029708",
"0.5026211",
"0.50201356",
"0.5016761",
"0.500636... | 0.762492 | 0 |
Get all hosts in the sqlite3 db | def get_allhosts():
connection, tablename = HomeNetwork.get_connection_info()
query = 'SELECT hostname from {}'.format(tablename)
output = pandas.read_sql_query(query, connection).to_json(orient='records')
for host in json.loads(output):
yield host["hostname"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_hosts():\n db = sqlite3.connect('/home/tropius/TROPIUS/TROPIUS.db')\n res = hosts.get_all(db)\n res = {'list': res}\n return jsonify(res)",
"def all_hosts(self):\n ...",
"def get_all_index_servers(self):\n try:\n conn = psycopg2.connect(\"dbname='{0}'\".format(DATA... | [
"0.7736205",
"0.72115093",
"0.68987846",
"0.6766225",
"0.6706228",
"0.66647464",
"0.6644789",
"0.6626815",
"0.6574912",
"0.6552498",
"0.647382",
"0.6434455",
"0.64322376",
"0.6368944",
"0.6285019",
"0.6262168",
"0.62507373",
"0.62336105",
"0.6210645",
"0.6204508",
"0.6191099"... | 0.7696335 | 1 |
Creates an NLTK Parse Tree from the user input msg. | def __call__(self, msg: str):
# Remove punctuation from the string
msg = re.sub(r"[.?']+\ *",
" ",
msg,
flags=re.VERBOSE)
# Parse sentence into list of tokens containing
# only entities and commands.
tokens = self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildtree(text):\n tokens = text.strip().replace('//TT_ERR','').replace('\\n','').replace('(', ' ( ').replace(')', ' ) ').split()\n # print 'tokens = {}'.format(tokens)\n queue = processtext(tokens)\n # print 'queue = {}'.format(queue)\n stack = []\n while queue:\n token = queue.pop(0)... | [
"0.6411171",
"0.6261072",
"0.57774585",
"0.5727645",
"0.5545047",
"0.55288285",
"0.55222535",
"0.5504249",
"0.5500528",
"0.54955226",
"0.54773927",
"0.5462137",
"0.5436885",
"0.5395603",
"0.53827703",
"0.53827703",
"0.53696024",
"0.5360188",
"0.52904207",
"0.5270398",
"0.5268... | 0.7164881 | 0 |
Generates RegEx patterns from command signifiers. | def _binary_command_regexes(self):
patterns = {}
for intent, keys in self.keywords.get("binary").items():
if keys:
patterns[intent] = re.compile(r'\b' + r'\b|\b'.join(keys) + r'\b')
return patterns | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_command_pattern(command: str) -> re.Pattern:\n # swap every expression wiht the format <vaiable> to ?Pvariable\n # this way the .match method from re can be called\n logger.info(f\"Building new command partter for command: {command}\")\n command_regex = re.sub(r\"(<\\w+>)\", r\"(?P\\1.+)\", c... | [
"0.653379",
"0.6484083",
"0.6328662",
"0.6173036",
"0.610725",
"0.5850984",
"0.5816659",
"0.5816576",
"0.5813355",
"0.5812216",
"0.5787904",
"0.5764316",
"0.5734072",
"0.57315695",
"0.57271516",
"0.56949216",
"0.56752104",
"0.5669257",
"0.5629325",
"0.56085503",
"0.55786955",... | 0.66550136 | 0 |
Lexes an input string into a list of tokens. This lexer first looks for Entities in the input string and parses them into tokens of the same name (i.e. 'blah U2 blah' > ['U2']). Next, the lexer will look for Commands by searching for keywords that signify the command. These keyword+command pairings are defined in the c... | def _lexer(self, msg: str):
def lexing_algorithm(text):
# TODO: >= O(n^2) (horrible time complexity). In the interest of
# making forward progress, optimize this later. Could use a
# bloom filter to look for matches, then binary search on
# entities/commands fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(self, string):\n tokens = [tok if tok in self.token_to_ix else self.unk\n for tok in string.split()]\n return [self.bos] + tokens + [self.eos]",
"def tokenize(self, input_string: str) -> List[str]:",
"def _next_tokens(self, context):\n state = context.state\n ... | [
"0.6456831",
"0.645226",
"0.63548565",
"0.6297312",
"0.6186637",
"0.61487323",
"0.6142615",
"0.6064563",
"0.60500246",
"0.5996603",
"0.5989371",
"0.5983331",
"0.59758335",
"0.59153837",
"0.5849638",
"0.5826889",
"0.5813295",
"0.58122796",
"0.5797753",
"0.57843983",
"0.573577"... | 0.6951192 | 0 |
Non pending means active | def is_active(self):
return not self.pending | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending(self):\n return 0",
"def is_pending(self):\n if self.status == \"PENDING\":\n return True\n else:\n return False",
"def is_pending(self):\n return self._state == \"PENDING\"",
"def active(self):\n resp = self.server.request(\"get\", \"/jobs... | [
"0.7105372",
"0.66958797",
"0.6692705",
"0.6672039",
"0.6651602",
"0.662965",
"0.6618941",
"0.6522897",
"0.6522897",
"0.6522897",
"0.6522897",
"0.65002215",
"0.6440229",
"0.6407704",
"0.63877517",
"0.63579935",
"0.6328006",
"0.6260277",
"0.6249674",
"0.62359685",
"0.62300056"... | 0.7400021 | 0 |
This function parses the database path that get from the load file function | def parse(database_path: str) -> str:
new_path = database_path.split("/")
database_file_name = './' + new_path[-1]
return database_file_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_file():\n global list_of_table, data_base, new_data\n open_name = askopenfilename()\n\n if Path(open_name).suffix == '.db':\n data_base = open_name\n data_base = str(data_base)\n new_data_base = parse(data_base)\n new_data = update_list_tables(new_data_base)\n n... | [
"0.6662973",
"0.6634628",
"0.6515047",
"0.62259877",
"0.62149435",
"0.6212921",
"0.61982244",
"0.61602557",
"0.6147627",
"0.61391324",
"0.61344475",
"0.6088236",
"0.60781986",
"0.60295606",
"0.6013678",
"0.5962346",
"0.59537405",
"0.5914958",
"0.5899533",
"0.5890997",
"0.5873... | 0.72006804 | 0 |
This function displays a window for the enter data to the user when creating a table | def create_win_create_table():
global data_base, table, enter_table_name, win_create_table, enter_column_values
if data_base == '':
mistake_load_table()
else:
win_create_table = Toplevel(root)
win_create_table.title("Ввод")
win_create_table.geometry('320x150')
win_cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_enter_window():\n global data, record, column_names, win_create_add_str\n try:\n column_names = data[0]\n win_create_add_str = Toplevel(root, relief=SUNKEN, bd=10, bg=\"light sky blue\")\n win_create_add_str.title(\"Окно ввода\")\n win_create_add_str.minsize(width=500, ... | [
"0.73735327",
"0.6828619",
"0.6776213",
"0.6675097",
"0.6648047",
"0.6610913",
"0.6559444",
"0.6490088",
"0.64710647",
"0.6443968",
"0.6404274",
"0.63451195",
"0.63008195",
"0.6294918",
"0.6258528",
"0.6209054",
"0.6143737",
"0.61309594",
"0.6127621",
"0.61190337",
"0.6094487... | 0.7440231 | 0 |
This function create new database file with table | def create_new_db():
global data_base, table
data_base = asksaveasfilename(title="Select file", filetypes=(("DATA BASE", "*.db"), ("all files", "*.*")),
defaultextension='.db')
if Path(data_base).suffix == '.db':
create_win_create_table()
else:
mistake_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(dbname, table_name, list_of_columns):\r\n\r\n\tc = sqlite3.connect(dbname)\r\n\tcolums = [ c_name +' ' +data_type for c_name, data_type in list_of_columns ]\r\n\tcreate_columns_str = ', '.join(colums)\r\n\tcurs = c.cursor()\r\n\tcurs.execute( ''' create table {0} ({1})'''.format(table_name, create... | [
"0.7579963",
"0.75358784",
"0.7362639",
"0.73544276",
"0.73512906",
"0.7316812",
"0.7285391",
"0.72684366",
"0.7264738",
"0.7213389",
"0.7213389",
"0.72087604",
"0.72061014",
"0.7203377",
"0.71530145",
"0.71448",
"0.7108601",
"0.70948476",
"0.70811826",
"0.70739156",
"0.70737... | 0.791012 | 0 |
This function displays an error message when loading a database file if the user tries to download a file with a different extension | def mistake_db_file():
win_mistake_load_file = Toplevel(root)
win_mistake_load_file.title("Ошибка")
win_mistake_load_file.geometry('270x40')
message = Label(win_mistake_load_file, text="Файл должен быть с расширением .db!", width=45, height=2)
message.place(x=-30, y=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_error(self, error=None):\n if error is not None or str(error).strip() != \"\":\n dial = wx.MessageDialog(self.parent, str(error),\n 'Error Loading File',\n wx.OK | wx.ICON_EXCLAMATION)\n dial.ShowModal()",
... | [
"0.6676496",
"0.6330044",
"0.6121887",
"0.6109673",
"0.60543114",
"0.5953958",
"0.58574927",
"0.5721498",
"0.5705456",
"0.56341153",
"0.56212044",
"0.56002396",
"0.55826026",
"0.5580493",
"0.5550471",
"0.54714227",
"0.5465321",
"0.5450314",
"0.54160666",
"0.5412863",
"0.54100... | 0.660544 | 1 |
This function loads a file with the extension .db and displays a list of tables | def load_file():
global list_of_table, data_base, new_data
open_name = askopenfilename()
if Path(open_name).suffix == '.db':
data_base = open_name
data_base = str(data_base)
new_data_base = parse(data_base)
new_data = update_list_tables(new_data_base)
new_data.clear(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enumerate_tables(self, files=False):\n dbinfo = self.stru.readrec(1)\n if dbinfo[:1] != b\"\\x03\":\n print(\"WARN: expected dbinfo to start with 0x03\")\n try:\n dbdef = self.decode_db_definition(dbinfo[1:])\n except Exception as e:\n print(\"ERROR ... | [
"0.68099165",
"0.67694",
"0.6673958",
"0.65166104",
"0.6402736",
"0.6373919",
"0.6368217",
"0.6343859",
"0.6336732",
"0.6333176",
"0.6332147",
"0.63183755",
"0.63158333",
"0.6315517",
"0.63022494",
"0.6299106",
"0.6241761",
"0.62272054",
"0.61859334",
"0.61509603",
"0.6133241... | 0.7127736 | 0 |
This function displays an error message when deleting a system table from database | def mistake_del_table():
win_mistake_del_table = Toplevel(root)
win_mistake_del_table.title("Ошибка")
win_mistake_del_table.geometry('350x40')
message = Label(win_mistake_del_table, text="Эта таблица является системной и не может быть удалена!", width=45,
height=2)
message.place(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_table():\n global data_base, table, output_on_display\n try:\n sqlite3_simple_delete_table(data_base, table)\n list_tables = update_list_tables(data_base)\n list_tables.clear()\n output_on_display.delete(1.0, END)\n output_on_display.insert(END, '')\n return\... | [
"0.6654895",
"0.65877056",
"0.65477324",
"0.64933014",
"0.6381418",
"0.62227684",
"0.62015164",
"0.6181133",
"0.6078354",
"0.6063406",
"0.6061685",
"0.6028653",
"0.60269797",
"0.6018508",
"0.59979624",
"0.59774035",
"0.5962228",
"0.59599286",
"0.59167427",
"0.59083545",
"0.58... | 0.661488 | 1 |
This function deletes a table from the database and displays an updated list of tables | def del_table():
global data_base, table, output_on_display
try:
sqlite3_simple_delete_table(data_base, table)
list_tables = update_list_tables(data_base)
list_tables.clear()
output_on_display.delete(1.0, END)
output_on_display.insert(END, '')
return
except sq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_table(self, db, table_name):\n pass",
"def delete_table(self, name: str) -> None:",
"def deleteTable(self):\n return self.db.table_drop(self.entity).run(self.r)",
"def refresh_tables(db):\r\n try:\r\n c = db.cursor()\r\n c.execute(\"DROP TABLE waiting\")\r\n ... | [
"0.7162452",
"0.70870405",
"0.68540466",
"0.6841408",
"0.67404747",
"0.6705394",
"0.663939",
"0.6615974",
"0.6569918",
"0.65626705",
"0.65599054",
"0.6553217",
"0.6483717",
"0.6467993",
"0.64381915",
"0.64352286",
"0.64161044",
"0.63911146",
"0.632093",
"0.6311984",
"0.630951... | 0.7946719 | 0 |
This function displays an error message when user try to do operation with strings before loading table | def mistake_load_table():
text_message = "Сначала загрузите таблицу!"
if data_base == '':
text_message = 'Сначала загрузите базу данных или создайте новую!'
win_mistake_load_table = Toplevel(root)
win_mistake_load_table.title("Ошибка")
win_mistake_load_table.geometry('330x40')
message = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_error(self, error=None):\n if error is not None or str(error).strip() != \"\":\n dial = wx.MessageDialog(self.parent, str(error),\n 'Error Loading File',\n wx.OK | wx.ICON_EXCLAMATION)\n dial.ShowModal()",
... | [
"0.60021985",
"0.58556074",
"0.5767596",
"0.5670003",
"0.5546288",
"0.5544397",
"0.5540195",
"0.55215293",
"0.5498016",
"0.54782134",
"0.54715085",
"0.5402569",
"0.53950846",
"0.53866684",
"0.5357994",
"0.5324931",
"0.5294169",
"0.52918345",
"0.5287677",
"0.52796155",
"0.5273... | 0.6704388 | 0 |
This function creates a window for entering data when adding a row to the table | def create_enter_window():
global data, record, column_names, win_create_add_str
try:
column_names = data[0]
win_create_add_str = Toplevel(root, relief=SUNKEN, bd=10, bg="light sky blue")
win_create_add_str.title("Окно ввода")
win_create_add_str.minsize(width=500, height=200)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self):\n try:\n self.active_table.add_row(Row.Row([obj.get() for obj in self.enter_values]))\n self.parent.display_content()\n self.master.withdraw()\n except UnableToCastException as err:\n messagebox.showerror(\"Error\", err)",
"def create_win_c... | [
"0.76981956",
"0.7102062",
"0.7040199",
"0.68071455",
"0.6736525",
"0.6724013",
"0.6650073",
"0.660719",
"0.66064",
"0.6562622",
"0.6537641",
"0.64963937",
"0.6444856",
"0.63859785",
"0.6373158",
"0.63544244",
"0.6330035",
"0.6299755",
"0.62529474",
"0.62145746",
"0.6196938",... | 0.8013944 | 0 |
This function create window for delete record in the table of database | def create_delete_window():
global data, column_names, output1, win_create_delete_str, place_for_enter
try:
column_names = data[0]
win_create_delete_str = Toplevel(root, relief=SUNKEN, bd=10, bg="light sky blue")
win_create_delete_str.title("Окно выбора данных")
win_create_delete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_record():\n global data_base, table, choice, res, confirmation, output1, place_for_enter, choice_row\n choice_row = choice.get()\n sqlite3_simple_delete_record(data_base, table, choice_row, res)\n output1.delete(1.0, END)\n confirmation.after(1, confirmation.destroy)\n place_for_enter.... | [
"0.728897",
"0.6733543",
"0.64978063",
"0.64593697",
"0.64210594",
"0.63642997",
"0.632088",
"0.6294666",
"0.6282508",
"0.6248629",
"0.61855114",
"0.6184242",
"0.61679405",
"0.61418015",
"0.6137974",
"0.61366755",
"0.6108344",
"0.61065406",
"0.60431963",
"0.6028281",
"0.60151... | 0.73253214 | 0 |
This function create window for update record in the table of database | def create_update_window():
global data, column_names, output1, place_for_enter, win_create_update_str
try:
column_names = data[0]
win_create_update_str = Toplevel(root, relief=SUNKEN, bd=10, bg="light sky blue")
win_create_update_str.title("Окно выбора данных")
win_create_update... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_enter_window():\n global data, record, column_names, win_create_add_str\n try:\n column_names = data[0]\n win_create_add_str = Toplevel(root, relief=SUNKEN, bd=10, bg=\"light sky blue\")\n win_create_add_str.title(\"Окно ввода\")\n win_create_add_str.minsize(width=500, ... | [
"0.62114245",
"0.6144669",
"0.61412287",
"0.6117684",
"0.6080887",
"0.60511154",
"0.60195816",
"0.59972525",
"0.59922194",
"0.598121",
"0.5960823",
"0.59477824",
"0.5914867",
"0.58772355",
"0.5807761",
"0.5768228",
"0.576147",
"0.5749111",
"0.57381135",
"0.57372934",
"0.57203... | 0.6832931 | 0 |
This function receives information from the main screen and writes it to a file with the extension txt | def save_txt_file():
global output_on_display
if data_base == '':
mistake_load_table()
else:
save_name = asksaveasfilename(title="Select file", filetypes=(("TXT", "*.txt"), ("all files", "*.*")),
defaultextension='.txt')
if Path(save_name).suffix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_file():\n filepath = asksaveasfilename(\n defaultextension=\"txt\",\n filetypes=[(\"Text Files\", \"*.txt\"), (\"All Files\", \"*.*\")],\n )\n if not filepath:\n return\n with open(filepath, \"w\") as output_file:\n text = txt_edit.get(\"1.0\", tk.END)\n outp... | [
"0.74791944",
"0.69363564",
"0.68939584",
"0.6844553",
"0.6811746",
"0.6766754",
"0.6766161",
"0.6702598",
"0.67015916",
"0.6581492",
"0.6572639",
"0.65541923",
"0.65033996",
"0.6441865",
"0.6434158",
"0.6432803",
"0.64298",
"0.6387638",
"0.63765246",
"0.63361615",
"0.6323934... | 0.73890835 | 1 |
This function receives information from the main screen and writes it to a file with the extension csv | def save_csv_file():
global output_on_display, import_lst, column_names, data
if data_base == '':
mistake_load_table()
else:
column_names = data[0]
save_name = asksaveasfilename(title="Select file", filetypes=(("CSV", "*.csv"), ("all files", "*.*")),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataSave():\n # NR5G = gui_reader()\n try: #Python3\n f = open(__file__ + \".csv\",'wt', encoding='utf-8')\n except:\n f = open(__file__ + \".csv\",'wb')\n f.write('%s,'%(entryCol.entry0.get()))\n f.write('%s,'%(entryCol.entry1.get()))\n f.write('%s,'%(entryCol.entry2.get()))\n ... | [
"0.7729314",
"0.7327067",
"0.7005893",
"0.6922315",
"0.6882394",
"0.68259627",
"0.67552376",
"0.6754796",
"0.6724929",
"0.6693639",
"0.6688815",
"0.66777986",
"0.66453063",
"0.6644166",
"0.6636141",
"0.6627853",
"0.6618472",
"0.6584091",
"0.65767205",
"0.65737665",
"0.6528909... | 0.73807514 | 1 |
This function changes list of pictures and call help_main function, which create display for pictures | def help_main_but():
global picture_lst
picture_lst = ["test/main.png", "test/main2.jpg", "test/main3.jpg", "test/main4.jpg", "test/main5.jpg",
"test/main6.jpg"]
help_main() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help_update_str():\n global picture_lst\n picture_lst = [\"test/update1.jpg\", \"test/update2.jpg\", \"test/update3.jpg\", \"test/update4.jpg\", \"test/update5.jpg\",\n \"test/update6.jpg\"]\n help_main()",
"def help_load_file():\n global picture_lst\n picture_lst = [\"test/l... | [
"0.77632856",
"0.7383563",
"0.738099",
"0.7261219",
"0.713248",
"0.6875759",
"0.6629382",
"0.6531717",
"0.6516548",
"0.6424569",
"0.6337515",
"0.6271372",
"0.61820304",
"0.6091347",
"0.6087788",
"0.60684943",
"0.60505813",
"0.60440516",
"0.60422367",
"0.6038367",
"0.6031686",... | 0.7941817 | 0 |
This function changes list of pictures and call help_main function, which create display for pictures | def help_update_str():
global picture_lst
picture_lst = ["test/update1.jpg", "test/update2.jpg", "test/update3.jpg", "test/update4.jpg", "test/update5.jpg",
"test/update6.jpg"]
help_main() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help_main_but():\n global picture_lst\n picture_lst = [\"test/main.png\", \"test/main2.jpg\", \"test/main3.jpg\", \"test/main4.jpg\", \"test/main5.jpg\",\n \"test/main6.jpg\"]\n help_main()",
"def help_load_file():\n global picture_lst\n picture_lst = [\"test/load1.png\", \"t... | [
"0.79425746",
"0.73836595",
"0.73811275",
"0.72621405",
"0.7133004",
"0.6876637",
"0.66291463",
"0.6532651",
"0.6516761",
"0.6424798",
"0.63387024",
"0.62726146",
"0.6183507",
"0.60914105",
"0.6088568",
"0.6069086",
"0.6051887",
"0.60462165",
"0.60432994",
"0.60386354",
"0.60... | 0.77630895 | 1 |
Adjust the element's natural abundance to compensate for enrichment. | def set_elemental_enrichment(self):
for elementEnrichement, zaidVector in self.enrichmentDict.items():
for zaid, enrichmentPercent in zaidVector.items():
self.elementDict[elementEnrichement].weightPercentDict[zaid] = enrichmentPercent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normal_abnormal(self):\n mp_pool()\n print(\"Classification of WCE to normal vs abnormal --> DONE\")",
"def __deriveElementalWeightsByNaturalNuclideAbundances():\n for element in elements.byName.values():\n numer = 0.0\n denom = 0.0\n for nb in element.getNaturalIsotopi... | [
"0.57051605",
"0.54225665",
"0.54017174",
"0.5270537",
"0.52331305",
"0.5229417",
"0.5192499",
"0.51712704",
"0.51697654",
"0.5167327",
"0.51232815",
"0.5111488",
"0.5110367",
"0.50913906",
"0.50826037",
"0.5043937",
"0.50328887",
"0.5024053",
"0.49982327",
"0.49904492",
"0.4... | 0.5740942 | 0 |
Calculates the weight percent of a material. | def set_weight_percent(self, void_percent=1.0):
weight_total = 0.0
for zaidNum, zaid in enumerate(self.zaids):
for isotope, isotopeFraction in self.elementDict[zaid].weightPercentDict.items():
if isotopeFraction != 0.0:
self.weightPercent[isotope] = isotop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWeight(self) -> float:\n ...",
"def weight(self) -> float:\n self.sanitize(raise_exception=False)\n return Descriptors.ExactMolWt(self.rd_mol)",
"def calculate_weight(self, element, total_cores_used, total_disk_used,\n total_memory_used):\n cpu_capacit... | [
"0.6778616",
"0.66045725",
"0.66026527",
"0.6512171",
"0.6507674",
"0.64926773",
"0.6436281",
"0.64110833",
"0.6392683",
"0.6337113",
"0.6324131",
"0.63018006",
"0.62751645",
"0.62480426",
"0.6246338",
"0.623802",
"0.623802",
"0.62005895",
"0.61958903",
"0.61779964",
"0.61770... | 0.6889777 | 0 |
Adjust the atom density/atom percent of a material to account for voiding. | def set_void(self, void_percent):
self.set_weight_percent(void_percent)
self.atomDensity, self.atomPercent = set_atom_percent(self.weightPercent, self.density, self.elementDict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_atom_fractions(self, void_percent=1.0):\n for zaidNum, zaid in enumerate(self.zaids):\n for isotope, isotopeFraction in self.elementDict[zaid].atomPercentDict.items():\n if zaid in self.isotopicAtomPercents:\n print(self.elementDict[zaid].weightPercentDic... | [
"0.5972262",
"0.5922541",
"0.57685566",
"0.5742786",
"0.57123256",
"0.56042546",
"0.5561478",
"0.54767036",
"0.53915685",
"0.53881294",
"0.53662884",
"0.5363659",
"0.5363659",
"0.5342414",
"0.531014",
"0.53071153",
"0.52754444",
"0.5274383",
"0.51955503",
"0.51866984",
"0.517... | 0.60428965 | 0 |
Converts the weight percent of a material to the atom percent and atom density. | def set_atom_percent(weight_percents, density, element_dict):
atom_densities = {}
atom_percent = {}
for zaid, weight in weight_percents.items():
element = str(zaid)
if len(element) < 5:
current_element = int(element[:1] + '000')
else:
current_element = int(ele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Density(material):\n if material == \"mild\":\n return 7850.0\n else:\n if material == \"al\":\n return 2700.0\n else:\n raise ValueError(\"Invalid material `\"+material+\"'\")",
"def atomWeight(matID):\n mat = goodID(matID)\n compound = xl.CompoundParse... | [
"0.64119893",
"0.59639645",
"0.57990247",
"0.56953514",
"0.562632",
"0.5625964",
"0.54547775",
"0.5433132",
"0.540137",
"0.53775764",
"0.5360344",
"0.52982795",
"0.5252613",
"0.52484334",
"0.5236156",
"0.52221453",
"0.5220146",
"0.5213132",
"0.5144586",
"0.51058364",
"0.50965... | 0.70738566 | 0 |
Create the material data card for a smeared material. | def get_smeared_material(materials, void_material='', void_percent=1.0):
smear_material = {}
for material, materialWeightPercent in materials.items():
void_multiplier = 1.0
if material == 'Void':
pass
else:
base_material = Material()
base_material.set_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_material_data(self):\n for num, zaid in enumerate(self.enrichmentZaids):\n enriched_isotope_dict = {}\n for isoNum, isotopes in enumerate(self.enrichmentIsotopes[num]):\n enriched_isotope_dict[isotopes] = self.enrichmentVector[num][isoNum]\n self.en... | [
"0.6239184",
"0.5838182",
"0.5823315",
"0.5809612",
"0.5803698",
"0.57793164",
"0.56875765",
"0.5664696",
"0.56497055",
"0.55801505",
"0.55265605",
"0.5521103",
"0.5520303",
"0.5515589",
"0.5510146",
"0.5486669",
"0.5461987",
"0.54357195",
"0.54301006",
"0.5421089",
"0.538638... | 0.61714965 | 1 |
Returns a smeared material for the coolant and wire wrap. | def smear_coolant_wirewrap(info):
height = info[0]
fuel_radius = info[1] / 2
wirewrap_radius = info[2] / 2
wire_wrap_axial_pitch = info[3]
fuel_pitch = info[4]
coolant_material = info[5]
clad_material = info[6]
fuel_volume = utilities.get_cylinder_volume(fuel_radius, height)
wire_wra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_smeared_material(materials, void_material='', void_percent=1.0):\n smear_material = {}\n for material, materialWeightPercent in materials.items():\n void_multiplier = 1.0\n if material == 'Void':\n pass\n else:\n base_material = Material()\n base_... | [
"0.66321373",
"0.62594223",
"0.60387546",
"0.5944046",
"0.5875552",
"0.5739568",
"0.56960857",
"0.56770736",
"0.564192",
"0.55646825",
"0.5525133",
"0.5470988",
"0.5465184",
"0.54306227",
"0.54144156",
"0.5376519",
"0.5360755",
"0.5315837",
"0.52805245",
"0.52402693",
"0.5233... | 0.7692396 | 0 |
Generates a kubernetes config from a kustomize template All parameters are configurable in the invoke config | def kustomize(ctx, path=None, output_file=None):
cmd = ctx.get('kustomize_cmd', 'kustomize')
kustomize_root = ctx.get('kustomize_root', 'k8s')
build_path = path or ctx.get('kustomize_path', join(kustomize_root, 'overlays', ctx['env']))
output_string = '-o {}'.format(output_file) if output_file else ''
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_template(self) -> cconfig.Config:",
"def generate_haproxy_config(template=None, instances=None):\n\n return Template(filename=template).render(instances=instances)",
"def export_scraper_kubernetes_config(filename_template, experiments,\n contents_template, ... | [
"0.6615139",
"0.61634254",
"0.6152234",
"0.60913444",
"0.60837996",
"0.60783774",
"0.5980321",
"0.59794945",
"0.59225446",
"0.58424973",
"0.58103037",
"0.5769593",
"0.5748882",
"0.5738248",
"0.5714511",
"0.5577814",
"0.5558549",
"0.5553356",
"0.55321664",
"0.5517282",
"0.5506... | 0.68263984 | 0 |
Finds the pareto front, i.e. the pareto dominant solutions. | def _pareto_front(teams_population, novelty):
for team in teams_population:
team.dom_by_ = 0
team.dom_of_ = 0
front = []
dominateds = []
for teamA in teams_population:
for teamB in teams_population:
# check if there are teams ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pareto_frontier(self) -> Tuple[Tensor, Tensor]:\n raise NotImplementedError(\"Pareto frontier not yet implemented.\")",
"def pareto_front_cut(self):\n return self.NDA([kernel.objective_values for kernel in self.kernels \\\n if kernel.objective_values is not None],\n ... | [
"0.6347055",
"0.6301714",
"0.6221045",
"0.5980256",
"0.5856892",
"0.5821961",
"0.5495132",
"0.549147",
"0.5490508",
"0.5476367",
"0.5469471",
"0.5450582",
"0.54449403",
"0.53219175",
"0.5274065",
"0.5214968",
"0.52133995",
"0.5212093",
"0.5197233",
"0.5162972",
"0.5153386",
... | 0.66619694 | 0 |
Returns the full path of the final (uncompressed) shapefile | def filename(self):
_, tail = os.path.split(self.url)
return self.folder + '/' + tail[:-4] + '/' + tail[:-3] + 'shp' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shp_file(self):\n files = os.listdir(self.targetpath)\n file = files[0].split('.')[0]\n return self.targetpath + '/' + file",
"def filename(self):\n return os.path.basename(self._spatial_filename)",
"def get_file_full_path(self):\n return self.save_dir + os.sep + self... | [
"0.74278766",
"0.64146143",
"0.61104494",
"0.6057461",
"0.605376",
"0.60332054",
"0.5975038",
"0.59692514",
"0.59462243",
"0.586062",
"0.58414674",
"0.58365583",
"0.58347934",
"0.5832067",
"0.5812978",
"0.58093446",
"0.58087647",
"0.5803587",
"0.57945704",
"0.5789323",
"0.578... | 0.70179445 | 1 |
Takes the URL and extracts the table name based on filename | def tablename(self):
_, tail = os.path.split(self.url)
return tail[:-4] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_table_name(url):\n try:\n return urlparse(url).path.strip('/').split('/')[1]\n except IndexError:\n return None",
"def convertTableName(fileName: str):\n if m := pattern.match(fileName):\n return m.group(\"tableName\")",
"def get_table_from_dataset_path(ds... | [
"0.8116714",
"0.6845925",
"0.6461912",
"0.6457437",
"0.63222957",
"0.6306733",
"0.62379616",
"0.6237906",
"0.60564196",
"0.6036914",
"0.601242",
"0.60033494",
"0.59999204",
"0.5986188",
"0.58853424",
"0.58568525",
"0.581859",
"0.5806277",
"0.5776187",
"0.57597035",
"0.5732305... | 0.7307592 | 1 |
Run a shell command on a remote host with sudo. | def sudo(command):
return Effect(Sudo(command=command)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_shell_and_run_su_user(driver):\n global sudo_results\n cmd = 'sudo ls /var/lib/sudo'\n sudo_results = ssh_sudo(cmd, host, 'ericbsd', 'testing')",
"def sudo(self, script, *args, **kwargs):\n return self._run('sudo', script, *args, **kwargs)",
"def sudo_subprocess(command, environment=No... | [
"0.731115",
"0.69078445",
"0.6687307",
"0.6599232",
"0.6552791",
"0.65431005",
"0.6532725",
"0.6423601",
"0.6387818",
"0.63546616",
"0.6227134",
"0.6208304",
"0.6147234",
"0.6145686",
"0.6144694",
"0.61430246",
"0.6142701",
"0.6127885",
"0.61182",
"0.60464144",
"0.59921855",
... | 0.6990591 | 1 |
Run a command on a remote host with sudo. This quotes the provided arguments, so they are not interpreted by the shell. | def sudo_from_args(command):
return Effect(Sudo.from_args(command)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sudo(command):\n return Effect(Sudo(command=command))",
"def sudo(self, script, *args, **kwargs):\n return self._run('sudo', script, *args, **kwargs)",
"def sudo_subprocess(command, environment=None, shell=False):\n sudo = '/usr/bin/sudo'\n #check if we've been passed an iterable or a strin... | [
"0.720367",
"0.71116996",
"0.6575359",
"0.65090317",
"0.63917536",
"0.6276574",
"0.621761",
"0.61792326",
"0.6110883",
"0.6103212",
"0.60678804",
"0.6061076",
"0.6055272",
"0.6053011",
"0.6008199",
"0.599101",
"0.59807026",
"0.5938771",
"0.5887863",
"0.5876875",
"0.5800341",
... | 0.7261695 | 0 |
Write to invoice_file all other parameters. If invoice_file exists append, else new | def add_furniture(invoice_file, customer_name, item_code, item_description, item_monthly_price):
with open(invoice_file, "a+") as passed_csv:
csv_writer = csv.writer(passed_csv, delimiter=',', lineterminator='\n')
csv_writer.writerow([customer_name, item_code, item_description, item_monthly_price]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_furniture(invoice_file, customer_name, item_code, item_description,\n item_monthly_price):\n add_line = [customer_name, item_code, item_description, item_monthly_price]\n with open(invoice_file, \"a+\", newline=\"\") as file:\n file_write = csv.writer(file)\n file_write... | [
"0.6355147",
"0.6000983",
"0.5830138",
"0.5747909",
"0.57349044",
"0.5717122",
"0.57094413",
"0.5617954",
"0.5610167",
"0.5608352",
"0.5599389",
"0.5582126",
"0.557653",
"0.5549714",
"0.5542313",
"0.5532071",
"0.5531101",
"0.5515582",
"0.55137223",
"0.5482978",
"0.54709476",
... | 0.65328264 | 0 |
Create function to curry customer_name and invoice_file for add_furniture | def single_customer(customer_name, invoice_file):
def customer_rental(rental_items):
"""
Loop through rental_items file and append each row to curried invoice_file with same
customer_name
"""
customer = partial(add_furniture, invoice_file=invoice_file, customer_name=customer_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_customer(customer_name, invoice_file):\n def customer_rental(rental_items):\n \"\"\"Closure to add single customer details\"\"\"\n with open(rental_items, 'r', newline='') as rentals:\n reader = csv.reader(rentals)\n add_invoice_items = partial(add_furniture, invoi... | [
"0.792377",
"0.77332824",
"0.7487173",
"0.6835596",
"0.6785258",
"0.6430023",
"0.634362",
"0.60337305",
"0.59824455",
"0.58750504",
"0.58009964",
"0.5692271",
"0.54978555",
"0.53667754",
"0.5289584",
"0.5270777",
"0.52136415",
"0.5209183",
"0.51590586",
"0.5138142",
"0.513643... | 0.803983 | 0 |
Start setter. Also adds start position as root in nodes tree. Raise exception if s position is nonexistent or occupied. | def start(self, s):
if s is not None:
if self.charMap[s[0]][s[1]].c == "1": # wall
print("[Error] Invalid start position.", file=sys.stderr)
raise UserInputException
try:
self.charMap[s[0]][s[1]] = CharMapCell(3)
except IndexEr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self, start: pos.Pos) -> None:\n self.__start = start",
"def set_starting_pos(self):\n if self.start and self.is_unoccupied(*self.start):\n self.current_pos = self.start[:]\n else:\n self.set_random_pos('starting')",
"def set_start_pos(self, start_pos):\n ... | [
"0.68785596",
"0.68763584",
"0.67034364",
"0.64853793",
"0.6435945",
"0.63806355",
"0.6226598",
"0.61423135",
"0.6120722",
"0.6118055",
"0.60489506",
"0.6041604",
"0.5977694",
"0.590638",
"0.590638",
"0.590638",
"0.590638",
"0.5894897",
"0.58449125",
"0.5830393",
"0.58269316"... | 0.7155249 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.