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
Prints out homepage options to the user
def homepage(self): print('-=' * 12 + " Home Page " + '-=' * 12) self._user.list_contacts() options = {1: self.add_contact, 2:self.remove_contact ,3: self.view_contact_chat, 4: self.sign_out, 5: self.exit} print_out = "(1) Add new contact \n (2) Remove Contact \n (3) View my chats \n (4)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_other_options():\n print(\"> - Next Song page.\")\n print(\"< - Previous song page.\")\n print(\"q - to quit\")", "def main_menu(self):\n welcome = \"\"\"\n ************************\n * WELCOME TO CARSHARE! *\n ************************\n \"\"\"\n int...
[ "0.7042643", "0.67346436", "0.66125506", "0.64347136", "0.6407639", "0.64059675", "0.64050734", "0.6386845", "0.63713026", "0.6307135", "0.62678397", "0.6239708", "0.6216758", "0.618103", "0.61778545", "0.6174112", "0.61685836", "0.6142617", "0.6133943", "0.61180687", "0.6090...
0.71009314
0
Add a contact to a user account by contact's username
def add_contact(self): contact_mob_num = self._input_mob_num("-=" * 30 + "\n" + "Please enter contact's mobile number to be added: ") if contact_mob_num == self._user.mob_num: print("You can't add yourself, IDIOT!!") return self.homepage() found_contact = self.au...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_adduser(self, line):\n\t\tif isinstance(self.cl, Book):\n\t\t\tself.cl.add_contact()\n\t\telse:\n\t\t\tprint(\"To add contacts you need to open or create a book.\")", "def add_contact(self, contact):\n\t\tclient_log.debug(f'Создание контакта {contact}')\n\t\treq = {\n\t\t\tACTION: ADD_CONTACT,\n\t\t\tTIME...
[ "0.70311785", "0.688382", "0.65328264", "0.6457848", "0.6391224", "0.63722444", "0.63144225", "0.6200419", "0.6163992", "0.6162148", "0.6123405", "0.6102063", "0.60712075", "0.6050677", "0.6011818", "0.6008362", "0.59680736", "0.5960808", "0.591985", "0.5908906", "0.5906909",...
0.70890373
0
print all chats usernames then view one of the contact's chat
def view_contact_chat(self): if self._user.chats == {}: print("No chats to be viewed yet") self.homepage() print('-=' * 30) chats = self._user.list_chats() user_choice = self._int_input_in_range("Pick whose contact chat to be viewed: " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_messages(stdscr):\n # Show the cursor and echo output.\n curses.curs_set(1)\n curses.echo()\n conversations = filesystem.conversations()\n stdscr.clear()\n row = 1\n column = 1\n for name in conversations:\n safe_put(stdscr, name, (row, column))\n row += 1\n safe_p...
[ "0.6596113", "0.65658224", "0.64484376", "0.6312091", "0.6303174", "0.61384296", "0.6124483", "0.6101503", "0.60731196", "0.60624266", "0.60381544", "0.59948516", "0.59897465", "0.59654415", "0.5922948", "0.5921107", "0.5865494", "0.58365196", "0.58352834", "0.5827944", "0.58...
0.7599768
0
uses Users's send_msg method to send a msg to a certain contact
def _send_msg(self, contact): msg_content = input('{} :'.format(self._user.username)) if msg_content == '0': return self.homepage() self._user.send_msg(contact, msg_content) return self._send_msg(contact)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(self, msg):\n if msg['type'] in ('chat', 'normal'):\n msg.reply(\"Thanks for sending\\n%(body)s\" % msg).send()", "def send(self, msg):\n self.message('Me', msg)", "def sendto(self, name, msg):\n self.send(\"send/{}/{}:{}\".format(self.msg_id, name, msg))\n self.m...
[ "0.75077295", "0.75053024", "0.72851026", "0.71197087", "0.70939976", "0.70884967", "0.706698", "0.69710916", "0.6948751", "0.6948751", "0.6948751", "0.69296354", "0.686146", "0.6788958", "0.6767372", "0.6760855", "0.67388237", "0.66719127", "0.6645962", "0.66444427", "0.6642...
0.75329095
0
Endpoint to receive new device datapoint, updates top devices cache.
def devicedata(): data = request.get_json() dd = DeviceData(**data) db.session.add(dd) db.session.commit() # update cache when write is confirmed, updates corresponding maxheaps num_top_devices = int(environ.get('NUM_TOP_DEVICES')) for feature in DeviceData.features(): # negate fea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.device = self._api.device_query(self._hardware_address, {})", "def async_update_device(self) -> None:", "def dashboard():\n features = request.args.get('features', None)\n interval = request.args.get('interval', \"all_time\")\n features = DeviceData.features() if featur...
[ "0.61019975", "0.5817862", "0.58065313", "0.5732114", "0.57284003", "0.561221", "0.561221", "0.5596885", "0.55961233", "0.5561533", "0.5548863", "0.5475346", "0.5436901", "0.5418248", "0.53638417", "0.52888125", "0.5253732", "0.5250218", "0.5242439", "0.5213964", "0.52058274"...
0.64702433
0
Retrieve top devices per feature over interval
def dashboard(): features = request.args.get('features', None) interval = request.args.get('interval', "all_time") features = DeviceData.features() if features is None else features.split(",") if interval == "past_minute": cutoff_time = dt.now() - timedelta(minutes=1) elif interval == "past...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ten_most_popular_devices(self):\n devices = DeviceFactory.create_batch(15)\n dates = create_dates_in_range(0, 2, '2017-05-01T00:{}:40Z')\n create_occurrences(devices[0], dates)\n\n dates = create_dates_in_range(0, 6, '2017-05-01T00:{}:40Z')\n create_occurrences(devices[1...
[ "0.60265946", "0.594315", "0.58434504", "0.5637146", "0.5609201", "0.5511789", "0.53965575", "0.533939", "0.52934563", "0.52539307", "0.52156544", "0.5195858", "0.51910466", "0.51692164", "0.5161478", "0.5159812", "0.5155001", "0.5145687", "0.51430875", "0.512167", "0.5112263...
0.69374967
0
this runs the script to ask for a zip code and then print out the town location and population
def run_script(): var=raw_input("Enter a Zipcode: ") address='http://www.uszip.com/zip/'+var conn=urllib.urlopen(address) t=[] for line in conn.fp: line=line.strip() if '<title>' in line: line.split() print line[7:-16] if 'Total population' in line: line=line.strip('z') loc=li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(postalcode):\n places = postalcodes_mexico.places(postalcode)\n click.echo(places)\n return 0", "def database():\n\n zip_to_tuple, town_to_zip = query()\n\n l = ''\n\n while l != quit:\n\n l = input(\"Type in a zip code, a town name, or quit:\\n\")\n\n if l == 'quit':\n ...
[ "0.72115284", "0.6591404", "0.64162874", "0.6266131", "0.61080503", "0.59263486", "0.5911287", "0.5887681", "0.58561957", "0.58087796", "0.5789213", "0.5735703", "0.5721184", "0.57066685", "0.5688648", "0.5640758", "0.5616105", "0.5614457", "0.5599004", "0.55722016", "0.55711...
0.7830859
0
Assert that source_files are installed in install_path and selected source files are obfuscated.
def assert_source_files_are_installed_and_obfuscated(install_path, source_files, source_files_without_obfuscate_path=None): assert os.path.isdir(install_path), "%s does not exist" % install_path for source_file, op, version, check_obfuscation in source_files:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_idea_missing_sources(self):\n self._idea_test(['testprojects/src/java/org/pantsbuild/testproject/missing_sources'])", "def assert_assembly_files_are_installed(assembly_source_files, microsoft_assembly_source_files):\n for assembly_file in assembly_source_files:\n assert is_file_in_subdirect...
[ "0.6273379", "0.610558", "0.5990108", "0.5975442", "0.59727985", "0.5918797", "0.5813625", "0.57438725", "0.5667816", "0.56490386", "0.5627883", "0.55917925", "0.5557579", "0.55402726", "0.55304146", "0.55293643", "0.5524229", "0.5511834", "0.5504771", "0.55013037", "0.549722...
0.82752395
0
Assert that files are installed in GAC_MSIL.
def assert_assembly_files_are_installed(assembly_source_files, microsoft_assembly_source_files): for assembly_file in assembly_source_files: assert is_file_in_subdirectory("%s.dll"% assembly_file, WINDOWS_ASSEMBLY_GAC_MSIL_PATH + assembly_file), \ "%s file not found in directory %s" % (assembly_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mmelemental_imported():\n import sys\n\n assert \"mmelemental\" in sys.modules", "def test_check():\n for f in cfg.required_files:\n assert os.path.isfile(f)", "def test_network_lic_file_present(self):\n\n str_matlab_bin_path = self.host.check_output(\"readlink -f $(which matlab...
[ "0.5879728", "0.5766973", "0.5738156", "0.5738147", "0.569487", "0.56844616", "0.5623787", "0.5610653", "0.5580728", "0.5538616", "0.5493665", "0.54421926", "0.53928185", "0.53919005", "0.53829306", "0.5343697", "0.53233", "0.53141606", "0.5281856", "0.5258395", "0.5239167", ...
0.66300887
0
Simply apply the value_counts function to every column in a dataframe
def pandas_value_counts(df): return df.apply(pd.value_counts).fillna(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj_value_counts(df):\n df_obj = obj_df(df)\n for col in df_obj.columns:\n print(df_obj[col].value_counts())\n print('-'*100)", "def count(df):\r\n\r\n\tdf_count_dict = dict()\r\n\r\n\tfor i, col in enumerate(df.columns):\r\n\t\tdf_count_dict[col] = df[col].count()\r\n\r\n\tdf_count = pd....
[ "0.80173266", "0.7216902", "0.7100851", "0.6849541", "0.68442845", "0.67460424", "0.674539", "0.67321604", "0.66469705", "0.65439206", "0.6435983", "0.6374298", "0.63453734", "0.63453734", "0.63251334", "0.6316298", "0.6299988", "0.62826157", "0.62393385", "0.62360716", "0.62...
0.7974501
1
Generates a path based on url.
def generate_path(url, output_path='', site_root=''): path = [] if not site_root else [site_root.replace('/', '')] for item in url.split('/'): if item: path.append(item) if '.' not in path[-1] and path[-1].split('.'): path.append('index.html') return os.path.join(output_path,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_url(self, path):\n if not self.base_location:\n raise ValueError(\"No base_location set. Cannot construct url.\")\n\n if path:\n path = self._normalise_last_slashes(path)\n path = self._normalise_head_slashes(path)\n\n return \"\".join((self.base_loca...
[ "0.6959691", "0.6937469", "0.676501", "0.67328423", "0.6726451", "0.6627678", "0.65264916", "0.6452767", "0.64111346", "0.640524", "0.6360018", "0.63565695", "0.63565695", "0.6339681", "0.62146103", "0.6203177", "0.61992043", "0.61939573", "0.615887", "0.61470675", "0.6118694...
0.7457683
0
initialize a new contest with country name and db cursor.
def __init__(self, country, cursor): self.country = country self.cursor = cursor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_data_for_countries(db_data):\n countries = db_data.get('country')\n if countries is not None:\n rows = countries.get('data')\n for row in rows:\n country = Country(name=row)\n db_add_and_commit(db, country)", "def __init__(self, db, verbose, cand_id=None, visit_...
[ "0.660491", "0.6150415", "0.58685863", "0.5862052", "0.58298", "0.5803479", "0.57945013", "0.5729912", "0.5638307", "0.56267554", "0.56196684", "0.5617302", "0.5576676", "0.55443263", "0.5519045", "0.5514122", "0.5504914", "0.5501202", "0.5499147", "0.5491143", "0.54765165", ...
0.70173824
0
find a notebook, given its fully qualified name and an optional path This turns "foo.bar" into "foo/bar.ipynb" and tries turning "Foo_Bar" into "Foo Bar" if Foo_Bar does not exist.
def find_notebook(fullname, path=None): name = fullname.rsplit(".", 1)[-1] if not path: path = [""] for d in path: nb_path = os.path.join(d, name + ".ipynb") if os.path.isfile(nb_path): return nb_path # let import Notebook_Name find "Notebook Name.ipynb" n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve_nb_path(self, nb_path):\n if nb_path is None and self._notebook is not None:\n nb_path = self._notebook\n\n elif nb_path is None and glob(\"*.ipynb\"):\n notebooks = glob(\"*.ipynb\")\n assert len(notebooks) == 1, \"nb_path not specified and > 1 notebook ...
[ "0.7191861", "0.6188864", "0.6052213", "0.58972746", "0.5611016", "0.55624646", "0.54965943", "0.54194707", "0.54043365", "0.5306842", "0.52780384", "0.5267952", "0.5224945", "0.51331246", "0.51177615", "0.50909376", "0.50849307", "0.50610876", "0.504978", "0.50256366", "0.50...
0.815862
0
Function that tells if the given locale is supported by the Anaconda or not. We consider locales supported by the langtable as supported by the Anaconda.
def is_supported_locale(locale): en_name = get_english_name(locale) return bool(en_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Locale_IsAvailable(*args, **kwargs):\n return _gdi_.Locale_IsAvailable(*args, **kwargs)", "def IsAvailable(*args, **kwargs):\n return _gdi_.Locale_IsAvailable(*args, **kwargs)", "def language_supported(self, iso_lang=\"ca-ES\"): # -> bool\n test_lang = \"\"\n if len(iso_lang) == 0:\n...
[ "0.71748304", "0.67560184", "0.6504597", "0.6485453", "0.6169756", "0.6107829", "0.60411143", "0.58866775", "0.584165", "0.58095956", "0.57179374", "0.56090534", "0.55979425", "0.55623186", "0.5506499", "0.54679406", "0.543604", "0.54240453", "0.53689474", "0.53326595", "0.52...
0.7342547
0
Function that tells if the given locale can be displayed by the Linux console. The Linux console can display Latin, Cyrillic and Greek characters reliably, but others such as Japanese, can't be correctly installed.
def locale_supported_in_console(locale): locale_scripts = get_locale_scripts(locale) return set(locale_scripts).issubset(SCRIPTS_SUPPORTED_BY_CONSOLE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Locale_IsAvailable(*args, **kwargs):\n return _gdi_.Locale_IsAvailable(*args, **kwargs)", "def is_supported_locale(locale):\n\n en_name = get_english_name(locale)\n return bool(en_name)", "def _system_supports_plotting():\n if os.environ.get('ALLOW_PLOTTING', '').lower() == 'true':\n retur...
[ "0.6627515", "0.6607746", "0.6314651", "0.61852306", "0.6138253", "0.58053625", "0.57903194", "0.5744814", "0.5728713", "0.5654515", "0.56541127", "0.56338316", "0.5629812", "0.55803573", "0.5571935", "0.5560601", "0.5543277", "0.5521936", "0.5519573", "0.5507645", "0.5494354...
0.8039387
0
Function that tells if the given langcode matches the given locale. I.e. if all parts of appearing in the langcode (language, territory, script and encoding) are the same as the matching parts of the locale.
def langcode_matches_locale(langcode, locale): langcode_parts = parse_langcode(langcode) locale_parts = parse_langcode(locale) if not langcode_parts or not locale_parts: # to match, both need to be valid langcodes (need to have at least # language specified) return False # Che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_language_code(code):\n try:\n iso639.languages.get(part3=code)\n return True\n except KeyError:\n return False", "def find_best_locale_match(locale, langcodes):\n\n score_map = { \"language\" : 1000,\n \"territory\": 100,\n \"script\" ...
[ "0.67303485", "0.6682557", "0.64869493", "0.6195389", "0.57334167", "0.56621647", "0.5462071", "0.5413448", "0.53151387", "0.5269527", "0.5230982", "0.52007663", "0.5193894", "0.51931304", "0.51603484", "0.50795096", "0.5066487", "0.5033391", "0.50066024", "0.5000865", "0.499...
0.8122806
0
Find the best match for the locale in a list of langcodes. This is useful when e.g. pt_BR is a locale and there are possibilities to choose an item (e.g. rnote) for a list containing both pt and pt_BR or even also pt_PT.
def find_best_locale_match(locale, langcodes): score_map = { "language" : 1000, "territory": 100, "script" : 10, "encoding" : 1 } def get_match_score(locale, langcode): score = 0 locale_parts = parse_langcode(locale) langco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_language(lang_list=None):\n\tlang_codes = frappe.request.accept_languages.values()\n\tif not lang_codes:\n\t\treturn frappe.local.lang\n\n\tguess = None\n\tif not lang_list:\n\t\tlang_list = get_all_languages() or []\n\n\tfor l in lang_codes:\n\t\tcode = l.strip()\n\t\tif not isinstance(code, text_type):...
[ "0.6443872", "0.61079204", "0.61042756", "0.607895", "0.5849928", "0.5608303", "0.55125475", "0.5488135", "0.5405592", "0.5380822", "0.5371423", "0.5334464", "0.53292495", "0.5322359", "0.53013057", "0.52993584", "0.52987677", "0.52869475", "0.526974", "0.5255281", "0.5253893...
0.80921227
0
Procedure setting the system to use the given locale and store it in to the ksdata.lang object (if given). DOES NOT PERFORM ANY CHECKS OF THE GIVEN LOCALE. $LANG must be set by the caller in order to set the language used by gettext. Doing this in a threadsafe way is up to the caller. We also try to set a proper consol...
def setup_locale(locale, lang=None, text_mode=False): if lang: lang.lang = locale # not all locales might be displayable in text mode if text_mode: # check if the script corresponding to the locale/language # can be displayed by the Linux console # * all scripts for the giv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_i18n(lang, language=None):\n import gettext\n import locale\n import warnings\n import os\n\n try:\n locale.setlocale(locale.LC_ALL, lang)\n locale.setlocale(locale.LC_MESSAGES, language or lang)\n os.environ[\"LANG\"] = lang\n os.environ[\"LANGUAGE\"] = language ...
[ "0.71032214", "0.68969995", "0.6707774", "0.6667625", "0.6464172", "0.64197475", "0.63668007", "0.6360514", "0.6258837", "0.62177956", "0.621213", "0.6055772", "0.60205764", "0.59804237", "0.5965746", "0.59169", "0.58849823", "0.58773863", "0.56971943", "0.56550485", "0.56550...
0.79741156
0
Function returning english name for the given locale.
def get_english_name(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) name = langtable.language_name(languageId=parts["language"], territoryId=parts.get("territory", ""), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_native_name(locale):\n\n parts = parse_langcode(locale)\n if \"language\" not in parts:\n raise InvalidLocaleSpec(\"'%s' is not a valid locale\" % locale)\n\n name = langtable.language_name(languageId=parts[\"language\"],\n territoryId=parts.get(\"territory...
[ "0.7876312", "0.77180785", "0.7477184", "0.7409858", "0.7364249", "0.7325009", "0.7026951", "0.69422877", "0.693985", "0.6770859", "0.66346914", "0.65739375", "0.6378897", "0.6323452", "0.6313075", "0.62488353", "0.6085183", "0.60159516", "0.6012822", "0.5982879", "0.5909848"...
0.7984551
0
Function returning native name for the given locale.
def get_native_name(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) name = langtable.language_name(languageId=parts["language"], territoryId=parts.get("territory", ""), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_localized_name(name):\n locale = \"{}_{}\".format(\n name[\"preferredLocale\"][\"language\"],\n name[\"preferredLocale\"][\"country\"]\n )\n return name['localized'].get(locale, '')", "def get_language_name(self, locale: Locale | str | None = None) -> str | None:\n if locale...
[ "0.71125025", "0.69137526", "0.6904741", "0.6725412", "0.66430044", "0.6561066", "0.6556972", "0.65130925", "0.6500227", "0.6475753", "0.63275784", "0.6256066", "0.61634076", "0.61133057", "0.61010855", "0.60682327", "0.5996985", "0.5977526", "0.59572643", "0.58402485", "0.58...
0.8685434
0
Method that generates (i.e. returns a generator) available translations for the installer in the given localedir.
def get_available_translations(localedir=None): localedir = localedir or gettext._default_localedir # usually there are no message files for en messagefiles = sorted(glob.glob(localedir + "/*/LC_MESSAGES/anaconda.mo") + ["blob/en/blob/blob"]) trans_gen = (path.split(os.path.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_translations():\n if \"@lang\" in input.load_input():\n lang = input.get_lang()\n try:\n trad = gettext.GNUTranslations(open(\"../course/common_student/$i18n/\" + lang + \".mo\", \"rb\"))\n except FileNotFoundError:\n trad = gettext.NullTranslations()\n ...
[ "0.5978555", "0.5838234", "0.5805316", "0.57504076", "0.57090265", "0.5661206", "0.5586652", "0.55807585", "0.5530141", "0.5519474", "0.5516491", "0.5417705", "0.5306534", "0.5302171", "0.5248377", "0.5206404", "0.51667666", "0.5164295", "0.5140475", "0.5131287", "0.5125426",...
0.6989117
0
Function returning list of locales for the given territory. The list is sorted from the most probable locale to the least probable one (based on langtable's ranking.
def get_territory_locales(territory): return langtable.list_locales(territoryId=territory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_locales(self) -> List[str]:\n\n return self.possible_locale_list", "def translated_locales(self):\r\n return sorted(set(self.locales) - set([self.source_locale]))", "def sorted_languages():\n # Python 3: Use functools.cmp_to_key\n def compare(a, b):\n if a.name == u\"English\...
[ "0.6352298", "0.60188526", "0.5842274", "0.57512105", "0.5664816", "0.55907327", "0.55778724", "0.5497595", "0.54512554", "0.5121554", "0.5081006", "0.50800115", "0.5067049", "0.50165933", "0.50112844", "0.49681905", "0.49145204", "0.49050337", "0.48998576", "0.4832239", "0.4...
0.6169706
1
Function returning preferred keyboard layouts for the given locale.
def get_locale_keyboards(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) return langtable.list_keyboards(languageId=parts["language"], territoryId=parts.get("territory", ""), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_layout(keymap_c: str):\n lines = get_keymap(keymap_c)\n lines = remove_excess_white_space(lines)\n layout_strs = get_layouts_strs(lines)\n return get_layout_keys(layout_strs)", "def get_available_layouts(self):\n\n return self._layout_infos.iterkeys()", "def get_keyboard(self, name...
[ "0.60228944", "0.5637982", "0.55843544", "0.5231292", "0.5200092", "0.51659167", "0.4992071", "0.4957695", "0.4894653", "0.48928568", "0.48863006", "0.47528282", "0.47521296", "0.4738308", "0.46856064", "0.46499667", "0.46469063", "0.46232203", "0.46160245", "0.4595352", "0.4...
0.6866152
0
Function returning preferred timezones for the given locale.
def get_locale_timezones(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) return langtable.list_timezones(languageId=parts["language"], territoryId=parts.get("territory", ""), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timezone_list():\n return pytz.country_timezones('US')", "def Timezones():\n return sorted(list(PytzCache._zmap.values()))", "def get_timezones() -> set[str]:\n return available_timezones() - UNAVAILABLE_TIMEZONES", "def time_zones(self) -> localedata.LocaleDataDict:\n return self._da...
[ "0.72454035", "0.6603862", "0.65251845", "0.6270924", "0.5843416", "0.58044297", "0.57158774", "0.5713681", "0.5672513", "0.5667701", "0.5554293", "0.55500525", "0.5534162", "0.5358738", "0.5318892", "0.53160745", "0.5300022", "0.52912754", "0.52506125", "0.5232472", "0.52239...
0.72785544
0
Function returning locale's territory.
def get_locale_territory(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) return parts.get("territory", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_territory_name(self, locale: Locale | str | None = None) -> str | None:\n if locale is None:\n locale = self\n locale = Locale.parse(locale)\n return locale.territories.get(self.territory or '')", "def territories(self) -> localedata.LocaleDataDict:\n return self._d...
[ "0.6446209", "0.6410002", "0.610459", "0.60990167", "0.5954823", "0.58422744", "0.5822268", "0.56995887", "0.5688319", "0.5630719", "0.557179", "0.55118454", "0.54884374", "0.54781526", "0.5470992", "0.5453731", "0.54023576", "0.5325863", "0.53256893", "0.5282508", "0.5279689...
0.6819847
0
Function returning preferred console fonts for the given locale.
def get_locale_console_fonts(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) return langtable.list_consolefonts(languageId=parts["language"], territoryId=parts.get("territory",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAvailableFonts():\n return list(AVAILABLE_FONTS)", "def get_system_fonts():\n fonts = set()\n for x in font_manager.findSystemFonts():\n dot = x.rfind('.')\n slash = x.rfind(sep)\n x = x[slash + 1:dot]\n fonts.add(x)\n return sorted(fonts)", "def available_text_fo...
[ "0.6526404", "0.61930466", "0.61460704", "0.6015974", "0.59824073", "0.5922822", "0.58878744", "0.5753985", "0.56537426", "0.5618229", "0.5439051", "0.5422323", "0.54174143", "0.5331235", "0.53221977", "0.53221977", "0.53221977", "0.52959025", "0.5294225", "0.5262638", "0.526...
0.7950278
0
Function returning preferred scripts (writing systems) for the given locale.
def get_locale_scripts(locale): parts = parse_langcode(locale) if "language" not in parts: raise InvalidLocaleSpec("'%s' is not a valid locale" % locale) return langtable.list_scripts(languageId=parts["language"], territoryId=parts.get("territory", ""), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_script(script):\n languages_scripts = {\n 'arab': ('ara', 'per'),\n 'cyrl': ('bel', 'chu', 'mac', 'rus', 'srp', 'ukr'),\n 'grek': ('grc', 'gre'),\n 'hani': ('chi', 'jpn'),\n 'hebr': ('heb', 'lad', 'yid'),\n 'jpan': ('jpn', ),\n 'kore': ('kor', ),...
[ "0.6649128", "0.5827049", "0.57364774", "0.5626669", "0.55779046", "0.53860724", "0.5307141", "0.53032994", "0.5285117", "0.5285105", "0.5262619", "0.52498895", "0.5218934", "0.5216045", "0.52101284", "0.52076274", "0.5197666", "0.5140851", "0.5096763", "0.5073295", "0.506578...
0.67950034
0
Write language configuration to the $root/etc/locale.conf file.
def write_language_configuration(lang, root): try: fpath = os.path.normpath(root + LOCALE_CONF_FILE_PATH) with open(fpath, "w") as fobj: fobj.write('LANG="%s"\n' % lang.lang) except IOError as ioerr: msg = "Cannot write language configuration file: %s" % ioerr.strerror ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_config(lang):\n\n # ~~ create CONFIG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n put_file_content('CONFIG', ['2' if lang == 'en' else '1', '6', ''])\n return True", "def write_locales(config: Config) -> Config:\n strings_rendered = render_strings(reduce_strings(config.root))\n\n d...
[ "0.6383091", "0.5974715", "0.59279996", "0.5890416", "0.58505267", "0.58486074", "0.5719034", "0.57134926", "0.5584349", "0.5558312", "0.5506062", "0.54640675", "0.54373384", "0.54269797", "0.541539", "0.54020566", "0.5401911", "0.53910375", "0.5380744", "0.53300685", "0.5324...
0.848899
0
Procedure that returns the firmware language information (if any).
def get_firmware_language(text_mode=False): try: n = "/sys/firmware/efi/efivars/PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c" d = open(n, 'r', 0).read() except IOError: return None # the contents of the file are: # 4-bytes of attribute data that we don't care about # N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_language_info(self):\n # If the following does not find _lang_list, then it assumes \n # there are no defined languages. If it finds _lang_list and \n # _lang_c, and _lang_c is listed in _lang_list then it assumes \n # everything is correct. It only does further checking if \n ...
[ "0.6677828", "0.64402527", "0.6295128", "0.6291391", "0.62625706", "0.62259954", "0.61591226", "0.60692286", "0.605621", "0.5981005", "0.5974207", "0.5966141", "0.5956271", "0.59466666", "0.5931928", "0.59110105", "0.5824171", "0.58137363", "0.581215", "0.5801298", "0.5789102...
0.71954906
0
Try to set console font to the given value.
def set_console_font(font): log.debug("setting console font to %s", font) rc = execWithRedirect("setfont", [font]) if rc == 0: log.debug("console font set successfully to %s", font) return True else: log.error("setting console font to %s failed", font) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTTFont(font='default'):\n if font == 'default':\n font = 'Times New Roman' \n dislin.winfnt(font)", "def set_font(self, font='A'):\n upper = font.upper()\n if upper == 'B':\n self._set_print_mode(self.FONT_MASK)\n elif upper == 'A':\n self._unset_pr...
[ "0.70265186", "0.70135546", "0.69861555", "0.6951681", "0.6923162", "0.6910645", "0.68927073", "0.6834571", "0.6778966", "0.67207116", "0.67187274", "0.66070294", "0.66006804", "0.6571807", "0.6571661", "0.6523891", "0.6514027", "0.64832944", "0.647367", "0.64600194", "0.6459...
0.75561583
0
Clean and configure the local environment variables. This function will attempt to determine the desired locale and configure the process environment (os.environ) in the least surprising way. If a locale argument is provided, it will be attempted first. After that, this function will attempt to use the language environ...
def setup_locale_environment(locale=None, text_mode=False, prefer_environment=False): # pylint: disable=environment-modify # Look for a locale in the environment. If the variable is setup but # empty it doesn't count, and some programs (KDE) actually do this. # If prefer_environment is set, the enviro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initializeLocale():\n \n if sys.platform == constants.WIN32:\n locale.setlocale(locale.LC_ALL, \"\")\n else:\n if constants.LC_ALL in os.environ:\n try:\n locale.setlocale(locale.LC_ALL, os.environ[constants.LC_ALL])\n return\n except ...
[ "0.68579626", "0.65727067", "0.65229607", "0.61467046", "0.61113185", "0.5992732", "0.5751856", "0.5712392", "0.5593329", "0.5477767", "0.5438577", "0.5424868", "0.5334427", "0.53033906", "0.53014386", "0.5283837", "0.5225252", "0.5225252", "0.5225252", "0.5225252", "0.522525...
0.74926955
0
Tests to see if both locations are the same ie rank and file is the same.
def __eq__(self, other): if not isinstance(other, self.__class__): raise TypeError("Cannot compare other types with Location") return int(self.rank) == int(other.rank) and \ int(self.file) == int(other.file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_same_entry(entry_1, entry_2):\r\n if entry_1 == entry_2:\r\n return True\r\n if os.path.realpath(entry_1) == os.path.realpath(entry_2):\r\n return True\r\n if (os.path.basename(entry_1) == os.path.basename(entry_2) and\r\n (os.path.basename(os.path.dirname(entry_1)) ==\r\n ...
[ "0.6606223", "0.64625067", "0.6404751", "0.6316974", "0.62666816", "0.62198895", "0.6162294", "0.60664684", "0.603733", "0.6031126", "0.6018793", "0.5989421", "0.59823585", "0.5964671", "0.59412783", "0.5938612", "0.58751655", "0.5868189", "0.5863637", "0.58289623", "0.580593...
0.6970993
0
Returns if the move is on the board or not. If the rank and file are both in between 0 and 7, this method will return True.
def on_board(self): if -1 < self._rank < 8 and \ -1 < self._file < 8: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_board(self,pos : np.ndarray) -> bool:\r\n if 0 > pos[0] or pos[0] >= BOARD_SIZE:\r\n return False\r\n if 0 > pos[1] or pos[1] >= BOARD_SIZE:\r\n return False\r\n\r\n return True", "def is_on_board(self, r, c):\r\n return 0 <= r <= 7 and 0 <= c <= 7", "...
[ "0.702184", "0.6970916", "0.6834526", "0.6800029", "0.6766021", "0.67560077", "0.668015", "0.65668744", "0.6562663", "0.65373456", "0.65343285", "0.65004635", "0.64892584", "0.6485119", "0.64796084", "0.64721423", "0.6472055", "0.6472033", "0.6468038", "0.6465691", "0.6419337...
0.85112965
0
Shifts in direction provided by ``Direction`` enum.
def shift(self, direction): try: if direction == Direction.UP: return self.shift_up() elif direction == Direction.DOWN: return self.shift_down() elif direction == Direction.RIGHT: return self.shift_right() elif direc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift(self, direction):\n direct, pos = tuple(direction)\n\n board = {'L': self.rows, 'R': self.rows, 'D': self.cols, 'U': self.cols}[direct]\n board[int(pos)].shift(direction=self.direct[direct])", "def move(self, direction):\n pass", "def shiftDir(self, direction, n):\n ...
[ "0.774642", "0.692398", "0.6842757", "0.6679597", "0.66020656", "0.65728146", "0.6467691", "0.64622736", "0.64192796", "0.63760555", "0.63722444", "0.63722444", "0.6337595", "0.6268015", "0.62238383", "0.62154263", "0.61994225", "0.6179677", "0.6145385", "0.6136167", "0.61124...
0.7574775
1
Finds Location shifted up by 1
def shift_up(self, times=1): try: return Location(self._rank + times, self._file) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_down(self, times=1):\n try:\n return Location(self._rank - times, self._file)\n except IndexError as e:\n raise IndexError(e)", "def shift_up_right(self, times=1):\n try:\n return Location(self._rank + times, self._file + times)\n except Inde...
[ "0.6270554", "0.60757375", "0.60245186", "0.60240287", "0.60180974", "0.6000895", "0.5944027", "0.5933273", "0.59240323", "0.58775055", "0.58667123", "0.58546114", "0.58382297", "0.58361113", "0.5834758", "0.58302695", "0.57927275", "0.57927275", "0.57927275", "0.5768575", "0...
0.6417926
0
Finds Location shifted down by 1
def shift_down(self, times=1): try: return Location(self._rank - times, self._file) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_position(self):", "def take_step(self, location, direction):\n if direction == RIGHT:\n step_location = (location[0]+1,location[1])\n elif direction == DOWN:\n step_location = (location[0], location[1]+1)\n else:\n return location\n\n if s...
[ "0.61814827", "0.6127964", "0.6118851", "0.6116896", "0.61094475", "0.60757875", "0.60212976", "0.60003173", "0.5983816", "0.5965933", "0.5955165", "0.59535277", "0.59151417", "0.5878911", "0.5878911", "0.5878911", "0.5869491", "0.5867789", "0.5857768", "0.5830655", "0.577826...
0.6511327
0
Finds Location shifted right by 1
def shift_right(self, times=1): try: return Location(self._rank, self._file + times) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_down_right(self, times=1):\n try:\n return Location(self._rank - times, self._file + times)\n except IndexError as e:\n raise IndexError(e)", "def shift_up_right(self, times=1):\n try:\n return Location(self._rank + times, self._file + times)\n ...
[ "0.6389681", "0.62587845", "0.6254561", "0.6108448", "0.6070218", "0.6069615", "0.60360247", "0.60355735", "0.5927134", "0.58692807", "0.58327454", "0.5816636", "0.58158803", "0.5808757", "0.5802878", "0.5780936", "0.57805306", "0.57633096", "0.574295", "0.57252795", "0.56811...
0.64013916
0
Finds Location shifted left by 1
def shift_left(self, times=1): try: return Location(self._rank, self._file - times) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_down_left(self, times=1):\n try:\n return Location(self._rank - times, self._file - times)\n except IndexError as e:\n raise IndexError(e)", "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def _shift(self, s):\n start_pos = self._rela...
[ "0.6472017", "0.6380348", "0.6290659", "0.62783647", "0.6157998", "0.6058475", "0.6055237", "0.60299575", "0.59697723", "0.5902902", "0.5895752", "0.58797586", "0.5867567", "0.5864666", "0.5861478", "0.58449423", "0.5817147", "0.5814789", "0.5799366", "0.5786945", "0.5749039"...
0.65139586
0
Finds Location shifted up right by 1
def shift_up_right(self, times=1): try: return Location(self._rank + times, self._file + times) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_up(self, times=1):\n try:\n return Location(self._rank + times, self._file)\n except IndexError as e:\n raise IndexError(e)", "def upright(self):\n return Coord([self.x + 1, self.y - 1])", "def shift_down(self, times=1):\n try:\n return Loc...
[ "0.6286779", "0.6285358", "0.62705064", "0.62500006", "0.61474323", "0.61086285", "0.6047894", "0.6024152", "0.6012993", "0.59905976", "0.59783375", "0.59731233", "0.59724426", "0.59681296", "0.5835306", "0.5796514", "0.57926786", "0.5772637", "0.5772487", "0.5758451", "0.575...
0.6357913
0
Finds Location shifted up left by 1
def shift_up_left(self, times=1): try: return Location(self._rank + times, self._file - times) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_down_left(self, times=1):\n try:\n return Location(self._rank - times, self._file - times)\n except IndexError as e:\n raise IndexError(e)", "def shift_up(self, times=1):\n try:\n return Location(self._rank + times, self._file)\n except Index...
[ "0.63747233", "0.6306525", "0.62983286", "0.6265653", "0.620307", "0.6142705", "0.6125544", "0.61203617", "0.6104564", "0.60243714", "0.6014703", "0.60107845", "0.59468216", "0.5945145", "0.59078413", "0.5889049", "0.5889049", "0.5889049", "0.58886904", "0.58095354", "0.58086...
0.6393994
0
Finds Location shifted down right by 1
def shift_down_right(self, times=1): try: return Location(self._rank - times, self._file + times) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downright(self):\n return Coord([self.x + 1, self.y + 1])", "def shift_down(self, times=1):\n try:\n return Location(self._rank - times, self._file)\n except IndexError as e:\n raise IndexError(e)", "def upright(self):\n return Coord([self.x + 1, self.y - 1...
[ "0.6554093", "0.648883", "0.64419365", "0.6361129", "0.6267717", "0.6208789", "0.6115083", "0.61124676", "0.6071752", "0.6006999", "0.600069", "0.5999654", "0.5944346", "0.5940241", "0.5940005", "0.58752936", "0.5782369", "0.5772367", "0.5767407", "0.57642084", "0.5757818", ...
0.65386313
1
Finds Location shifted down left by 1
def shift_down_left(self, times=1): try: return Location(self._rank - times, self._file - times) except IndexError as e: raise IndexError(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def upleft(self):\n return Coord([self.x - 1, self.y - 1])", "def shift_down(self, times=1):\n try:\n return Location(self._rank - times, self._file)\n except IndexError as e:\n raise IndexError(e)...
[ "0.6744617", "0.6414325", "0.6344078", "0.62217546", "0.62195355", "0.61563265", "0.61307687", "0.61189425", "0.6075411", "0.60592055", "0.60378623", "0.6034514", "0.59856564", "0.59467053", "0.5927173", "0.58799267", "0.58688897", "0.58650124", "0.58649886", "0.5841106", "0....
0.65283656
1
return shopping cart detail
def cart_detail(request): cart = Cart(request) return render(request, 'cart/cart.html', {'cart': cart})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail(request):\n # del request.session['cart_id']\n # del request.session['total_in_cart']\n data = {}\n if (cart_id := request.session.get('cart_id', None)):\n cart = Cart.objects.get(pk=cart_id)\n data['products_in_cart'] = cart.cartitems.all()\n data['total_price'] = cart....
[ "0.80897045", "0.74780965", "0.74587524", "0.7386842", "0.73347443", "0.7275893", "0.7201817", "0.71161604", "0.7087134", "0.68783367", "0.68732184", "0.6833306", "0.6833306", "0.68280244", "0.6793842", "0.6793842", "0.6793842", "0.6753704", "0.6749037", "0.67163604", "0.6672...
0.79108906
1
Load the indexes listed in this dataset's image set file.
def _load_image_set_index(self): image_index = [] image_set_file = self.data_dir \ + "/ImageSets/{}.txt".format(self.mode) assert os.path.exists(image_set_file), \ 'Path does not exist: {}'.format(image_set_file) with open(image_set_file, 'r') as f: f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_image_set_index(self):\n image_set_file = os.path.join(self._data_path, 'ImageSets', 'Main',\n self._image_set + '.txt')\n assert os.path.exists(image_set_file), \\\n 'Path does not exist: {}'.format(image_set_file)\n with open(image_se...
[ "0.8110825", "0.80748975", "0.80505925", "0.80249274", "0.80228895", "0.7933334", "0.76450604", "0.74506855", "0.69827074", "0.6790647", "0.66879445", "0.65021986", "0.65021986", "0.64863884", "0.6448904", "0.63080627", "0.62396497", "0.6179855", "0.6103942", "0.60800034", "0...
0.8145496
0
Calls the `to_pipeline` method on itself.
def pipeline(self) -> Pipeline: if self._to_pipeline is None: raise AttributeError( "pipeline not available because `to_pipeline` was not set on __init__." ) return self._to_pipeline(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipeline(self):\n # gotta avoid circular imports by deferring\n from .pipeline import Pipeline\n return Pipeline().from_source(self._collection)", "def run(self):\n pipeline = set_pipeline()\n pipeline.fit(self.X_train, self.y_train)\n return pipeline", "def pipeli...
[ "0.6798451", "0.6618348", "0.65910554", "0.65910554", "0.6581963", "0.6552421", "0.641886", "0.6402468", "0.63573986", "0.63514197", "0.6336858", "0.62606335", "0.62050164", "0.6182921", "0.6109646", "0.60787505", "0.6045552", "0.60202897", "0.6011419", "0.6011088", "0.600779...
0.7730287
0
Lists all primitive nodes, starting with the Individual's main node.
def primitives(self) -> List[PrimitiveNode]: primitives = [self.main_node] current_node = self.main_node._data_node while isinstance(current_node, PrimitiveNode): # i.e. not DATA_TERMINAL primitives.append(current_node) current_node = current_node._data_node retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_nodes(self):\n return self.ironic_client.node.list()", "def nodes(self): \n return [n for n in self.iternodes()]", "def list_nodes(self, type_):\n raise NotImplementedError()", "def displayNode(self):\n for x in self.__node:\n print(x)", "def node_list(ctx):\...
[ "0.6407321", "0.6391654", "0.63787967", "0.6297833", "0.62783486", "0.6180489", "0.6174722", "0.6101564", "0.6089356", "0.60265636", "0.59619343", "0.5940407", "0.59089303", "0.59052485", "0.58955514", "0.5893381", "0.58924395", "0.5887432", "0.5851083", "0.5831555", "0.58175...
0.7425432
0
Lists all terminals connected to the Individual's primitive nodes.
def terminals(self) -> List[Terminal]: return [terminal for prim in self.primitives for terminal in prim._terminals]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminals(self):\n\n return self._terminals.getSlice(0)", "def terminals(self):\n\n return self._terminals.getSlice(0)", "def terminals(self):\n unique_nodes, unique_counts = np.unique(self.edges, return_counts=True)\n return unique_nodes[ unique_counts == 1 ]", "def terminals(self) -...
[ "0.6630996", "0.6630996", "0.6356642", "0.6237207", "0.6134914", "0.59288365", "0.5890043", "0.5884904", "0.5793998", "0.57869047", "0.57813084", "0.5745473", "0.5714512", "0.5654323", "0.5578676", "0.54320294", "0.5428282", "0.54231596", "0.53973806", "0.53786254", "0.537161...
0.72116995
0
Replace the terminal at `position` by `new_terminal` inplace.
def replace_terminal(self, position: int, new_terminal: Terminal) -> None: scan_position = 0 for primitive in self.primitives: if scan_position + len(primitive._terminals) > position: terminal_to_be_replaced = primitive._terminals[position - scan_position] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_position(board: Board, position: Position, character: str) -> Board:\n board = list(board)\n \n row = board[position[0]]\n new_row = row[:position[-1]] + character + row[position[-1] + 1:]\n board[position[0]] = new_row\n\n board = tuple(board) \n\n return board", "def reset_po...
[ "0.59610856", "0.57170063", "0.56611526", "0.5623337", "0.53372204", "0.5206256", "0.5122167", "0.5102501", "0.50833666", "0.5053095", "0.50475603", "0.504088", "0.5039403", "0.50336826", "0.50032115", "0.49785298", "0.49696037", "0.4960981", "0.49289528", "0.49156287", "0.49...
0.7815409
0
Replace the PrimitiveNode at `position` by `new_primitive`.
def replace_primitive(self, position: int, new_primitive: PrimitiveNode): last_primitive = None for i, primitive_node in enumerate(self.primitives): if i == position: if primitive_node._primitive.output != new_primitive._primitive.output: raise ValueError(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_terminal(self, position: int, new_terminal: Terminal) -> None:\n scan_position = 0\n for primitive in self.primitives:\n if scan_position + len(primitive._terminals) > position:\n terminal_to_be_replaced = primitive._terminals[position - scan_position]\n ...
[ "0.57029593", "0.55897343", "0.51725495", "0.50479764", "0.5024666", "0.49654397", "0.48944867", "0.48825198", "0.4826908", "0.48052645", "0.47664177", "0.47615296", "0.4702991", "0.46913335", "0.46813706", "0.46742797", "0.46691516", "0.4666951", "0.4660286", "0.46550384", "...
0.8847874
0
Construct an Individual from its `pipeline_str` representation.
def from_string( cls, string: str, primitive_set: dict, to_pipeline: Optional[Callable] = None, strict: bool = True, ) -> "Individual": expression = PrimitiveNode.from_string(string, primitive_set, strict) return cls(expression, to_pipeline=to_pipeline)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_str(cls, string):", "def on_pipeline_from_string(code: str) -> PipelineInspectorBuilder:\n return PipelineInspectorBuilder(python_code=code)", "def from_str(cls, s):\n raise NotImplementedError", "def from_string(cls, string):\n normalised = cls.normalise_string(string)\n ...
[ "0.61646575", "0.59634817", "0.5879963", "0.5879679", "0.574354", "0.56137294", "0.5543158", "0.5537403", "0.5508447", "0.5491343", "0.5461753", "0.5400685", "0.5326605", "0.52744126", "0.525887", "0.52570957", "0.5246513", "0.52418774", "0.5240452", "0.52136445", "0.51783484...
0.7422873
0
Generate C API RST as string
def gen_capi(args): if not args.header: return "" cmd = ["ctags", "-x", "--c-kinds=fpsgx", args.header] process = Popen(cmd, stdout=PIPE, stderr=PIPE) out, err = process.communicate() if process.returncode: return "" titles = { "nvm_geo": "Geometry", "nvm_buf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DocString():\n return", "def gen_rst(txt):\n res = \"\"\n title_block = get_title_block(txt)\n title_rst = gen_title_rst(title_block)\n res += title_rst\n # add a blank line just to be sure\n res += \"\\n\"\n fun_blocks = get_fun_blocks(txt)\n for (name, fun_block) in fun_blocks:\n...
[ "0.6348354", "0.61365306", "0.604517", "0.5923929", "0.5889454", "0.58836114", "0.58230215", "0.5807948", "0.57579327", "0.5728273", "0.5695438", "0.5687779", "0.56875557", "0.5671", "0.56369007", "0.5624715", "0.55779654", "0.55236787", "0.5504747", "0.5488637", "0.54666436"...
0.61944115
1
Generates code for lhs_ast = new_ast, where new_ast is an array initializer of either Type[expr1][expr2]...[exprN] or { { { ... } } }. Currently on supports Type[expr1]
def new_array(lhs_ast, new_ast): assert(new_ast.tag == 'NEW_ARRAY') rank = new_ast.rank assert(rank > 0) type_name = new_ast.type_name array_var = checker.new_temp() env = {} template = '{\n' template += 'var %s%s %s;\n' % (type_name, '[]'*rank, array_var) if rank == 1: templ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAstNode_newTypeInstance(funcEnv, objType, argAst=None, argType=None):\n interpreter = funcEnv.interpreter\n origObjType = objType\n while isinstance(objType, CTypedef):\n objType = objType.type\n while isinstance(argType, CTypedef):\n argType = argType.type\n\n if isinstance(obj...
[ "0.53399026", "0.5122241", "0.51023453", "0.50702715", "0.5011889", "0.49890527", "0.49315548", "0.49182403", "0.48647463", "0.48503703", "0.48396584", "0.48342964", "0.48304525", "0.4830084", "0.482372", "0.48142827", "0.48136747", "0.47997293", "0.4798387", "0.4798273", "0....
0.65886825
0
Creates a shared matrix or vector using the given in_size and out_size. Inputs
def create_shared(out_size, in_size=None, name=None): if in_size is None: return theano.shared(np.zeros((out_size, ),dtype=theano.config.floatX), name=name) else: return theano.shared(np.zeros((out_size, in_size),dtype=theano.config.floatX), name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_to_matrix(input, output_shape):\n output_h, output_w = output_shape\n output = np.zeros(output_shape, dtype=input.dtype)\n for i in range(output_h):\n st = i*output_w\n nd = st + output_w\n output[i, :] = input[st:nd]\n # flip the output matrix up-down to get correct res...
[ "0.5724623", "0.57070524", "0.5683393", "0.55953485", "0.54363215", "0.54331064", "0.53848374", "0.53823334", "0.5342572", "0.5305575", "0.52464527", "0.52179205", "0.51994514", "0.51989526", "0.5182485", "0.5149679", "0.5126486", "0.5121966", "0.5120387", "0.51178217", "0.51...
0.74856454
0
Execute the query in database. con is a SQLite connection and query is a string. Returns a dict with the query, the rows and column's names in the description item.
def execute(con, query): c = con.cursor() data = {} data['query'] = query data['rows'] = None data["description"] = None data['error'] = None try: data['rows'] = c.execute(query).fetchall() or None data["description"] = c.description or None except Exception as e: data['error'] = str(e) return json.dumps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(query: str):\r\n try:\r\n global connection\r\n global cursor\r\n\r\n cursor.execute(query)\r\n records = cursor.fetchall()\r\n connection.commit()\r\n return records\r\n\r\n except sqlite3.Error as error:\r\n logger.error(f\"Error while connecting...
[ "0.6735245", "0.667364", "0.6655871", "0.65157926", "0.64183664", "0.6412074", "0.64018434", "0.6384665", "0.63658595", "0.63307995", "0.63086003", "0.6293174", "0.62854195", "0.62713844", "0.6236288", "0.6202163", "0.6181412", "0.61524445", "0.61452717", "0.6130225", "0.6129...
0.72614986
0
Will attempt to parse out the title of a movie given a file name that contains the movie title. Most useful for torrented movies that follow a particular naming scheme
def parse_movie_title(file_name): movie_name = os.path.basename(file_name) movie_name = parsers.remove_extension(file_name) movie_name = movie_name.lower() movie_name = parsers.fix_word_seperators(movie_name) movie_name = parsers.remove_tags(movie_name) movie_name = parsers.remove_resolution(movie_name) movie_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_manga_title(filename):\n print_info('Attempting to parse manga title from {0}'.format(filename))\n for regex in MANGA_TITLE_REGEX:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_title = m.group('Series')\n return clean_episode_titl...
[ "0.7444756", "0.7063565", "0.70005333", "0.68266726", "0.66763353", "0.6623276", "0.6516655", "0.6300323", "0.6278855", "0.62699896", "0.6266796", "0.6234666", "0.62332964", "0.6214932", "0.6211282", "0.6099446", "0.60892713", "0.6073653", "0.6051425", "0.60418546", "0.597446...
0.86128676
0
Retrieve wall time from cloudinit metadata. CloudInit saves all passed metadata into a cloudinit.sources.DataSource object with attribute 'metadata' A DataSourceOpenStack object stores information on additional metadata in a subdictionary 'meta'.
def get_times(): try: with open("/var/lib/cloud/instance/obj.pkl", "r") as file_: data = pickle.load(file_) except IOError: return meta = data.metadata.get("meta") if meta is None: raise EnvironmentError("Wrong virtualization environment.") keys = [x for x in me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wall_time(self):", "def _update_metadata_date(self, properties):\n if \"core\" not in properties:\n properties.core = Struct()\n properties.core.metadata_date = self._backend.server_time_utc()", "def meta_data(date):\n return {'sourceDate': datetime.strptime(date, '%a, %d %b %Y ...
[ "0.5747218", "0.5261601", "0.5219078", "0.518085", "0.5073197", "0.5068388", "0.5050664", "0.4977583", "0.49501786", "0.49469298", "0.49465525", "0.49380222", "0.49379975", "0.4932889", "0.49007112", "0.48968756", "0.48864484", "0.48787802", "0.48739028", "0.48662192", "0.485...
0.6368934
0
Save walltime information to system variables WALLTIME & BOOTTIME. Values by default are stored in /etc/environment, discarding old wall/boottime entries, preserving the rest.
def save_env(wall_time_=None, start_time_=None, environment_file="/etc/environment"): if not os.access(environment_file, os.W_OK): raise EnvironmentError("Can't write to %s" % environment_file) with open(name=environment_file, mode="r") as file_: # keep results != WALLTIME/BOOTTIME cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_walltime(self):\n\n walltime = time.time() - self._start_time\n with open(self._walltime_path, 'w') as f:\n f.write(str(walltime) + \"\\n\")", "def set_walltime(self, walltime: str) -> None:\n if not self.batch:\n raise SmartSimError(\"Not running as batch, can...
[ "0.7262268", "0.6065319", "0.59060913", "0.58288807", "0.56810534", "0.5605353", "0.5567082", "0.5476224", "0.5462885", "0.545563", "0.54304385", "0.5336938", "0.53221285", "0.5315285", "0.52749306", "0.52722496", "0.5256955", "0.51557994", "0.51556337", "0.51247483", "0.5083...
0.7155372
1
recs is array of Preverb objects
def write_preverbs(recs,fileout): fout = codecs.open(fileout,'w') n = 0 nadj=0 for rec in recs: L = rec.L # headword record number hw = rec.hw # the headword pfx = rec.pfx # the preverb prefixes pfxhw = rec.pfxhw linenum = rec.linenum out = "%s:%s:%s:%s:%s" %(L,hw,pfx,pfxhw,linenum) fout.write(out + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_rec(filename):\n tree = et.parse(filename)\n objects = []\n for obj in tree.findall('object'):\n obj_struct = {}\n obj_struct['name'] = obj.find('name').text\n obj_struct['pose'] = obj.find('pose').text\n obj_struct['truncated'] = int(obj.find('truncated').text)\n ...
[ "0.5232923", "0.5217052", "0.51894987", "0.51644367", "0.5116569", "0.5047526", "0.50373435", "0.50315493", "0.50176704", "0.49668643", "0.48515674", "0.48328376", "0.48281032", "0.48136282", "0.4806055", "0.48041537", "0.47668582", "0.4759249", "0.47503585", "0.47404984", "0...
0.5888206
0
Yield sample analysis results fetched from the server.
def get_analysis_results(self, cache=True): if cache and self._get_result_cache: for ar in self._get_result_cache: yield ar return url = f'sample_ars?sample_id={self.uuid}' result = self.knex.get(url) for result_blob in result['results']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n if self.random_seeds: \n self._validate_random_seeds()\n seed_iter = list(map(iter,self.random_seeds))\n nsamples = len(self.random_seeds[0])\n else:\n seed_iter = None\n nsamples = self.numsamples\n self._set_meta_fe...
[ "0.6731637", "0.6690499", "0.66678214", "0.6459945", "0.6429607", "0.64113545", "0.6407596", "0.6363508", "0.6355756", "0.6331724", "0.6320033", "0.6299205", "0.62114656", "0.6101482", "0.6099996", "0.6096582", "0.60882914", "0.6019894", "0.59304935", "0.59299564", "0.5867920...
0.73539895
0
Return a manifest for this sample.
def get_manifest(self): url = f'samples/{self.uuid}/manifest' return self.knex.get(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_manifest(self):\r\n if os.path.exists(self.manifestfile):\r\n return Manifest(json.loads(file(self.manifestfile).read()))\r\n return Manifest({})", "def get_manifest(self):\n return self.manifest", "def manifest(self) -> pulumi.Output[Optional[Mapping[str, Any]]]:\n ...
[ "0.7615293", "0.75619924", "0.7228468", "0.69406515", "0.67661595", "0.6721726", "0.67200625", "0.6517161", "0.65150267", "0.65150267", "0.6418849", "0.64011556", "0.632388", "0.6211856", "0.61604166", "0.61489534", "0.60881954", "0.6037556", "0.59305507", "0.58315796", "0.58...
0.814788
0
Returns the canvas size in pixels.
def getCanvasSize(): return canvas.winfo_width(), canvas.winfo_height()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self):\n return self.screen.get_size()", "def canvas_size(self):\r\n width = height = 0\r\n for image in self.images:\r\n x = image.x + image.absolute_width\r\n y = image.y + image.absolute_height\r\n if width < x:\r\n width = x\r\n...
[ "0.76065636", "0.7291654", "0.72000766", "0.71854603", "0.71594596", "0.7155651", "0.7155651", "0.7099896", "0.70850754", "0.70767885", "0.7060285", "0.7034011", "0.7029985", "0.7029985", "0.7029985", "0.7029985", "0.7029985", "0.7029985", "0.7029985", "0.69946253", "0.698392...
0.8923893
0
Saves a python object to path (in filesytem).
def save_object(path,object): with open(path,"wb") as f: pickle.dump(object,f,pickle.HIGHEST_PROTOCOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_obj(obj, path ):\n with open(path, 'wb') as f:\n pickle.dump(obj, f)", "def save_obj(obj, path: str):\n with open(path, 'wb') as h:\n pickle.dump(obj, h)", "def save_object(obj, fpath):\r\n with open(fpath, 'wb') as o:\r\n pickle.dump(obj, o)", "def picklesave(obj, path...
[ "0.8127162", "0.80762535", "0.79843014", "0.7827321", "0.7706124", "0.76796144", "0.76796144", "0.76796144", "0.7668016", "0.7657294", "0.7656872", "0.7633103", "0.75708205", "0.74377614", "0.74298906", "0.7400824", "0.73958284", "0.7359934", "0.73415333", "0.73415333", "0.73...
0.8243574
0
loads a python object from path (in filesytem).
def load_object(path): with open(path,"rb") as f: object = pickle.load(f) return object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_object(path):\n\n try:\n dot = path.rindex('.')\n except ValueError:\n raise ValueError(\"Error loading object '%s': not a full path\" % path)\n\n module, name = path[:dot], path[dot + 1:]\n mod = import_module(module)\n\n try:\n obj = getattr(mod, name)\n except Att...
[ "0.821035", "0.8207554", "0.8137635", "0.8132656", "0.8068644", "0.8003069", "0.8003069", "0.7993919", "0.78682834", "0.78477365", "0.7648063", "0.7589315", "0.7433589", "0.74033934", "0.7324059", "0.72719944", "0.7229998", "0.7194066", "0.7148879", "0.71485585", "0.70853275"...
0.829935
0
Returns a list of values filled with random numbers. The number of elements changes each time the function is called
def get_value_list(): return [some_random_number() for _ in range(some_random_number())]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_numbers():\n\n return random.sample(range(100), 10)", "def individual(min_val, max_val):\n value_list = [i for i in range(min_val, max_val+1)] #generate a list of 1 to 10\n random.shuffle(value_list) #shuffle the list\n return value_list", "def newList(self):\n lst = []\n ...
[ "0.750624", "0.7490539", "0.7296255", "0.7264398", "0.72286063", "0.721338", "0.717384", "0.71707714", "0.7136113", "0.71132106", "0.7103014", "0.7091646", "0.70703304", "0.7049899", "0.703982", "0.6956948", "0.694967", "0.6850403", "0.68373185", "0.6828457", "0.68178284", ...
0.80803955
0
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the default algorithm.
def test_encryption_cycle_default_algorithm_non_framed(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=0, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_default_algorithm_non_framed_no_encryption_context(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"], key_provider=self.kms_master_key_provider, frame_length=0\n )\n plaintext, _ = aws_encryption_sdk.decrypt(source=ciph...
[ "0.72198886", "0.70477796", "0.703508", "0.692355", "0.68278927", "0.6626544", "0.6580773", "0.65805084", "0.6580006", "0.6514737", "0.6499495", "0.64881426", "0.64735883", "0.6394814", "0.6348888", "0.6316184", "0.62909734", "0.6271909", "0.6263519", "0.6253984", "0.625003",...
0.7250217
0
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the default algorithm.
def test_encryption_cycle_default_algorithm_non_framed_no_encryption_context(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, frame_length=0 ) plaintext, _ = aws_encryption_sdk.decrypt(source=ciphertext, key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_default_algorithm_non_framed(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=0,\n ...
[ "0.72509044", "0.7048452", "0.7035682", "0.69241333", "0.68283325", "0.6627613", "0.6581378", "0.65806115", "0.658028", "0.65148526", "0.6499561", "0.6489213", "0.6473501", "0.63943124", "0.6348847", "0.63158214", "0.6292437", "0.62737685", "0.6263489", "0.6254395", "0.625021...
0.7220198
1
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the default algorithm.
def test_encryption_cycle_default_algorithm_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=1024, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_default_algorithm_multiple_frames(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"] * 100,\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_len...
[ "0.71647835", "0.6868584", "0.67947006", "0.67754734", "0.66704136", "0.6647159", "0.6578349", "0.6536304", "0.6478507", "0.6441947", "0.64351726", "0.64146996", "0.63911974", "0.6362077", "0.63369554", "0.63120055", "0.62790716", "0.62682337", "0.62535655", "0.62238795", "0....
0.7332935
0
Test that the enrypt/decrypt cycle completes successfully for a framed message with multiple frames using the default algorithm.
def test_encryption_cycle_default_algorithm_multiple_frames(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"] * 100, key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=1024, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_default_algorithm_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=1024,...
[ "0.7067218", "0.6682916", "0.66145265", "0.65793484", "0.6564629", "0.64674115", "0.643743", "0.64061713", "0.6394333", "0.63934284", "0.63829815", "0.6313884", "0.63053197", "0.630154", "0.6298164", "0.6282151", "0.62698716", "0.6220615", "0.61705005", "0.6101196", "0.610002...
0.7274183
0
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the aes_128_gcm_iv12_tag16 algorithm.
def test_encryption_cycle_aes_128_gcm_iv12_tag16_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=1024, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=...
[ "0.83253515", "0.8318194", "0.8020325", "0.79975146", "0.79973", "0.79532135", "0.78981006", "0.7864936", "0.7814415", "0.78118306", "0.77208996", "0.7692941", "0.7652597", "0.7610188", "0.7565554", "0.7534197", "0.74828565", "0.66384315", "0.6446058", "0.61986744", "0.617998...
0.83224666
1
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the aes_128_gcm_iv12_tag16 algorithm.
def test_encryption_cycle_aes_128_gcm_iv12_tag16_non_framed(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=0, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_non_framed(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=0,...
[ "0.8125926", "0.812481", "0.78688955", "0.78336215", "0.78271556", "0.7804262", "0.77557755", "0.77254546", "0.7697716", "0.7648585", "0.75668395", "0.7490993", "0.740553", "0.7383814", "0.73778427", "0.7327657", "0.7217686", "0.6693059", "0.6647088", "0.6601028", "0.6460592"...
0.81351954
0
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the aes_192_gcm_iv12_tag16 algorithm.
def test_encryption_cycle_aes_192_gcm_iv12_tag16_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=1024, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_256_gcm_iv12_tag16_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=...
[ "0.82340854", "0.81368446", "0.8037293", "0.794402", "0.7889821", "0.78590316", "0.772915", "0.77018535", "0.76803374", "0.7665735", "0.75949967", "0.752944", "0.7509843", "0.74839497", "0.74594146", "0.7330118", "0.73176104", "0.6417498", "0.62863433", "0.6270313", "0.598979...
0.8333003
0
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the aes_192_gcm_iv12_tag16 algorithm.
def test_encryption_cycle_aes_192_gcm_iv12_tag16_non_framed(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=0, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_256_gcm_iv12_tag16_non_framed(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=0,...
[ "0.8052337", "0.7957958", "0.78567165", "0.77485675", "0.7733715", "0.7628773", "0.76000386", "0.75640064", "0.75172585", "0.7472284", "0.74037635", "0.73793584", "0.7221947", "0.71908444", "0.7173333", "0.71495783", "0.7008892", "0.6746724", "0.6503002", "0.64997023", "0.645...
0.8143048
0
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the aes_256_gcm_iv12_tag16 algorithm.
def test_encryption_cycle_aes_256_gcm_iv12_tag16_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=1024, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=...
[ "0.82659876", "0.8149171", "0.7972375", "0.7958142", "0.7951207", "0.7863249", "0.78558993", "0.7819351", "0.77480054", "0.7725433", "0.770075", "0.7648856", "0.7616764", "0.75784475", "0.7509083", "0.74368125", "0.7422427", "0.65046304", "0.63733006", "0.6131729", "0.6083416...
0.82665855
0
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the aes_256_gcm_iv12_tag16 algorithm.
def test_encryption_cycle_aes_256_gcm_iv12_tag16_non_framed(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=0, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_non_framed(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n frame_length=0,...
[ "0.80557966", "0.79471004", "0.7786498", "0.77632356", "0.7734715", "0.77075064", "0.76572573", "0.76069474", "0.7582958", "0.75700486", "0.7485742", "0.74492884", "0.7329467", "0.7287656", "0.7265688", "0.7225671", "0.7110978", "0.6608641", "0.65697694", "0.64846396", "0.640...
0.8068432
0
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the aes_192_gcm_iv12_tag16_hkdf_sha256 algorithm.
def test_encryption_cycle_aes_192_gcm_iv12_tag16_hkdf_sha256_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=10...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_256_gcm_iv12_tag16_hkdf_sha256_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n f...
[ "0.8300203", "0.82431793", "0.8080313", "0.80119574", "0.7955447", "0.7933083", "0.79175746", "0.7875227", "0.78650355", "0.7831236", "0.77585673", "0.7638734", "0.7600599", "0.7563252", "0.75303715", "0.7509076", "0.7427312", "0.6463067", "0.63739026", "0.62837136", "0.60598...
0.83834475
0
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the aes_192_gcm_iv12_tag16_hkdf_sha256 algorithm.
def test_encryption_cycle_aes_192_gcm_iv12_tag16_hkdf_sha256_non_framed(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_256_gcm_iv12_tag16_hkdf_sha256_non_framed(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n fra...
[ "0.8106477", "0.8044833", "0.7915947", "0.7796911", "0.7775928", "0.77545696", "0.77477324", "0.7743791", "0.774213", "0.7659902", "0.76441413", "0.753039", "0.7520855", "0.7500556", "0.74554074", "0.7379598", "0.73441225", "0.6818662", "0.65952843", "0.65744424", "0.6453497"...
0.8183349
0
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the aes_256_gcm_iv12_tag16_hkdf_sha256 algorithm.
def test_encryption_cycle_aes_256_gcm_iv12_tag16_hkdf_sha256_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=10...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_hkdf_sha256_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n f...
[ "0.8349734", "0.8254614", "0.8019414", "0.801054", "0.7972647", "0.7942672", "0.7920008", "0.7875361", "0.78438544", "0.77628016", "0.77153695", "0.7620499", "0.76162994", "0.758943", "0.74901235", "0.73929536", "0.7372713", "0.6539147", "0.6385468", "0.623899", "0.60363567",...
0.8321763
1
Test that the enrypt/decrypt cycle completes successfully for a nonframed message using the aes_256_gcm_iv12_tag16_hkdf_sha256 algorithm.
def test_encryption_cycle_aes_256_gcm_iv12_tag16_hkdf_sha256_non_framed(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], frame_length=0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_hkdf_sha256_non_framed(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n fra...
[ "0.8120955", "0.80299413", "0.7859964", "0.77964133", "0.77957535", "0.7729641", "0.7724217", "0.7703868", "0.76865077", "0.76191044", "0.7574905", "0.754382", "0.74360013", "0.7435429", "0.73939097", "0.73673207", "0.72987735", "0.6695215", "0.6554786", "0.6514424", "0.64927...
0.81052995
1
Test that the enrypt/decrypt cycle completes successfully for a single frame message using the aes_192_gcm_iv12_tag16_hkdf_sha384_ecdsa_p384 algorithm.
def test_encryption_cycle_aes_192_gcm_iv12_tag16_hkdf_sha384_ecdsa_p384_single_frame(self): ciphertext, _ = aws_encryption_sdk.encrypt( source=VALUES["plaintext_128"], key_provider=self.kms_master_key_provider, encryption_context=VALUES["encryption_context"], fram...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encryption_cycle_aes_192_gcm_iv12_tag16_hkdf_sha256_single_frame(self):\n ciphertext, _ = aws_encryption_sdk.encrypt(\n source=VALUES[\"plaintext_128\"],\n key_provider=self.kms_master_key_provider,\n encryption_context=VALUES[\"encryption_context\"],\n f...
[ "0.8205865", "0.8129983", "0.8120724", "0.8086859", "0.8070674", "0.79456544", "0.79447645", "0.794005", "0.7914017", "0.7858736", "0.78543276", "0.7836834", "0.780984", "0.7741609", "0.7599251", "0.7597625", "0.75322336", "0.6708555", "0.65327346", "0.63315946", "0.6212951",...
0.8223634
0
Get key for metrics list
def get_metrics_key(self, project): return "{0}-metrics".format(project)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column_key(label: Tuple[str, ...], metrics: List[str]) -> Tuple[Any, ...]:\n parts: List[Any] = list(label)\n metric = parts[-1]\n parts[-1] = metrics.index(metric)\n return tuple(parts)", "def metric_identifier(self) -> str:\n return self._metric_identifier", "def key(key):\n ...
[ "0.64254856", "0.6350569", "0.63114125", "0.6273934", "0.6273934", "0.6222081", "0.6210373", "0.61114717", "0.60946375", "0.60946375", "0.6091866", "0.60288227", "0.60165614", "0.6011354", "0.59872615", "0.5983219", "0.5978787", "0.5976253", "0.5976253", "0.59761053", "0.5976...
0.69156116
0
Get key for metrics filters names
def get_filters_names_key(self, project, metric_name): return u"{0}-metrics-filters:{1}".format(project, to_unicode(metric_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filters_values_key(self, project, metric_name, f):\n return u\"{0}-metrics-filter-values:{1}:{2}\".format(project,\n to_unicode(metric_name),\n to_unicode(f))", "def get_filter_name(...
[ "0.7208164", "0.68630666", "0.5900287", "0.58664966", "0.5773699", "0.57675856", "0.57655513", "0.5757507", "0.57541454", "0.5703139", "0.5664727", "0.5664727", "0.5664727", "0.5664727", "0.5664727", "0.5664727", "0.5664727", "0.5664727", "0.5664727", "0.5615112", "0.5581076"...
0.8068788
0
Convert filter value to string object
def clean_filter_value(self, filter_value): if isinstance(filter_value, bool) or isinstance(filter_value, NoneType): return str(bool) return filter_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filterDictToStr(self, filterDict):\n values = []\n for key, vals in filterDict.items():\n if key not in ('contentRating', 'label', 'contentRating!', 'label!'):\n raise BadRequest(f'Unknown filter key: {key}')\n values.append(f\"{key}={'%2C'.join(vals)}\")\n ...
[ "0.7072729", "0.6677008", "0.63663065", "0.63333833", "0.6180153", "0.6167613", "0.6098829", "0.60581315", "0.60311866", "0.60164213", "0.6016281", "0.60055685", "0.5987304", "0.5948737", "0.5947506", "0.58897954", "0.5842242", "0.5801041", "0.5799115", "0.5799011", "0.579901...
0.7261331
0
Run a Kafka consumer and apply process_func to incoming messages.
def consume_messages(process_func: Callable[[str], None]): consumer = get_consumer() for message in consumer: log.debug(f'Received a message: {message}') try: process_func(message.value) except Exception as e: log.error(f'Failed to process a message: {message.val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self, handler):\n try:\n logger.info('Listening on topic: {}'.format(self.topic))\n consumer = KafkaConsumer(self.topic)\n\n for msg in consumer:\n object_dict = self._extract_updated_object(msg)\n if object_dict:\n ...
[ "0.62038803", "0.5999372", "0.59506476", "0.587573", "0.58691865", "0.5739204", "0.5648513", "0.56234175", "0.55911964", "0.5572861", "0.55719227", "0.55717945", "0.5530835", "0.55171555", "0.55148387", "0.54914945", "0.5488683", "0.54419833", "0.542208", "0.5419174", "0.5410...
0.7023197
0
Set up an Arlo media player.
async def async_setup_platform(hass, _config, async_add_entities, _discovery_info=None): arlo = hass.data.get(COMPONENT_DATA) if not arlo: return players = [] for camera in arlo.cameras: if camera.has_capability(MEDIA_PLAYER_KEY): name = "{0}".format(camera.name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OnPlay(self):\r\n # check if there is a file to play, otherwise open a\r\n # Tk.FileDialog to select a file\r\n print(\"1-1\")\r\n\r\n\r\n self.Media = self.Instance.media_new(self.youtube_url)\r\n self.player.set_media(self.Media)\r\n\r\n # set the window id where to ...
[ "0.6124019", "0.6033745", "0.57720435", "0.5672428", "0.5659317", "0.56030464", "0.55808127", "0.5578291", "0.5571156", "0.5568045", "0.5557043", "0.55538464", "0.55161655", "0.5514134", "0.55140793", "0.5498919", "0.54745305", "0.54496276", "0.5445883", "0.54299134", "0.5420...
0.642649
0
Initialize an Arlo media player.
def __init__(self, name, device): self._name = name self._unique_id = device.entity_id self._device = device self._name = name self._volume = None self._muted = None self._state = None self._shuffle = None self._position = 0 self._track_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_video(self):\n\n assert self.container is None\n\n retry = 3\n while self.container is None and 0 < retry:\n retry -= 1\n try:\n self.container = av.open(self.tello.get_video_stream())\n except av.AVError as ave:\n print(a...
[ "0.63464123", "0.6276088", "0.6197421", "0.60042477", "0.5966629", "0.5964369", "0.59573257", "0.5955853", "0.5942402", "0.59255", "0.59211975", "0.588976", "0.58767784", "0.58719885", "0.5865433", "0.5840495", "0.5824255", "0.581618", "0.58082753", "0.57726705", "0.57574016"...
0.659764
0
Audit vault and strategy configuration.
def audit(): governance = web3.ens.resolve('ychad.eth') registry = load_registry() vaults = load_vaults(registry) for v in vaults: if v.vault.governance() != governance: secho(f'{v.name} vault governance == {v.vault.governance()}', fg='red') print(f'{v.vault}.setGovernanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setup(bot: DreamBot) -> None:\n\n await bot.add_cog(Audit(bot))\n bot_logger.info('Completed Setup for Cog: Audit')", "def vault(self):", "def configure(self, account_id):\n print(\"Configuring Vault\")\n client = self.connect(VAULT_TOKEN)\n\n # Audit Backend\n if 's...
[ "0.5853268", "0.58281404", "0.58206046", "0.5669815", "0.5580182", "0.5573544", "0.55566853", "0.5363275", "0.53354853", "0.52385104", "0.52081513", "0.5198259", "0.5194844", "0.5165448", "0.5140817", "0.51114434", "0.50980794", "0.5084414", "0.50298756", "0.49605715", "0.493...
0.7084648
0
n = number of sides, s = side length, both positive integers this function returns the sum of the area and square perimeter of the polygon described by n and s
def polysum(n, s): area = 0 #avoiding division by zero if n != 0: area = (0.25 * n * (s**2)) / math.tan(math.pi / n) perimeter = n * s return (round(area + perimeter**2, 4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_polygon(n, s):\n area = ((float(1)/float(4)) * n * s ** 2) / (math.tan(math.pi / n))\n return area", "def polysum(n, s):\n\n import math\n\n area = 0.25*n*s**2/math.tan(math.pi/n)\n peri = s*n\n summary = area + peri**2\n return round(summary, 4)", "def square_area(side):\n ret...
[ "0.8268719", "0.74184024", "0.68404865", "0.680953", "0.67098576", "0.6519029", "0.6479288", "0.64529556", "0.63541496", "0.63223577", "0.6297985", "0.6282858", "0.62641627", "0.6218108", "0.6207018", "0.6203102", "0.6181889", "0.61453784", "0.6070842", "0.60687673", "0.60675...
0.83128154
0
Print the \n separated lines in the string s, indented lvl levels.
def printIndent(s,lvl) : for line in s.split('\n') : print('%s%s' % (' '*lvl,line))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent_lines(s, n):\n return \"\\n\".join(map(lambda line: \" \" * n + line, \n s.split('\\n')))", "def FormatLines(s, depth, reflow=True):\n if reflow:\n lines = _ReflowLines(s, depth)\n else:\n lines = [s]\n\n result = []\n for line in lines:\n line = (\" \" * TABSIZ...
[ "0.709268", "0.66912967", "0.6484763", "0.62385815", "0.6086636", "0.60229385", "0.6016925", "0.5888356", "0.58879775", "0.55820423", "0.5500408", "0.54932576", "0.5424956", "0.5420362", "0.53914034", "0.5383994", "0.5332292", "0.53215086", "0.52720195", "0.52537227", "0.5249...
0.7449001
0
Return the score of the game if L is the next to move. L looks for high scores. The score is the first item in the tuple that is returned. The remaining items are the sequence of games that led to this score.
def scoreL(self) : if self.leafL() : # # Here L has no possible moves. Return # the leaf score at the current leaf. # return self.leafScore(), self else : games = self.L() max_g = games[0] max_score = max_g....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoreR(self) :\n if self.leafR() :\n return self.leafScore(), self\n else :\n games = self.R()\n min_g = games[0]\n min_score = min_g.scoreL()\n for g in games[1:] :\n score = g.scoreL()\n if score[0] < min_score...
[ "0.66091055", "0.64791185", "0.6124664", "0.6111734", "0.6031296", "0.5966228", "0.59599215", "0.5930257", "0.5900158", "0.5900001", "0.5888329", "0.586471", "0.5856103", "0.5846379", "0.58395654", "0.5838082", "0.5822587", "0.58184224", "0.5794663", "0.57706267", "0.57643527...
0.7738779
0
Return the score of the game if R is the next to move. R looks for low scores
def scoreR(self) : if self.leafR() : return self.leafScore(), self else : games = self.R() min_g = games[0] min_score = min_g.scoreL() for g in games[1:] : score = g.scoreL() if score[0] < min_score[0] : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_move_score(game, player):\n if game.is_loser(player):\n return float(\"-inf\")\n\n if game.is_winner(player):\n return float(\"inf\")\n\n return float(len(game.get_legal_moves(player)))", "def get_score(self) -> int:\n return self.rstate.score()", "def check_score(self, m...
[ "0.71845496", "0.70455074", "0.7044914", "0.70207614", "0.7008354", "0.69949126", "0.69718325", "0.6961224", "0.69367784", "0.6910868", "0.6904701", "0.6903983", "0.6901333", "0.68918365", "0.68903387", "0.68803644", "0.6870168", "0.6866687", "0.68577814", "0.6853682", "0.684...
0.72899574
0
Inverse current selected image by multiplying with 1.
def inverse_image(model): # get data and name from current selected image current_row = model.currentIndex().row() source_vol = model.data(model.index(current_row), Qt.UserRole + 6) source_name = model.data(model.index(current_row), Qt.DisplayRole) # inverse process inversed_vol = imtool.invers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invert(self, img):\n return self.inverse()(img)", "def inv_img(img):\n return np.abs(img - 1.)", "def inverse(im): \t \n x,y = np.shape(im)\n img = np.zeros([x,y])\n\t\n for i in range(x):\n for j in range(y):\n img[i,j] = 255 - im[i,j]\n return img", "def...
[ "0.7295463", "0.6611736", "0.64922965", "0.63058925", "0.6305444", "0.6302544", "0.62361765", "0.62113416", "0.6208909", "0.61493313", "0.6142045", "0.612923", "0.6120892", "0.60997754", "0.6098013", "0.60662985", "0.6061178", "0.6061004", "0.6035097", "0.6024617", "0.601124"...
0.71684796
1
draw a tile returns None if bag is empty returns first tile first
def draw(self): tiles = list(self.bag.elements()) if len(tiles) == 0: return None if self.first_tile: chosen_tile = self.first_tile self.first_tile = None # done, we've drawn the first tile else: chosen_tile = random.choice(tiles) self.bag[chosen_tile] -= 1 return chos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_tile(self, tile):\n raise NotImplemented()", "def doTile(tile):\n global d, fmt, output, img, demag\n # get adjusted upper left coordinate for tile\n xstart,ystart=getCoords(tile)\n px = 256//demag\n tumor,blank=0,0\n for y in range(0,px):\n for x in range(0,px):\n ...
[ "0.6956463", "0.60607404", "0.59384507", "0.59070325", "0.58282965", "0.5801085", "0.5735737", "0.5669857", "0.5658397", "0.56544286", "0.56393045", "0.5629337", "0.56218994", "0.5612351", "0.5593023", "0.5592965", "0.55929166", "0.5585017", "0.5556688", "0.55470335", "0.5509...
0.8375741
0
does tile T fit in location L?
def tile_fits(self, location, tile): x, y = location CONNECTIONS_TO_CHECK = [ [(x+1, y), 'east', 'west'], [(x-1, y), 'west', 'east'], [(x, y+1), 'north', 'south'], [(x, y-1), 'south', 'north'] ] for neighbor_loc, my_offset, their_offset in CONNECTIONS_TO_CHECK: neighbor_ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tiles_to_bounds():\n tiles = [morecantile.Tile(x=150, y=182, z=9), morecantile.Tile(x=151, y=182, z=9)]\n assert len(utils.tiles_to_bounds(tiles)) == 4", "def in_grid(self, tile):\n return 0 <= tile[0] < self.gs[0] and 0 <= tile[1] < self.gs[1]", "def valid(point):\n index = offset(poi...
[ "0.6746748", "0.67260736", "0.6515046", "0.6514588", "0.6514078", "0.6365492", "0.62904865", "0.6278291", "0.62414855", "0.62305176", "0.61929804", "0.6121494", "0.6096097", "0.6079293", "0.6074842", "0.60705346", "0.6037277", "0.6031438", "0.5947393", "0.59265006", "0.591545...
0.6806946
0
Lookup the 'all' and 'all_count' views from the metadata or construct defaults.
def get_views(view_args, model_type): # XXX Why pop? metadata = view_args.pop('metadata') all_view = metadata.get('views', {}).get('all') if not all_view: all_view= '%s/all'%model_type all_count_view = metadata.get('views', {}).get('all_count') if not all_count_view: all_count_vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_views(context, data_dict):\n # noinspection PyUnresolvedReferences\n frc = _get_or_bust(data_dict, 'frc')\n\n lc = ckanapi.LocalCKAN(context=context)\n\n cube_results = lc.action.package_search(\n q=(\n 'type:cube AND frc:{frc}'\n ).format(\n frc=frc\...
[ "0.5791284", "0.5705834", "0.5399181", "0.53550243", "0.5300899", "0.5277965", "0.5185668", "0.51750314", "0.514737", "0.5087578", "0.50462204", "0.49970847", "0.4987755", "0.49721837", "0.49630272", "0.48864326", "0.48848885", "0.48412365", "0.48411632", "0.4757586", "0.4751...
0.6535335
0
Return a flash message box element.
def flash_message(self, request): return FlashMessagesElement()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMessageBox(self, id):\n try:\n messageBoxWrapUp = self._getMessageBoxCompactWrapUp(id)\n\n return messageBoxWrapUp.messageBox\n except:\n return None", "def _flash(self,id,msg,duration=30.0):\n if duration>0:\n pass #gtk.timeout_add(duration...
[ "0.6299474", "0.6288294", "0.61859554", "0.61429226", "0.60550874", "0.60471123", "0.5999118", "0.59611005", "0.58801323", "0.58488834", "0.58245665", "0.5819826", "0.5815885", "0.58019423", "0.57987386", "0.57850605", "0.5783196", "0.5781271", "0.5781271", "0.5745172", "0.57...
0.8044592
1
Confirm that the src and dest docs match in terms of id and rev, raising an HTTP exception on failure. A BadRequestError is raised if the ids do not match. A ConflictError is raised if the revs do not match.d
def confirm_doc_and_rev(src, dest): if src['_id'] != dest['_id']: raise http.BadRequestError('incorrect id') if src['_rev'] != dest['_rev']: raise http.ConflictError([('Content-Type', 'text/plain')], 'rev is out of date')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_revision(self, request):\n assert hasattr(self, 'doc'), \"dispatcher document must be set\"\n try:\n rev = request.cgi_fields['_rev'].value\n except KeyError:\n return\n if rev != self.doc.rev:\n raise HTTP_CONFLICT(\"Your edit was based on an ...
[ "0.60801184", "0.5607128", "0.5460178", "0.53366244", "0.5295656", "0.5231881", "0.51995516", "0.5198802", "0.5194811", "0.51876605", "0.5168762", "0.5166662", "0.51323646", "0.5114137", "0.51095927", "0.510616", "0.5049082", "0.5046716", "0.5040745", "0.5032963", "0.5015139"...
0.81150794
0
Create a form for the given model type.
def _form_for_type(request, C, defn, add_id_and_rev=False): form = build(defn, C, add_id_and_rev=add_id_and_rev, widget_registry=_widget_registry(request)) form.renderer = request.environ['restish.templating'].renderer return form
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_class(self):\r\n return modelform_factory(self.model)", "def make_form(self):", "def get_form_for_model(\n model,\n form_class=WagtailAdminModelForm,\n **kwargs,\n):\n\n # This is really just Django's modelform_factory, tweaked to accept arbitrary kwargs.\n\n meta_class_attrs...
[ "0.6819877", "0.6556186", "0.64142656", "0.6294211", "0.6244579", "0.61463284", "0.60895634", "0.5927193", "0.5925178", "0.5921908", "0.5921233", "0.5910685", "0.5899504", "0.58937675", "0.5880354", "0.58687985", "0.5854467", "0.58382326", "0.58021164", "0.57389766", "0.57210...
0.7316288
0
Create a new doc from the model type and form data.
def _doc_create(type, data): doc = dict(data) doc.update({'model_type': type}) return doc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_new():\n\n t = request.form['type']\n if t == 'book':\n doc = Book(\n title=request.form['title'],\n price=request.form['price'],\n keywords=comma_to_list(request.form['keywords']),\n authors=comma_to_list(request.form['authors']),\n ...
[ "0.7059826", "0.68696034", "0.67143714", "0.65898913", "0.6445171", "0.6390132", "0.63503194", "0.62521714", "0.6249602", "0.6166081", "0.61429954", "0.61121595", "0.6060808", "0.605228", "0.60333145", "0.59959775", "0.59767336", "0.5920667", "0.5892497", "0.58733225", "0.585...
0.80970454
0
Retrieve the adminish config from the request.
def _config(request): return request.environ['adminish']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(req):\n #try:\n # user_id = req.user\n #except KeyError as e:\n # msg = req.get_error_msg(e)\n # return send_error_response(msg)\n try:\n config = tools_config_get_config(req)\n except Exception:\n raise http_exc.HTTPClientError()\n else:\n retur...
[ "0.6695683", "0.65137017", "0.64466333", "0.6323818", "0.62771636", "0.62771636", "0.620728", "0.6170023", "0.6149542", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0.61401767", "0...
0.79236895
0
Create a widget registry from the config, defaulting to couchish's default.
def _widget_registry(request): factory = _config(request).get('widget_registry_factory') or WidgetRegistry return factory(_store(request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(widget):\n w = widget.class_traits()\n _registry.register(w['_model_module'].default_value,\n w['_model_module_version'].default_value,\n w['_model_name'].default_value,\n w['_view_module'].default_va...
[ "0.5875929", "0.5706359", "0.5351235", "0.5184889", "0.51765466", "0.5141085", "0.51340145", "0.5107969", "0.51062024", "0.51062024", "0.50923616", "0.5079311", "0.5072025", "0.5058826", "0.5034717", "0.5029233", "0.5029233", "0.5029233", "0.5029233", "0.5029233", "0.50091606...
0.71795803
0