query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Remove html tags from string
def remove_html_tags(data): p = re.compile(r'<.*?>') return p.sub('', data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_html_tags(text):\n print('VOU REMOVER AS TAGS DA STRING')\n clean = re.compile('<.*?>')\n print('',re.sub(clean, '', text))\n return re.sub(clean, '', text)", "def remove_html_tags(self,text):\n #https://medium.com/@jorlugaqui/how-to-strip-html-tags-from-a-string-in-python-7cb81a2bb...
[ "0.8601719", "0.8508436", "0.8382815", "0.83795327", "0.8347479", "0.83158517", "0.83158517", "0.8291176", "0.8283774", "0.82750565", "0.8184092", "0.8181785", "0.8163925", "0.8146746", "0.8118009", "0.8096395", "0.80443776", "0.80394965", "0.800225", "0.7992396", "0.7960763"...
0.81516665
13
Get choices list from model queryset
def objects_to_choices(queryset): res = [] for elm in queryset: res.append((elm.pk, unicode(elm))) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_choices(cls):\n return cls.values.items()", "def get_choices(self):\n raise NotImplementedError()", "def get_choices(self):\n raise NotImplementedError()", "def get_choices_for_model_field(cls):\n return [c[0:2] for c in cls.attr_choices]", "def get_choices(self, instanc...
[ "0.744479", "0.7378873", "0.7378873", "0.72358197", "0.7182181", "0.7062831", "0.7040386", "0.69332314", "0.6900223", "0.68839663", "0.68183136", "0.68016744", "0.67447954", "0.66269994", "0.6531107", "0.65026766", "0.64537567", "0.6444781", "0.64409816", "0.6439735", "0.6432...
0.72486097
3
Generate unique filename with folder path
def generate_filename(extension, with_path=True, base_folder=None): name = get_md5(str(uuid4())) # if not extension: # extension = get_file_extension() if base_folder is not None: base_folder = "%s/" % base_folder.rstrip("/") else: base_folder = "" if with_path: return "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unique_path(prefix):\n suffix = ''.join([\n random.choice(string.ascii_letters) for i in range(8)\n ])\n return '%s/%r.%s' % (prefix, time.time(), suffix)", "def generateFilename(folder, prefix, ext):\n filename = os.path.basename(os.path.normpath(folder))\n if prefix:\...
[ "0.79868495", "0.7943087", "0.78634673", "0.7594685", "0.7574332", "0.7540442", "0.74794555", "0.74514514", "0.7435445", "0.74291724", "0.7418639", "0.7392791", "0.72711885", "0.7253524", "0.7251226", "0.72488075", "0.7138581", "0.7131509", "0.70886606", "0.7079675", "0.70515...
0.7308379
12
Return cached rated game map.
def get_rated_map(self): if not self._rated_map: self._rated_map = self.rate_game_map( self._game_map, self._start_bot_position, self._game_map[self._start_bot_position].get('orientation') ) return self._rated_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_cache(self):\n cache = {\"grains\": {}, \"pillar\": {}}\n if self.grains or self.pillar:\n if self.opts.get(\"minion_data_cache\"):\n minions = self.cache.list(\"minions\")\n if not minions:\n return cache\n for min...
[ "0.63036615", "0.6253817", "0.6018754", "0.59708107", "0.59329504", "0.5931083", "0.57815576", "0.5763771", "0.57630396", "0.5743628", "0.5729335", "0.5728442", "0.5688322", "0.5686882", "0.56468683", "0.56468683", "0.56468683", "0.56468683", "0.5564091", "0.55235744", "0.544...
0.82021224
0
Test notifications for '{}' Assessment if LCAD changed in import.
def test_import_lcad_changed(self, status): object_generator = ObjectGenerator() _, user = object_generator.generate_person(user_role="Creator") with factories.single_commit(): assessment = factories.AssessmentFactory() factories.CustomAttributeDefinitionFactory( title="Test LCAD", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ca_change_by_import(self):\n\n with factories.single_commit():\n assessment = factories.AssessmentFactory(status=\"Completed\")\n factories.CustomAttributeDefinitionFactory(\n definition_type=\"assessment\",\n title=\"Test GCAD\",\n )\n assessment_slug = assessment...
[ "0.65227103", "0.58965254", "0.5839855", "0.5828088", "0.573238", "0.57189643", "0.56951123", "0.5611068", "0.55925655", "0.55394477", "0.55107784", "0.5506721", "0.54670656", "0.5459034", "0.54566526", "0.54457396", "0.5430792", "0.5414864", "0.536464", "0.5345682", "0.52916...
0.70883405
0
Write a single byte `b` to the register `reg`.
def write_byte(fd, reg, b): write_read_i2c(fd, bytes([reg, b]), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_byte(self, register: str, byte: str):\n register = self.check_and_convert_add(register)\n\n if len(byte) != 2:\n raise Exception(\"Data to be written must be two digit hex.\")\n\n with SMBus(self.bus) as bus:\n bus.write_byte_data(self.device_address, register, in...
[ "0.6317357", "0.6310943", "0.61606467", "0.6113493", "0.6109886", "0.6037486", "0.59829706", "0.59804094", "0.58989334", "0.5845714", "0.5815657", "0.5801804", "0.57991797", "0.57344073", "0.5722734", "0.571573", "0.56957704", "0.5667175", "0.56635314", "0.56627876", "0.56470...
0.76068914
0
To keep this example small and relatively fast, drop examples with a length of over 40 tokens.
def filter_max_length(x, y, max_length=MAX_LENGTH): return tf.logical_and(tf.size(x) <= max_length, tf.size(y) <= max_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_short_tokens(tokens):\n return [token for token in tokens if len(token) > 3]", "def discard_samples(chain_length):\n return min(chain_length / 10, MAX_GEN_DISCARD)", "def test_drop_empty_tokens():\n assert TextCleaner().transform([[[\",;\", \"hi\"]]])[\"corpus\"][0] == [\"hi\"]", "def wor...
[ "0.6425843", "0.6183442", "0.60004586", "0.59855014", "0.5983173", "0.5861682", "0.58065724", "0.578105", "0.55717546", "0.55237716", "0.55221415", "0.551711", "0.5506792", "0.547445", "0.5457141", "0.5454833", "0.5425842", "0.5394221", "0.53631943", "0.5358843", "0.5352865",...
0.0
-1
True if argument is a list, tuple, array or similar object, but not a string, dictionary, set or similar object.
def is_sequence(arg): # np.float{16,32,64} and np.int types have __getitem__ defined # this is a long-standing bug in NumPy and unlikely to be fixed # todo: backport to qmmlpack, write tests if isinstance(arg, (str, bytes, np.number, dict, set)): return False return hasattr(arg, "__getitem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_iterable_non_string(arg):\n return (hasattr(arg, \"__iter__\") or hasattr(arg, \"__getattr__\")) and not isinstance(arg, str)", "def _is_list(arg):\n return isinstance(arg, collections.Sequence) and not _is_string(arg)", "def _is_list(arg):\n if isinstance(arg, dict):\n return False\n ...
[ "0.7427451", "0.7365814", "0.72341233", "0.6997561", "0.69131076", "0.6877407", "0.68771774", "0.6847154", "0.6832235", "0.6832235", "0.6787186", "0.66949373", "0.66357434", "0.6618669", "0.6615235", "0.66071737", "0.657454", "0.65229696", "0.65226245", "0.6507653", "0.646849...
0.63163567
32
Migrate unique IDs from {device_id}_{name} format to {mac}_{name} format. This makes devices persist better with in HA. Anything a device is unadopted/readopted or the Protect instance has to rebuild the disk array, the device IDs of Protect devices can change. This causes a ton of orphaned entities and loss of histori...
async def async_migrate_device_ids( hass: HomeAssistant, entry: ConfigEntry, protect: ProtectApiClient ) -> None: registry = er.async_get(hass) to_migrate = [] for entity in er.async_entries_for_config_entry(registry, entry.entry_id): parts = entity.unique_id.split("_") # device ID = 24...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate_unique_id(entity_entry: er.RegistryEntry) -> dict[str, Any]:\n unique_id_pieces = entity_entry.unique_id.split(\"_\")\n old_mac = unique_id_pieces[0]\n new_mac = \":\".join(old_mac[i : i + 2] for i in range(0, len(old_mac), 2))\n unique_id_pieces[0] = new_mac...
[ "0.6927677", "0.6247085", "0.6101666", "0.5996758", "0.5996758", "0.58577895", "0.5766163", "0.56719214", "0.5670506", "0.56046313", "0.5584782", "0.557637", "0.55463475", "0.54947066", "0.5476103", "0.5475579", "0.5473534", "0.54274833", "0.5399205", "0.53892463", "0.5373228...
0.6461366
1
Return a dict of package names to the prefixes in which they are found.
def get_packages_with_prefixes(): return get_resources('packages')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages_by_prefix(prefix: str) -> Dict[str, str]:\n\n with request.urlopen(PYPI_SIMPLE_API_URL) as response:\n html = response.read().decode()\n\n return {\n name: PYPI_SIMPLE_API_URL + url\n for url, name in re.findall(\n f'<a href=\"/simple/(.+)\">({prefix}.*)</a>',...
[ "0.70798814", "0.7064872", "0.67331815", "0.6549871", "0.6545638", "0.62590784", "0.61325586", "0.61162305", "0.60855556", "0.60424256", "0.6031952", "0.6021953", "0.5951021", "0.5908373", "0.58934957", "0.588966", "0.5888291", "0.58748186", "0.5858345", "0.58471984", "0.5845...
0.7163866
0
Return the share directory of the given package. For example, if you install the package 'foo' into '/home/user/ros2_ws/install' and you called this function with 'foo' as the argument, then it will return '/home/user/ros2_ws/install/share/foo' as the package's share directory.
def get_package_share_directory(package_name, print_warning=True): path = os.path.join(get_package_prefix(package_name), 'share', package_name) if print_warning and not os.path.exists(path): warnings.warn(f'Share directory for {package_name} ({path}) does not exist.', stacklevel=2) return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_share_path():\n cwd = os.path.dirname(__file__)\n share = os.path.join(cwd, '../share')\n return os.path.abspath(share)", "def get_package_share_path(package_name, print_warning=True):\n path = pathlib.Path(get_package_share_directory(package_name, print_warning=False))\n if print_warning ...
[ "0.73383856", "0.7195106", "0.6733271", "0.654978", "0.64101464", "0.6410121", "0.64074236", "0.61859256", "0.61550665", "0.6110169", "0.604608", "0.6021255", "0.5867037", "0.57402253", "0.5730514", "0.5730514", "0.5727352", "0.5651995", "0.56477326", "0.5625668", "0.5621952"...
0.79330677
0
Return the share directory of the given package as a pathlib.Path. For example, if you install the package 'foo' into '/home/user/ros2_ws/install' and you called this function with 'foo' as the argument, then it will return a path representing '/home/user/ros2_ws/install/share/foo' and then you could use it to construc...
def get_package_share_path(package_name, print_warning=True): path = pathlib.Path(get_package_share_directory(package_name, print_warning=False)) if print_warning and not path.exists(): warnings.warn(f'Share path for {package_name} ({path}) does not exist.', stacklevel=2) return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_share_directory(package_name, print_warning=True):\n path = os.path.join(get_package_prefix(package_name), 'share', package_name)\n if print_warning and not os.path.exists(path):\n warnings.warn(f'Share directory for {package_name} ({path}) does not exist.', stacklevel=2)\n return p...
[ "0.78777695", "0.7331659", "0.66936207", "0.65003026", "0.6498998", "0.6411748", "0.6398971", "0.6391163", "0.6391163", "0.6274969", "0.62154794", "0.6185831", "0.6154738", "0.60673237", "0.60666215", "0.59480935", "0.5942945", "0.5853484", "0.58451724", "0.5805256", "0.57855...
0.76993537
1
Return posts from user or page feed.
def get_messages_user(self, feed_id, count=20): return self.get_api().get_connections(feed_id.encode('utf-8'), 'feed')['data']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_posts(self):\n return Post.select().where (Post.user == self)", "def getMyPosts():\n \n cur, user_id = initialise(3)\n cur.execute(\"SELECT username FROM users WHERE id = ?\", [user_id])\n name = cur.fetchall()[0][0]\n cur.execute(\"SELECT * FROM posts WHERE name = ?\", [name])\n ...
[ "0.74407375", "0.7227192", "0.71885264", "0.7180094", "0.710736", "0.70922095", "0.70364356", "0.70281804", "0.70082176", "0.69656926", "0.69241816", "0.68731517", "0.6850463", "0.67434037", "0.67044604", "0.66728604", "0.66432154", "0.6641402", "0.6629619", "0.66023856", "0....
0.0
-1
Returns index from the minimum value from a list.
def get_imin(self, lists): return lists.index(min(lists))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __idx_of_minimum(cls, lst: list) -> int:\n\t\treturn lst.index(min(lst))", "def find_min(list):\n return find_value_at(list, -1)", "def smallest_elem_index(input_list):\n if len(input_list) == 0:\n raise Exception(\"List must contain at least 1 element\")\n \n min_index = 0 \n for i i...
[ "0.90256417", "0.85854316", "0.8256723", "0.81488645", "0.79086006", "0.764455", "0.76414484", "0.75774443", "0.75524396", "0.7515652", "0.75129807", "0.7506576", "0.74918216", "0.745322", "0.73739076", "0.73691887", "0.73543733", "0.7330311", "0.7308783", "0.7307598", "0.730...
0.7177751
26
Returns true if the value of the arc (a,b) is equal to the value of the arc(a,b) in the matrix g.
def is_equal(self, g, a, b): return self.matrix[a][b] == g[a][b]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_arc(self, a, b):\n return self.matrix[a][b] != 0", "def check_affine_equivalence(f, g, A, a, B, b):\n for x in range(0, 2**N):\n y = oplus(x, a)\n y = apply_bin_mat(y, A)\n y = g[y]\n y = apply_bin_mat(y, B)\n y = oplus(y, b)\n if y != f[x]:\n ...
[ "0.7822471", "0.6506238", "0.6231314", "0.6222611", "0.6148189", "0.61332256", "0.60304254", "0.6026992", "0.6001459", "0.59992355", "0.5986492", "0.5967857", "0.5934874", "0.59076464", "0.5868814", "0.5859294", "0.58513576", "0.5841561", "0.5820605", "0.5790869", "0.5784783"...
0.7848615
0
Reshapes highdimension input to a vector. [batch_size, mask_row, mask_col, n_mask] > [batch_size, mask_row mask_col n_mask]
def flatten_reshape(variable): dim = 1 for d in variable.get_shape()[1:].as_list(): dim *= d return tf.reshape(variable, shape=[-1, dim])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape_masks(masks, \n resize_shape,\n ):\n _reshaped_masks = np.array([cv2.resize(_lr, tuple(resize_shape[-2:]), \n interpolation=cv2.INTER_NEAREST) for _lr in masks])\n return _reshaped_masks", "def _reshape_batch(i...
[ "0.69424826", "0.68135804", "0.6732879", "0.6732879", "0.65668434", "0.65569407", "0.65563565", "0.65275574", "0.65275574", "0.6496486", "0.64288837", "0.63917834", "0.6371824", "0.6344888", "0.6284121", "0.6220336", "0.6203883", "0.61847764", "0.61656", "0.61656", "0.6119678...
0.57024384
74
Get a random batch of data from the specified bucket, prepare for step. To feed data in step(..) it must be a list of batchmajor vectors, while data here contains single lengthmajor cases. So the main logic of this function is to reindex data cases to be in the proper format for feeding.
def get_batch(self, data, bucket_id, PAD_ID=0, GO_ID=1, EOS_ID=2, UNK_ID=3): encoder_size, decoder_size = self.buckets[bucket_id] encoder_inputs, decoder_inputs = [], [] # Get a random batch of encoder and decoder inputs from data, # pad them if needed, reverse encoder inputs and add GO to decoder. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_batch(data_bucket, bucket_id, batch_size=1):\n # only pad to the max length of the bucket\n encoder_size, decoder_size = config.BUCKETS[bucket_id]\n encoder_inputs, decoder_inputs = [], []\n\n for _ in range(batch_size):\n encoder_input, decoder_input = random.choice(data_bucket)\n ...
[ "0.6346966", "0.6291491", "0.622398", "0.5910936", "0.58013445", "0.5782511", "0.5738133", "0.5736934", "0.5705941", "0.5447181", "0.54397595", "0.5386586", "0.53530943", "0.5336237", "0.5325782", "0.5204154", "0.5194293", "0.5187829", "0.51865757", "0.51792455", "0.5169404",...
0.56178945
9
Gets the match_score of this Response. MatchScore for the record
def match_score(self): return self._match_score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self):\n return self.client.call('GET', self.name + 'score')", "def get_score(self):\n\n return self._score", "def get_score(self):\n return self._score", "def get_score(self):\n return self._score", "def get_score(self):\n return self._score", "def get_score(...
[ "0.7311513", "0.71679026", "0.71667343", "0.71667343", "0.71667343", "0.71177787", "0.71177787", "0.71177787", "0.7029001", "0.70191586", "0.69693106", "0.6923774", "0.6905658", "0.6884565", "0.6841589", "0.6816617", "0.68007517", "0.6623826", "0.65692574", "0.65615433", "0.6...
0.82292825
0
Gets the match_indicators of this Response. List of attributes that found a match or did not find a match
def match_indicators(self): return self._match_indicators
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_indicators(self, match_indicators):\n\n self._match_indicators = match_indicators", "def match_results(self):\n return np.array(list(self._match_result_dict.values()))", "def indicators(self):\n return self._indicators", "def missed_matches(self, match_type) -> list:\n m...
[ "0.6116697", "0.58411276", "0.55013233", "0.5330202", "0.5315688", "0.5287083", "0.5283497", "0.5207403", "0.5198671", "0.5178477", "0.5178477", "0.5178477", "0.51610714", "0.5118217", "0.5102442", "0.5052879", "0.5001538", "0.4997202", "0.4990002", "0.49845484", "0.49845484"...
0.77652895
0
Sets the match_indicators of this Response. List of attributes that found a match or did not find a match
def match_indicators(self, match_indicators): self._match_indicators = match_indicators
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_indicators(self):\n return self._match_indicators", "def matches(self, matches):\n\n self._matches = matches", "def matches(self, matches):\n\n self._matches = matches", "def __init__(self, match_score=None, match_indicators=None, response_values=None):\n self.swagger_ty...
[ "0.67439497", "0.5983895", "0.5983895", "0.54714787", "0.5349615", "0.5220606", "0.51070464", "0.509438", "0.5073614", "0.4928131", "0.4923518", "0.49115935", "0.48517486", "0.48295733", "0.47834235", "0.47146198", "0.4672872", "0.46688256", "0.46284747", "0.45599902", "0.451...
0.82330906
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Response): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Convert date to age regarding current day
def get_age(date): today = datetime.date.today() return today.year - date.year - ((today.month, today.day) < (date.month, date.day))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age(self):\n today = datetime.date.today()\n\n return today.year - int(self.birthday[0:4])", "def age(self):\n today = date.today()\n birthday = datetime.strptime(self.birt['date'], \"%d %b %Y\")\n return birthday", "def age(self):\n today = datetime.date(2001, 5, ...
[ "0.77376205", "0.77183145", "0.7654524", "0.7432431", "0.7423877", "0.7423877", "0.7423877", "0.7423877", "0.74237365", "0.74140006", "0.7383767", "0.7383395", "0.7380594", "0.73799914", "0.73244673", "0.72743815", "0.7264971", "0.7240535", "0.72140336", "0.71625", "0.7148981...
0.7746839
0
Get the OSPL HOME binary folder
def get_ospl_home_bin(self): return self.ospl_home_bin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home", "def get_home_path(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetHomePath', self.handle)", "def get_home():\n try:\n return str(Path.home())\n except Exception:\n return None", "def get...
[ "0.7693204", "0.7671644", "0.76618177", "0.7246726", "0.72208154", "0.71564555", "0.71316993", "0.71249384", "0.70733076", "0.7053322", "0.70051914", "0.6991061", "0.6963216", "0.6950954", "0.69481134", "0.69468", "0.6921864", "0.6873169", "0.6873169", "0.68484616", "0.682233...
0.7522596
3
Returns dicts associating nodes > names and vice versa from an enum. Given an enum, returns the dict of names to numbers and numbers to names.
def node_associations(enum): node_to_name = {} name_to_node = {} for key, value, in enum.__dict__.iteritems(): if not key.startswith('_'): node_to_name[value] = key name_to_node[key] = value return (node_to_name, name_to_node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_for_enum(mapping):\n return dict(mapping.keys())", "def enums(self) -> Mapping[str, wrappers.EnumType]:\n return collections.OrderedDict([\n (k, v) for k, v in self.all_enums.items()\n if not v.meta.address.parent\n ])", "def reverse_enum(\n enum_to_reverse...
[ "0.67727107", "0.6418199", "0.6381157", "0.6264682", "0.6105831", "0.5982872", "0.5913278", "0.5847186", "0.57798934", "0.5729574", "0.57054573", "0.5646199", "0.56356066", "0.5483542", "0.54520774", "0.54391164", "0.5394367", "0.536788", "0.5367623", "0.5359761", "0.53595257...
0.78241825
0
Get the TPM name of the public area.
def get_name(self): name = getname(self) return TPM2B_NAME(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n return self.publicArea.get_name()", "def get_name(self):\n return self.nvPublic.get_name()", "def get_fullname(self):\n if self.controller.oem_config:\n return 'OEM Configuration (temporary user)'\n return self.fullname", "def infogpuname(self):\n ...
[ "0.74062204", "0.6316463", "0.613181", "0.5895939", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "...
0.6578274
1
Get the TPM name of the NV public area.
def get_name(self): return self.nvPublic.get_name()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n name = getname(self)\n return TPM2B_NAME(name)", "def get_name(self):\n name = getname(self)\n return TPM2B_NAME(name)", "def get_name(self):\n return self.publicArea.get_name()", "def vpd_name(self) -> str:\n return pulumi.get(self, \"vpd_name\...
[ "0.6590622", "0.6590622", "0.6522782", "0.614015", "0.61248195", "0.6093428", "0.5938506", "0.5938506", "0.59260195", "0.59132814", "0.5832676", "0.57834196", "0.57398444", "0.5722757", "0.5658794", "0.56552637", "0.56517345", "0.56097585", "0.56008506", "0.55932575", "0.5570...
0.69108456
0
Get the TPM name of the public area.
def get_name(self): return self.publicArea.get_name()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n name = getname(self)\n return TPM2B_NAME(name)", "def get_name(self):\n name = getname(self)\n return TPM2B_NAME(name)", "def get_name(self):\n return self.nvPublic.get_name()", "def get_fullname(self):\n if self.controller.oem_config:\n ...
[ "0.6578274", "0.6578274", "0.6316463", "0.613181", "0.5895939", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0.5864764", "0...
0.74062204
0
Get the TPM name of the NV public area.
def get_name(self): name = getname(self) return TPM2B_NAME(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n return self.nvPublic.get_name()", "def get_name(self):\n return self.publicArea.get_name()", "def vpd_name(self) -> str:\n return pulumi.get(self, \"vpd_name\")", "def infogpuname(self):\n return self._infogpuname", "def get_name(self):\n\t\treturn call_sdk...
[ "0.69108456", "0.6522782", "0.614015", "0.61248195", "0.6093428", "0.5938506", "0.5938506", "0.59260195", "0.59132814", "0.5832676", "0.57834196", "0.57398444", "0.5722757", "0.5658794", "0.56552637", "0.56517345", "0.56097585", "0.56008506", "0.55932575", "0.5570449", "0.555...
0.6590622
2
Take the minimum value of the underlying S2 units.
def forward(self, s2_outputs): mins = [s2.min(dim=3)[0] for s2 in s2_outputs] mins = [m.min(dim=2)[0] for m in mins] mins = torch.cat([m[:, None, :] for m in mins], 1) return mins.min(dim=1)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)", "def GetMinimum(self, label: 'short') -> \"double\":\n return _itkLabelStatisticsImageFilterPython.itkLabelStatisticsImageFilterIF2ISS2_GetMinimum(self, label)", "def GetMinimum(self, label: 'short') -> \"double\"...
[ "0.7297054", "0.7138198", "0.7132221", "0.7128359", "0.7097522", "0.7086465", "0.7053838", "0.70105857", "0.700949", "0.700949", "0.69936186", "0.69817114", "0.6956818", "0.6943702", "0.69052964", "0.6900426", "0.6896165", "0.68888646", "0.6885266", "0.6881272", "0.6881272", ...
0.0
-1
Compute the activation for each layer.
def run_all_layers(self, img): # noqa s1_outputs = [s1(img) for s1 in self.s1_units] # Each C1 layer pools across two S1 layers c1_outputs = [] for c1, i in zip(self.c1_units, range(0, len(self.s1_units), 2)): c1_outputs.append(c1(s1_outputs[i:i+2])) s2_outputs = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_activation(self):\r\n\r\n x=0\r\n edges=self.in_edges\r\n for edge in edges:\r\n x+= edge.source.activation*edge.weight\r\n self.activation=1/(1+exp(-x))", "def compute(self, inputs):\n\t\tres = inputs\n\t\tfor layer in range(self.layersNumber):\n\t\t\tweight = ...
[ "0.7813546", "0.73586184", "0.7070928", "0.70695525", "0.70594025", "0.70009506", "0.6883982", "0.6703351", "0.66861945", "0.6621917", "0.66038424", "0.65949506", "0.65760607", "0.65747607", "0.6573498", "0.65570605", "0.6555511", "0.65465665", "0.6535536", "0.6524397", "0.65...
0.0
-1
Get the activation for all layers as NumPy arrays.
def get_all_layers(self, img): # noqa s1_out, c1_out, s2_out, c2_out = self.run_all_layers(img) return ( [s1.cpu().detach().numpy() for s1 in s1_out], [c1.cpu().detach().numpy() for c1 in c1_out], [[s2_.cpu().detach().numpy() for s2_ in s2] for s2 in s2_out], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activations(\n self, x: np.ndarray, layer: Union[int, str], batch_size: int, framework: bool = False\n ) -> np.ndarray:\n raise NotImplementedError", "def get_layer_activations(network, y_in):\r\n extractor=get_layer_activation_extractor(network)\r\n layer_features = extractor(y_in...
[ "0.6774945", "0.6547625", "0.62723637", "0.6256449", "0.60364336", "0.60184145", "0.5953494", "0.59492683", "0.58955365", "0.58853567", "0.58853567", "0.58323056", "0.5824135", "0.58230036", "0.5782477", "0.5744888", "0.5701721", "0.56902176", "0.5646054", "0.5645216", "0.561...
0.5472386
27
Convert a flowcell into a samplesheet for demultiplexing.
def from_flowcell(run_folder, lane_details, out_dir=None): fcid = os.path.basename(run_folder) if out_dir is None: out_dir = run_folder out_file = os.path.join(out_dir, "%s.csv" % fcid) with open(out_file, "w") as out_handle: writer = csv.writer(out_handle) writer.writerow(["FCID...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_sample_sheet(self):\n pass", "def test_generate_sample_sheet(self):\n pass", "def make_custom_sample_sheet(input_sample_sheet,output_sample_sheet=None,\n lanes=None,fmt=None):\n # Load the sample sheet data\n sample_sheet = IlluminaData.SampleSheet...
[ "0.5983302", "0.59530574", "0.5459467", "0.5435266", "0.5337143", "0.5230705", "0.52049446", "0.51426804", "0.509924", "0.50141805", "0.4952338", "0.49345937", "0.48889673", "0.48770133", "0.48708147", "0.4857839", "0.4856847", "0.48376274", "0.48345482", "0.4797277", "0.4782...
0.5173055
7
Gets the display_name of this CreateVolumeBackupDetails. A userfriendly name for the volume backup. Does not have to be unique and it's changeable. Avoid entering confidential information.
def display_name(self): return self._display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_name(self):\n return self.properties.get(\"displayName\", None)", "def display_name(self):\n answer = self._call('display_name')\n return answer.display_name", "def display_name(self) -> str:\n return pulumi.get(self, \"display_name\")", "def display_name(self) -> str:...
[ "0.6958679", "0.69295275", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68929124", "0.68495995", "0.6789186", "0.6777145", "0.6775349", "0.67744964", "0.67706037", ...
0.67164654
27
Sets the display_name of this CreateVolumeBackupDetails. A userfriendly name for the volume backup. Does not have to be unique and it's changeable. Avoid entering confidential information.
def display_name(self, display_name): self._display_name = display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_name(self, display_name: str):\n\n self._display_name = display_name", "def set_display_name(self, display_name):\n self._call('set_display_name', display_name=display_name)", "def display_name(self, display_name):\n\n self._display_name = display_name", "def display_name(sel...
[ "0.721396", "0.71279484", "0.7091928", "0.7091928", "0.7091928", "0.7091928", "0.7091928", "0.7091928", "0.6743124", "0.6374154", "0.6184406", "0.6070832", "0.5883861", "0.58395773", "0.58075297", "0.5745993", "0.5731016", "0.57194084", "0.5717826", "0.5708357", "0.5602811", ...
0.7059356
13
Gets the volume_id of this CreateVolumeBackupDetails. The OCID of the volume that needs to be backed up.
def volume_id(self): return self._volume_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_id(self):\n if self.volume:\n return self.volume.id\n else:\n return None", "def get_volumeid(self, volume_name):\n\n volume_id = None\n volume_name = self.encode_string(volume_name, double=True)\n\n r_uri = '/api/types/Volume/instances/getByNam...
[ "0.72971827", "0.637292", "0.62306", "0.61103374", "0.60753053", "0.60720915", "0.60422546", "0.60314804", "0.60029036", "0.60029036", "0.5999864", "0.5930942", "0.5930942", "0.59136546", "0.5885213", "0.5725234", "0.57035404", "0.5687002", "0.56842494", "0.56600237", "0.5615...
0.7274227
1
Replace noncharacter, nondigit, nonspace characters with spaces.
def _replace_non_alnum(self): no_punct = [x if x.isalnum() else ' ' for x in self._phrase.lower()] return ''.join(no_punct) # Convert an array of char to string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_space (text):\n return RE_WS.sub (' ', text.strip ())", "def remove_punctations_fun(self): \n self.doc = re.sub('[^a-zA-Z0-9]', ' ', self.doc)", "def normalize_space(text):\n return re.sub(r\"\\s+\", \" \", text.strip(), flags=re.UNICODE)", "def replace_non_break_space(str):\n n...
[ "0.7059954", "0.68962216", "0.686126", "0.6831277", "0.6823762", "0.67978275", "0.6796424", "0.67903006", "0.6718121", "0.6694067", "0.66899216", "0.66899216", "0.66699934", "0.6641046", "0.6618514", "0.66048336", "0.6599505", "0.65973645", "0.6592124", "0.6544931", "0.652972...
0.69887197
1
Returns the position of the internal toolkit widget as an (x, y) tuple of integers, including any windowing decorations. The coordinates should be relative to the origin of the widget's parent, or to the screen if the widget is toplevel.
def pos(self): pos = self.widget.pos() return Pos(pos.x(), pos.y())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_position(self):\r\n # TODO: add: Now deprecated in favor of pi3d.events\r\n if self.mouse:\r\n return self.mouse.position()\r\n elif self.tkwin:\r\n return self.tkwin.winfo_pointerxy()\r\n else:\r\n return -1, -1", "def get_pos(self) -> tuple:\n return self.rect.center...
[ "0.72868645", "0.72115344", "0.7163071", "0.712127", "0.7103717", "0.7036254", "0.69426554", "0.6925903", "0.69077456", "0.69077456", "0.6884151", "0.6882131", "0.68719524", "0.68707335", "0.68707335", "0.68551546", "0.6833816", "0.67443573", "0.6711571", "0.67060816", "0.666...
0.73778
0
F function for 1s orbital
def F0(t): if (t < 1e-6): return 1.0 - t / 3.0 else: return 0.5 * (np.pi / t) ** 0.5 * sp.erf(t ** 0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def F(x):\n soln = x - (1.0/5.0)*math.cos(10.0*x+1.0) \n return soln", "def lorentzian(f, A, fc):\n return A/(1+(2*np.pi*f/fc)**2)", "def f(x):\n return np.tan(x) - np.sin(x) - (m*g)/(2*k*L)", "def f1(self) -> float:\n return self._matrix.f1", "def f4(x):\n return sin(x)/x", "def _f...
[ "0.7194813", "0.707724", "0.6990369", "0.68387735", "0.67827904", "0.677401", "0.6632298", "0.6609975", "0.6605609", "0.65782315", "0.6567598", "0.6551233", "0.6527496", "0.65190285", "0.65063906", "0.64947677", "0.64947677", "0.64947677", "0.64947677", "0.6494325", "0.648521...
0.63173145
34
Calculate the G matrix from the density matrix and two electron integals
def FormG(): for i in range(2): for j in range(2): G[i, j] = 0.0 for k in range(2): for l in range(2): G[i, j] = G[i, j] + P[k, l] * (TT[i, j, k, l] - 0.5 * TT[i, j, k, l])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_energy_ueg(system, G, Ghalf=None, two_rdm=None):\n if (system.diagH1):\n ke = numpy.einsum('sii,sii->',system.H1,G)\n else:\n ke = numpy.einsum('sij,sij->',system.H1,G)\n\n Gkpq = numpy.zeros((2,len(system.qvecs)), dtype=numpy.complex128)\n Gpmq = numpy.zeros((2,len(system.qve...
[ "0.6334387", "0.6202206", "0.6154188", "0.6144217", "0.6134124", "0.6109588", "0.60824907", "0.6023453", "0.59969306", "0.5994799", "0.5972223", "0.59001", "0.58629644", "0.58408153", "0.58395225", "0.58385783", "0.5825072", "0.58112025", "0.58106995", "0.58046293", "0.580271...
0.64104223
0
Return a dictionary representation of this model.
def to_dict(self, show=None, _hide=[], _path=None): show = show or [] hidden = self._hidden_fields if hasattr(self, "_hidden_fields") else [] default = self._default_fields if hasattr(self, "_default_fields") else [] default.extend(['id', 'modified_at', 'created_at']) if not _...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dict(self)", "def to_dict(self):\n return self.__dict__", "def to_dict(self):\n return self.__dict__", "def to_dict(self):\n return self.__dict__", "def to_dict(self):\n return self.__dict__", "def to_dict(self):\n return self.__dict__...
[ "0.82969093", "0.8296305", "0.8296305", "0.8296305", "0.8296305", "0.8296305", "0.8296305", "0.828905", "0.82345885", "0.8233762", "0.82115823", "0.82113564", "0.81916267", "0.8173779", "0.8154098", "0.8154098", "0.8154098", "0.8115743", "0.8112896", "0.81097287", "0.8094405"...
0.0
-1
Computes the gradient vector calculates the dot product.
def compute_gradient(c, x, y): vectors = np.array([[0, 1], [0, -1], [1, 0], [-1, 0]]) rows, cols = c.shape result = np.empty_like(x) for i in nb.prange(rows): for j in nb.prange(cols): c_remainder = c[i, j] % 4 gradient_co = vectors[c_remain...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gradient_dot_product(\n input_grads: Tuple[Tensor], src_grads: Tuple[Tensor]\n) -> Tensor:\n\n assert len(input_grads) == len(src_grads), \"Mismatching gradient parameters.\"\n\n iterator = zip(input_grads, src_grads)\n total = _tensor_batch_dot(*next(iterator))\n for input_grad, src_grad in it...
[ "0.6717305", "0.6711045", "0.6648165", "0.66017306", "0.65977705", "0.65459496", "0.65381885", "0.652647", "0.6523554", "0.652125", "0.6489096", "0.64886624", "0.6486391", "0.6470408", "0.64561963", "0.6438205", "0.6437574", "0.6421712", "0.6405638", "0.6392676", "0.6386202",...
0.6315641
33
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.76427615", "0.74189496", "0.7418079", "0.72710466", "0.72456723", "0.72446615", "0.7237539", "0.72213703", "0.7210107", "0.7058935", "0.6852219", "0.6786084", "0.67836976", "0.6768417", "0.67273885", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0....
0.0
-1
Test the tag string representation
def test_tag_str(): tag = models.Tag.objects.create(user=sample_user(), name="Vegan") assert str(tag) == tag.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Internal'\n )\n\n self.assertEqual(str(tag), tag.name)", "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Docke...
[ "0.7170174", "0.70703965", "0.6938718", "0.6938718", "0.6922232", "0.69209194", "0.6899433", "0.6885665", "0.6861665", "0.64923304", "0.637821", "0.6311385", "0.63077676", "0.62146807", "0.616337", "0.61539763", "0.60839355", "0.60640544", "0.6059385", "0.5983592", "0.5948616...
0.66865885
9
Returns a list of affine permutations A,B such that B[s[A[x]]] = s[x] for all x, where the permutations are specified via their lookup tables.
def self_affine_equivalent_mappings(s): result = [] for cstt_in in range(0, len(s)): for cstt_out in range(0, len(s)): mappings = linear_equivalence( s, [oplus(cstt_out, s[oplus(cstt_in, x)]) for x in range(0, len(s))], all_mappings=True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_affine_equivalent_mappings_approx(s, max_contradictions):\n result = []\n all_pairs_of_mappings = self_affine_equivalent_mappings_approx_attempt([\n (s, max_contradictions, [cstt_in, cstt_out])\n for cstt_in, cstt_out in itertools.product(range(0, len(s)), repeat=2)\n ])\n\n for ...
[ "0.57620066", "0.56715447", "0.5664082", "0.5548067", "0.554123", "0.5461344", "0.5455414", "0.54304665", "0.53913283", "0.5345975", "0.53242296", "0.52931356", "0.52692264", "0.5252135", "0.5229468", "0.5123343", "0.5113283", "0.507935", "0.5044762", "0.50361186", "0.5025974...
0.65703195
0
Renders home page when main website loaded.
def index(): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n return render_template('Main_Page.html')", "def home():\n return render_template('homepage.html')", "def home():\n\n return render_template('home_page.html')", "def home():\n logging.info('Entering route: HOME')\n\n...
[ "0.7827736", "0.77683216", "0.7650279", "0.7636011", "0.7627047", "0.7590838", "0.75856525", "0.7501465", "0.74897736", "0.74897736", "0.7480368", "0.74784017", "0.74524295", "0.74317205", "0.74280447", "0.74269694", "0.74248713", "0.741362", "0.7405968", "0.7390168", "0.7386...
0.0
-1
Gets the name of this IngredientObjectItems.
def name(self) -> str: return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_name(self):\n return self.__item_name", "def getName(self,item):\n return item.s", "def get_item_name(self, i):\n for item in self.items:\n if item['id'] == i:\n return item['localized_name']\n return 'Unknown Item'", "def __str__(self):\n ...
[ "0.82289314", "0.74215966", "0.72000873", "0.6998324", "0.6745667", "0.6624344", "0.6614428", "0.6587649", "0.65688396", "0.65688396", "0.65656626", "0.65590554", "0.65559596", "0.65533704", "0.65533704", "0.65533704", "0.65533704", "0.65533704", "0.65533704", "0.65533704", "...
0.0
-1
Sets the name of this IngredientObjectItems.
def name(self, name: str): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, item_name):\r\n self.name = item_name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, nam...
[ "0.76614887", "0.67452127", "0.67452127", "0.67452127", "0.67452127", "0.67452127", "0.6717061", "0.67061335", "0.6686832", "0.664695", "0.6646634", "0.6597381", "0.6576472", "0.6576472", "0.65541416", "0.65263695", "0.6517706", "0.6477665", "0.6477665", "0.6477665", "0.64776...
0.0
-1
Sets the categories of this IngredientObjectItems.
def categories(self, categories: List[str]): self._categories = categories
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_categories(self, categories: NounCategories):\n \n self._categories = categories", "def categories(self, categories):\n self._categories = categories", "def categories(self, categories):\n\n self._categories = categories", "def categories(self, categories):\n\n self._cate...
[ "0.6850278", "0.6782858", "0.6754768", "0.6754768", "0.6754768", "0.6754768", "0.6328537", "0.5951982", "0.5744881", "0.5707023", "0.568607", "0.56745094", "0.5483116", "0.54773057", "0.54110575", "0.54070234", "0.5392452", "0.5363371", "0.5363371", "0.5363371", "0.5363371", ...
0.6528155
6
Gets the nutrients of this IngredientObjectItems.
def nutrients(self) -> List[IngredientObjectNutrients]: return self._nutrients
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nutrients(self, nutrients: List[IngredientObjectNutrients]):\n\n self._nutrients = nutrients", "def vitamins(self) -> List[RecipeObjectNutrientsCalories]:\n return self._vitamins", "def get_ingredients(self):\n try:\n ingredients = self.soup.find_all(class_=\"ingredient-grou...
[ "0.6660975", "0.61238366", "0.61037725", "0.5851115", "0.5844533", "0.58251286", "0.5779096", "0.57642627", "0.57256085", "0.5668879", "0.56561613", "0.56503844", "0.5624446", "0.5602194", "0.5521103", "0.55168796", "0.5509444", "0.54681736", "0.54572475", "0.5400951", "0.539...
0.88940847
0
Gets the common_name of this IngredientObjectItems.
def common_name(self) -> str: return self._common_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_name(self):\n return self.__item_name", "def common_name(self) -> str:\n return pulumi.get(self, \"common_name\")", "def get_common_name(self):\n return self.reference[REF_COMMON_NAME][REF_VALUE]", "def getName(self,item):\n return item.s", "def get_item_name(self, ...
[ "0.72384137", "0.717831", "0.69963914", "0.65736526", "0.64529353", "0.6236878", "0.6204695", "0.60636824", "0.59476626", "0.5901526", "0.5899667", "0.5881394", "0.5881394", "0.58733827", "0.58731997", "0.585979", "0.5840975", "0.58290136", "0.5806239", "0.5800323", "0.578960...
0.72850966
0
Replaces pythonhashable keys by their string representation. Required for dict keys in JSON.
def turn_keys_into_str(d): return { str(k) : v for k,v in d.items() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringify_keys(d):\n di = copy.deepcopy(d)\n for key in di.keys():\n # check inner dict\n if isinstance(d[key], dict):\n value = stringify_keys(d[key])\n else:\n value = d[key]\n\n # convert nonstring to string if needed\n if not isinstance(key, st...
[ "0.65461016", "0.6448789", "0.6407648", "0.62778115", "0.62070364", "0.6164724", "0.6143755", "0.613877", "0.61028683", "0.6022944", "0.59108794", "0.58771765", "0.58706635", "0.5853769", "0.5816402", "0.5804339", "0.5787946", "0.57741976", "0.5763799", "0.573952", "0.5738522...
0.6839341
0
Get config object but fallback to AutoConfig if AWS connection fails
def get_config(source, region): try: logger.debug( 'Querying AWS Secrets manager for %s in region %s', source, region) repo = RepositoryAwsSecretManager(source, region) logger.debug('Successfully queried for %s in region %s', source, region) return Co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config():\n\n # Retrieve config from S3\n config = get_json(BUCKET, CONFIG_S3_KEY)\n\n # If config does not currently exist, create a default one and save to S3\n if not config:\n config = generate_config()\n save_config(config)\n\n return config", "def get_config() -> Config...
[ "0.68780786", "0.6382303", "0.6271372", "0.6260925", "0.612768", "0.61071265", "0.6064036", "0.602823", "0.6008878", "0.5928156", "0.59272707", "0.59266406", "0.5914294", "0.5901489", "0.5882608", "0.5841769", "0.58284515", "0.58188707", "0.58160186", "0.57813454", "0.5781345...
0.68642527
1
Write contents of file as JSON.
def read_json(self, *args, **kwargs): with self.open('rb') as f: return json.load(f, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json_file(self, file, content):\n with open(file, \"w\", encoding=\"utf-8\") as f:\n json.dump(content, f, indent=2)", "def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n enco...
[ "0.8416374", "0.81146324", "0.8050857", "0.8050857", "0.7914074", "0.7880411", "0.78645533", "0.78609663", "0.7769637", "0.7713167", "0.7708952", "0.76074076", "0.7561402", "0.75477743", "0.74996006", "0.7496678", "0.74350554", "0.7413595", "0.7403437", "0.73582506", "0.73313...
0.0
-1
Write contents of file as JSON.
def write_json(self, obj, mode='wb', **kwargs): with self.open(mode) as f: return json.dump(obj, f, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json_file(self, file, content):\n with open(file, \"w\", encoding=\"utf-8\") as f:\n json.dump(content, f, indent=2)", "def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n enco...
[ "0.8416374", "0.81146324", "0.8050857", "0.8050857", "0.7914074", "0.7880411", "0.78645533", "0.78609663", "0.7769637", "0.7713167", "0.7708952", "0.76074076", "0.7561402", "0.75477743", "0.74996006", "0.7496678", "0.74350554", "0.7413595", "0.7403437", "0.73582506", "0.73313...
0.6755723
76
Returns RGBA as tuple
def rgba(self): return (self.red, self.green, self.blue, self.alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgba_bytes_tuple(self, x):\n return tuple(int(u * 255.9999) for u in self.rgba_floats_tuple(x))", "def to_tuple(self):\n return (self._red, self._green, self._blue, self._alpha)", "def as_tuple(self):\n return (\n self.red, self.green, self.blue)", "def rgba_floats_tuple(self...
[ "0.7899978", "0.7884669", "0.7730872", "0.7531662", "0.7464003", "0.74361145", "0.7405513", "0.73614013", "0.73563963", "0.7191563", "0.6959136", "0.6935343", "0.6882177", "0.6876825", "0.6871045", "0.68558663", "0.6839529", "0.6806393", "0.67790294", "0.6776042", "0.67567414...
0.76862544
3
Adds a data array to the GiftiImage
def add_gifti_data_array(self, dataarr): if not isinstance(dataarr, GiftiDataArray): raise TypeError("Not a valid GiftiDataArray instance") self.darrays.append(dataarr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_img_array(data):\n data['img_array'] = data['url'].map(input_processing)\n data.to_hdf('reddit_img.h5', key='data')", "def add_data(self, data: np.ndarray):\n data = np.asarray(data)\n if data.ndim < 2:\n data = np.reshape(data, (-1, 1))\n\n self.create_storage(data)\n\n start = se...
[ "0.73029834", "0.6995231", "0.6975267", "0.6804443", "0.66442704", "0.6552128", "0.6509592", "0.64539015", "0.6410229", "0.63414407", "0.6315004", "0.62792844", "0.62547284", "0.62378037", "0.62051064", "0.6132016", "0.6092582", "0.6062338", "0.6061322", "0.6056861", "0.59927...
0.7756917
0
Return a list of all mentions in text, converted to lowercase, with duplicates included. >>> extract_mentions('Hi do you like meowmeow') ['uoft', 'cats', 'cats'] >>> extract_mentions(' are cute meow ') ['cats', 'cats', 'cat', 'meow'] >>> extract_mentions(' $extra ?!') ['many', 'cats', 'meow'] >>> extract_mentions('No v...
def extract_mentions(text: str) -> List[str]: final = [] result = list(text.split()) for word in result: if word[0] == MENTION_SYMBOL: final.append(alnum_prefix(word[1:])) if alnum_prefix(word[1:]) == '': final.remove(alnum_prefix(word[1:])) return f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_mentions(text):\n return re.sub(\"@\\S+\", \"\", text)", "def remove_mentions(text):\n return ' '.join(re.sub(r'(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b', ' ', text).split())", "def get_mentions(texts, word):\r\n mentions = {}\r\n for text, label, text_id in texts:\r\n if ...
[ "0.6555562", "0.64731234", "0.622361", "0.61077493", "0.60083055", "0.59521013", "0.59368396", "0.58140403", "0.5807817", "0.5765594", "0.5765594", "0.5765594", "0.5765594", "0.5765594", "0.5764694", "0.57566214", "0.57511455", "0.57431984", "0.5714485", "0.5707772", "0.57040...
0.7390601
0
Return a list of all unique hashtags in text, converted to lowercase >>> extract_hashtags('Hi UofT do you like cats CATS meowmeow') ['uoft', 'cats', 'meowmeow'] >>> extract_hashtags('cats are cute cats cat meow meow') ['cats', 'cute', 'cat', 'meow'] >>> extract_hashtags('many cats$extra meow?!') ['many', 'cats', 'meow'...
def extract_hashtags(text: str) -> List[str]: final = [] result = list(text.split()) for word in result: if word[0] == HASH_SYMBOL and alnum_prefix(word[1:]) not in final: final.append(alnum_prefix(word[1:])) if alnum_prefix(word[1:]) == '': final.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hashtags(text):\n # alternatives\n \"#[^ :\\n\\t\\.,\\?\\/’'!]+\"\n \"#[a-zA-Z1-9]+\"\n\n # frankly I\"m happy with this as it's simple and I will go down a rabbit hole on these other ones.\n # it seems to do a decent job\n htag = re.compile(r'#[a-zA-Z0-9\\U0001f3c0]+')\n # tested it o...
[ "0.8615458", "0.825788", "0.76486295", "0.7551022", "0.7457217", "0.7338758", "0.7297301", "0.71393603", "0.7135061", "0.70381373", "0.68772644", "0.677258", "0.673602", "0.67325675", "0.6718096", "0.6707643", "0.66574323", "0.6622159", "0.6616835", "0.6509103", "0.6469128", ...
0.81661606
2
Visualize a depth map using Matplotlib's `inferno` colormap side by side with an RGB image.
def vis_depth_map( img_rgb: NDArrayByte, depth_map: NDArrayFloat, interp_depth_map: bool, num_dilation_iters: int = 10, ) -> None: if not interp_depth_map: # fix the zero values? depth_map[depth_map == 0] = np.finfo(np.float32).max # purely for visualization depth_map = cv2....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_well_depth(self):\n fig, ax = plt.subplots()\n imMap = ax.imshow(self.get_well_depth_image())\n ax.set_title('Well Fraction Map Map')\n ax.set_xlabel('x')\n ax.set_ylabel('y')\n \n ## Adjust colorbar height to match image\n divider = make_axes_locata...
[ "0.6771614", "0.67195934", "0.65686446", "0.6546927", "0.65233964", "0.6438889", "0.63818127", "0.6254294", "0.6239173", "0.62091076", "0.61974895", "0.61816984", "0.617622", "0.61637324", "0.6146031", "0.61213243", "0.6099613", "0.6097616", "0.60972583", "0.60843325", "0.604...
0.7867557
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plotConfusionMatrix(self, cm, classes, normalize=True, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, without normalization') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81922984", "0.80933887", "0.80272716", "0.8016492", "0.79913706", "0.79885876", "0.79777396", "0.79729784", "0.7958926", "0.7954523", "0.79347897", "0.7931899", "0.7931772", "0.7928666", "0.7923684", "0.7921764", "0.79213995", "0.7920191", "0.792016", "0.7919876", "0.79153...
0.79021394
25
Returns a migration job.
def _GetMigrationJob( self, source_ref, destination_ref, conversion_workspace_ref, cmek_key_ref, args, ): migration_job_type = self.messages.MigrationJob labels = labels_util.ParseCreateArgs( args, self.messages.MigrationJob.LabelsValue ) type_value = self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetUpdatedMigrationJob(\n self, migration_job, source_ref, destination_ref, args):\n update_fields = self._GetUpdateMask(args)\n if args.IsSpecified('display_name'):\n migration_job.displayName = args.display_name\n if args.IsSpecified('type'):\n migration_job.type = self._GetType(self...
[ "0.6943334", "0.6723661", "0.65313196", "0.6460316", "0.6320317", "0.6245926", "0.6242248", "0.6229643", "0.6078519", "0.60345393", "0.59870905", "0.596301", "0.58240473", "0.57947356", "0.5745383", "0.56846106", "0.56710786", "0.5655607", "0.5569938", "0.5569938", "0.5569802...
0.7640038
0
Decode a yaml file.
def read_yaml(path: PathLike) -> Dict: with open(path, "r") as read_file: return yaml.load(read_file, Loader=yaml.UnsafeLoader)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_yaml(file):\n with open(file, mode='r') as stream:\n out = yaml.load(stream)\n\n return out", "def decode(self,data):\n import yaml\n return yaml.load(data.decode('utf-8'))", "def load_yaml(file: Text):\n with open(file) as fp:\n return yaml.load(fp, yaml.F...
[ "0.7325009", "0.7286577", "0.7219757", "0.7181683", "0.7127255", "0.70620114", "0.70385027", "0.6976914", "0.69537264", "0.69396055", "0.69172394", "0.69036955", "0.69029194", "0.6897766", "0.6897745", "0.689771", "0.68531615", "0.67841554", "0.67482215", "0.6747433", "0.6718...
0.6782058
18
Plot the given confusion matrix cm as a matrix using and return the resulting axes object containing the plot.
def plot_confusion_matrix(cm, classes, xlabel, ylabel, normalize=False, cmap=plt.cm.Blues): vmin = None vmax = None if normalize: cm = cm.astype('float') / cm.sum(axis=1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=None, ax=None, rotate_y=True, cmap='Blues'):\n if ax is None:\n fig, ax = plt.subplots(figsize=(8, 6))\n\n # If cm not put in, create one\n if isinstance(cm, list) or isinstance(cm, tuple):\n cm = confusion_matrix(cm[0], cm[1])\n if not classes:\n ...
[ "0.7833185", "0.77036446", "0.7645966", "0.75901896", "0.75530237", "0.7553015", "0.7547423", "0.75050676", "0.74773026", "0.741075", "0.7408256", "0.7398276", "0.73545945", "0.7345392", "0.73382777", "0.7328069", "0.7327025", "0.73261946", "0.73248154", "0.7309393", "0.73081...
0.73269933
17
Nonnested components are expected to have a template of the same name in the same directory as the Controller
def test_non_nested_template_source_generation(self): sources = [source for source in self.loader.get_template_sources('component.html')] self.assertEqual(len(sources), 2) self.assertEqual(sources[0], 'MOCK_BASE_DIR/component/component.html') self.assertEqual(sources[1],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_otoroshi_controllers_adminapi_templates_controller_template_spec(self):\n pass", "def test_create_namespaced_template(self):\n pass", "def test_register_template(self):\n pass", "def test_create_namespaced_processed_template(self):\n pass", "def __init__(self, name, tem...
[ "0.7035726", "0.63372815", "0.62877494", "0.61909133", "0.61177367", "0.61118615", "0.60985816", "0.60802543", "0.5936337", "0.5893268", "0.58633137", "0.5830664", "0.5829074", "0.57462496", "0.57193565", "0.56991255", "0.5687413", "0.56575096", "0.56395787", "0.55959094", "0...
0.6024831
8
Tile a vector as if it were channels onto every pixel of an image. This version is designed to be used as layers within a Keras model. Params
def concat_images_with_tiled_vector_layer(images, vector, image_shape=None, vector_shape=None): with K.name_scope('concat_images_with_tiled_vector_layer'): if not isinstance(images, list): images = [images] if vector_shape is None: # check if K.shape, K.int_shape, or vector.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_vector_as_image_channels(vector_op, image_shape):\n with K.name_scope('tile_vector_as_image_channels'):\n ivs = K.shape(vector_op)\n # reshape the vector into a single pixel\n vector_pixel_shape = [ivs[0], 1, 1, ivs[1]]\n vector_op = K.reshape(vector_op, vector_pixel_shape)\...
[ "0.67232347", "0.60192406", "0.59124917", "0.58996373", "0.58564794", "0.5823464", "0.57872117", "0.5755375", "0.57235897", "0.5568123", "0.55406487", "0.55028754", "0.5499288", "0.5498049", "0.5488109", "0.5463761", "0.54353744", "0.54023516", "0.53925884", "0.5383624", "0.5...
0.5539352
11
Tile a vector as if it were channels onto every pixel of an image. This version is designed to be used as layers within a Keras model. Params
def add_images_with_tiled_vector_layer(images, vector, image_shape=None, vector_shape=None): with K.name_scope('add_images_with_tiled_vector_layer'): if not isinstance(images, list): images = [images] if vector_shape is None: # check if K.shape, K.int_shape, or vector.get_sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_vector_as_image_channels(vector_op, image_shape):\n with K.name_scope('tile_vector_as_image_channels'):\n ivs = K.shape(vector_op)\n # reshape the vector into a single pixel\n vector_pixel_shape = [ivs[0], 1, 1, ivs[1]]\n vector_op = K.reshape(vector_op, vector_pixel_shape)\...
[ "0.6722837", "0.60206294", "0.59142995", "0.58986557", "0.58571386", "0.5823363", "0.57862896", "0.5754588", "0.572396", "0.55687207", "0.5539956", "0.5539841", "0.55022156", "0.5497811", "0.5486816", "0.5463078", "0.54356074", "0.5400771", "0.539177", "0.5382329", "0.5377035...
0.5498896
13
Vector branches that simply contain a single dense layer.
def vector_branch_dense( tensor, vector_dense_filters=vector_dense_filters, num_layers=vector_branch_num_layers, model_name=vector_model_name, vector_normalization=vector_normalization): x = tensor # create the chosen layers startin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __branch(self):\n\n if len(np.unique(self.__data[1][self.__indexes])) <= 1:\n return []\n\n branches = []\n disc_max = -np.inf\n disc_max_col = None\n\n for col in range(self.__data[0].shape[1]):\n if col in self.__cols_exclude:\n ...
[ "0.60489357", "0.5733134", "0.5716119", "0.55348676", "0.5278189", "0.52685875", "0.5256288", "0.52150357", "0.52122176", "0.52088845", "0.51937103", "0.5185922", "0.51718456", "0.51639473", "0.51602846", "0.5158137", "0.51525795", "0.51525795", "0.51524514", "0.51471525", "0...
0.6587739
0
Split capital and small words. Capital words are only allowed at the first half of the phrase. If a capital word is after a small word, it is NOT marked capital.
def split_capital(phrase): format_capital = [] #words = [phrase] #format_capital.append(words[0].isupper()) #words = phrase.split() re_split_result = re.split('(\W)', phrase) words = list(filter(None, re_split_result)) for k_item in range(len(words)-1, 0, -1): while len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def titlecase(original: str, delimiter: str = \" \", small_words: list = None) -> str:\n _small_words = [\"of\", \"in\", \"at\", \"to\", \"the\", \"on\", \"an\", \"a\"]\n if small_words:\n _small_words = list(set(_small_words + small_words))\n\n original_splitted = original.split(delimiter)\n re...
[ "0.6536723", "0.6461479", "0.6346886", "0.6228994", "0.6161717", "0.6113305", "0.6110726", "0.6104196", "0.6050738", "0.603385", "0.59608793", "0.5924122", "0.5917947", "0.5861508", "0.5856925", "0.58188564", "0.58019143", "0.58003175", "0.5785679", "0.5779814", "0.57768005",...
0.76739174
0
Use the sigmoid activation function instead of sign function
def sigmoid_net(args, random_seeds, train_data, test_data): err = np.zeros(int(args['n_epochs'])) train_loss = np.zeros_like(err) test_loss = np.zeros_like(err) for seed in random_seeds: np.random.seed(seed) data = prep_data(train_data, test_data, augment=True) n_features = d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))", "def activation_sigmoid_custom(self):\n self.value = 1 / (1 + np.e ** (-4.9 * self.value))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def _tanh_to_sigmoid(x):\n return x * 0.5...
[ "0.8418209", "0.83111197", "0.83110094", "0.83110094", "0.8310597", "0.827208", "0.8204134", "0.81913984", "0.8190665", "0.81793606", "0.81712836", "0.81712836", "0.81712836", "0.81712836", "0.81712836", "0.81712836", "0.81631714", "0.8151893", "0.81465316", "0.81378675", "0....
0.0
-1
Aborts the transaction. All operations defined on the transaction will be ignored (discarded). Raises the ``AbortSignal``, to be called only within a transaction.
def abort() -> NoReturn: raise AbortSignal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abort_transaction(self) -> None:\n pass", "def abort(self) -> None:\n self._connector.abort_transaction()", "def abort(self, transaction):\n raise NotImplementedError", "def abort(self):\n if self.transaction:\n token = self.transaction\n self.transaction...
[ "0.83938175", "0.83707494", "0.8319546", "0.8073379", "0.7876153", "0.7820457", "0.7441953", "0.70280933", "0.69473356", "0.6839332", "0.6788322", "0.66794944", "0.6645475", "0.6589442", "0.658872", "0.65876186", "0.6559362", "0.6486485", "0.6456124", "0.64299816", "0.6427464...
0.68184483
10
Return the strongest signal as a 1dtime dependent array.
def get_signal_maximum( data, setup={}, varname=None, gate_min=None, gate_max=None): idx = get_index_of_signal_maximum( data, setup, varname, gate_min, gate_max) nt = range(len(idx)) if varname is None: varname = get_ return data[varname][nt, idx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def np_collapse_freq_into_time(x):\n if x.ndim == 4:\n return np.reshape(x, [x.shape[0], x.shape[1] * x.shape[2], -1])\n return np.reshape(x, [x.shape[0], x.shape[1] * x.shape[2]])", "def get_s(self, t: Optional[int]) -> np.array:\n t = t or self.t\n if t < 0:\n raise ex.TimeCanNotB...
[ "0.6032452", "0.5863707", "0.5851179", "0.57570875", "0.55341613", "0.54003257", "0.5387314", "0.53769755", "0.5371949", "0.5354909", "0.53540206", "0.5350946", "0.53290486", "0.5328147", "0.5319649", "0.53120303", "0.5271559", "0.52646935", "0.5257622", "0.5253639", "0.52532...
0.0
-1
Get an input function for the given mode.
def get_input_fn(self, mode: tf.estimator.ModeKeys, shuffle: Optional[bool] = None, num_epochs: Optional[int] = None): if not self._data[mode]: raise ValueError('No data provided for mode %s' % mode) def input_fn(): """An input function under...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_input_fn(mode='TRAIN'):\n mode = mode.upper()\n if mode == 'TRAIN' or mode == 'EVAL':\n return input_fn\n elif mode == 'PREDICT' or mode == 'NOISE':\n return noise_input_fn\n else:\n raise ValueError('Incorrect mode provided')", "def get_input_fn(pattern, flags, batc...
[ "0.77777296", "0.6391255", "0.62828916", "0.6253016", "0.6223967", "0.6070239", "0.59514827", "0.5940065", "0.5940065", "0.5940065", "0.58519435", "0.5815205", "0.5778196", "0.57321227", "0.57247466", "0.5724583", "0.5709197", "0.5694973", "0.567462", "0.5667399", "0.5639803"...
0.6406187
1
An input function under training/eval mode.
def input_fn(): with tf.name_scope('ReadData'): tensor, _ = self._get_tensor_and_example( mode, shuffle=shuffle, num_epochs=num_epochs) with tf.name_scope('Batch'): batched = tf.train.batch( tensor, batch_size=self._batch_size, dynamic_pad=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_fn(self, params, mode=tf.estimator.ModeKeys.TRAIN):\n raise NotImplementedError()", "def input_fn(sources, train, params):\n \n raise NotImplementedError", "def train_input_fn(self) -> types.FeatureAndLabelTensors:\n return self._input_fn_from_file(self._train_path)", "def get_input...
[ "0.7623568", "0.7424133", "0.73180073", "0.71845686", "0.7096205", "0.69351304", "0.692543", "0.6826458", "0.6805881", "0.67610097", "0.6731552", "0.664246", "0.6633773", "0.66227615", "0.6602538", "0.6600139", "0.6580364", "0.653053", "0.64687467", "0.64590466", "0.64492583"...
0.0
-1
The access review instance id.
def id(self) -> str: return pulumi.get(self, "id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_point_id(self) -> str:\n return pulumi.get(self, \"access_point_id\")", "def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")", "def get_instance_id(self):\n return self.instance_id", "def reviewer_id(self) -> int:\n return self._reviewer_id", "def...
[ "0.6967151", "0.68616146", "0.6790942", "0.66482425", "0.66070396", "0.66070396", "0.66070396", "0.6569577", "0.65202695", "0.65202695", "0.65202695", "0.64631844", "0.64631844", "0.64631844", "0.64631844", "0.64631844", "0.64631844", "0.6438001", "0.64012146", "0.64012146", ...
0.0
-1
The access review instance name.
def name(self) -> str: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getname(self):\n if self.instance is not None:\n return '%s_%s' % (self.name,self.instance)\n else:\n return self.name", "def show_name(self):\n return self.name", "def name(self):\n return self._client.project_name + '/instances/' + self.instance_id", "d...
[ "0.7009463", "0.6847629", "0.6710662", "0.66421527", "0.6620386", "0.65789735", "0.65677154", "0.655428", "0.655428", "0.6551454", "0.6550097", "0.65317893", "0.6523306", "0.6523306", "0.6523306", "0.65211636", "0.65127003", "0.65100867", "0.65100867", "0.65100867", "0.651008...
0.64942396
95
This field specifies the type of reviewers for a review. Usually for a review, reviewers are explicitly assigned. However, in some cases, the reviewers may not be assigned and instead be chosen dynamically. For example managers review or self review.
def reviewers_type(self) -> str: return pulumi.get(self, "reviewers_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reviewers(self, reviewers):\n\n self._reviewers = reviewers", "def reviewers(self) -> Optional[Sequence['outputs.AccessReviewReviewerResponse']]:\n return pulumi.get(self, \"reviewers\")", "def set_review_type(self, review_type):\n if review_type not in [APPROVE, REQUEST_REVISION]:\n ...
[ "0.64661443", "0.6373006", "0.62240493", "0.58964294", "0.57263625", "0.5604552", "0.55977386", "0.55045897", "0.5502388", "0.5501451", "0.5494755", "0.5483293", "0.5469539", "0.5433386", "0.5427725", "0.5307668", "0.5284853", "0.52618647", "0.52421397", "0.52261317", "0.5178...
0.84256643
0
This readonly field specifies the status of an access review instance.
def status(self) -> str: return pulumi.get(self, "status")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_review_status(self):\n if not hasattr(self, 'credential_review'):\n status = 'Awaiting review'\n elif self.credential_review.status <= 20:\n status = 'Awaiting review'\n elif self.credential_review.status == 30:\n status = 'Awaiting a response from refe...
[ "0.6954047", "0.6339097", "0.5915768", "0.5755993", "0.5520354", "0.5484609", "0.53898644", "0.5330178", "0.53222305", "0.5303278", "0.5299282", "0.52880293", "0.5271521", "0.52606696", "0.5256787", "0.52482086", "0.5220906", "0.5218011", "0.51951325", "0.51951325", "0.517883...
0.0
-1
Calculates the softmax output of a model and returns the index of the maximum value (predicted class).
def softmax(x: np.array) -> Tuple[int, List[float]]: dist = np.exp(x) / np.sum(np.exp(x)) y = np.argmax(dist) return int(y), dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_prediction(\n model,\n batch_x\n):\n outputs = model(batch_x, training=False)\n preds = tf.argmax(outputs, axis=1)\n return preds", "def predict(self, output):\n return t.argmax(output, dim=1)", "def _softmax(self,x):\n e_x = np.exp(x - np.max(x))\n return np.nan_to_...
[ "0.7242566", "0.7167854", "0.7077012", "0.70562154", "0.7053349", "0.69931084", "0.6992742", "0.6955997", "0.6937023", "0.69142675", "0.69139117", "0.68835807", "0.68704736", "0.6864549", "0.6860852", "0.6858624", "0.684796", "0.68361", "0.68225926", "0.6818093", "0.6815707",...
0.0
-1
This is like sklearn's StandardScaler, except that constant signals are replaced with an arbitrary constant. This transforms the DataFrame in place.
def standard_scaling(df: pd.DataFrame, fill: float = 0.0) -> pd.DataFrame: scaler = StandardScaler(copy=True, with_mean=True, with_std=True) df = df.copy() for i in range(len(df.columns)): signal = df.iloc[:, i].values.reshape(-1, 1) if np.min(signal) == np.max(signal): df.iloc[:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standardiser(self):\n # Select only numeric features first\n\n #self.X = self.data.loc[:, self.data.columns != self.target].values\n numeric_columns = []\n for col in self.X.columns:\n if self.X[col].dtype!='object':\n numeric_columns.append(col)\n s...
[ "0.7027446", "0.684083", "0.67822117", "0.67629695", "0.67603976", "0.6730062", "0.6725958", "0.66695", "0.6614969", "0.6584519", "0.6574076", "0.6549784", "0.6548832", "0.65087646", "0.6484263", "0.64658505", "0.64653206", "0.64525926", "0.64525926", "0.6432448", "0.63930714...
0.6814257
2
Set the value for this field.
def set_value(self, value): if self._is_string(value): value = value.split(',') for item in value: self._value.append(self._type(item)) elif self._is_list(value): self._value = [] for item in value: if not self._is_primitiv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_value(self, value):\n self.value = value", "def set_value(self, value):\n self.value = value", "def set_value(self, value):\n self.value = value", "def setValue(self, value):\n self._value = value", "def set_value(self, value):\n self.value = str(value)", "def s...
[ "0.8405562", "0.8405562", "0.8405562", "0.83166116", "0.8280729", "0.8275549", "0.82359016", "0.82359016", "0.8180247", "0.8156728", "0.8156728", "0.8156728", "0.8156728", "0.8156728", "0.8156728", "0.804723", "0.8043659", "0.7974154", "0.79217607", "0.79204404", "0.7878482",...
0.0
-1
Returns the polar angle (in radians) from points p0 to p1.
def polar_angle(self, p0, p1=None): if p1 == None: p1 = anchor y_span = p0[1] - p1[1] x_span = p0[0] - p1[0] return atan2(y_span, x_span)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_polar_angle(p1, p2):\n # note the negative sign before the first component, which is y component\n # the y in scikit-image is flipped.\n # it is to convert the angle into right-handed coordinate\n # the range is from -pi to pi\n angle = np.arctan2(-(p2[1] - p1[1]), (p2[0] - p1[0])) * ...
[ "0.8223249", "0.7988346", "0.7460613", "0.7450279", "0.7445135", "0.73566926", "0.7313466", "0.72894555", "0.7260118", "0.72530067", "0.71263635", "0.70889586", "0.70852655", "0.69550633", "0.69333875", "0.68626404", "0.68267316", "0.68109953", "0.67955863", "0.67743224", "0....
0.9043312
0
Returns the eculidean distance from p0 to p1.
def distance(self, p0, p1=None): if p1 == None: p1 = anchor y_span = p0[1] - p1[1] x_span = p0[0] - p1[0] return y_span ** 2 + x_span ** 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclid_dist(p1, p2):\n \n return float(np.linalg.norm(np.array(p1)-np.array(p2)))", "def get_euclidean_distance(p1, p2):\n return np.sqrt(np.power((p2[0] - p1[0]), 2) + np.power((p2[1] - p1[1]), 2))", "def euclidian_distance(p):\n return(np.sqrt(sum([(p[0][i]-p[1][i])**2 for i, _ in enumerate(p...
[ "0.73810494", "0.7255432", "0.72054315", "0.7130153", "0.7049582", "0.6871365", "0.6870225", "0.68699944", "0.68585896", "0.6841921", "0.6837292", "0.67942727", "0.67119575", "0.6709154", "0.67038137", "0.6696428", "0.6691669", "0.66877216", "0.66580176", "0.6627773", "0.6601...
0.66490114
19
Returns the rotation direction. If > 0, counterclockwise. If < 0, clockwise. If = 0, collinear.
def rotation(self, p1, p2, p3): return (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p2[1] - p1[1]) * (p3[0] - p1[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction(self):\r\n return 180 - atan2(self.x, self.y)*180/pi", "def direction_angle(self):\n return math.atan2(self.velocity, self.velocity)", "def rotate_ccw_90(self):\n return self.perpendicular_2d()", "def comp_rot_dir(self):\n\n MMF = self.comp_mmf_unit()\n p = self.get_p...
[ "0.7414712", "0.7220324", "0.71628535", "0.70221156", "0.6995537", "0.6767888", "0.6727281", "0.6715146", "0.6698137", "0.6670367", "0.66563153", "0.66242814", "0.6576809", "0.65593493", "0.6550022", "0.6451505", "0.6425276", "0.64121115", "0.6408497", "0.6397271", "0.6396420...
0.0
-1
Displays points on the scatter plot for visualization.
def display(self): scatter_plot(self.points, self.hull_points, self.color, self.title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scatter_points(self):\n self.plot(1)", "def show_scatter(self):\n plt.scatter(self.a1[:, 0], self.a1[:, 1], c=\"red\", alpha=0.5, s=10)\n plt.scatter(self.a2[:, 0], self.a2[:, 1], c=\"blue\", alpha=0.5, s=10)\n plt.scatter(0, 0, marker=\"D\", c=\"black\", alpha=0.8)\n ...
[ "0.8607287", "0.7985135", "0.76327205", "0.74203175", "0.73838013", "0.73371327", "0.7316366", "0.73106635", "0.7306297", "0.72685057", "0.72398597", "0.7097057", "0.7055016", "0.7014824", "0.69911873", "0.69624436", "0.6960674", "0.6948977", "0.6932205", "0.69154125", "0.688...
0.84502953
1
" Will check if all elements values in " the list are the same. "
def listDone(List, val): for x in List: if int(x['amount']) != val: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_same(items):\n \n return all(x == items[0] for x in items)", "def allsame(xs):\n assert len(xs) > 0\n return all(x == xs[0] for x in xs[1:])", "def all_different(l):\n seen = set()\n for i in l:\n if i in seen:\n return False\n seen.add(i)\n return True", ...
[ "0.7971755", "0.7644582", "0.74924487", "0.7440229", "0.73320055", "0.7319998", "0.7315543", "0.7287953", "0.7279925", "0.7278891", "0.72217137", "0.7184387", "0.7183179", "0.71399045", "0.71276915", "0.71219814", "0.7092858", "0.7021557", "0.69817716", "0.6976752", "0.692519...
0.6167294
77
Factorystyle method for getting dataset from string name.
def make_dataset(dataset_name): return { 'duc': DUCDataset(), 'icsi-asr': ICSIASRDataset(), 'icsi-ht': ICSIHumanTranscriptDataset(), 'inspec-train': InspectTrainingDataset(), 'inspec-val': InspectValidationDataset(), 'inspec-test': InspectTestDataset(), 'n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_by_name(name):\n return _datasets[name.lower()]", "def get_dataset(name):\n if name == 'cityscapes':\n return Cityscapes", "def get_by_name(self, name: str) -> Optional[\"Dataset\"]:\n raise NotImplementedError", "def find_dataset_using_name(dataset_name):\n\tdataset_filename ...
[ "0.80638844", "0.7702188", "0.7687957", "0.75960994", "0.7504916", "0.7504916", "0.7504916", "0.74856573", "0.74334407", "0.72636724", "0.7225682", "0.7209035", "0.71301943", "0.7109478", "0.71014553", "0.70829415", "0.7054306", "0.6965832", "0.69646007", "0.6930873", "0.6872...
0.7492322
7
Construct an empty occupancy grid.
def __init__(self, origin_x=-2.5, origin_y=-2.5, resolution=.1, width=50, height=50): self.origin_x = origin_x self.origin_y = origin_y self.resolution = resolution self.width = width self.height = height self.grid = np.zeros((height, width))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_empty_grid(width, height):\n return [[None] * width for _ in range(height)]", "def __init__(self, grid_height, grid_width):\n self._grid_height = grid_height\n self._grid_width = grid_width\n self._cells = [[EMPTY for dummy_col in range(self._grid_width)]\n ...
[ "0.73815244", "0.7205705", "0.6904384", "0.6800015", "0.6794871", "0.6788501", "0.67267704", "0.669845", "0.6674869", "0.6670038", "0.6657876", "0.66322887", "0.6631472", "0.6617627", "0.65653163", "0.6542854", "0.6516518", "0.65148836", "0.6480752", "0.64801955", "0.6471079"...
0.60316676
51
Return timezone information for the timezone named timezone_name.
def get_timezone_info(self, timezone_name): try: return self._db[timezone_name] except KeyError: raise TimezoneNotFoundError(timezone_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timezone(timezone: str=None) -> datetime.tzinfo:\n if timezone[0] in ('+', '-'):\n timezone = 'UTC' + timezone\n result = tz.gettz(timezone)\n if result is not None and not hasattr(result, '_timezone_'):\n setattr(result, '_timezone_', timezone[3:] if timezone.startswith('UTC') and l...
[ "0.65528005", "0.65364623", "0.6473638", "0.63799524", "0.6369283", "0.6301157", "0.6265696", "0.6057061", "0.603914", "0.5994514", "0.5971521", "0.5958917", "0.5929361", "0.58916116", "0.5889956", "0.5859962", "0.5837202", "0.58205223", "0.58036476", "0.578736", "0.57602495"...
0.8232877
0
At the end of the web request, this makes sure to close the database connection. If you don't the database could run out of memory!
def teardown_request(exception): try: g.conn.close() except Exception as e: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_request():\n db.close()", "def close(self):\r\n self.conn.close()\r\n gc.collect()", "def cleanup(_):\n self.db.close()", "def close(self): \n self.connection.close()", "def close(self):\n\t\tself.db.close()", "def after_request(response):\n g.db.close(...
[ "0.79805404", "0.7822594", "0.76404536", "0.7538507", "0.7476456", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.7448957", "0.74364656", "0.74364656", "0.7422345", "0.74196684", "0.74106085...
0.0
-1
The tags associated with the assessment.
def tags(self) -> Optional[Sequence['outputs.AssessmentTag']]: return pulumi.get(self, "tags")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags(self):\n return self._tags", "def tags(self):\n return self._tags", "def tags(self):\n return self._tags", "def tags(self):\n return self._tags", "def tags(self):\n return self._tags", "def tags(self):\n return self._tags", "def tags(self):\n re...
[ "0.7964616", "0.7964616", "0.7964616", "0.7964616", "0.7964616", "0.7964616", "0.7964616", "0.7964616", "0.7866456", "0.78521496", "0.782349", "0.78073484", "0.773681", "0.7684905", "0.765586", "0.765307", "0.7630382", "0.75986767", "0.7591877", "0.7580125", "0.7580125", "0...
0.78163654
11
Initializes the vdW and vdb parameters for momentum optimizer.
def initialize_momentum_velocity(parameters): L = len(parameters)//2 v = {} for l in xrange(L): v["dW" + str(l+1)] = np.zeros(parameters["W" + str(l+1)].shape) v["db" + str(l+1)] = np.zeros(parameters["b" + str(l+1)].shape) return v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params_init(self) -> None:\n # Initialize weights and biases with uniform distribution.\n nn.init.uniform_(self.emb.weight, self.init_lower, self.init_upper)\n nn.init.uniform_(self.fc_e2h[1].weight, self.init_lower, self.init_upper)\n nn.init.uniform_(self.fc_e2h[1].bias, self.init_lower, self.ini...
[ "0.62177527", "0.6148866", "0.61414766", "0.6095812", "0.6050926", "0.60494894", "0.60094666", "0.60068417", "0.5989184", "0.59348774", "0.5921443", "0.59208834", "0.5913467", "0.59104276", "0.58972913", "0.5884649", "0.5881061", "0.58728945", "0.58623666", "0.58600444", "0.5...
0.6344896
0
Initializes the vdW, vdb, sdW and sdb parameters for adams optimizer.
def initialize_adam(parameters): v = initialize_momentum_velocity(parameters) s = initialize_momentum_velocity(parameters) return v, s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_parameters(self):\n # Weights\n init = select_w_init(self.w_init)\n if self.w_gain:\n gain = nn.init.calculate_gain('relu')\n init(self.relations, gain=gain)\n else:\n init(self.relations)\n\n # Biases\n if self.b_init:\n ...
[ "0.61397743", "0.6069441", "0.6063543", "0.6050992", "0.5999438", "0.5934147", "0.58897626", "0.58766615", "0.5862008", "0.58589673", "0.58539975", "0.583556", "0.58297217", "0.5800369", "0.57952744", "0.578874", "0.5783125", "0.57751894", "0.57678413", "0.57672316", "0.57524...
0.5721775
22
Get data and turn to .csv format
def data_to_str(data): s = "" items = "" s += draw_item.draw_config(data) items = draw_item.draw_items(data) for i in range(len(items)): if i == 0: s += items[i] + "\n" else: t = len(title().split(",")) - 2 s += "," * t + items[i] + "\n" return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_csv(self, filename):\n self.data.to_csv(filename)", "def to_csv(self, filename):\n self.data.to_csv(filename)", "def dbtocsv():\n connection = sqlite3.connect(\"sensordata.db\")\n cursor = connection.cursor()\n cursor.execute(\"Select * from sensordata\")\n road...
[ "0.7124587", "0.7124587", "0.70616347", "0.7039936", "0.6984284", "0.6970982", "0.69613516", "0.6937344", "0.6909254", "0.690631", "0.68561065", "0.6854211", "0.68344104", "0.6810988", "0.68026257", "0.676076", "0.6741937", "0.6740229", "0.67365", "0.67243624", "0.6710578", ...
0.0
-1
Returns the attribute at the specified index..
def getAttributeByIndex(self, index): if self._checkAttributeIndex(index) is not True: return False return self._attributes[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr(self, index):\n return self.row[0, index]", "def get(self, index):\n return self._node.attributes.get_public(index)", "def get_attr(self, value):\n return self.index[value]", "def __getitem__(self, attribute_name: str) -> Attribute:\n return self._attributes_by_name[attri...
[ "0.8613976", "0.8030115", "0.78981525", "0.73650235", "0.72557354", "0.72485846", "0.70878553", "0.70878553", "0.7086208", "0.6988241", "0.6988241", "0.69428515", "0.6931734", "0.69189376", "0.6911108", "0.6900333", "0.6899318", "0.6898354", "0.68365896", "0.6836392", "0.6835...
0.8010662
2
Standardize address column. Should be applied on the alphabetical columns only. All nonalphanumerical characters are removed, except fot the '|' needed for the Orbis dataset. Then, single consecutive letters are joint to words, independent numbers are removed, multiple spaces are replaced with single spaces, and spaces...
def clean_addresses(df, column_name): parent_dir = pkg_resources.resource_filename("linkage.model.to_replace", "") file_names = ["redundant_in_addresses.json", # Remove names of German states ] column = df[column_name] # Addresses to uppercase # apply func helps to preserve only...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_address(address):\n # Fix 'Place/Place' -> 'Place & Place'\n if re.findall(r'[a-zA-Z0-9]/[a-zA-Z0-9]', address):\n address = address.replace('/', ' & ')\n # Fix 'Place:Place' -> 'Place & Place'\n if re.findall(r'[a-zA-Z0-9]:[a-zA-Z0-9]', address):\n address = address.replace...
[ "0.7305745", "0.7201299", "0.718848", "0.71758026", "0.70107913", "0.666083", "0.6205775", "0.5949079", "0.5930495", "0.5914388", "0.58842313", "0.5851492", "0.584973", "0.5816574", "0.5805793", "0.579234", "0.57810575", "0.5765752", "0.57308185", "0.57005715", "0.56911397", ...
0.69098085
5
Test setup with configuration missing required entries.
async def test_setup_missing_config(hass: HomeAssistant) -> None: assert await async_setup_component( hass, SENSOR_DOMAIN, {SENSOR_DOMAIN: {"platform": DOMAIN}} ) await hass.async_block_till_done() assert len(hass.states.async_all(SENSOR_DOMAIN)) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpConfig(self):\n pass", "def setUp(self):\n test_env_setup()", "def test_required_config_none(self):\n base_config = BaseConfig()\n setattr(base_config, 'required_config', ['TEST_CONF'])\n setattr(base_config, 'TEST_CONF', None)\n\n self.assertRaises(Exception,...
[ "0.7669418", "0.72130454", "0.7183481", "0.71051687", "0.7016971", "0.6920542", "0.6917804", "0.6912883", "0.69047725", "0.69031185", "0.68934655", "0.68607384", "0.68607384", "0.68459934", "0.6825602", "0.6823809", "0.6798329", "0.6795894", "0.6782767", "0.677881", "0.677777...
0.6681245
69
Test attributes when no JSON result fetched.
async def test_update_with_json_attrs_no_data( hass: HomeAssistant, caplog: pytest.LogCaptureFixture ) -> None: respx.get("http://localhost").respond( status_code=HTTPStatus.OK, headers={"content-type": CONTENT_TYPE_JSON}, content="", ) assert await async_setup_component( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def look_for_other_attributes(context):\n json_data = context.response.json()\n assert \"recommended_versions\" in json_data, \"No recommended version found\"\n assert \"registration_link\" in json_data, \"No snyk registration link found\"\n assert \"component_analyses\" in json_data, \"No component an...
[ "0.667935", "0.6639048", "0.6414923", "0.6374166", "0.631917", "0.6290591", "0.62596345", "0.6162128", "0.60810286", "0.6042644", "0.5967932", "0.59640384", "0.59489536", "0.58915883", "0.58915883", "0.58915883", "0.5880054", "0.58735245", "0.58686084", "0.5865724", "0.584033...
0.0
-1
convert sql struct to string
def sql_dict_to_str(self, result, tables): table = tables[result['sql']['from'][0]] header_names = table['header_name'] + ['空列'] header_ids = table['header_id'] + ['null'] sql = result['sql'] str_cond_list, sql_cond_list = [], [] where_conds, orderby_conds = [], [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sql_to_string(self, psql):\n pcon = self.__engine.raw_connection()\n try:\n pcur = pcon.cursor()\n xxx = psql.as_string(pcur)\n finally:\n pcon.close()\n return xxx", "def sqlify(obj):\n # because `1 == True and hash(1) == hash(True)`\n # we...
[ "0.7051769", "0.6831173", "0.64168197", "0.63388485", "0.6148355", "0.61295176", "0.59182334", "0.59123236", "0.5907495", "0.58044523", "0.5802764", "0.57845944", "0.5770526", "0.57631916", "0.57362616", "0.56831014", "0.56769323", "0.56762207", "0.5674851", "0.5661987", "0.5...
0.56320554
21
Creates an ArgumentParser to read the options for this script from sys.argv
def make_argument_parser(): parser = argparse.ArgumentParser( description="Train model.", epilog='\n'.join(__doc__.strip().split('\n')[1:]).strip(), formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('--inputdirs', '-i', type=str, required=True, nargs='+', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def _init_parser():\n\t\n\t_parser = argparse.ArgumentParser()\n\t_parser.add_argument(\"--pull\...
[ "0.77495533", "0.7427968", "0.7407757", "0.73361915", "0.73148197", "0.7309196", "0.72941315", "0.729033", "0.7288606", "0.72717685", "0.72671", "0.72608715", "0.7257929", "0.72291887", "0.72102225", "0.7202624", "0.71952707", "0.7194806", "0.71738976", "0.71731013", "0.71731...
0.0
-1