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
Check if value is a public key.
def is_key(v) -> bool: try: _validate(v, prefixes=[b"edsk", b"edpk", b"spsk", b"p2sk", b"sppk", b"p2pk"]) except (ValueError, TypeError): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsa_is_valid_publickey(key):\r\n # must be a dict\r\n if type(key) is not dict:\r\n return False\r\n\r\n # missing the right keys\r\n if 'e' not in key or 'n' not in key:\r\n return False\r\n\r\n # has extra data in the key\r\n if len(key) != 2:\r\n return False\r\n\r\n for item in ['e', 'n']:\...
[ "0.6909285", "0.68924886", "0.67930853", "0.67379916", "0.670946", "0.6584235", "0.6582291", "0.6432557", "0.64263415", "0.6347107", "0.6285771", "0.6222731", "0.6183509", "0.61783797", "0.61660796", "0.6137798", "0.6125817", "0.611028", "0.61051744", "0.61047745", "0.6074136...
0.69407177
0
Check if value is a chain id.
def is_chain_id(v) -> bool: try: _validate(v, prefixes=[b'Net']) except (ValueError, TypeError): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_node_id(val):\n if not val:\n return False\n if not isinstance(val, bytes) and not isinstance(val, bytearray):\n return False\n\n length = len(val)\n if length != SHA1_BIN_LEN and length != SHA2_BIN_LEN and \\\n length != SHA3_BIN_LEN:\n...
[ "0.606815", "0.5954897", "0.59288996", "0.5886045", "0.5855306", "0.57465386", "0.5731161", "0.56909406", "0.5682489", "0.56128734", "0.5554714", "0.5542293", "0.55414873", "0.55077225", "0.55061734", "0.55059975", "0.54959613", "0.5450412", "0.5435369", "0.5433022", "0.54199...
0.79599625
0
Decode chain id from byte form.
def parse_chain_id(data: bytes): return base58_encode(data, b'Net').decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decodeId(id):\n decoded = base64.b64decode(id) # ex: b'UserType:braden@n.com'\n type_and_id = str(decoded)[2:-1].split(\":\")\n return type_and_id[1]", "def unpack_id(self, bytes_string, offset=0):\r\n return self._packer.unpack_from(bytes_string, offset)", "def _decode_object_identifier...
[ "0.6877652", "0.6793608", "0.678589", "0.63483155", "0.6256372", "0.6232649", "0.6232649", "0.60909444", "0.6084937", "0.59652203", "0.5961985", "0.5958148", "0.5948018", "0.5929923", "0.59294295", "0.5920777", "0.5898652", "0.58979404", "0.58912814", "0.58704436", "0.5869055...
0.73457766
0
Decode signature from byte form.
def parse_signature(data: bytes): return base58_encode(data, b'sig').decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_sig(sig):\n table = maketrans(\"-._\", \"+/=\")\n sig = str(sig).translate(table)\n try:\n return b64decode(sig)\n except TypeError:\n raise MalformedResponseError(\"Signature is not a valid base-64 \"\n \"encoded string\")", "def parse(sig...
[ "0.7537346", "0.66972435", "0.6327409", "0.6325036", "0.6325036", "0.624623", "0.61954343", "0.6177919", "0.61098427", "0.608816", "0.60582966", "0.60331136", "0.5996064", "0.5989281", "0.59855163", "0.59242314", "0.5886702", "0.5855573", "0.5850713", "0.5846709", "0.5763423"...
0.6870893
1
Decode contract (address + optional entrypoint) from bytes
def parse_contract(data: bytes): res = parse_address(data[:22]) if len(data) > 22: res += f'%{data[22:].decode()}' return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(data): #@NoSelf", "def q_decode_address(abe, page, chain):\n addr = wsgiref.util.shift_path_info(page['env'])\n if addr is None:\n return \"Shows ADDRESS's version byte(s) and public key hash\" \\\n ' as hex strings separated by colon (\":\").\\n' \\\n ...
[ "0.62553734", "0.6090081", "0.5887138", "0.5880483", "0.5805643", "0.57756114", "0.57756114", "0.5751987", "0.56942505", "0.5651604", "0.5614349", "0.54907787", "0.5483079", "0.5483079", "0.5483079", "0.5483079", "0.5483079", "0.5483079", "0.5483079", "0.5483079", "0.5483079"...
0.68560046
0
Encode boolean value into bytes.
def forge_bool(value: bool) -> bytes: return b'\xff' if value else b'\x00'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeBoolean(self, value: bool):\n self.writeByte(1 if value else 0)", "def write_bool(self, b: bool) -> None:\n self.buffer += struct.pack(\"<?\", b)", "def _bool_encode(self, d):\n for k, v in d.items():\n if isinstance(v, bool):\n d[k] = str(v).lower()\n ...
[ "0.7631715", "0.76057476", "0.75045395", "0.74285877", "0.7100429", "0.6971353", "0.69339216", "0.6930289", "0.6888032", "0.6720014", "0.66895944", "0.668205", "0.66659003", "0.6603797", "0.65938085", "0.658666", "0.6427669", "0.6339604", "0.6303503", "0.62970036", "0.6284704...
0.7770121
0
Encode base58 string into bytes.
def forge_base58(value: str) -> bytes: return base58_decode(value.encode())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_base58(bytestring):\n # Count zero's\n zeros = 0\n for i in range(len(bytestring)):\n if bytestring[i] == 0:\n zeros += 1\n else:\n break\n\n n = int.from_bytes(bytestring, 'big')\n\n result = ''\n (n, rest) = divmod(n, 58)\n while n or rest:\n ...
[ "0.7701246", "0.7676759", "0.7664771", "0.75629586", "0.75629586", "0.74584925", "0.73593754", "0.72235775", "0.71700084", "0.7089226", "0.7059358", "0.69578207", "0.68610495", "0.68239784", "0.6697485", "0.66973984", "0.660411", "0.6534118", "0.6489434", "0.64111733", "0.636...
0.7843441
0
Encode a value of contract type (address + optional entrypoint) into bytes.
def forge_contract(value) -> bytes: parts = value.split('%') address, entrypoint = (parts[0], parts[1]) if len(parts) == 2 else (parts[0], 'default') res = forge_address(address) if entrypoint != 'default': res += entrypoint.encode() return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_any(value: object) -> bytes:\n raise NotImplementedError()", "def encode_value(\n protocol: ProtocolMetaData,\n meta_data: FieldMetaData,\n value: Any\n) -> bytes:\n\n if value is None:\n return b''\n\n encoder = _ENCODERS.get(meta_data.type)\n if not encoder:\n...
[ "0.6588856", "0.651631", "0.64203584", "0.6414817", "0.63587165", "0.63179207", "0.6317373", "0.6241615", "0.624066", "0.62255603", "0.61805695", "0.6171914", "0.61277217", "0.612717", "0.6126265", "0.60946757", "0.60826874", "0.6020994", "0.6009698", "0.6009698", "0.6009698"...
0.672834
0
Write a novel at `filepath`.
def write(self, filepath): with open(filepath, 'w') as f: written = 0 while written < self.size: paragraph, length = self.get_paragraph() f.write(paragraph) written += length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to(self, filepath):\n output = self._generate_output()\n with open(filepath, 'wb') as out:\n out.write(output.encode('utf-8'))\n out.write(b'<!-- handrolled for excellence -->\\n')", "def write(self, filename):\n pass", "def write(self, filename):\n p...
[ "0.6395008", "0.6157521", "0.6157521", "0.61278933", "0.6090805", "0.60143715", "0.5949439", "0.5909323", "0.58167666", "0.58018", "0.5740056", "0.57191277", "0.56770873", "0.5674545", "0.5643307", "0.558223", "0.5532726", "0.5527881", "0.5494483", "0.5472562", "0.5471692", ...
0.6336358
1
Return a paragraph of text and its wordcount.
def get_paragraph(self): size = self.paragraph_sizes.get() size += int(random.randrange(int(size * 0.8), int(size * 1.2))) lines = [] paragraph_length = 0 while paragraph_length < size: sentence, length = self.get_sentence() line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paragraph_count(self, doc):\n\n paragraphs = doc.split(\"\\n\\n\")\n # remove the empty string\n return len([paragraph for paragraph in paragraphs if paragraph])", "def get_number_of_paragraph(self):\n file_to_read = f'{self.path}/{self.filename}'\n file = open(file_to_read...
[ "0.7192711", "0.6794767", "0.6707214", "0.64885664", "0.6352637", "0.6351139", "0.6323157", "0.6322932", "0.6310379", "0.63006884", "0.62845796", "0.62527853", "0.6226805", "0.61926246", "0.6172371", "0.6148777", "0.6145186", "0.61325157", "0.61295986", "0.6119599", "0.611203...
0.6874301
1
Return a newly generated string word.
def create_word(self): template = self.word_constructions.get() word = "" for c in template: if c == "v": letter = self.get_letter(100) else: letter = self.get_letter(0) word += letter while not any(letter i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_word(self):\n return self.random.choice(CONSONANTS) + self.random.choice(VOWELS)", "def make_word(self, offset):\n self.ret = idaapi.create_word(offset, 2)\n return self.ret", "def get_random_word(self):\n pass", "def create_word(char_list):", "def get_word(self):\r\n...
[ "0.77009064", "0.7365859", "0.7330699", "0.72334075", "0.70506394", "0.7014322", "0.69888276", "0.6967375", "0.6955948", "0.69291", "0.6866737", "0.685328", "0.6851329", "0.6836104", "0.6786532", "0.6769629", "0.67593014", "0.6694388", "0.6686687", "0.6686687", "0.6686687", ...
0.7887058
0
Creates empty probability sets for object.
def initiatilise_empty_probability_sets(self): self.letters = probabilities.ProbabilitySet(adjust=True, redo_repeats=True) self.punctuation_endline = probabilities.ProbabilitySet() self.punctuation_midline = probabilities.ProbabilitySet() self.punctuation_matched = probabilitie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_probability_dict(self):\n for x in xrange(0,10):\n self.class_probabilities[x] = self.init_probability_2d()", "def create_probability_object(self):\n self.update_frequencies(self)\n prob_dict = {}\n for symbol in self.all_symbols.keys():\n prob_dict[symb...
[ "0.61972016", "0.5857545", "0.5803545", "0.58016515", "0.5761455", "0.57037276", "0.5695849", "0.56529075", "0.5623352", "0.5593922", "0.5593922", "0.5593922", "0.5579484", "0.55611527", "0.5528555", "0.5510533", "0.5490202", "0.54764664", "0.547086", "0.54662305", "0.5459669...
0.77195543
0
Return a filtered string of vowels with unlikely ones removed. Vowels are filtered based on if they appear without other vowels. If a word contains just one vowel, that vowel's usage is incremented. A vowel is kept if uses > iteration Where iteration is the number of the current iteration (from 0 to `iterations`). This...
def filter_vowels(self, vowels, word_set, iterations=10): true_vowels = vowels for i in range(iterations): vowels = true_vowels # Go backwards as the last ones are least likely. for vowel in vowels[::-1]: uses = 0 for w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_vowels(string: str) -> str:\n return \" \".join([word for word in string.split() if word[0].lower() not in ['a', 'e', 'i', 'o', 'u']])", "def most_repeating_vowels(words):\n return ' '.join([x for x in WORDS if len(x) == len(sv_count(words)[-1])])", "def remove_vowels(phrase):\n vowels = ['...
[ "0.6227483", "0.62077135", "0.6115161", "0.60617566", "0.5970348", "0.5953034", "0.5744797", "0.5723525", "0.56524885", "0.56231314", "0.56016904", "0.55933076", "0.52880675", "0.5253052", "0.52325153", "0.5190231", "0.5154868", "0.5148532", "0.5127246", "0.5102803", "0.50313...
0.77998585
0
Return a string showing the consonant and vowel construction of word. Returns a string with the characters c and v in place of consonants and vowels respectively.
def calculate_construction(self, word): construction = "" for c in word.lower(): if c in self.vowels: construction += "v" elif c in letters: construction += "c" return construction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def censor_vowels(word):\n\n chars = []\n\n for letter in word:\n if letter in \"aeiou\":\n chars.append(\"*\")\n chars.append(letter)\n\n return \"\".join(vowels)", "def censor_vowels(word):\n\n chars = []\n\n for letter in word:\n if letter in \"aeiou\":\n ...
[ "0.6721714", "0.6684785", "0.6429723", "0.629118", "0.6203352", "0.6107545", "0.6051736", "0.6038779", "0.60268724", "0.6026208", "0.60229594", "0.59494346", "0.590504", "0.5847752", "0.57655", "0.57647663", "0.57330495", "0.5731885", "0.5678679", "0.56555295", "0.56220865", ...
0.759586
0
Creates a playlist with a given name.
def create_playlist(self, playlist_name): print("create_playlist needs implementation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_playlist(self, playlist_name):\n if playlist_name.lower() in self._playlists:\n print(\"Cannot create playlist: A playlist with the same name already exists\")\n return\n print(f\"Successfully created new playlist: {playlist_name}\")\n self._playlists[playlist_name...
[ "0.85554105", "0.8544041", "0.84868944", "0.8483596", "0.84133744", "0.84097624", "0.8327404", "0.8276789", "0.81442547", "0.7785124", "0.76372933", "0.7628255", "0.7530136", "0.7377695", "0.7313419", "0.7106524", "0.7087746", "0.70772105", "0.70699054", "0.7060932", "0.70289...
0.85660213
0
Handles authentication, and persists the XAPPLEWEBKB cookie so that subsequent logins will not cause additional emails from Apple.
def authenticate(self): LOGGER.info(f"Authenticating as {self.user['apple_id']}") data = dict(self.user) # We authenticate every time, so "remember me" is not needed #data.update({"extended_login": False}) data.update({"extended_login": True}) try: req = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_apple_session(request):\n session_key = request.COOKIES.get(APPLE_SESSION_COOKIE_NAME)\n request.apple_login_session = SessionStore(session_key)", "def persist_apple_session(request, response):\n patch_vary_headers(response, ('Cookie',))\n request.apple_login_session.save()\n response.set_...
[ "0.6577762", "0.6337168", "0.6325511", "0.6303775", "0.6141453", "0.6043342", "0.59775", "0.5933999", "0.5848137", "0.5760807", "0.5709032", "0.5698446", "0.5691821", "0.56689477", "0.5667011", "0.56581485", "0.56087065", "0.557387", "0.55671966", "0.55593187", "0.5556166", ...
0.6628283
0
Get path for cookiejar file.
def _get_cookiejar_path(self): return path.join( self._cookie_directory, "".join([c for c in self.user.get("apple_id") if match(r"\w", c)]), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_cookiejar_path():\n cache_dir = xdg.BaseDirectory.save_cache_path('AUR')\n return os.path.join(cache_dir, 'cookiejar.txt')", "def get_auth_cookie_path(self):\r\n \r\n # fetches authentication type and cookie path if still unloaded\r\n if self._authType == None: self.get_auth_type()\r\n...
[ "0.7903083", "0.6769989", "0.65593606", "0.62150407", "0.6176019", "0.6139347", "0.6121949", "0.60538423", "0.60461426", "0.5943386", "0.5930227", "0.58614594", "0.58520967", "0.57945836", "0.5791484", "0.5781943", "0.5702421", "0.56848305", "0.56696546", "0.5649285", "0.5615...
0.84164685
0
Returns devices trusted for twostep authentication.
def trusted_devices(self): request = self.session.get( f"{self.SETUP_ENDPOINT}/listDevices", params=self.params ) return request.json().get("devices")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_devices():\n return _lib.SeaTeaseAPI().list_devices()", "def trusted_server_certificates(self):\n return self._trusted_server_certificates", "def find_devices(cls):\n if hasattr(cls, 'ADVERTISED_CALLBACK'):\n return get_provider().find_devices(cls.ADVERTISED, services_uuid_...
[ "0.566919", "0.55045766", "0.53312016", "0.528945", "0.52780783", "0.5250127", "0.52395374", "0.5222731", "0.5214248", "0.5203389", "0.5194738", "0.51710176", "0.5168915", "0.51140755", "0.510139", "0.5101376", "0.5101376", "0.50499886", "0.50262815", "0.499498", "0.49945647"...
0.78135496
0
Requests that a verification code is sent to the given device.
def send_verification_code(self, device): data = json.dumps(device) request = self.session.post( f"{self.SETUP_ENDPOINT}/sendVerificationCode", params=self.params, data=data, ) LOGGER.info(f"Send Trusted Device ID result-{request.json()}") retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_verification_code(request) -> HttpResponse:\n request_data = get_request_data(request.body)\n if request_data is None:\n return error_response()\n\n phone_number = get_e164_phone_number(request_data.phone_number, request_data.region)\n if phone_number is None:\n return error_resp...
[ "0.73965484", "0.6885805", "0.67707986", "0.66764873", "0.6675518", "0.642775", "0.630777", "0.61972344", "0.6070047", "0.6053311", "0.6021355", "0.6020942", "0.5962768", "0.5941551", "0.59119916", "0.5891569", "0.5871185", "0.5849243", "0.58028525", "0.57836795", "0.5763868"...
0.79173094
0
Get webservice URL, raise an exception if not exists.
def _get_webservice_url(self, ws_key): if self._webservices.get(ws_key) is None: raise PyiCloudServiceNotActivatedException( "Webservice not available", ws_key ) return self._webservices[ws_key]["url"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_url():\n return get_config_handler().get_service_url()", "def service_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_url\")", "def service_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_url\")", "def _get_api_endpo...
[ "0.691514", "0.6339951", "0.6339951", "0.611899", "0.6077252", "0.6060869", "0.5962812", "0.5914799", "0.58381724", "0.58005065", "0.5798619", "0.5779774", "0.57622564", "0.575893", "0.57418275", "0.5729624", "0.57124513", "0.5688136", "0.5662257", "0.56301975", "0.55747974",...
0.7102065
0
Gets the 'Friends' service.
def friends(self): service_root = self._get_webservice_url("fmf") return FindFriendsService(service_root, self.session, self.params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users_friends(self):\n user = self.sp.user(self.user)\n return user", "def friends(self) -> List['Friend']:\n\n return self.sObj.getFriends()", "def get_friends():\n\n acct = get_current_account(session[\"acct\"])\n get_user_friends(acct, GR_KEY, GR_SECRET)\n search = Fal...
[ "0.64625794", "0.6220007", "0.5936066", "0.58820796", "0.5875668", "0.5843165", "0.5834377", "0.5771647", "0.5714605", "0.56952304", "0.56738335", "0.55639756", "0.55542386", "0.5539111", "0.55276096", "0.5521271", "0.54607314", "0.5457826", "0.5341512", "0.5339627", "0.53093...
0.7999176
0
Gets the 'Contacts' service.
def contacts(self): service_root = self._get_webservice_url("contacts") return ContactsService(service_root, self.session, self.params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contacts(self):\n from hubspot3.contacts import ContactsClient\n\n return ContactsClient(**self.auth, **self.options)", "def get_contacts(self):\n\n\t\treturn self.__contacts", "def list_contacts(self):\n return self.contacts", "def contacts(self):\n return ContactCollection(s...
[ "0.7491957", "0.6959616", "0.6858653", "0.68381757", "0.6801723", "0.6527586", "0.64854443", "0.6452875", "0.6373646", "0.6257713", "0.60973865", "0.59803784", "0.5960666", "0.5933673", "0.59317017", "0.5860894", "0.5811302", "0.568619", "0.5672376", "0.5670488", "0.56533396"...
0.82634234
0
Returns status information for device. This returns only a subset of possible properties.
def status(self, additional=[]): # pylint: disable=dangerous-default-value self.manager.refresh_client() fields = ["batteryLevel", "deviceDisplayName", "deviceStatus", "name"] fields += additional properties = {} for field in fields: properties[field] = self.content....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_info(self):\n def subdevice_filter(info):\n return bool(info['kind'] & Kind.normal)\n\n return ophydobj_info(self, subdevice_filter=subdevice_filter)", "def _do_get_status(self):\n logging.info(__name__ + ' : Get status of the device.')\n result = self._execute('...
[ "0.7348414", "0.73328424", "0.6963053", "0.69546175", "0.69357085", "0.68658984", "0.66653234", "0.65854776", "0.6550837", "0.6537534", "0.6532112", "0.65268654", "0.6499705", "0.6464166", "0.6464166", "0.6382854", "0.6350663", "0.6343501", "0.63251793", "0.6298219", "0.62548...
0.75170356
0
Send a request to the device to play a sound. It's possible to pass a custom message by changing the `subject`.
def play_sound(self, subject="Find My iPhone Alert"): data = json.dumps( { "device": self.content["id"], "subject": subject, "clientContext": {"fmly": True}, } ) self.session.post(self.sound_url, params=self.params, data=dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_sound(self, sound) -> None:\n pass", "def playSound(self,sound):\n sound.play()", "async def sound(self, ctx, name='default', start=0):\n voice = discord.utils.get(self.bot.voice_clients, guild=ctx.guild)\n \n if not (ctx.author.voice or voice):\n await ct...
[ "0.69483286", "0.68287206", "0.6675486", "0.6536839", "0.6431559", "0.64148694", "0.64056677", "0.6305197", "0.6290814", "0.62868935", "0.6269323", "0.6267441", "0.6267065", "0.62515205", "0.61755955", "0.6173517", "0.6166738", "0.6163589", "0.6163589", "0.61523545", "0.61523...
0.8371016
0
Send a request to the device to trigger 'lost mode'. The device will show the message in `text`, and if a number has been passed, then the person holding the device can call the number without entering the passcode.
def lost_device( self, number, text="This iPhone has been lost. Please call me.", newpasscode="" ): data = json.dumps( { "text": text, "userText": True, "ownerNbr": number, "lostModeEnabled": True, "trackingE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_call_forwarding_busy(self, dtmf_code: str) -> None:", "def disable_call_waiting_per_call(self, dtmf_code: str) -> None:", "def unavailable(self):\n print(\"\\n**Sorry this Service is unavailable**\\n\")\n self.get_input()", "def disconnect(self):\n self.send_presence(typ=u'Fl...
[ "0.52924544", "0.52864593", "0.51911014", "0.51836944", "0.5180467", "0.5172294", "0.50958997", "0.50482875", "0.49933416", "0.49488193", "0.49389258", "0.49142253", "0.49057028", "0.4902059", "0.48952603", "0.4883052", "0.4880907", "0.48582825", "0.48551813", "0.48547593", "...
0.78530043
0
Customizable logic to determine whether the data should be refreshed. By default, this returns False. Consumers can set `refresh_always` to True or assign their own function that takes a singleargument (the last reponse) and returns a boolean.
def should_refresh_client(self): return self.refresh_always or FindFriendsService.should_refresh_client_fnc( self.response )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_refresh_client_fnc(response):\n return not response", "def should_reset(self):\n # type: () -> bool\n if not self._is_cache_enabled():\n return False\n elapsed = time.time() - self._last_ts\n return elapsed > self._refresh_interval_sec", "def auto_refres...
[ "0.7081736", "0.64856315", "0.64296556", "0.6410178", "0.6032431", "0.6032431", "0.60149574", "0.58555883", "0.5756816", "0.57453173", "0.57453173", "0.57453173", "0.57453173", "0.57453173", "0.5710015", "0.57030165", "0.567462", "0.56660634", "0.56660634", "0.56232643", "0.5...
0.73922545
0
Returns the location of your friend with a given contact_id
def location_of(self, contact_id, default=None): candidates = [ item.get("location", default) for item in self.locations if item.get("id") == contact_id ] if not candidates: return default return candidates[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location_by_id(self, location_id):", "def contact_point(self) -> object:\n return self._contact_point", "def getContactById(self, id):\n for contact in self.contacts:\n if contact.id == id:\n return contact\n if self.profile:\n if self.profile.i...
[ "0.6310716", "0.58662", "0.5781861", "0.56856716", "0.5547265", "0.55330914", "0.552927", "0.552927", "0.5477416", "0.54259783", "0.5399456", "0.5371383", "0.536133", "0.53469265", "0.5335225", "0.5332912", "0.5328235", "0.53201836", "0.53006935", "0.5290269", "0.527457", "...
0.7393766
0
Return true if the password of a username exists in the keyring.
def password_exists_in_keyring(username): try: get_password_from_keyring(username) except PyiCloudNoStoredPasswordAvailableException: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, key):\n return self.cli.passwords.contains(key)", "def is_registered(username):\n with open(PASSFILE, \"r\") as passfile:\n for record in passfile:\n try:\n r_username, r_salt_hash = record.split()\n # The below is just for the lint...
[ "0.7435272", "0.7382526", "0.73124343", "0.731195", "0.70989174", "0.70981234", "0.706676", "0.70336455", "0.7031765", "0.7018283", "0.7016522", "0.6955871", "0.69540626", "0.69367975", "0.6933843", "0.69164515", "0.69139296", "0.6912593", "0.69054574", "0.6888786", "0.688441...
0.8771552
0
Store the password of a username.
def store_password_in_keyring(username, password): return keyring.set_password(KEYRING_SYSTEM, username, password,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user(cls,username,password):\n cls.users[username] = password", "def update_password(self, username, password):\n self.update(('Password', password), username)", "def save_user(username, data):\n\n hashed_username = base64.b64encode(Cryptography.hash(username).digest()).decode()\n...
[ "0.82293695", "0.743624", "0.7204106", "0.71786827", "0.71751004", "0.70580757", "0.70024323", "0.6941912", "0.69101334", "0.6870842", "0.68569523", "0.6824505", "0.6774085", "0.6730534", "0.6717623", "0.67003363", "0.6698031", "0.6694579", "0.6679969", "0.6663457", "0.663395...
0.7479107
1
Delete the password of a username.
def delete_password_in_keyring(username): return keyring.delete_password(KEYRING_SYSTEM, username,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_user(self, username):\n pass", "def password(self, oid):\n path = '/users/%s' % oid\n res = self.client.call(path, 'DELETE', data='', token=self.manager.identity.token)\n self.logger.debug('Delete openstack user: %s' % truncate(res))\n return res[0]['server']", "def d...
[ "0.7748979", "0.7354001", "0.7259075", "0.703018", "0.698801", "0.69710284", "0.69356304", "0.6931988", "0.6925708", "0.67756754", "0.6775376", "0.67538524", "0.6737239", "0.66815513", "0.66567457", "0.6645559", "0.66319156", "0.6618149", "0.6587016", "0.6559593", "0.65371585...
0.8339676
0
Wheels created from sdists are not reproducible by default. We can however workaround this by patching in some configuration with environment variables.
def configure_reproducible_wheels(): # wheel, by default, enables debug symbols in GCC. This incidentally # captures the build path in the .so file We can override this # behavior by disabling debug symbols entirely. # https://github.com/pypa/pip/issues/6505 if os.environ.get("CFLAGS") is not None:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wheels():\n with lcd(env.local_path):\n put('./requirements.txt', '/srv/build/wheel_requirements.txt')\n put('./etc/base_image/image_requirements.txt',\n '/srv/build/requirements.txt')\n\n with cd('/srv/build/wheelhouse'):\n run('rm -rf *.whl')\n\n compose(cmd='-f servi...
[ "0.56918144", "0.55553997", "0.53362185", "0.524388", "0.51038265", "0.5092247", "0.504893", "0.50450784", "0.50061387", "0.4983047", "0.49803153", "0.49654698", "0.49606308", "0.4958294", "0.49500853", "0.49132004", "0.48903054", "0.48866782", "0.48755607", "0.48251563", "0....
0.62132615
0
Generate cc_library rule for numpy headers.
def _get_numpy_headers(directory): sys.path.insert(0, directory) import numpy include_dir = os.path.relpath(numpy.get_include(), directory) sys.path.pop(0) return """ cc_library( name = "headers", hdrs = glob(["{include_dir}/**/*.h"]), includes = ["{include_dir}"], ) """.format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cblas_header_text():\r\n\r\n return \"\"\"\r\n //#include <stddef.h>\r\n\r\n #undef __BEGIN_DECLS\r\n #undef __END_DECLS\r\n #ifdef __cplusplus\r\n #define __BEGIN_DECLS extern \"C\" {\r\n #define __END_DECLS }\r\n #else\r\n #define __BEGIN_DECLS /* empty */\r\n #define ...
[ "0.5874989", "0.5728142", "0.56980735", "0.54318595", "0.53701305", "0.5320193", "0.5206699", "0.5194782", "0.51545936", "0.51403415", "0.5115876", "0.50975645", "0.5060948", "0.50434715", "0.50103015", "0.5005137", "0.49940068", "0.49931738", "0.49832395", "0.49668753", "0.4...
0.68862516
0
node id for dot output
def dot_id(self): return u"{0}_{1}".format( Concept.d_clean(self.dot_printname()), str(id(self))[-4:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showId(self):\n extent = self.getExtent()\n id = self.parent_id\n levels = self.getLevels()\n prefix = settings.NESTED_TAXONOMY_PREFIX\n \n # name = prefix,id,levels,extent\n \n name = '%s:%s:%s:%s' %(prefix,id,levels,extent)\n return name", "def...
[ "0.66517043", "0.66221917", "0.65593755", "0.6476628", "0.6345358", "0.6345358", "0.626135", "0.6227308", "0.6220587", "0.61556864", "0.61556864", "0.61459255", "0.6140453", "0.61239123", "0.6112471", "0.6111969", "0.6101112", "0.6098384", "0.6089805", "0.60343236", "0.603370...
0.70308787
0
printname for dot output
def dot_printname(self): return self.printname.split('/')[0].replace('-', '_')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot():\n print_message(\".\")", "def printDot(system,out):\n print_header(out)\n #printVariablesDot(system,out)\n printRulesDot(system,out)\n print_footer(out)", "def dot():\n\n sys.stdout.write('.')\n sys.stdout.flush()", "def dot(self, name):\n nodes = \" \".join(\"_%s_%...
[ "0.766914", "0.74533165", "0.71256053", "0.7120161", "0.69777566", "0.69174653", "0.6886438", "0.6714341", "0.66950095", "0.65566105", "0.6349702", "0.63290334", "0.6300173", "0.62996155", "0.6292505", "0.61689717", "0.6158499", "0.6137837", "0.6137837", "0.61311734", "0.6094...
0.7493367
1
Helper functions that creates a titlestyled label
def create_title(text, y=PADDING, screen=None): if screen is None: screen = lv.scr_act() lbl = lv.label(screen) lbl.set_style(0, styles["title"]) lbl.set_text(text) lbl.set_long_mode(lv.label.LONG.BREAK) lbl.set_width(HOR_RES-2*PADDING) lbl.set_x(PADDING) lbl.set_align(lv.label.A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_title(self):\n label_title = Label(self.frame, text=\"Brick Breaker\", font=(\"Arial\", 40), bg='light blue',\n fg='white')\n label_title.pack()", "def create_title(self):\n label_title = Label(self.frame, text=\"Game Over\", font=(\"Arial\", 40), bg='li...
[ "0.74677587", "0.746571", "0.72310877", "0.70557135", "0.6947155", "0.6939413", "0.69321924", "0.6741492", "0.6739582", "0.6739214", "0.65853053", "0.6567049", "0.65649736", "0.6549668", "0.6496115", "0.64491737", "0.6433332", "0.6402477", "0.6400429", "0.63965553", "0.633976...
0.78454345
0
Helper function that creates a button with a text label
def create_button(text, callback=None, screen=None, y=700): if screen is None: screen = lv.scr_act() btn = lv.btn(screen) btn.set_width(HOR_RES-2*PADDING); btn.set_height(BTN_HEIGHT); lbl = lv.label(btn) lbl.set_text(text) lbl.set_align(lv.label.ALIGN.CENTER) btn.align(scre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_button(self, parent, text=\"Button\", command=None, row=0, column=0):\n but = Button(parent, text=text, command=command, relief='flat', padx=5, pady=5)\n but.grid(row=row, column=column, sticky=EW)\n return but", "def create_label(self, on, text: str):\n return tk.Label(on, f...
[ "0.74480975", "0.7427134", "0.7311104", "0.72605926", "0.725786", "0.72246253", "0.7048074", "0.6926478", "0.6876118", "0.6869746", "0.68658376", "0.6835161", "0.674562", "0.6711475", "0.66974527", "0.6659956", "0.6603777", "0.65636027", "0.65314204", "0.64750683", "0.6444440...
0.7753647
0
A sample screen that has a counter and two buttons
def show_counter_screen(): # Get and clear active screen clear() create_title("Here is the counter:") obj = {"counter": 0} counter_lbl = create_title("%d" % obj["counter"]) counter_lbl.set_y(150-counter_lbl.get_height()//2) def plus_one(btn, e): if e == lv.EVENT.RELEASED: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_pushButton1_clicked(self):\n self.count+=1\n self.zShow.printf(\"count=%f\", self.count)", "def refresh(self):\n #self.find('counter-label').text = 'Counter: %i' % self.counter\n\n #@on('increment-button', 'click')\n #def on_button(self):\n \"\"\"\n This method is ...
[ "0.6918488", "0.65029883", "0.6386094", "0.61868346", "0.6005864", "0.59403616", "0.5925689", "0.58807695", "0.5849215", "0.5798327", "0.5743593", "0.5735908", "0.57021487", "0.56975836", "0.55961293", "0.55506784", "0.55506784", "0.54778427", "0.5464562", "0.5453323", "0.544...
0.8523499
0
Get the loss function according to the loss config name and parameters.
def get_loss(loss_config): if hasattr(torch_losses, str(loss_config.name)): function = getattr(torch_losses, loss_config.name) return function(**loss_config.params.dict()) if loss_config.name == 'FocalLoss': return FocalLoss(**loss_config.params.dict()) else: raise ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loss_fn(params):\r\n i = importlib.import_module(\"dlex.utils.losses\")\r\n return getattr(i, params.loss)", "def get_loss(name: str):\n if name == 'mse' or name is None:\n loss = nn.MSELoss()\n elif name == 'cp':\n loss = CosineProximityLoss()\n elif name == 'mae':\n ...
[ "0.8003294", "0.76006263", "0.7389438", "0.720925", "0.7180094", "0.71702397", "0.710507", "0.70967835", "0.7077608", "0.70417595", "0.7025308", "0.6695044", "0.6683967", "0.66422224", "0.65828174", "0.65000266", "0.6493642", "0.64489114", "0.6426479", "0.6419533", "0.638437"...
0.8099341
0
Remove build directory of gem5
def clean_gem5(c): _delete_file(f'{ROOT_DIR}/gem5/build/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_native_build():\n rmtree(BUILD_DIR)", "def clean_build(c):\n c.run(\"rm -fr build/\")\n c.run(\"rm -fr dist/\")\n c.run(\"rm -fr xmlstarlet/config.h \" \"xmlstarlet/Makefile \" \"xmlstarlet/config.status\")\n c.run(\"rm -fr .eggs/\")\n c.run(\"find . -name '*.egg-info' -exec rm -fr {...
[ "0.7312751", "0.7176378", "0.71618146", "0.7150535", "0.69373715", "0.6777019", "0.6598878", "0.6570945", "0.65412474", "0.65349156", "0.65149784", "0.6495783", "0.6459759", "0.6450269", "0.643138", "0.6431345", "0.6391921", "0.6384565", "0.63646847", "0.6362759", "0.6322372"...
0.8256037
0
Clean condor files (log, err, out, ...)
def clean_condor(c): for fname in glob.glob(os.path.join(ROOT_DIR, '*.dag')): _delete_pattern(fname + '.*') for fname in glob.glob(os.path.join(ROOT_DIR, '*.sub')): temps = [] with open(fname, 'r') as f: for line in f.readlines(): for w in ('log', 'error', 'ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n clean_files()", "def dev_clean():\n clean_files(\"csv\", True)\n clean_files(\"jsontxt\", True)", "def _clean_files(self):\n if self.delfiles & 1:\n ProcUtils.remove(self.okm)\n if self.delfiles & 2:\n ProcUtils.remove(self.hkm)\n if self.delfi...
[ "0.74667543", "0.7328528", "0.73196065", "0.7151084", "0.70752096", "0.70197624", "0.6959874", "0.69332564", "0.68319017", "0.6828315", "0.682382", "0.6800687", "0.6792244", "0.67802656", "0.6749237", "0.67450434", "0.6730699", "0.6723903", "0.6707476", "0.6707087", "0.670126...
0.7663365
0
Build all of gem5 GCN3
def build_gem5(c, archive=False): _run(c, f'cd {ROOT_DIR}/gem5/ && scons -j$(nproc) ./build/GCN3_X86/gem5.opt') if archive: _run(c, f'tar -czf gem5-build.tar gem5/build/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_all(self):\n self.android_build()\n self.generate_patch_build('')\n self.generate_specs_build()\n self.generate_interfaces()", "def build(config):", "def build():", "def build_models(config):\n inputs = Input(shape=(config['patch_height'], config['patch_width'], confi...
[ "0.60612893", "0.58889306", "0.5737754", "0.5686563", "0.56834286", "0.5544201", "0.55139095", "0.55087864", "0.548895", "0.54591477", "0.5436916", "0.5382997", "0.53398925", "0.5336438", "0.5324397", "0.5321613", "0.5279874", "0.5249329", "0.5221464", "0.51842684", "0.517872...
0.62361264
0
Mehod to set documents_names
def set_documents_names(cls, input_list_names: List[str]) -> None: cls.documents_names = input_list_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_document_name(self, document_name_prefix):\n document_name = document_name_prefix + self.random_string_generator(6)\n self.set_value_into_input_field(self.document_name_text_field_locator, document_name)\n return document_name", "def set_document_name_for_search(self, document_name):...
[ "0.6647043", "0.66281074", "0.6616381", "0.6616381", "0.6616381", "0.6580862", "0.6035552", "0.60264474", "0.6021539", "0.60107195", "0.5958772", "0.5925678", "0.5654494", "0.5654494", "0.54714596", "0.5468566", "0.54589707", "0.54283607", "0.54254395", "0.54226154", "0.54159...
0.77481204
0
Draw every object with a `.draw()` method, in order of increasing `.z` value
def draw(self, **kwargs): for o in sorted(self._drawables, key=default_itemgetter("z", default=0)): o.draw(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n for obj in self.objects:\n obj.draw()", "def on_draw( self ):\r\n self.clear()\r\n self.setup_3D()\r\n print \"DEBUG:\" , \"There are\" , len( self.renderlist ) , \"items in 'self.renderlist'\"\r\n for obj in self.renderlist:\r\n obj.draw...
[ "0.75621516", "0.6799689", "0.6721861", "0.66649866", "0.6659334", "0.66035604", "0.65918434", "0.65220284", "0.65220284", "0.65220284", "0.65220284", "0.65220284", "0.65220284", "0.65220284", "0.65220284", "0.6485266", "0.63849753", "0.6368221", "0.6358063", "0.63252294", "0...
0.769476
0
Calculates your slide value for Clover based on an input address (in hex).
async def slide(self, ctx, input_hex = None): try: # We're accepting strings here - convert start_addr = int(input_hex, 16) except: await ctx.send("Malformed input hex - try again.") return # Setup our temp vars first_str = "0x100000" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def slide(self, ctx, input_hex = None):\n\t\ttry:\n\t\t\t# We're accepting strings here - convert\n\t\t\tstart_addr = int(input_hex, 16)\n\t\texcept:\n\t\t\tawait ctx.send(\"Malformed input hex - try again.\")\n\t\t\treturn\n\t\t# Setup our temp vars\n\t\tfirst_str = \"0x100000\"\n\t\tfirst = int(first_str, ...
[ "0.5837187", "0.5274969", "0.5191868", "0.51759964", "0.5067229", "0.48600957", "0.475496", "0.4675898", "0.46628693", "0.4650768", "0.46498603", "0.464243", "0.46331105", "0.46313426", "0.46219712", "0.45950615", "0.45819512", "0.4572285", "0.45682073", "0.45661974", "0.4553...
0.5844881
0
Converts the input binary to its string representation.
async def binstr(self, ctx, *, input_binary = None): if input_binary == None: await ctx.send("Usage: `{}binstr [input_binary]`".format(ctx.prefix)) return # Clean the string new_bin = "" for char in input_binary: if char is "0" or char is "1": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def binstr(self, ctx, *, input_binary = None):\n\t\tif input_binary == None:\n\t\t\tawait ctx.send(\"Usage: `{}binstr [input_binary]`\".format(ctx.prefix))\n\t\t\treturn\n\t\t# Clean the string\n\t\tnew_bin = \"\"\n\t\tfor char in input_binary:\n\t\t\tif char is \"0\" or char is \"1\":\n\t\t\t\tnew_bin += ch...
[ "0.72549105", "0.67621064", "0.67257154", "0.6674221", "0.6619566", "0.6568312", "0.63967365", "0.63876987", "0.6306187", "0.6299027", "0.62337625", "0.618985", "0.61826235", "0.6182287", "0.6166701", "0.61380965", "0.6127304", "0.6074253", "0.60717773", "0.6054103", "0.60413...
0.7250756
1
Converts the input binary to its integer representation.
async def binint(self, ctx, *, input_binary = None): if input_binary == None: await ctx.send("Usage: `{}binint [input_binary]`".format(ctx.prefix)) return try: msg = int(input_binary, 2) except Exception: msg = "I couldn't make that conversion!" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def binint(self, ctx, *, input_binary = None):\n\t\tif input_binary == None:\n\t\t\tawait ctx.send(\"Usage: `{}binint [input_binary]`\".format(ctx.prefix))\n\t\t\treturn\n\t\ttry:\n\t\t\tmsg = int(input_binary, 2)\n\t\texcept Exception:\n\t\t\tmsg = \"I couldn't make that conversion!\"\n\t\tawait ctx.send(ms...
[ "0.7993375", "0.75589454", "0.71576196", "0.6991726", "0.68525845", "0.6812395", "0.67503226", "0.6750077", "0.6734671", "0.6699782", "0.6644759", "0.6599054", "0.6578783", "0.6570725", "0.6554527", "0.65428317", "0.647346", "0.6456172", "0.64527035", "0.64513355", "0.6408165...
0.7997914
0
In the case of assertFailure failing, check that we get lots of information about the exception that was raised.
def test_assertFailure_moreInfo(self): try: 1 / 0 except ZeroDivisionError: f = failure.Failure() d = defer.fail(f) d = self.assertFailure(d, RuntimeError) d.addErrback(self._checkInfo, f) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertion_failed(self, func, exception):", "def assertion_errored(self, func, exception):", "def test_failed():\n assert False", "def test_add_expected_failure_details(self):\n self.protocol.addExpectedFailure(\n self.test, details=self.sample_tb_details)\n self.assertThat([\n...
[ "0.7399913", "0.7185232", "0.70558065", "0.69069", "0.6766728", "0.6732894", "0.6666936", "0.65944", "0.64988893", "0.6488436", "0.64483815", "0.64475596", "0.6442973", "0.64303344", "0.6422524", "0.64013433", "0.63537866", "0.634421", "0.63418293", "0.6327871", "0.63259035",...
0.74278986
0
Generate a random image given commandline arguments.
def genrandimg(args) -> None: size = (int(args.x), int(args.y)) fp = Image.new("RGB", size) data = [] if not args.c: # If color for i in range(size[0]*size[1]): r = random.choice([0x00, 0xff]) data.append((r, r, r)) # Each RGB value is the same random value else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n images = Images()\n #print images.create_image_urls()\n print images.get_image_random()\n print images.get_image(12)", "def generate(options, args):\n\n size = (256,256)\n # Expect option of the form '64,40'.\n if options.size:\n size = re.findall(r'\\d+', options.size)\...
[ "0.64562356", "0.6439222", "0.6325315", "0.6266672", "0.6041786", "0.5977493", "0.5931963", "0.59223354", "0.58886665", "0.587598", "0.58754253", "0.5835262", "0.57991314", "0.5799057", "0.57806104", "0.5758509", "0.5742654", "0.5721877", "0.5714364", "0.56823987", "0.5674356...
0.7617174
0
Convert image file to RGB.
def convtoRGB(filename: str): fp = Image.open(filename) if fp.mode == "RGB": return 0 fp = fp.convert("RGB") fp.save(filename) fp.close() return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_color_image(path):\n with open(path, 'rb') as f:\n img = Image.fromarray(read_ppm(f), mode='RGB')\n img = tf.keras.preprocessing.image.img_to_array(img, dtype=int)\n img = tf.convert_to_tensor(img)\n return img", "def readImageFileRGB(imageFileLocation):\n \n sourceI...
[ "0.69575095", "0.68463105", "0.6834619", "0.67780966", "0.67780465", "0.6773529", "0.67587686", "0.6747556", "0.6705816", "0.66292435", "0.6559382", "0.65475", "0.6545475", "0.6513206", "0.651099", "0.65070426", "0.64522386", "0.642863", "0.6427746", "0.6422845", "0.641282", ...
0.77831095
0
Perform one of 3 operations on a tuple of ints. For pixel bitwise operations.
def tuple_operation(a: list, b: list, op: str) -> list: o = [] for i in range(0, 3): if op == "xor": o.append(a[i] ^ b[i]) elif op == "and": o.append(a[i] & b[i]) elif op == "or": o.append(a[i] | b[i]) else: raise RuntimeError('Unkn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitmask(*args: Union[int, Sequence[int], Tuple[int, int]]) -> int:\n mask = 0\n\n for a in args:\n if isinstance(a, tuple):\n hi, lo = a\n mask |= ((1 << (hi - lo + 1)) - 1) << lo\n elif isinstance(a, (list, set)):\n mask |= reduce(operator.or_, ((1 << b) fo...
[ "0.6143161", "0.6135129", "0.6123766", "0.59546065", "0.58128524", "0.5672703", "0.56639004", "0.56437135", "0.56320465", "0.5619139", "0.56042755", "0.55926585", "0.5591671", "0.5573612", "0.55426735", "0.5523497", "0.5506474", "0.5505779", "0.54240936", "0.5401375", "0.5395...
0.62276465
0
Attempts to parse Season from filename. If no season is found, returns S01.
def parse_season(filename): print_info('Attempting to parse {0}'.format(filename)) print_info('Extracting season from {0}'.format(filename)) for regex in SEASON_REGEX: m = re.search(regex, filename) if m is None: continue extracted_season = m.group('Season').lower() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season(self, seasonnum, order='aired'):\n if order=='aired':\n seasons = self.seasons\n elif order == 'dvd':\n seasons = self.dvd_seasons\n try:\n return seasons[seasonnum]\n except KeyError:\n raise SeasonNotFoundError(\n '...
[ "0.65561193", "0.6510522", "0.6207461", "0.58912414", "0.5865345", "0.5858775", "0.58224946", "0.58124167", "0.5806633", "0.57401437", "0.5663297", "0.5575576", "0.55308545", "0.5495587", "0.5439508", "0.5395807", "0.53844255", "0.53698343", "0.53636944", "0.53541434", "0.534...
0.88426566
0
Attempts to parse episode title from filename. Will strip out separators at start of string. If no title is found, returns empty string
def parse_episode_title(filename): print_info('Attempting to parse episode title from {0}'.format(filename)) for regex in EPISODE_TITLE_REGEX: m = re.search(regex, filename) if m is None: continue extracted_title = m.group('EpisodeTitle') return clean_episode_title(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_anime_episode_title(filename):\n print_info('Attempting to parse episode title from {0}'.format(filename))\n for regex in ANIME_EPISODE_TITLE_REGEXS:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_title = m.group('EpisodeTitle')\n ...
[ "0.7903644", "0.7394436", "0.710285", "0.70086825", "0.70013696", "0.69837636", "0.67549497", "0.67480516", "0.6742487", "0.6429723", "0.6402898", "0.63838804", "0.63431174", "0.61843216", "0.6144727", "0.6041006", "0.6027109", "0.6011833", "0.6007994", "0.5985635", "0.597785...
0.8399631
0
Given a filename, attempts to match a part num (a = 1, b = 2) from the title. Returns 0 if no matches.
def parse_episode_part(filename): print_info('Extracting part num from {0}'.format(filename)) baseline = ord('a') for regex in EPISODE_PART_REGEXS: m = re.search(regex, filename) if m is None: continue extracted_part = m.group('Part').lower() print_info('Extrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part2(filename: str) -> int:\n data = parse(filename)\n return index_of_floor(data, -1)", "def part1(filename: str) -> int:\n data = parse(filename)\n return floor(data)", "def parse_file_name(filename):\n import re\n rgx = r'bin_thresh_([0-9]+).*n_bins_([0-9]+)'\n m = ...
[ "0.6751518", "0.6263981", "0.5971167", "0.58939177", "0.5654045", "0.56235677", "0.5593702", "0.5590457", "0.55777425", "0.55152124", "0.55021846", "0.5431569", "0.5425024", "0.54201186", "0.54200935", "0.5410898", "0.54031086", "0.53731877", "0.53707474", "0.536376", "0.5356...
0.6578844
1
Given a filename, matches episode and returns episode in E01 format. This will ignore episode parts. Returns None if no matches.
def parse_episode(filename): print_info('Extracting episode from {0}'.format(filename)) for regex in EPISODE_NUM_REGEXS: m = re.search(regex, filename) if m is None: continue extracted_ep = m.group('Episode').lower() print_info('Extracted episode: {0}'.format(extrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_anime_episode(filename):\n print_info('Extracting episode from {0}'.format(filename))\n for regex in ANIME_EPISODE_NUM_REGEXS:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_ep = m.group('Episode')\n print_info('Extracted episode: ...
[ "0.77291584", "0.7096206", "0.7037154", "0.65560323", "0.6157339", "0.6106215", "0.60878634", "0.6056859", "0.57441247", "0.5640848", "0.5640518", "0.55741304", "0.5570394", "0.5563704", "0.5439408", "0.54036874", "0.53817", "0.53173405", "0.53050005", "0.5271643", "0.5241164...
0.7861588
0
Given a filename, match anime sub group and return group without brackets. Returns None if no matches.
def parse_anime_group(filename): print_info('Extracting hash from {0}'.format(filename)) for regex in ANIME_GROUP_REGEXS: m = re.search(regex, filename) if m is None: continue ep_group = m.group('Group') print_info('Extracted Group: {0}'.format(ep_group)) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMatch(reMatch,group=0):\n if reMatch: return reMatch.group(group)\n else: return ''", "def _group_for(file_path):\n return re.sub(pattern_pair_lane_combo, \"\", os.path.basename(file_path))", "def _match(self, filename: str) -> Optional[dict]:\n if not self.named_regexp:\n ...
[ "0.5639445", "0.5604266", "0.54635483", "0.5407139", "0.53795815", "0.5321197", "0.5296679", "0.5288988", "0.52636635", "0.52251065", "0.51743466", "0.51570415", "0.5005359", "0.50016093", "0.49634275", "0.49463814", "0.49241462", "0.4921792", "0.48386148", "0.48225185", "0.4...
0.7050889
0
Given a filename, matches episode and returns episode in E01 format. This will ignore episode parts. Returns None if no matches.
def parse_anime_episode(filename): print_info('Extracting episode from {0}'.format(filename)) for regex in ANIME_EPISODE_NUM_REGEXS: m = re.search(regex, filename) if m is None: continue extracted_ep = m.group('Episode') print_info('Extracted episode: {0}'.format(ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_episode(filename):\n print_info('Extracting episode from {0}'.format(filename))\n for regex in EPISODE_NUM_REGEXS:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_ep = m.group('Episode').lower()\n print_info('Extracted episode: {0}'...
[ "0.7861297", "0.7095891", "0.70367754", "0.6554921", "0.6155849", "0.6104916", "0.6086632", "0.6056212", "0.5743952", "0.5641562", "0.5639342", "0.5573497", "0.5569225", "0.556454", "0.5441612", "0.54038036", "0.5382811", "0.5318519", "0.53037167", "0.5271705", "0.5240671", ...
0.77290845
1
Attempts to parse episode title from filename. Will strip out separators at start of string. If no title is found, returns empty string
def parse_anime_episode_title(filename): print_info('Attempting to parse episode title from {0}'.format(filename)) for regex in ANIME_EPISODE_TITLE_REGEXS: m = re.search(regex, filename) if m is None: continue extracted_title = m.group('EpisodeTitle') return clean_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_episode_title(filename):\n print_info('Attempting to parse episode title from {0}'.format(filename))\n for regex in EPISODE_TITLE_REGEX:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_title = m.group('EpisodeTitle')\n return clean_...
[ "0.83965796", "0.7394562", "0.71009195", "0.7009156", "0.70020264", "0.69802344", "0.6753111", "0.6746745", "0.6742253", "0.64262295", "0.6403628", "0.6383935", "0.63456243", "0.6184778", "0.61438733", "0.6041889", "0.6026892", "0.6013797", "0.6009238", "0.5984488", "0.597954...
0.7900671
1
Attempts to parse Volume from filename. If no season is found, returns Volume 0.
def parse_volume(filename): print_info('Extracting volume from {0}'.format(filename)) for regex in MANGA_VOLUME_REGEX: m = re.search(regex, filename) if m is None: continue extracted_season = m.group('Volume').lower() print_info('Extracted volume: {0}'.format(extrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_season(filename):\n print_info('Attempting to parse {0}'.format(filename))\n print_info('Extracting season from {0}'.format(filename))\n for regex in SEASON_REGEX:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_season = m.group('Season...
[ "0.7012481", "0.5876939", "0.58329153", "0.5769287", "0.5705311", "0.5654707", "0.56111854", "0.5477228", "0.54399407", "0.5311714", "0.52573496", "0.5254276", "0.52401394", "0.5199329", "0.5148581", "0.5132743", "0.5121778", "0.50900745", "0.5075869", "0.5072004", "0.5059811...
0.8472952
0
Attempts to parse manga title from filename. Will strip out separators at start of string. If no title is found, returns empty string
def parse_manga_title(filename): print_info('Attempting to parse manga title from {0}'.format(filename)) for regex in MANGA_TITLE_REGEX: m = re.search(regex, filename) if m is None: continue extracted_title = m.group('Series') return clean_episode_title(extracted_ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_title(title):\n title = title.split(\" / \")\n return title", "def parse_movie_title(file_name):\n\tmovie_name = os.path.basename(file_name)\n\tmovie_name = parsers.remove_extension(file_name)\n\tmovie_name = movie_name.lower()\n\tmovie_name = parsers.fix_word_seperators(movie_name)\n\tmovie_name...
[ "0.7183822", "0.69831145", "0.6956511", "0.67418593", "0.6703901", "0.66796917", "0.66499287", "0.6620092", "0.6562216", "0.6534533", "0.65228283", "0.6514367", "0.6505699", "0.64771134", "0.6456151", "0.6445295", "0.6414232", "0.640962", "0.6374577", "0.63695", "0.63191026",...
0.8022794
0
Given a filename, matches chapter and returns episode in Chapter 01 format. This will ignore episode parts. Returns None if no matches.
def parse_chapter(filename): print_info('Extracting chapter from {0}'.format(filename)) for regex in MANGA_CHAPTER_REGEX: m = re.search(regex, filename) if m is None: continue extracted_ep = m.group('Chapter') print_info('Extracted chapter: {0}'.format(extracted_ep)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_episode(filename):\n print_info('Extracting episode from {0}'.format(filename))\n for regex in EPISODE_NUM_REGEXS:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_ep = m.group('Episode').lower()\n print_info('Extracted episode: {0}'...
[ "0.64668596", "0.6292552", "0.62716854", "0.6262924", "0.6116237", "0.6082553", "0.59884256", "0.55361134", "0.5378302", "0.5213499", "0.51608306", "0.5141356", "0.51305044", "0.5126948", "0.5124161", "0.5090696", "0.49776387", "0.4929345", "0.49215916", "0.49136674", "0.4893...
0.81106716
0
Given a filename, match media info and return MediaInfo object. Returns empty MediaInfo if no matches.
def parse_media_info(filename): print_info('Extracting hash from {0}'.format(filename)) media_info = MediaInfo() for media_info_type in MEDIA_INFO_REGEXS: #print_info('Parsing for {0}'.format(media_info_type)) for regex in MEDIA_INFO_REGEXS[media_info_type]: m = re.search(regex, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_media_info(self, filename: str) -> Metadata:\n result: pymediainfo.MediaInfo = pymediainfo.MediaInfo.parse(filename)\n video: Optional[pymediainfo.Track] = None\n audio: Optional[pymediainfo.Track] = None\n for track in result.tracks:\n if track.track_type == 'Video':...
[ "0.7050766", "0.594156", "0.5739192", "0.5650894", "0.5641395", "0.55515015", "0.54971373", "0.54524463", "0.54304963", "0.53639674", "0.53617114", "0.53504264", "0.5291985", "0.52432436", "0.52310705", "0.5195647", "0.5189608", "0.5154483", "0.5132156", "0.5129597", "0.50846...
0.72634566
0
Returns True if Season is formated as Special (ie S00)
def is_special_season(season_str): return season_str == 'S00'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_season(cls, season):\r\n\r\n\t\tseason = season.lower()\r\n\t\tdataset = cls.all_seasons()\r\n\r\n\t\ttry:\t# Check in the all_seasons dataset\r\n\t\t\tind = [s.lower() for s in dataset].index(season)\r\n\t\texcept ValueError:\r\n\t\t\treturn False\r\n\t\t\r\n\t\treturn dataset[ind]", "def test_repr...
[ "0.60816735", "0.589254", "0.5782258", "0.57802796", "0.56272554", "0.5410547", "0.529985", "0.5259862", "0.5199486", "0.5183002", "0.51205367", "0.507707", "0.50683486", "0.50476295", "0.50401866", "0.50400954", "0.5029831", "0.50231254", "0.50136346", "0.50123596", "0.50093...
0.78620213
0
Returns true if file is a known media extension. This list is selfmaintained.
def is_media_file(file): return file.lower().endswith(MEDIA_EXTENSIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_known_media(extension: str) -> bool:\n return get_analyze_tool(extension) is not None", "def _valid_extension(self, filename):\n return any(filename.endswith(ext)\n for ext in self.config['document-extensions'])", "def have_mpeg_extension(l):\r\n if \".mpeg\" in str(l)...
[ "0.7715759", "0.7290552", "0.7252331", "0.7247137", "0.7134413", "0.70900923", "0.703342", "0.7006105", "0.7005341", "0.6998105", "0.6968491", "0.69278425", "0.6858323", "0.6823715", "0.68025523", "0.6800015", "0.6790841", "0.67759055", "0.67607844", "0.6729701", "0.6699359",...
0.8435781
0
Returns true if file is a known subtitle extension. This list is selfmaintained.
def is_subtitle(file): return file.lower().endswith(SUBTITLE_EXTENSIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extensions", "def _valid_extension(self, filename):\n return any(filename.endswith(ext)\n for ext in self.config['document-extensions'])", ...
[ "0.725117", "0.71732587", "0.69373", "0.69332296", "0.6831451", "0.67917275", "0.67758065", "0.6760962", "0.6631628", "0.663049", "0.6602128", "0.6560397", "0.6558565", "0.65360624", "0.6481933", "0.6469865", "0.6469865", "0.64661765", "0.64196044", "0.64022356", "0.63865197"...
0.84408325
0
Returns true if file is a known manga file extension. This list is selfmaintained.
def is_manga(file): return file.lower().endswith(MANGA_EXTENSIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supportsFile(self, filename):\n extension = filename.rsplit(\".\", 1)[1]\n return extension in AcronymDisambiguator.supported_extensions", "def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extens...
[ "0.7768693", "0.75858337", "0.74395084", "0.7438519", "0.74237555", "0.73428005", "0.7329734", "0.7262043", "0.71752834", "0.7127566", "0.7086381", "0.7047793", "0.70406044", "0.70379883", "0.7032205", "0.7007886", "0.70009905", "0.6985098", "0.6908625", "0.6896287", "0.68942...
0.8054451
0
Formats a number to have leading 0 if below 10
def format_num(num): if num is None: return num if (num < 10): return '0' + str(num) return str(num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_leading_zero(num):\n formated = \"\"\n if num <= 9:\n formated = \"0\" + str(num)\n else:\n formated = str(num)\n \n return formated", "def format_number(num):\n result = \" \" + str(num) + \" \"\n if num < 10:\n result = result + \" \"\n return result", "de...
[ "0.80409414", "0.7454219", "0.7180003", "0.7118244", "0.710393", "0.7098261", "0.70806056", "0.70411575", "0.7036366", "0.701721", "0.6974548", "0.68971974", "0.6879016", "0.685904", "0.68265", "0.6797871", "0.6663686", "0.66584074", "0.66531134", "0.66283935", "0.6618726", ...
0.75125474
1
defined_timepoints should be an array the length of the t with True at timepoints that are defined and False at timepoints that are not defined. signal should also be an array of length t. Timepoints at defined as False will be overwritten. This script supports extrapolation at beginning/end of the time signal. As a qu...
def interpolate(timepoint_defined, signal, interp_type, TR): timepoint_defined = np.array(timepoint_defined) true_inds = np.where(timepoint_defined == True)[0] false_inds = np.where(timepoint_defined == False)[0] signal_copy = np.array(signal) if interp_type == 'linear': #Still need to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, x, y, t, n_knots):\n knots = np.linspace(t[0], t[-1], n_knots)[1:-1]\n self.splx = LSQUnivariateSpline(t, x, knots)\n self.sply = LSQUnivariateSpline(t, y, knots)", "def interpolate_timeseries(self, x, t, **kw):\n v, t_v = self.timeseries(x, rmnans=True)\n kw...
[ "0.52057767", "0.5184135", "0.5069236", "0.50574136", "0.5040914", "0.5033069", "0.50243026", "0.50067616", "0.49909055", "0.49680924", "0.49592513", "0.49105948", "0.48705408", "0.48515925", "0.48463446", "0.47955865", "0.47912607", "0.47874224", "0.47767767", "0.47721148", ...
0.7511313
0
Takes input_matrix . Returns the num_dimensions top PCs from the input_matrix which are derived excluding n_skip_vols, but zeros are padded to the beginning of the time series in place of the n_skip_vols.
def reduce_ics(input_matrix, num_dimensions, n_skip_vols): if input_matrix.shape[0] > input_matrix.shape[1]: raise NameError('Error: input_matrix should have longer dim1 than dim0') if input_matrix.shape[0] <= 1: raise NameError('Error: input matrix must have multiple matrices') input_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_dim(CT):\r\n if CT[0]==0 and CT[-1]==0:\r\n return 2\r\n elif CT[0]!=0 and CT[-1]!=0:\r\n return 4", "def number_of_my_pieces_on_top_of_column(column):\n return number_pieces_on_top_of_column(column, ME)", "def dim_calculator():\r\n probe_set = np.arange(1, 101)\r\n X = ...
[ "0.5903456", "0.56333894", "0.5466866", "0.5411916", "0.53824496", "0.5358453", "0.5351578", "0.5325505", "0.53176636", "0.52856857", "0.5241535", "0.5235526", "0.5217601", "0.5186762", "0.5182601", "0.5180318", "0.51582104", "0.51286626", "0.51122636", "0.5110314", "0.509669...
0.6463705
0
Get Server Stats Retrieves statistics from specified virtual server on remote ESX host. Middleware See SETTINGS for active Middleware. Decorators request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request.user.company.services service.vars i...
def get_stats(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settings.VMWA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_agent_statistics(ctx):\n data = ctx.obj.get_agent_statistics()\n output_json_data(data)", "def getServerStats():\n return _xmlUrlToDict(serverString + \"/rest/stats\", int)", "def get_stats(self, **kwargs):\n resp = self.get(_u.build_uri(\"stats\"), kwargs)\n return utils.hand...
[ "0.6535754", "0.6408665", "0.6251992", "0.6020277", "0.5998159", "0.5969544", "0.59649163", "0.57734495", "0.57358783", "0.5725229", "0.5711126", "0.56402624", "0.5590553", "0.559012", "0.55724096", "0.55563945", "0.5519289", "0.5477847", "0.5456502", "0.5455757", "0.54520005...
0.73025566
0
Get ISO's Retrieves available ISO's from remote ESX server. Middleware See SETTINGS for active Middleware. Decorators request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request.user.company.services service.vars is injected into view paramet...
def get_isos(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settings.VMWARE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mount_iso(request, server_ids, server_id):\n try:\n if int(server_id) not in server_ids:\n raise Exception(\"Forbidden: specified Server does not belong to specified Service.\")\n\n server = Server.objects.get(pk=server_id) \n\n pysph = Vsphere(settings.VMWARE[\"address...
[ "0.54663813", "0.5239825", "0.5185842", "0.51477236", "0.51229256", "0.5100645", "0.5098369", "0.50894827", "0.50523245", "0.5024148", "0.5004038", "0.4989683", "0.49810952", "0.49747014", "0.4909734", "0.4855931", "0.48532784", "0.48409742", "0.48344976", "0.48288152", "0.48...
0.63716525
0
Get Snapshots Retrieves current snapshots from specified virtual server on remote ESX host. Middleware See SETTINGS for active Middleware. Decorators request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request.user.company.services service.va...
def get_snapshots(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_snapshot(request, server_ids, server_id):\n try:\n if int(server_id) not in server_ids:\n raise Exception(\"Forbidden: specified Server does not belong to specified Service.\")\n\n server = Server.objects.get(pk=server_id) \n\n pysph = Vsphere(settings.VMWARE[\"addre...
[ "0.5857182", "0.51904744", "0.51279587", "0.512064", "0.5120219", "0.51159644", "0.5079558", "0.5031905", "0.5025098", "0.4991249", "0.49760702", "0.4864958", "0.48456377", "0.48372346", "0.48092607", "0.48084846", "0.48013473", "0.47983864", "0.47840318", "0.4779444", "0.475...
0.6681699
0
Reboot virtual server Reboots specified guest virtual server on remote Vmware ESX host server. Middleware See SETTINGS for active Middleware. Decorators request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request.user.company.services service...
def reboot(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) graceful = (False, True)[request.POST["graceful"]==1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot(cls, client_object):\n # TODO: This function has not been tested yet as even with\n # VMware tools intalled on the guest, it throws an error saying\n # tools not found. VMware tools most probably remains to be\n # upgraded but upgrade was failing, so this function needs to\n ...
[ "0.6071136", "0.60458004", "0.59725505", "0.5948936", "0.58556163", "0.57863706", "0.5677436", "0.5642851", "0.5635296", "0.54480135", "0.5332371", "0.52588296", "0.52458423", "0.52172923", "0.5209717", "0.5202578", "0.5182258", "0.5162518", "0.5144667", "0.51139766", "0.5096...
0.6945389
0
Shutdown virtual server Shuts down specified virtual server on remote ESX server. Middleware See SETTINGS for active Middleware. Decorators request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request.user.company.services service.vars is inje...
def shutdown(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) graceful = (False, True)[request.POST["graceful"]==1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown():\n query = {\n \"type\": \"op\",\n \"cmd\": \"<request><shutdown><system></system></shutdown></request>\",\n }\n\n return __proxy__[\"panos.call\"](query)", "def server_shutdown():\n if not current_app.testing:\n abort(404)\n shutdown = request.environ.get('werk...
[ "0.58221376", "0.5652867", "0.5633478", "0.5512474", "0.55091625", "0.5446589", "0.53668517", "0.53540623", "0.5335905", "0.53014016", "0.5277671", "0.5255064", "0.5249671", "0.5227023", "0.52244073", "0.51961076", "0.5185618", "0.5120593", "0.51097167", "0.50895905", "0.5053...
0.65556806
0
Boot virtual server Starts specified virtual server on remote ESX server. Middleware See SETTINGS for active Middleware. Decorators request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request.user.company.services service.vars is injected int...
def boot(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settings.VMWARE["us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runServer(self, services=[]):\n self.add_routes()\n #debug = self.general_section.get(\"debug\")\n host = self.general_section.get(\"host\")\n use_reloader = ast.literal_eval(self.general_section.get(\"use_reloader\"))\n app_port = int(self.general_section.get(\"port\"))\n ...
[ "0.5738992", "0.5492787", "0.5327996", "0.5312335", "0.51900184", "0.517885", "0.51741856", "0.5173999", "0.5169485", "0.51680285", "0.51146597", "0.5113733", "0.50984204", "0.5079159", "0.50769037", "0.5070328", "0.5066219", "0.5064558", "0.5041801", "0.5028197", "0.5028186"...
0.58371264
0
Mount ISO Mounts ISO image to specified virtual server on remote ESX host. Middleware See SETTINGS for active Middleware. Decorators request.POST must validated against MountISOForm request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id must belong to request....
def mount_iso(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settings.VM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, request, *args, **kwargs):\n if kwargs['optionset'] == 'sftp':\n optinon_sets = self.get_optionset(**kwargs)\n optinon_sets['roots'][0]['storageKwArgs'] = {'host':'127.0.0.1','params':{'port':22,'username':'test','password':'password','timeout':30},'root_path':'/','inter...
[ "0.57202363", "0.54544556", "0.50262815", "0.49868786", "0.496743", "0.4941795", "0.49183723", "0.48764548", "0.4820336", "0.4734352", "0.47233418", "0.4671546", "0.46713078", "0.46507204", "0.45900878", "0.45735082", "0.45509788", "0.4540023", "0.45398417", "0.45255217", "0....
0.6751748
0
Delete Snapshot Deletes specified snapshot from specified virtual server on remote ESX host. Middleware See SETTINGS for active Middleware. Decorators request.POST must validated against SnapshotPathForm request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id m...
def delete_snapshot(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aws_service_api_snapshot_delete(self):\n pass", "def delete_snapshot(self, pool, project, share, snapshot):\n svc = self.snapshot_path % (pool, project, share, snapshot)\n ret = self.rclient.delete(svc)\n if ret.status != restclient.Status.NO_CONTENT:\n exception_m...
[ "0.6453076", "0.6442975", "0.64367163", "0.6189414", "0.60990024", "0.6036216", "0.6013612", "0.6008914", "0.5983087", "0.5977909", "0.5942238", "0.5924171", "0.58846086", "0.58083814", "0.57459307", "0.5736088", "0.57215405", "0.5701219", "0.5689264", "0.5685936", "0.5600678...
0.73833895
0
Revert to Snapshot Loads specified snapshot onto specified virtual server on remote ESX host. Middleware See SETTINGS for active Middleware. Decorators request.POST must validated against SnapshotPathForm request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True service_id ...
def revert_snapshot(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settings....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_snapshot(request, server_ids, server_id):\n try:\n if int(server_id) not in server_ids:\n raise Exception(\"Forbidden: specified Server does not belong to specified Service.\")\n\n server = Server.objects.get(pk=server_id) \n\n pysph = Vsphere(settings.VMWARE[\"ad...
[ "0.58595234", "0.5674384", "0.53096426", "0.5209524", "0.51047814", "0.51033866", "0.50901073", "0.49823633", "0.49564284", "0.492779", "0.49041724", "0.48693687", "0.48587185", "0.48403063", "0.4833645", "0.48221922", "0.4748726", "0.4738229", "0.47228962", "0.46986353", "0....
0.68911296
0
Create Snapshot Creates snapshot for specified virtual server on remote ESX host. Middleware See SETTINGS for active Middleware. Decorators request.POST must validated against CreateSnapshotForm request.method must be POST request.is_ajax() must be True request.user.is_authenticated() must be True. service_id must belo...
def create_snapshot(request, server_ids, server_id): try: if int(server_id) not in server_ids: raise Exception("Forbidden: specified Server does not belong to specified Service.") server = Server.objects.get(pk=server_id) pysph = Vsphere(settings.VMWARE["address"], settings....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_snapshot(self, **kwargs):\n post_body = json.dumps({'snapshot': kwargs})\n resp, body = self.post('snapshots', post_body)\n body = json.loads(body)\n self.validate_response(schema.create_snapshot, resp, body)\n return rest_client.ResponseBody(resp, body)", "def test_...
[ "0.64445734", "0.599166", "0.57448906", "0.5469427", "0.54688334", "0.5468065", "0.5414597", "0.5288698", "0.5274899", "0.5210391", "0.52082366", "0.5170502", "0.5111824", "0.5063098", "0.5043961", "0.49805242", "0.49742872", "0.49592844", "0.49361795", "0.49242008", "0.49197...
0.7242029
0
Calls an external service to get the 512 dimensional vector representation of a piece of text.
def getVector(text): url = cfg.use_vectoriser res = requests.post(url, json={'text': text, 'access_key': cfg.vectoriser_access_key}) res_dictionary = res.json() return res_dictionary['vectors']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVectorSemanticSBERT(text):\n url = cfg.sbert_vectoriser\n res = requests.post(url, json={'text': text, 'access_key': cfg.vectoriser_access_key})\n res_dictionary = res.json()\n return res_dictionary['vectors']", "def get_vector(filename):\n\n command = 'tokenizer -l Java ' + filename\n process =...
[ "0.63218576", "0.60291815", "0.58886653", "0.5752013", "0.57420117", "0.56671554", "0.56116384", "0.56067157", "0.5598813", "0.55709213", "0.5546895", "0.5528327", "0.55065703", "0.54038143", "0.5393766", "0.53485817", "0.53431803", "0.5322824", "0.5266658", "0.5252179", "0.5...
0.7361391
0
Calls an external service to check if an ontology based similarity measures exist.
def checkOntoSimilarity(ontology_id): # print('checkOntoSimilarity() =>', ontology_id) url = cfg.ontology_sim + '/status' res = requests.post(url, json={'ontologyId': ontology_id}) resp = res.json() resp['statusCode'] = res.status_code return resp #resp['statusCode'] = 200 if ontology exists and 404 otherw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_similarity():\n for similarity_enum in SimilarityEnum:\n similarity = get_similarity(similarity=similarity_enum)", "def _do_action_calculate_similarity_cosine_express(self):\n self._run_express_job(\"com.directv.recommend.express.CosineCFTrainer\")\n self._scan_table(\"conten...
[ "0.55418694", "0.5462745", "0.5327672", "0.52760804", "0.5274831", "0.5257932", "0.52313405", "0.520455", "0.51740885", "0.5170471", "0.5106514", "0.5072726", "0.50368506", "0.50286376", "0.50125074", "0.4976025", "0.49748445", "0.49670857", "0.49516827", "0.49331462", "0.492...
0.70734555
0
Calls an external service to get ontology based similarity values for concept comparisons.
def getOntoSimilarity(ontology_id, key): # print('getOntoSimilarity() =>', ontology_id) url = cfg.ontology_sim + '/query' res = requests.post(url, json={'ontologyId': ontology_id, 'key': key}) res_dictionary = res.json() return res_dictionary.get('map', {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_similarity():\n for similarity_enum in SimilarityEnum:\n similarity = get_similarity(similarity=similarity_enum)", "def checkOntoSimilarity(ontology_id):\n # print('checkOntoSimilarity() =>', ontology_id)\n url = cfg.ontology_sim + '/status'\n res = requests.post(url, json={'ontologyId'...
[ "0.6378326", "0.6194076", "0.61910206", "0.5902058", "0.5871096", "0.5798367", "0.57184374", "0.5683188", "0.5659053", "0.55389374", "0.5500452", "0.53813356", "0.5354273", "0.5317129", "0.5310351", "0.52959776", "0.52875555", "0.5260313", "0.52589035", "0.5208928", "0.520777...
0.6420253
0
Calls an external service to remove an ontology index of similarity measures.
def removeOntoIndex(ontology_id): # print('removeOntoIndex() =>', ontology_id) url = cfg.ontology_sim + '/delete' body = { "ontologyId": ontology_id } try: res = requests.post(url, json=body) return res.json() except: print("Could not remove details for ontology with id " + ontology_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, attributeIndexOrName) -> None:\n ...", "def delete_analysis(self, index=None):\n del self.analyses[index]", "def delete_index(self):\n if self.index_module:\n self.index_module = None\n gc.collect()", "def clear_index(self):\n return AlgoliaU...
[ "0.5676058", "0.56232315", "0.5611934", "0.5523816", "0.5493624", "0.548013", "0.54756325", "0.5418296", "0.54067624", "0.54026085", "0.53894323", "0.5376037", "0.537539", "0.5375326", "0.532829", "0.53262866", "0.5293625", "0.52883387", "0.52846646", "0.52799225", "0.5257295...
0.68911314
0
Expand data values to include vector fields.
def add_vector_fields(attributes, data): for attrib in attributes: if attrib['similarity'] == 'Semantic USE': value = data.get(attrib['name']) if value is not None: newVal = {} newVal['name'] = value newVal['rep'] = getVector(value) data[attrib['name']] = newVal eli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XPLMSetDatavf(inDataRef, inValues, inoffset, inCount):", "def reconstruct_vectors(self, vectors):\n return self.instance_vectors(self.project_vectors(vectors))", "def reconstruct(self, vector):\n return self.reconstruct_vectors(vector[None, :]).flatten()", "def transform(self, X):\n\n ...
[ "0.57985044", "0.57326645", "0.5715466", "0.5694917", "0.56471896", "0.56404895", "0.5566394", "0.5539208", "0.5536029", "0.5524499", "0.55209816", "0.55079484", "0.5501829", "0.5462976", "0.54509324", "0.54299927", "0.542466", "0.5424079", "0.54230726", "0.5421098", "0.54076...
0.5971724
0
Retrieves an attribute by name from list of attributes.
def get_attribute_by_name(attributes, attributeName): for attrib in attributes: if attrib['name'] == attributeName: return attrib return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attr(attributes, name):\n try:\n return attributes.getValue(name)\n except KeyError:\n return None", "def get_attribute_by_name(self, name):\n if name in self._attributes:\n return self._attributes[name]", "def getAttributeByName(self, name):\n\n for eachAtt...
[ "0.7658042", "0.7415298", "0.72840863", "0.7235529", "0.7207669", "0.6930242", "0.6891297", "0.68178946", "0.67741", "0.65195173", "0.6496673", "0.64370036", "0.63892484", "0.634651", "0.6297161", "0.62925684", "0.62774605", "0.6250757", "0.6247883", "0.6225039", "0.61639416"...
0.7768928
0
Extracts the field names and local similarity values from explanations.
def get_explain_details2(match_explanation): expl = [] matchers = match_explanation["details"] # at times the explanation is not in 'details' list!! if len(matchers) <= 1: # not more than one explanation then match attribute in the entire string txt = str(match_explanation) m0 = re.search("attrib=([a-zA-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_explain_details(match_explanation):\n expl = []\n for x in match_explanation[\"details\"]:\n if len(re.findall(\"attrib=([a-zA-Z0-9_\\-\\s]+)\", str(x))) > 1:\n expl.extend(get_explain_details(x))\n elif len(re.findall(\"attrib=([a-zA-Z0-9_\\-\\s]+)\", str(x))) == 1:\n expl.append({\"fiel...
[ "0.7034078", "0.63352364", "0.5404273", "0.53421164", "0.5271887", "0.5226922", "0.5219064", "0.51516557", "0.5063566", "0.5059792", "0.50404525", "0.503089", "0.5003643", "0.4982319", "0.49770778", "0.49766776", "0.49477616", "0.4946338", "0.49421254", "0.49371213", "0.49218...
0.7042656
0
Extracts the field names and local similarity values from explanations.
def get_explain_details(match_explanation): expl = [] for x in match_explanation["details"]: if len(re.findall("attrib=([a-zA-Z0-9_\-\s]+)", str(x))) > 1: expl.extend(get_explain_details(x)) elif len(re.findall("attrib=([a-zA-Z0-9_\-\s]+)", str(x))) == 1: expl.append({"field": re.search("attrib=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_explain_details2(match_explanation):\n expl = []\n matchers = match_explanation[\"details\"] # at times the explanation is not in 'details' list!!\n if len(matchers) <= 1: # not more than one explanation then match attribute in the entire string\n txt = str(match_explanation)\n m0 = re.search(\"a...
[ "0.7042656", "0.63352364", "0.5404273", "0.53421164", "0.5271887", "0.5226922", "0.5219064", "0.51516557", "0.5063566", "0.5059792", "0.50404525", "0.503089", "0.5003643", "0.4982319", "0.49770778", "0.49766776", "0.49477616", "0.4946338", "0.49421254", "0.49371213", "0.49218...
0.7034078
1
Determine query function to use base on attribute specification and retrieval features. Add new query functions in the if..else statement as elif.
def getQueryFunction(projId, caseAttrib, queryValue, type, weight, simMetric, options): # print("all info: ", projId, caseAttrib, queryValue, weight, simMetric, options) # minVal = kwargs.get('minVal', None) # optional parameter, minVal (name 'minVal' in function params when calling function e.g. minVal=5) if sim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_attribute_functions(self, attributes):\n subqueries = []\n columns = []\n for attr in attributes:\n function = attributes[attr]\n if function == 'sum':\n sq = DBSession.query(\n self.db_item.id.label('item_id'),\n ...
[ "0.5697198", "0.5662157", "0.5401362", "0.5395566", "0.5387177", "0.5374541", "0.53423876", "0.5328231", "0.5312965", "0.52468014", "0.5219396", "0.5194634", "0.5166136", "0.5139881", "0.50574815", "0.5056084", "0.50426435", "0.49981192", "0.49846688", "0.4973126", "0.4971519...
0.5762467
0
Find the documents whose attribute values have the closest date to the query date. The date field field is indexed as 'keyword' to enable use of this similarity metric.
def ClosestDate(caseAttrib, queryValue, weight, scale, decay): # format 'dd-MM-yyyy' e.g. '01-02-2020' # format = "%d-%m-%Y"'T'"%H:%M:%SZ" # qd = dateutil.parser.isoparse(queryValue) # queryValue = qd.strftime(format) # enforce query conversion to a known date format # build query string queryFnc = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_similar(self, doc, *args, **kwargs):\n n = kwargs.get('n', 5)\n distance_threshold = kwargs.get('distance_threshold', 0.4)\n\n # for each doc, find the most similar one...\n distances = []\n doc_vector = self.vectorizer.transform([doc])\n for i in range(self.vecto...
[ "0.55266094", "0.55023867", "0.53997016", "0.5353275", "0.5253669", "0.5195839", "0.5052103", "0.5045156", "0.50290847", "0.49706817", "0.4961016", "0.49455598", "0.4920742", "0.48854512", "0.48792627", "0.4833882", "0.4785057", "0.47798833", "0.47738934", "0.47621465", "0.47...
0.6085392
0
Find the documents whose attribute values have the closest number to the query value.
def ClosestNumber(caseAttrib, queryValue, weight, scale, decay): # build query string queryFnc = { "script_score": { "query": { "exists": { "field": caseAttrib } }, "script": { "params": { "attrib": caseAttrib, "origin": queryValue, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_to(arr, attr, val, d):\n return filter(lambda x: getattr(x, attr) < (val + d) and \\\n getattr(x, attr) > (val - d))", "def ExactFloat(caseAttrib, queryValue, weight):\n# build query string\n queryFnc = {\n \"script_score\": {\n \"query\": {\n \"match\": {\n ...
[ "0.59564763", "0.5936828", "0.5867875", "0.5759276", "0.5702409", "0.5649545", "0.5627116", "0.56253165", "0.55926055", "0.55565405", "0.55482215", "0.55043507", "0.5457859", "0.545129", "0.54412174", "0.5436948", "0.54245114", "0.54063326", "0.539235", "0.5386835", "0.538683...
0.63594174
0
Implements Table local similarity function. Returns the similarity of two categorical values as specified in a similarity table.
def TableSimilarity(caseAttrib, queryValue, weight, options): # stores enum as array # build query string queryFnc = { "script_score": { "query": { "exists": { "field": caseAttrib } }, "script": { "params": { "attrib": caseAttrib, "queryVa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similarity_function(x, y):\n\n def safe_get(field, row, default_value):\n # Safely get a value from the Row. If the value is None, get the\n # default value.\n return row[field] if row[field] is not None else default_value\n\n # Extract the values for the categorical and continuous f...
[ "0.69848186", "0.62539935", "0.60823643", "0.6052001", "0.59764874", "0.5878306", "0.58704215", "0.58704215", "0.582548", "0.58230436", "0.58203584", "0.5806522", "0.57730836", "0.5752258", "0.57377684", "0.57145524", "0.5623567", "0.5575845", "0.556843", "0.55584645", "0.554...
0.6394701
1
Gathered columns collects all the rules for column types into a single rule
def test_gather_columns(self): expected_gathered_columns = [ """ unusable_col: "DUMMYVALUNUSABLECOL" date.1: date_0 | extra_date_rule | "(" + date + ")" datetime.2: datetime_0 | extra_datetime_rule | "(" + datetime + ")" datetime_end.1: datetime_0 | da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_column_types(self):\n type_list = [\"category\" if u_input == 1 else float for u_input in self.user_column_label]\n self.df = self.df.astype(dict(zip(self.df.columns, type_list)))\n df_types = pd.DataFrame(self.df.dtypes).reset_index()\n df_types.columns = [\"column_name\", \...
[ "0.55393434", "0.55170125", "0.543612", "0.5387738", "0.5377282", "0.5342292", "0.5280521", "0.52610916", "0.52523977", "0.5230727", "0.5211386", "0.51994926", "0.51984006", "0.5189028", "0.5182764", "0.51507443", "0.5150619", "0.5115174", "0.510464", "0.5104271", "0.51035523...
0.5547532
0
Take input where each line looks like field > expected_sql field > expected_sql (commented out)
def examples(self, input_rows): for row in input_rows.split("\n"): row = row.strip() if row == "" or row.startswith("#"): continue if "->" in row: field, expected_sql = row.split("->") else: field = row ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_sql(filename=gconf.DB_builder.SQL_CONSTRUCTION):\n data = open(filename, 'r').readlines()\n statements = []\n delimiter = ';'\n stmt = ''\n\n for line_no, line in enumerate(data):\n if not line.strip():\n continue\n\n if line.startswith('--'):\n continue...
[ "0.6153281", "0.6014418", "0.60045666", "0.5805106", "0.5802801", "0.5782236", "0.5770598", "0.5674983", "0.5593435", "0.5580664", "0.5578472", "0.55357236", "0.5483118", "0.54549104", "0.5448157", "0.5410765", "0.53516304", "0.53106755", "0.5309566", "0.53088564", "0.5284135...
0.7079834
0
Take input where each input is separated by three equals field > expected_error === field > expected_error === field > expected_error (commented out)
def bad_examples(self, input_rows): for row in input_rows.split("==="): row = row.strip() if row == "" or row.startswith("#"): continue if "->" in row: field, expected_error = row.split("->") else: field = row ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nl_separated_values(self, test_input, expected, sc):\n assert sc.add(test_input) == expected", "def _expected_inputs():\n return 3", "def _expected_inputs():", "def test_coma_separated_values(self, test_input, expected, sc):\n assert sc.add(test_input) == expected", "def test_...
[ "0.61202556", "0.5965311", "0.59646755", "0.58384234", "0.58071953", "0.5796379", "0.5760207", "0.5751342", "0.57426506", "0.5663953", "0.56460077", "0.5634815", "0.5551057", "0.5529847", "0.54879475", "0.5475157", "0.54549694", "0.537635", "0.5363735", "0.5353585", "0.535006...
0.6859342
0
Test a selectable that is a recipe
def test_selectable_recipe(self): recipe = ( self.recipe(shelf=self.mytable_shelf).metrics("age").dimensions("first") ) b = SQLAlchemyBuilder(selectable=recipe) type_examples = """ [age] -> num [first] -> str ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_visualize_recipe_equipment_by_id(self):\n pass", "def test_choice(self):\n elt = random.choice(self.liste)\n self.assertIn(elt, self.liste)", "def test_choice(self):\n elt = random.choice(self.liste)\n self.assertIn(elt, self.liste)", "def select(self):\n re...
[ "0.605129", "0.59538436", "0.59538436", "0.59196895", "0.58766794", "0.58550155", "0.58480847", "0.5737638", "0.5733958", "0.571407", "0.56841546", "0.5680766", "0.56774086", "0.5634413", "0.56173414", "0.5614458", "0.560884", "0.5597763", "0.55921733", "0.55921733", "0.55727...
0.7407082
0
Test a selectable that is a orm class
def test_selectable_orm(self): b = SQLAlchemyBuilder(selectable=self.datatypes_table) type_examples = """ [score] -> num score -> num [testid] -> str [username] > "foo" -> bool s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_selectable_recipe(self):\n recipe = (\n self.recipe(shelf=self.mytable_shelf).metrics(\"age\").dimensions(\"first\")\n )\n b = SQLAlchemyBuilder(selectable=recipe)\n type_examples = \"\"\"\n [age] -> num\n [first] ...
[ "0.6240647", "0.61687773", "0.610817", "0.5998768", "0.5958093", "0.5926408", "0.59117585", "0.588814", "0.5821242", "0.57905215", "0.5758008", "0.5736668", "0.571749", "0.5699737", "0.5694868", "0.56794685", "0.56755096", "0.5670505", "0.5663485", "0.56564265", "0.56561023",...
0.72902095
0
Vertices are equivalent if they are sufficiently close. Use the "is" operator to test if they are identical.
def __eq__(self, other): return abs(self.x - other.x) + abs(self.y - other.y) < Vertex.epsilon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verticesEqual(self, v1, v2, eps=1e-8):\n if abs(v1[0] - v2[0]) > eps:\n return False\n if abs(v1[1] - v2[1]) > eps:\n return False\n if abs(v1[2] - v2[2]) > eps:\n return False\n return True", "def _vertices_are_equal(\n vertices1: List[np.ndarr...
[ "0.7453717", "0.72692144", "0.7005311", "0.6835252", "0.6734327", "0.6692228", "0.6658585", "0.6639025", "0.6619329", "0.661404", "0.65609276", "0.6522427", "0.65069145", "0.6498356", "0.6480899", "0.6462569", "0.6453289", "0.6429027", "0.64131904", "0.64131904", "0.6385622",...
0.74623466
0
Creates an element with Gst Element Factory make. Return the element if successfully created, otherwise print to stderr and return None.
def make_elm_or_print_err(factoryname, name, printedname, detail=""): print("Creating", printedname) elm = Gst.ElementFactory.make(factoryname, name) if not elm: sys.stderr.write("Unable to create " + printedname + " \n") if detail: sys.stderr.write(detail) return elm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_add_element(self, gst_element_name, name):\n gst_element = Gst.ElementFactory.make(gst_element_name, name)\n self.pipeline.add(gst_element)\n return gst_element", "def do_create_element(self, url):\n return Gst.parse_launch(self.launch_string)", "def create(data):\n ...
[ "0.6522517", "0.6347123", "0.58476955", "0.5683892", "0.5634748", "0.54181516", "0.5214508", "0.50888056", "0.501876", "0.5017379", "0.50081426", "0.49547052", "0.495271", "0.48818597", "0.48560447", "0.48304322", "0.48204416", "0.48021698", "0.4734166", "0.47069106", "0.4599...
0.72889155
0
``connection.extra_dejson`` but where keys are converted to lower case. This is used internally for caseinsensitive access of jdbc params.
def connection_extra_lower(self) -> dict: conn = self.get_connection(getattr(self, self.conn_name_attr)) return {k.lower(): v for k, v in conn.extra_dejson.items()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extra_dejson(self):\n obj = {}\n if self.extra:\n try:\n obj = json.loads(self.extra)\n except Exception as e:\n self.log.exception(e)\n self.log.error(\"Failed parsing the json for conn_id %s\", self.conn_id)\n\n return ob...
[ "0.6820992", "0.5492032", "0.5402606", "0.5353985", "0.5323187", "0.5273009", "0.52247745", "0.5186828", "0.5165687", "0.5121205", "0.5106709", "0.5086637", "0.5058252", "0.5017126", "0.50118935", "0.49766362", "0.49278525", "0.49092036", "0.4907377", "0.49054754", "0.4903246...
0.758095
0
Set autocommit for the given connection.
def set_autocommit(self, conn: jaydebeapi.Connection, autocommit: bool) -> None: conn.jconn.setAutoCommit(autocommit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_auto_commit(self, auto_commit):\n self.__aceQLHttpApi.set_auto_commit(auto_commit)", "def get_autocommit(self, conn: jaydebeapi.Connection) -> bool:\n return conn.jconn.getAutoCommit()", "def autocommit(self, val):\n if val:\n self.isolation_level = None\n else:\n...
[ "0.7673202", "0.68914723", "0.67960733", "0.6483478", "0.63436496", "0.634059", "0.6267601", "0.6198182", "0.6142179", "0.609381", "0.60444564", "0.58865654", "0.5796428", "0.56758994", "0.5546418", "0.5540986", "0.5535915", "0.5513793", "0.55099", "0.5454079", "0.5413985", ...
0.8574528
0
Get autocommit setting for the provided connection.
def get_autocommit(self, conn: jaydebeapi.Connection) -> bool: return conn.jconn.getAutoCommit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_auto_commit(self):\n return self.__aceQLHttpApi.get_auto_commit()", "def set_autocommit(self, conn: jaydebeapi.Connection, autocommit: bool) -> None:\n conn.jconn.setAutoCommit(autocommit)", "def autocommit(self) -> bool:\n return self._autocommit", "def get_conn(self):\n ...
[ "0.69197476", "0.6353389", "0.5830042", "0.5773924", "0.55353", "0.5462344", "0.5434265", "0.5369477", "0.53618443", "0.5309689", "0.5240811", "0.5230575", "0.52063566", "0.5097489", "0.50900126", "0.50890785", "0.50504774", "0.49926156", "0.4942451", "0.48938218", "0.4869205...
0.7610391
0