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
Generate wordcloud from text. The input "text" is expected to be a natural text. If you pass a sorted list of words, words will appear in your output twice. To remove this duplication, set ``collocations=False``. Alias to generate_from_text. Calls process_text and generate_from_frequencies. Returns self
def generate(self, text): return self.generate_from_text(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_wordcloud(self, text):\n text = ' '.join(f\"{word}\" for word in text)\n mask = np.array(Image.open(os.path.join(CURRDIR, \"cloud.png\")))\n wc = WordCloud(background_color=\"white\",\n max_words=200,\n mask=mask)\n wc.generate(text...
[ "0.7321067", "0.7125735", "0.7000952", "0.66037923", "0.65328604", "0.6426229", "0.635972", "0.63260776", "0.63139814", "0.6270058", "0.6206381", "0.6104454", "0.60532176", "0.58928305", "0.5879114", "0.57920814", "0.5689042", "0.5669589", "0.5654585", "0.5638587", "0.5546514...
0.513227
45
Draw mask contour on a pillow image.
def _draw_contour(self, img): if self.mask is None or self.contour_width == 0: return img mask = self._get_bolean_mask(self.mask) * 255 contour = Image.fromarray(mask.astype(np.uint8)) contour = contour.resize(img.size) contour = contour.filter(ImageFilter.FIND_EDGES...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _draw_mask_on_image(self, mask):\n mask = self.STANDARD_COLORS_ARRAY[mask]\n cv2.addWeighted(mask,self.config.ALPHA,self.image,1.0,0,self.image)", "def draw_contours(self, image, maskImg):\r\n # Required variables..\r\n x, y, width, height = 0, 0, 0, 0\r\n # Find contours..\r\n...
[ "0.7054004", "0.6875407", "0.6691408", "0.6553718", "0.6550829", "0.6529287", "0.64861745", "0.64277035", "0.63999516", "0.6387939", "0.63366115", "0.62999153", "0.6298419", "0.6289319", "0.62264115", "0.6213536", "0.61829853", "0.6153491", "0.6097288", "0.60694355", "0.60611...
0.7335727
0
DeviceRequest a model defined in Swagger
def __init__(self, accept=None, content_type=None, method=None, payload_b64=None, uri=None): self._accept = accept self._content_type = content_type self._method = method self._payload_b64 = payload_b64 self._uri = uri self.discriminator = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_model_create_rest_api():\n request_json = request.get_json()\n OptimModelRequestAPI(request_json).validate()\n return create_model_data(request_json)", "def device(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"device\"), kwargs)", "def device(self, **kwargs):\...
[ "0.6399914", "0.59935594", "0.59935594", "0.59935594", "0.59935594", "0.58712864", "0.5751708", "0.57502145", "0.571685", "0.56972414", "0.5670372", "0.56288075", "0.5616586", "0.5599476", "0.557619", "0.55731493", "0.55656487", "0.55616665", "0.5549717", "0.55450004", "0.551...
0.0
-1
Gets the accept of this DeviceRequest. The content type of an accepted response.
def accept(self): return self._accept
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accept_header(\n cls,\n media_type=None,\n version=None,\n ):\n if not media_type:\n media_type = cls.media_type\n if not version:\n version = cls.api_version\n return {'HTTP_ACCEPT': '{}; version={}'.format(media_type, version)}", "def a...
[ "0.65516925", "0.6447753", "0.61971855", "0.60161924", "0.60096276", "0.5922715", "0.58552164", "0.58437896", "0.5798946", "0.5732729", "0.57047063", "0.5623401", "0.5568873", "0.54779", "0.5467829", "0.54548913", "0.5439186", "0.5429292", "0.5397432", "0.53409916", "0.531123...
0.66832167
0
Sets the content_type of this DeviceRequest. The content type of the payload.
def content_type(self, content_type): self._content_type = content_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setContentType(self, content_type):\n self.content_type = content_type", "def content_type(self, value):\n if value:\n self._headers['CONTENT-TYPE'] = value\n else:\n self.del_header('CONTENT-TYPE')", "def set_content_type(self, data):\n self._content_type ...
[ "0.7500705", "0.71212494", "0.7073143", "0.7024496", "0.70036817", "0.6287808", "0.6221375", "0.6138405", "0.60107297", "0.5937071", "0.5937071", "0.58619237", "0.58392286", "0.5827382", "0.5801091", "0.5787701", "0.5783754", "0.5717894", "0.56839204", "0.56839204", "0.568392...
0.7687349
0
Gets the method of this DeviceRequest. The CoAP request method. Allowed values are GET, POST, PUT and DELETE.
def method(self): return self._method
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Method(self):\n if self._method is None:\n return \"GET\"\n if len(self._method) == 0:\n return \"GET\"\n return self._method", "def getMethod(self):\n return self.__get('method')", "def get_requestmethod(self):\n return self.request.method.lower()",...
[ "0.764096", "0.7338331", "0.7315135", "0.71793914", "0.71184516", "0.70490223", "0.69281656", "0.680086", "0.6608744", "0.6570877", "0.64526284", "0.63241434", "0.62961274", "0.62688583", "0.6191311", "0.61481917", "0.6015211", "0.59274924", "0.59219486", "0.58819586", "0.586...
0.6326981
11
Gets the uri of this DeviceRequest. The URI path of the requested resource.
def uri(self): return self._uri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uri(self):\n if self._uri is None:\n self._uri = \"{0}{1}/{2}\".format(\n self.session.resource_prefix,\n self.base_uri,\n self.ip_or_ifname_or_group_name,\n )\n\n return self._uri", "def get_uri(self):\n return self....
[ "0.7658608", "0.7472539", "0.72388", "0.72387254", "0.7238287", "0.7192562", "0.68946636", "0.6879716", "0.68114495", "0.67648053", "0.6747851", "0.6747851", "0.6747851", "0.6747851", "0.6747851", "0.6698215", "0.6669744", "0.6669744", "0.6669744", "0.66432476", "0.66059786",...
0.7355813
5
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DeviceRequest): 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.808826", "0.808826", "0.8054592", "0.79827315", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "...
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
Function to split the image_list to training/validation sets.
def split_datasets(img_lst): num = len(img_lst) idx = np.random.permutation(num) train_lst = np.array(img_lst)[idx[:int(num * .8)]] # 80/20 split validation_lst = np.array(img_lst)[idx[int(num * .8):int(num * .9)]] test_lst = np.array(img_lst)[idx[int(num * .9):]] return train_lst, validation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_split_data(aligned_image_lists, raw_image_lists, test_ratio ,validation = True ):\n\n assert len(aligned_image_lists) == len(raw_image_lists), \"images have different size\"\n mask = list(range(len(aligned_image_lists)))\n mask_train, mask_test = train_test_split(mask, test_size= test_ratio...
[ "0.77804697", "0.7038002", "0.68176794", "0.67854583", "0.6711248", "0.6674599", "0.6669104", "0.66541415", "0.6619824", "0.6617424", "0.6575943", "0.64894485", "0.6468141", "0.6467643", "0.64413875", "0.6425122", "0.6390245", "0.63787025", "0.63672835", "0.6366868", "0.63657...
0.80874634
0
Inicializaliza el webdriver de Selenium que va a ser usado para realizar el scraping.
def __init_webdriver(self): try: # Inicializar driver para Firefox # - Configuración parámetro profile profile = webdriver.FirefoxProfile() # - Indicar que no se ha de usar el directorio por defecto de Downloads profile.set_preference("browser.download...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_driver(self):\n # Set UserAgent to prevent issues with blocking bot\n self.chrome_options.add_argument(\n \"user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\")\n # Set headless\n if s...
[ "0.7659929", "0.76242304", "0.7536185", "0.7476434", "0.7417294", "0.7377062", "0.73640746", "0.7362667", "0.73611647", "0.72186965", "0.71799517", "0.7172211", "0.7036025", "0.6976502", "0.69670516", "0.69299686", "0.69078654", "0.68689203", "0.68107396", "0.67844397", "0.67...
0.76196164
2
Find the indices for a feature type in the dataset.
def find_feature(self, pattern): idxs = [] for idx, header in enumerate(self.headers): header = header.decode('utf-8') lp = len(pattern) # Find continuations if header == pattern: idxs.append(idx) elif header[:lp] == pattern an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_agent_indices_of_type(array, agent_type):\t\n\tagent_indices = np.argwhere(array == agent_type)\n\treturn agent_indices", "def getFeaturesIndices(self, tag, history, in_data=True):\n indices = []\n if in_data:\n self.__checkFeatureIndex__(self.__f100__((history.getWord(), tag)), ...
[ "0.6895146", "0.6340112", "0.6328995", "0.61625695", "0.61040395", "0.6092817", "0.60914147", "0.6084349", "0.6063701", "0.6063701", "0.60521424", "0.5951172", "0.5910862", "0.58817786", "0.5859882", "0.5836692", "0.5794135", "0.57535255", "0.57514673", "0.5730898", "0.569244...
0.0
-1
Creates and saves a User with the given email, name and password.
def create_user(self, email, name, phone1, password=None, signed_up=timezone.localtime(),): if not email: raise ValueError(_('Users must have an email address')) user = self.model( email=self.normalize_email(email), name=name, phone1=phone1, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self, name, email, password):\n new_user = User(name=name, email=email, password=password)\n db.session.add(new_user)\n db.session.commit()", "def Create_user(self, email, name, password):\n\n #validating user inputs\n if not email:\n raise ValueError...
[ "0.865435", "0.8460559", "0.8407932", "0.83753693", "0.8355915", "0.835164", "0.8339796", "0.83342993", "0.83279973", "0.83212274", "0.8309494", "0.83015496", "0.8288598", "0.82839537", "0.823949", "0.8211049", "0.820871", "0.82057345", "0.820555", "0.82001686", "0.8191416", ...
0.0
-1
Creates and saves a superuser with the given email, name and password.
def create_superuser(self, email, name, phone1, password=None, signed_up=timezone.localtime(),): user = self.create_user( email, password=password, name=name, phone1=phone1, signed_up=signed_up, ) user.is_admin = True user.save(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, email, name, password):\n\n user = self.create_user(email, name, password)\n\n # Make this user an admin.\n user.is_superuser = True\n user.is_staff = True\n user.save(using=self._db)\n\n return user", "def create_superuser(self, email, name, password):\n # Cre...
[ "0.8250757", "0.8202313", "0.8198529", "0.81922776", "0.81493104", "0.814835", "0.8146433", "0.81415796", "0.81397396", "0.8131938", "0.81093377", "0.81093377", "0.8106839", "0.8075575", "0.80554855", "0.80347353", "0.80328953", "0.801549", "0.8005391", "0.8004749", "0.798410...
0.7890217
40
Returns a "termfrequency inversedocumentfrequency" weighted bag of words vector from the given document.
def tfidf_bow(doc): if VECTORIZER == None: sys.stderr.write("ERROR: Vectorizer not defined... Did you call set_vocab?\n") return None return VECTORIZER.transform([doc]).toarray()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_frequency(self, document):\n freq_table = {}\n words = nltk.word_tokenize(document)\n for word in words:\n if word in freq_table:\n freq_table[word] = freq_table.get(word) + 1\n else:\n freq_table[word] = 1\n # cut down the fr...
[ "0.7261806", "0.70417756", "0.6845095", "0.67943263", "0.6705665", "0.6618403", "0.65749985", "0.6567144", "0.6532955", "0.651436", "0.6475793", "0.6302743", "0.6296834", "0.62434864", "0.6238441", "0.61872786", "0.6159652", "0.6157867", "0.6141391", "0.61338145", "0.61192787...
0.6445812
11
Accessor for the backend implementation name.
def backend(self) -> str: return self.__class__.BACKEND_NAME
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._config.backend_name", "def backend_name(self) -> str:\n return self._db_data.backend", "def backend(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"backend\")", "def get_name(self) -> str:\n raise NotImplementedError", "def get_name(self):...
[ "0.8230206", "0.80846757", "0.718454", "0.7056363", "0.6981317", "0.6981317", "0.6981317", "0.6981317", "0.6974759", "0.6957721", "0.6927489", "0.6898061", "0.6882686", "0.6869664", "0.6865531", "0.6829155", "0.68173456", "0.68173456", "0.68173456", "0.6817242", "0.68091136",...
0.8084543
2
Accessor for the created flag indicating a new profile.
def created(self) -> bool: return self._created
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_profile_for_new_user(sender, created, instance, **kwargs):\n if created:\n profile = self.get_model('profile')(user=instance)\n profile.save()", "def getCreated(self):\n return self.__created", "def create_profile_for_new_users(sender, instance, create...
[ "0.6504535", "0.6399787", "0.63894", "0.63742775", "0.63448364", "0.632226", "0.63141906", "0.6294412", "0.627818", "0.6215819", "0.6211774", "0.6206639", "0.61617005", "0.61485636", "0.61485636", "0.61485636", "0.61485636", "0.61485636", "0.6145385", "0.60362685", "0.6004994...
0.6042291
19
Accessor for the profile name.
def name(self) -> str: return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self) -> str:\n return self.profile_device.name", "def get_name(self):\n try:\n return self.profile_data[\"name\"]\n except Exception as e:\n error_msg = (\"Failed to retrieve player name: {}\"\n \"\".format(str(e)))\n raise P...
[ "0.7475491", "0.7342574", "0.72158927", "0.71779466", "0.715317", "0.71318805", "0.709894", "0.7090573", "0.7090573", "0.7090573", "0.7065558", "0.70252794", "0.70085967", "0.70085967", "0.70084", "0.6996619", "0.6982879", "0.69599384", "0.69599384", "0.6950784", "0.69367176"...
0.0
-1
Accessor for scopespecific settings.
def settings(self) -> BaseSettings: return self._context.settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings():\n return _get_settings()[1]", "def get_settings(self):\n return self.settings", "def settings(self):\r\n return settings.Settings(self)", "def settings(self):\n return self._settings", "def settings(self):\n return self._settings", "def settings(self) -> Optio...
[ "0.6822185", "0.68138766", "0.66667575", "0.66279984", "0.66279984", "0.63539046", "0.6298295", "0.6240654", "0.6227429", "0.62234646", "0.6206192", "0.61295235", "0.61252606", "0.6101482", "0.61001194", "0.61001194", "0.61001194", "0.61001194", "0.6066084", "0.6060536", "0.6...
0.68345845
0
Accessor for the session active state.
def active(self) -> bool: return self._active
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_active(self):\n return self._active", "def _get_active(self):\n return self.__active", "def _get_active(self):\n return self.__active", "def _get_active(self):\n return self.__active", "def _get_active(self):\n return self.__active", "def active(self):\n return self._act...
[ "0.7690493", "0.75330335", "0.75330335", "0.75330335", "0.75330335", "0.7433626", "0.7433626", "0.7358532", "0.7358532", "0.7358532", "0.73445046", "0.72758883", "0.7233065", "0.7230763", "0.7230763", "0.7230763", "0.7230763", "0.72269166", "0.7197208", "0.7060772", "0.699344...
0.6691027
37
Accessor for scopespecific settings.
def settings(self) -> BaseSettings: return self._context.settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings():\n return _get_settings()[1]", "def get_settings(self):\n return self.settings", "def settings(self):\r\n return settings.Settings(self)", "def settings(self):\n return self._settings", "def settings(self):\n return self._settings", "def settings(self) -> Optio...
[ "0.6822185", "0.68138766", "0.66667575", "0.66279984", "0.66279984", "0.63539046", "0.6298295", "0.6240654", "0.6227429", "0.62234646", "0.6206192", "0.61295235", "0.61252606", "0.6101482", "0.61001194", "0.61001194", "0.61001194", "0.61001194", "0.6066084", "0.6060536", "0.6...
0.68345845
1
Accessor for the associated profile instance.
def profile(self) -> Profile: return self._profile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile(self):\n return self._profile", "def profile(self):\n return self.__profile", "def get_user_profile(self):\n return self.user.profile", "def profile(self) -> AskarProfile:\n return self._profile", "def get_profile(self):\n endpoint = '/profile'\n return...
[ "0.77406186", "0.7511576", "0.7465245", "0.73184276", "0.6949237", "0.69122267", "0.6906659", "0.6868853", "0.67496604", "0.6668668", "0.6659439", "0.65992355", "0.65992355", "0.6583674", "0.65764296", "0.653909", "0.6386787", "0.63692504", "0.6270765", "0.62291265", "0.62169...
0.78337884
1
Initialize the profile manager provider.
def __init__(self): self._inst = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_user_profile(self, authz_token):\n try:\n return self.user_profile_client_pool.initializeUserProfile(authz_token)\n except TException:\n logger.exception(\"Error occurred in add_gateway, \", TException)\n raise", "def __init__(self):\r\n super(...
[ "0.65000266", "0.6437543", "0.6206161", "0.596414", "0.5960201", "0.5933525", "0.5880033", "0.58052516", "0.5784897", "0.5708182", "0.57040715", "0.56956553", "0.5686321", "0.56793725", "0.56571996", "0.56532854", "0.5628215", "0.5602667", "0.5588751", "0.5564222", "0.5548556...
0.0
-1
Plot a confusion matrix.
def plot_confusion_matrix(self, id:int, title="Confusion matrix", cmap=plt.cm.Reds): if isinstance(cmap, str): cmap = plt.get_cmap(cmap) return plot_confusion_matrix(self.cms[id][1], self.classes_names, normalize=True, title=title, cmap=cmap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def plot_confusion_matrix(cm, classes=None, title='Confusion matrix'):\n if classes is not None:\n sns.heatmap(cm, cmap=\"YlGnBu\", xticklabels=classes...
[ "0.8346288", "0.8009091", "0.8008569", "0.7926985", "0.78939724", "0.7892289", "0.78611463", "0.7857628", "0.785709", "0.7848136", "0.7828893", "0.7809595", "0.7807486", "0.7799956", "0.77992225", "0.77787936", "0.7776414", "0.7775345", "0.77748877", "0.77725124", "0.7753516"...
0.0
-1
Return clean VCS url from RFCstyle url
def chomp_protocol(url: str) -> str: if "+" in url: url = url.split("+", 1)[1] scheme, netloc, path, query, frag = urlparse.urlsplit(url) rev = None if "@" in path: path, rev = path.rsplit("@", 1) url = urlparse.urlunsplit((scheme, netloc, path, query, "")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_url(url):\n if not url.startswith((\"git+\", \"hg+\")):\n return url\n return url[4:]", "def contract_url(full_url: str) -> str:\n url_lst = list(urlparse(full_url))\n # delete params, query and fragment\n for i in [3, 4, 5]:\n url_lst[i] = ''\n # reduce url : path p...
[ "0.71630037", "0.7157285", "0.67969847", "0.67502785", "0.67250395", "0.6719597", "0.67055273", "0.66991746", "0.6686367", "0.6607708", "0.6550631", "0.6547109", "0.6536747", "0.6507275", "0.6470302", "0.6463234", "0.6435771", "0.64287513", "0.6382788", "0.6361964", "0.633289...
0.57932127
85
Retrieve name of the remote / upstream of currently checked out branch. Returns If upstream the same, returns ``branch_name``. If upstream mismatches, returns ``remote_name/branch_name``.
def get_current_remote_name(self) -> str: match = self.status() if match.branch_upstream is None: # no upstream set if match.branch_head is None: raise Exception("No branch found for git repository") return match.branch_head if match.branch_head is None:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upstream_branch(self, current_path, branch_name):\n command = [\n \"git\",\n \"rev-parse\",\n \"--abbrev-ref\",\n \"{}@{{upstream}}\".format(branch_name),\n ]\n p = subprocess.Popen(\n command,\n stdout=PIPE,\n ...
[ "0.7058417", "0.6934962", "0.6891487", "0.68761206", "0.6502097", "0.63282126", "0.63093853", "0.6280419", "0.6228176", "0.61851716", "0.6176428", "0.60566586", "0.6055257", "0.6041588", "0.60115004", "0.5991926", "0.5981033", "0.5971665", "0.59130394", "0.58966994", "0.57776...
0.82647103
0
Getter fuction for FileStorage mode
def cities(self): objs = models.storage.all() tmp = [] for key, value in objs.items(): name = key.split('.') if name[0] == "City": if value.state_id == str(self.id): tmp.append(objs[key]) return t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _CreateStorageFile(self):\n return sqlite_file.SQLiteStorageFile(storage_type=self._storage_type)", "def file_access(self):\n return self._file_access", "def get_storage(self):\n return self.storage", "def get(self, cls, id):\n\n return FileStorage.__objects[key(cls, id)]", "def...
[ "0.6463092", "0.6321593", "0.6309469", "0.6130948", "0.6104647", "0.60922635", "0.6084994", "0.60098904", "0.59722555", "0.5970949", "0.5936736", "0.5922109", "0.5911827", "0.59044045", "0.58612406", "0.5848565", "0.58418757", "0.5839903", "0.5816715", "0.58055335", "0.578898...
0.0
-1
A string representing this node
def __repr__(self): return 'TreeNode({0})'.format(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n\t\treturn get_node_description(self.name)", "def __str__(self) -> str:\n return 'Node({})'.format(self.yaml_node)", "def __str__(self):\n\n pg_str = pformat(self.content)\n repr_str = \"Node ID: {} \\nNode Name: {} \\n{}\".format(self.id, self.name, pg_str)\n\n ...
[ "0.82119346", "0.8182425", "0.815507", "0.81248873", "0.80062306", "0.7944664", "0.785034", "0.7848389", "0.7848389", "0.7692921", "0.76741517", "0.7597848", "0.75446266", "0.7542078", "0.7531955", "0.75011665", "0.74969465", "0.7425142", "0.7409291", "0.73911834", "0.7389148...
0.7232789
61
Get the path to where the DICOM files are stored for this scan, relative to the root path set in the pylidc configuration file (i.e., `~/.pylidc` in MAC and Linux).
def get_path_to_dicom_files(self): dicompath = _get_dicom_file_path_from_config_file() if not os.path.exists(dicompath): msg = ("Could not establish path to dicom files. Have you " "specified the `path` option in the configuration " "file {}?") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configPath(self):\n return os.path.dirname(__file__)", "def path(self):\n return os.path.join(self.config.get('path', os.getcwd()))", "def idk_config_dir(self):\n return self.cm.config_dir", "def get_config_file_location():\n\n return './' + CONFIG_FILE_NAME", "def path_to_calib...
[ "0.6899972", "0.68045884", "0.67311525", "0.67027825", "0.6700457", "0.6699443", "0.66953486", "0.66793716", "0.65875673", "0.6565565", "0.65514016", "0.6542061", "0.65384877", "0.6513114", "0.6470374", "0.64548516", "0.6448836", "0.6412679", "0.6391513", "0.6391381", "0.6382...
0.7260567
0
Return the status of the wit project.
def status() -> None: wit = WitStatus() print(f'Commit ID: {wit.last_commit_id}') if wit.last_commit_id: full_changes = wit.get_changes_to_be_committed() print(f'Changes to be committed: {", ".join(full_changes)}') changed, untracked = wit.compare_two_list_files( wit.o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self) -> str:\n return pulumi.get(self, \"status\")", "def status(self) -> str:\n return pulumi.get(self, \"status\")", "def status(self) -> str:\n return pulumi.get(self, \"status\")", "def status(self) -> str:\n return pulumi.get(self, \"status\")", "def status(self...
[ "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "0.7158357", "...
0.0
-1
Test that if we update an event id associated with a job, that the job's elastic search update is triggered
def test_job_save_event_id_update(self, lookup_users_mock, elasticsearch_update_mock): from bilbyui.models import BilbyJob, EventID event_id = EventID.create( "GW123456_123456", 12345678, trigger_id="S123456a", nickname="Test Nick", is_ligo_event=True ) job = BilbyJob.objec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_save_update_document(self, lookup_users_mock, elasticsearch_update_mock):\n from bilbyui.models import BilbyJob\n\n job = BilbyJob.objects.create(\n user_id=self.user.id,\n name=\"Test1\",\n description=\"first job\",\n job_controller_id=2,\n ...
[ "0.6785173", "0.6247469", "0.6222333", "0.6023295", "0.6013579", "0.598738", "0.5985785", "0.5969659", "0.594538", "0.5907827", "0.5907827", "0.5907827", "0.58684987", "0.5845408", "0.58315784", "0.5791578", "0.5776594", "0.57588714", "0.57272345", "0.57255614", "0.5723187", ...
0.7743935
0
Creates a new Block from the tag format on Section.Palette
def from_palette(cls, tag: nbt.TAG_Compound): name = tag['Name'].value properties = tag.get('Properties') if properties: properties = dict(properties) return cls.from_name(name, properties=properties)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeBlock(tag):\n return {\"t\":\"RawBlock\",\"c\":[\"html\",tag]}", "def create_block(type: str, color_key, position):\n if type not in BlockCreator.types.keys():\n raise BlockCreator.IncorrectBlockType\n image_name = BlockCreator.types[type]\n return Block(image_name, col...
[ "0.68492925", "0.6408916", "0.6253609", "0.5846288", "0.580115", "0.57959837", "0.57726973", "0.57716644", "0.5736296", "0.5729031", "0.57138366", "0.5680187", "0.56713814", "0.56177133", "0.55536044", "0.5549993", "0.5535567", "0.55290866", "0.552367", "0.5517504", "0.550539...
0.5466057
23
loops over a twodimensional array and determines if there are any unwatched rooms and returns boolean and unwatched room coordinates
def check_for_unguarded_rooms(museum): empty_rooms = [] for row_idx in range(len(museum)): for item_idx in range(len(museum[row_idx])): #Go back and fix this to be enumerate instead if museum[row_idx][item_idx] == "0": empty_rooms.append([row_idx, item_idx]) # for row_idx, row_value in e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallsAndGates(self, rooms: List[List[int]]) -> None:\n if len(rooms)==0:\n return rooms\n n, m = len(rooms), len(rooms[0])\n for i in range(n):\n for j in range(m):\n if rooms[i][j] == 0:\n q= [(i,j,0)]\n while q:\n...
[ "0.6664323", "0.6524256", "0.6485627", "0.6402216", "0.6395304", "0.63798493", "0.6350463", "0.6277082", "0.6231979", "0.6210724", "0.61077136", "0.59789926", "0.5957571", "0.59506184", "0.5920705", "0.58676", "0.58521897", "0.5835247", "0.5834399", "0.5822375", "0.57947785",...
0.6637238
1
Pure python version to compute the levenshtein distance between a and b. The Levenshtein distance includes insertions, deletions, substitutions; unlike the Hamming distance, which is substitutions only.
def distance(a,b): n, m = len(a), len(b) if n > m: # Make sure n <= m, to use O(min(n,m)) space a,b = b,a n,m = m,n current = range(n+1) for i in range(1,m+1): previous, current = current, [i]+[0]*n for j in range(1,n+1): add, delete = previous[j]+1, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __levenshtein(a, b):\n\n n, m = len(a), len(b)\n if n > m:\n # Make sure n <= m, to use O(min(n,m)) space\n a, b = b, a\n n, m = m, n\n\n current = list(range(n + 1))\n for i in range(1, m + 1):\n previous, current = current, [i] + [0] * n\n for j in range(1, n + ...
[ "0.796443", "0.785561", "0.7786385", "0.7774445", "0.7736419", "0.7694315", "0.76516205", "0.7645767", "0.7606263", "0.75738287", "0.7573492", "0.75230104", "0.7520018", "0.7508515", "0.74968576", "0.7408928", "0.7301144", "0.7297995", "0.72526455", "0.7245518", "0.72176874",...
0.0
-1
Write summaries to be viewed by TensorBoard.
def _WriteSummaries(self, job_name, global_step, summaries): if not summaries: return with contextlib.ExitStack() as stack: if py_utils.IsEagerMode(): stack.enter_context(self._summary_writer.as_default()) for unused_name, summary in sorted(summaries.items()): if py_utils.IsEag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_training_summaries(self):\n for metric, epochs in self._training_summaries.items():\n self._write_scalar_to_tensorboard(\n name=f\"{self._Sections.SUMMARY}/training_{metric}\",\n value=epochs[-1],\n step=self._epochs,\n )", "def ...
[ "0.7581542", "0.73276764", "0.73154473", "0.7297411", "0.72043127", "0.7191004", "0.71215713", "0.7084875", "0.70785034", "0.6977345", "0.6976182", "0.68956774", "0.68922", "0.67848325", "0.6784483", "0.67750436", "0.6693117", "0.6621105", "0.6587284", "0.65748435", "0.657222...
0.711205
7
Restore additional state before training starts.
def LoadProgramState(self, restored_checkpoint_path=None, sess=None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self):\n self.igate.restore()\n self.fgate.restore()\n self.ogate.restore()\n super(LSTM, self).restore()", "def _restore(self):\n self._logger = LOGGER\n self._param_store = pyro.get_param_store()\n self.set_state(self.best_params)\n self._alph...
[ "0.76957387", "0.7673653", "0.7487891", "0.7467014", "0.7430578", "0.72823244", "0.71881205", "0.70727265", "0.7016034", "0.7004747", "0.6999466", "0.6988604", "0.69749", "0.69529057", "0.6836385", "0.6834523", "0.67848307", "0.677899", "0.67723423", "0.6762358", "0.6760007",...
0.0
-1
Instantiates a model object for a particular task. MultiTaskModels can accept a shared_model parameter, but SingleTaskModels cannot, so we handle them separately here.
def _InstantiateTaskModel( self, task_params ) -> Union[base_model.SingleTaskModel, base_model.MultiTaskModel]: if issubclass(task_params.cls, base_model.MultiTaskSubModel): return task_params.Instantiate( shared_model=self._shared_model, executor_ema=self._executor_ema) return task_para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n\n # Validate Inputs\n create_dict = {\n \"model_id\": self.model.id,\n }\n\n try:\n # Create Task\n self.spinner.start()\n task_obj = self.dal.task.create(Task(create_dict))\n finally:\n self.spinner.stop(...
[ "0.6674407", "0.6567831", "0.6457757", "0.6449754", "0.6341709", "0.62728536", "0.6207076", "0.59842354", "0.59752315", "0.5942606", "0.5912393", "0.5910969", "0.58755916", "0.58463985", "0.58044136", "0.5726108", "0.5726108", "0.5717431", "0.5705282", "0.56873107", "0.566106...
0.82217675
0
Infeed function. Only needed in tf.function / eager mode.
def InfeedTFFunc(self): self.task.input.DeviceLoopSetupEager() def InfeedBody(i): self.task.input.CreateTpuEnqueueOps() return i + 1 tf.while_loop( cond=lambda i: i < self._steps_per_loop, body=InfeedBody, loop_vars=[tf.constant(0)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InfeedTFFunc(self):\n self._task.input.DeviceLoopSetupEager()\n\n def InfeedBody(i):\n self._task.input.CreateTpuEnqueueOps()\n return i + 1\n\n tf.while_loop(\n cond=lambda i: i < self._steps_per_loop,\n body=InfeedBody,\n loop_vars=[tf.constant(0)])", "def _InfeedLoo...
[ "0.7290163", "0.72207683", "0.65646327", "0.6472237", "0.6100199", "0.60039014", "0.5979061", "0.59114486", "0.59108335", "0.5764563", "0.5757518", "0.57310605", "0.57231987", "0.5674787", "0.56480515", "0.5644827", "0.55970794", "0.55934364", "0.5547156", "0.554651", "0.5543...
0.7240367
1
A single forward/backward step. Processes the given input batch and updates the distributed metrics accumulator. We use FProp (instead of FPropDefaultTheta) and _BPropForVariables (instead of BProp) in order to permit the tf.distribute library to handle threading values across devices.
def _Step(batch: py_utils.NestedMap): with tf.name_scope('tpu_train'): with py_utils.GradientTape(persistent=True): batch.Update( tpu_embedding_layers_v2.TPU_EMBEDDING_MANAGER.Dequeue(batch) ) metrics_dict, _ = self.task.FPropDefaultTheta(batch) # py_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(ctx, input, gamma, beta, eps=1e-5):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n\n ####### Forward pass of batch normalization ######\n\n # In this section, we have to perform the forward pass of batch normalization\n # with more intermediate step...
[ "0.67128277", "0.6583401", "0.6525036", "0.6525036", "0.64879036", "0.64785206", "0.64760774", "0.6470613", "0.64340407", "0.6424575", "0.64163154", "0.6339865", "0.63196594", "0.6297519", "0.6258924", "0.6251459", "0.6211694", "0.6202756", "0.6188833", "0.6186847", "0.617261...
0.69391733
0
Eval a shard of a batch on a single TPU core.
def TpuEvalStep(self, *args): with tf.name_scope('tpu_eval'): self._model.ConstructFPropGraph() per_step_eval_metrics = self._eval_metrics.PackStepMetricsForAccumulation( self._task.eval_metrics, args) return [x + y for x, y in zip(per_step_eval_metrics, args)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _eval_on_tpu_system(ctx, model_fn_wrapper, dequeue_fn):\n iterations_per_loop_var = _create_or_get_iterations_per_loop()\n\n single_tpu_eval_step, host_calls, captured_scaffold_fn = (\n model_fn_wrapper.convert_to_single_tpu_eval_step(dequeue_fn))\n\n def multi_tpu_eval_steps_on_single_shard():\n re...
[ "0.658149", "0.6225023", "0.59446156", "0.58990073", "0.58817333", "0.56335104", "0.55688435", "0.5560876", "0.54880995", "0.5444276", "0.5365182", "0.53565645", "0.534543", "0.53196394", "0.5283961", "0.5260732", "0.5228011", "0.522717", "0.51534003", "0.51398444", "0.513448...
0.49627393
37
Fetch decoder outputs, combining with CPU passthrough tensors if needed.
def _FetchDecodeOut(tpu_outs: Union[List[tf.Tensor], Callable[..., tf.Tensor]], sess=None): if py_utils.IsEagerMode(): # The CPU pass through data will be from the infeed function. # Here we will get an empty `cpu_pt`. decode_out_dict, cpu_pt = tpu_outs() decode_out_dict = py_utils...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, decoder_output):\r\n\r\n # decoder_output = [batch size, trg len, hid dim]\r\n\r\n decoder_output_seq = decoder_output[:, :-1, :] if self.has_non_seq else decoder_output\r\n decoder_output_non_seq = decoder_output[:, -1, :] if self.has_non_seq else None\r\n device = de...
[ "0.63353723", "0.6262099", "0.62538815", "0.6213787", "0.6181044", "0.6155525", "0.6139918", "0.6124117", "0.6066893", "0.6021688", "0.60009277", "0.599099", "0.5964074", "0.59536594", "0.5827042", "0.5817272", "0.57714856", "0.57708675", "0.57391274", "0.57279384", "0.569578...
0.7340662
0
Write summaries to be viewed by TensorBoard.
def _WriteSummaries(self, job_name, dataset_name, global_step, summaries): if not summaries: return sliced_summaries = collections.defaultdict(dict) for name, summary in summaries.items(): arr = name.split(summary_utils.METRIC_SLICE_SEPARATOR) if len(arr) == 2: metric, slice_name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_training_summaries(self):\n for metric, epochs in self._training_summaries.items():\n self._write_scalar_to_tensorboard(\n name=f\"{self._Sections.SUMMARY}/training_{metric}\",\n value=epochs[-1],\n step=self._epochs,\n )", "def ...
[ "0.75818", "0.732781", "0.73164475", "0.72973967", "0.72043204", "0.71911174", "0.71221435", "0.7112638", "0.708464", "0.7079041", "0.6978051", "0.69767183", "0.68965685", "0.68917036", "0.67848414", "0.67756337", "0.6693621", "0.66204596", "0.65869915", "0.6575147", "0.65722...
0.6784595
15
Loads configuration from YAML file.
def load(cred_path: Path): logger.debug(f"Retrieving credentials from {cred_path}") if not cred_path.exists(): raise Exception(f"Authentication file {cred_path} does not exist.") with open(cred_path, mode="r", encoding="utf-8") as cred: content = yaml.full_load(cred) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p...
[ "0.81291693", "0.800257", "0.79436225", "0.7916159", "0.7909068", "0.78592306", "0.78561884", "0.7842526", "0.7830859", "0.7802767", "0.77727634", "0.7757022", "0.7750679", "0.7732182", "0.77274853", "0.76999307", "0.7658749", "0.76347834", "0.7625129", "0.7619906", "0.759819...
0.0
-1
Extract last update date of the feed.
def extract_last_update_dates(self, feed): parsed_feed = parse_feed(feed) if not parsed_feed: return [] dates = [ (publication.metadata.identifier, publication.metadata.modified) for publication in self._get_publications(parsed_feed) if publicati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated(self):\n try:\n date_ = parse(self._data.get('last_updated'))\n except (ValueError, TypeError):\n date_ = None\n return date_", "def last_update_datetime(self):\n return datetime.strptime(self.last_update, \"%Y-%m-%d %H:%M:%S.%f\")", "def last_...
[ "0.77001876", "0.76480556", "0.76480556", "0.753277", "0.74644876", "0.7432048", "0.7335139", "0.73054594", "0.7261835", "0.71180254", "0.7088244", "0.70380855", "0.7032516", "0.7032516", "0.70166045", "0.68682367", "0.6856677", "0.6833886", "0.68249315", "0.68172294", "0.678...
0.7326086
7
Computes backward for nonRR variant. To add DP noise at the aggregated gradient level, we compute the jacobians for dP/dW in plaintext so we can matrix multiply by dL/dP to compute our gradients without performing a full backward pass in crypten.
def backward(self, grad_output=None): # Compute dL/dP_j self.loss.backward(grad_output) dLdP = self.preds_enc.grad # Turn batched vector into batched matrix for matmul dLdP = dLdP.unsqueeze(-1) # Compute Jacobians wrt model weights if self.rank == self.feature_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, grad):\n self.grads[\"w\"] = np.matmul(self.input_data.T, grad)\n self.grads[\"b\"] = np.sum(grad, axis=0)\n return np.matmul(self.input_data.T, grad)", "def backward_pass(self, delta):\n\n a = config['learning_rate']\n y = config['momentum_gamma']\n m = config['m...
[ "0.6970008", "0.6916492", "0.68862534", "0.685825", "0.6854937", "0.6850125", "0.67625993", "0.67543894", "0.6737047", "0.67368484", "0.67368484", "0.6733833", "0.67323625", "0.67219424", "0.67216814", "0.6709214", "0.66822517", "0.6637459", "0.6635189", "0.6627113", "0.66051...
0.75247836
0
return the x that maximizes func_to_maximize(x)
def fmax(func_to_maximize, initial_guess=0): func_to_minimize = lambda x : -func_to_maximize(x) return fmin(func_to_minimize, initial_guess, disp=False)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fmax(func_to_maximize, initial_guess=0.5*V):\n func_to_minimize = lambda x : -func_to_maximize(x)\n return fmin(func_to_minimize, initial_guess, disp=False)[0]", "def maximize(self,x0,method='fmin',**kwargs):\n return self._optimize(x0,'max',method,**kwargs)", "def maximize_scalar(max_func, *a...
[ "0.7962692", "0.7630155", "0.7091616", "0.7006498", "0.69195586", "0.68324333", "0.6805818", "0.67932534", "0.678302", "0.6752092", "0.6752092", "0.67507684", "0.67263925", "0.67263925", "0.67211246", "0.6706114", "0.6700905", "0.66891325", "0.66891325", "0.66891325", "0.6689...
0.7858626
1
Get magnitude of vector of vals.
def mag(self): return np.linalg.norm(self._vals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(v):\n if len(v.arr) != 4 or v[3] != 0.0:\n raise ValueError(\"Only use this function with vectors.\")\n return np.sqrt(np.sum(np.square(v.arr)))", "def magnitude(v):\n\treturn math.sqrt(sum_squares(v))", "def magnitude(self): # @todo @caution check: something wrong?\n\n return...
[ "0.79733336", "0.78820896", "0.78795636", "0.7857294", "0.78371", "0.7760697", "0.77284783", "0.76199955", "0.7539248", "0.7483015", "0.7396681", "0.71666044", "0.7154449", "0.71068114", "0.7076321", "0.7071122", "0.7052283", "0.7007865", "0.69603544", "0.6828065", "0.6819392...
0.7602074
8
Mark this shape as invalid.
def invalidate(self): self.put_param('is_valid', False) self._vals = np.empty_like(self._vals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_invalid(self):\n self._is_valid = False", "def invalidate(self):\n self._valid = False", "def invalidate(self):\n self.valid = False", "def invalid(self):\n pass", "def is_invalid(self):\n return self._is_invalid", "def set_mask_bad(self, _=None):\n self.s...
[ "0.7259071", "0.6778752", "0.66314423", "0.63913274", "0.6332165", "0.6007666", "0.59878093", "0.5915958", "0.5834739", "0.5775123", "0.5711689", "0.55669105", "0.5565979", "0.55591786", "0.5558558", "0.5511357", "0.5486968", "0.5486968", "0.5484641", "0.54702103", "0.5457777...
0.6485822
3
Pads the 2nd and 3rd dimensions of a 4D tensor. Arguments
def spatial_reflection_2d_padding(x, padding=((1, 1), (1, 1)), data_format=None): assert len(padding) == 2 assert len(padding[0]) == 2 assert len(padding[1]) == 2 if data_format is None: data_format = image_data_format() if data_format not in {'channels_first', 'channels_last'}: rais...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_pad(input, size):\n M1 = tf.concat([input[:, :, -size[1]:, :], input, input[:, :, 0:size[1], :]], 2)\n M1 = tf.concat([M1[:, -size[0]:, :, :], M1, M1[:, 0:size[0], :, :]], 1)\n return M1", "def test_Pad3D4():\n input_shape = (1, 2, 3)\n # pad = np.array([1, 2]).astype('int32')\n pad = ...
[ "0.65624815", "0.64521575", "0.6313094", "0.6302155", "0.61607784", "0.61518085", "0.6137873", "0.6081061", "0.60715365", "0.6068361", "0.6050434", "0.6038186", "0.59996057", "0.59968114", "0.59693897", "0.5959567", "0.59569484", "0.59104216", "0.5890119", "0.5880264", "0.586...
0.0
-1
Deep residual network that keeps the size of the input throughout the whole network
def keepsize_256(nx, ny, noise, depth, activation='relu', n_filters=64, l2_reg=1e-7): def residual(inputs, n_filters): x = ReflectionPadding2D()(inputs) x = Conv2D(n_filters, (3, 3), padding='valid', kernel_initializer='he_normal', kernel_regularizer=l2(l2_reg))(x) x = BatchNormalization()(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual_net_old(total_depth, data_layer_params, num_classes = 1000, acclayer = True):\n # figure out network structure\n net_defs = {\n 18:([2, 2, 2, 2], \"standard\"),\n 34:([3, 4, 6, 3], \"standard\"),\n 50:([3, 4, 6, 3], \"bottleneck\"),\n 101:([3, 4, 23, 3], \"bottleneck\...
[ "0.6768489", "0.6738228", "0.6733045", "0.672238", "0.66824967", "0.66094655", "0.66067207", "0.6562009", "0.6499362", "0.64870167", "0.64614576", "0.6448761", "0.6444441", "0.63754195", "0.6353542", "0.63480204", "0.6308129", "0.6293664", "0.6290439", "0.62724763", "0.625667...
0.63224113
16
Deep residual network that keeps the size of the input throughout the whole network
def keepsize(nx, ny, noise, depth, activation='relu', n_filters=64, l2_reg=1e-7): def residual(inputs, n_filters): x = ReflectionPadding2D()(inputs) x = Conv2D(n_filters, (3, 3), padding='valid', kernel_initializer='he_normal', kernel_regularizer=l2(l2_reg))(x) x = BatchNormalization()(x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual_net_old(total_depth, data_layer_params, num_classes = 1000, acclayer = True):\n # figure out network structure\n net_defs = {\n 18:([2, 2, 2, 2], \"standard\"),\n 34:([3, 4, 6, 3], \"standard\"),\n 50:([3, 4, 6, 3], \"bottleneck\"),\n 101:([3, 4, 23, 3], \"bottleneck\...
[ "0.6767628", "0.6736358", "0.6731723", "0.6720954", "0.668095", "0.6608586", "0.66054994", "0.65600204", "0.649759", "0.6485263", "0.6460005", "0.6446854", "0.63735837", "0.6351682", "0.63466704", "0.6321339", "0.6306857", "0.6293093", "0.6289098", "0.6271157", "0.62557244", ...
0.64436793
12
Function called to yield infinity values
def gaussian_gen(ngaussian, nd, batchSize, seed, random=True): torch.manual_seed(seed) np.random.seed(seed) means, covars, weights = get_means_covars(nd, ngaussian, random) while True: # yield multi_normal.sample((batchSize,)) yield mm_gaussian(batchSize, means, covars, weights) / 1.414
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inf(self):\n return self._inf", "def isinf(x):\n return False", "def isInfinity(self):\n return _libsbml.ASTNode_isInfinity(self)", "def test_finite(self):\n \n Number_of_tests = 1000\n low = -1000\n high = 1000\n for i in range(Number_of_tests):\n ...
[ "0.70010513", "0.67467743", "0.64016175", "0.6399817", "0.6257279", "0.6242452", "0.6239584", "0.61958534", "0.61625093", "0.6138919", "0.60927635", "0.60840786", "0.6071748", "0.60268927", "0.5992874", "0.59848684", "0.5984134", "0.5983123", "0.5965083", "0.5963781", "0.5952...
0.0
-1
CNN decoder/generator. The decoder and generator share structure but do NOT share weights.
def _construct_imggen(self): z = Input(shape=(self.latent_dim,)) z0 = Dense(512)(z) deconv_block = deconvnet(z0, self.img_dim, self.dec_param, activation='elu') gen_img = bn_deconv_layer(deconv_block, self.img_dim[-1], 4, 2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _define_decoder(self):\n self.decoder = nn.Sequential(nn.Linear(self.encoding_shape, 256), # B, 256\n View((-1, 256, 1, 1)), # B, 256, 1, 1\n nn.SELU(),\n nn.ConvTranspose2d(256, 64, 4), # B, 64, 4, 4\n ...
[ "0.7206008", "0.71508485", "0.71273273", "0.6971922", "0.68378264", "0.68174624", "0.6812688", "0.67076015", "0.66787344", "0.66634446", "0.66583514", "0.66252285", "0.6601838", "0.65112734", "0.64766896", "0.6455989", "0.6427302", "0.6393366", "0.63924026", "0.638524", "0.63...
0.6323735
25
Converts an array to a dictionary where the keys are the unique values of the array and the values of the dictionary are the counts of the array values.
def array_to_dict(arr: np.ndarray, domain: Optional[np.ndarray] = None) -> DictStrNum: if domain is None: keys, counts = np.unique(numpy_array(arr), return_counts=True) out_dict = dict(zip(keys, counts)) else: out_dict = {} for d in np.unique(domain): arr_d = arr[dom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_values(array):\n unique, counts = np.unique(array, return_counts=True)\n return dict(zip(unique, counts))", "def get_frequency(arr):\n freq = {}\n for i in arr:\n if(i not in freq):\n freq[i] = 0\n freq[i] += 1\n \n return freq", "def countDistinctValues(arr...
[ "0.89248556", "0.7449299", "0.71260923", "0.6676585", "0.6545737", "0.6545737", "0.6507824", "0.6477577", "0.6470422", "0.6436173", "0.63506824", "0.6278666", "0.62399644", "0.6225525", "0.6188995", "0.616392", "0.614693", "0.6102614", "0.6102614", "0.6102614", "0.61001486", ...
0.73490715
2
Returns a pandas dataframe from an np.ndarray.
def dataframe_to_array(df: pd.DataFrame) -> np.ndarray: if isinstance(df, pd.Series): x_array = df elif isinstance(df, pd.DataFrame): nb_vars = df.shape[1] varlist = df.columns x_array = df[varlist[0]] if nb_vars > 1: for k in range(1, nb_vars): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_nparray_to_df(nparray: np.ndarray) -> pd.DataFrame:\n return pd.DataFrame(data=nparray[1:, 1:],\n index=nparray[1:, 0],\n columns=nparray[0, 1:])", "def array_to_dataframe(\n array: np.ndarray, column: str, df=None\n) -> pd.DataFrame:\n if len(array...
[ "0.78699064", "0.72545624", "0.7138105", "0.6782471", "0.67686117", "0.67605376", "0.67503375", "0.67126673", "0.66977376", "0.6645288", "0.64414436", "0.6349555", "0.631757", "0.62937325", "0.6229855", "0.6229431", "0.622892", "0.61983275", "0.6187557", "0.6174216", "0.61415...
0.5627644
54
concatenate the elements into one string using '_' to separate the elements
def concatenate_series_to_str(row: Series) -> str: return "__by__".join([str(c) for c in row])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def underscore_join(iterable):\n iterable_as_str = [str(x) for x in iterable]\n return \"__\".join(iterable_as_str)", "def __str__(self):\n s = \"\"\n for i in self.__buckets:\n temp =\"\"\n while len(temp) + len(str(self.__buckets.index(i))) < 5:\n temp +...
[ "0.6966551", "0.61711633", "0.6166975", "0.615568", "0.6115176", "0.61047894", "0.6042642", "0.60422957", "0.5986461", "0.598433", "0.597992", "0.5973854", "0.5956953", "0.5956701", "0.59478855", "0.5934739", "0.59215224", "0.5902794", "0.58995086", "0.5858611", "0.58282655",...
0.0
-1
plot colorbar at right side of figure Parameter
def Colorbar( x=np.linspace(0,1,2), label=None, labelsize=16, cmap=rainbow, ax=None ): sm = plt.cm.ScalarMappable( cmap=cmap, norm=plt.Normalize(vmin=x.min(), vmax=x.max() ) ) sm._A = [] cb = plt.colorbar(sm, ax=ax ) cb.ax.tick_params( labelsize=labelsize ) if label is not None: cb.set_label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotColorbar(self):\n self.removeColorbar()\n\n # X Y W H\n self._colorbarax = self.figure.add_axes([0.02,-0.06,0.97,0.05])\n\n mx = self.images[0].get_clim()[1]\n mn = self.images[0].get_clim()[0]\n dm = (mx-mn)\n ...
[ "0.749574", "0.7169532", "0.70763147", "0.70763147", "0.700854", "0.7002504", "0.69325566", "0.6875021", "0.6815529", "0.68081844", "0.67718804", "0.67387694", "0.6658428", "0.6623425", "0.66152734", "0.6580841", "0.6534335", "0.65201414", "0.65022624", "0.6493753", "0.648960...
0.5739965
51
transforms coordinate x in (logarithmic) plot to normal coordinates (0,1)
def coord2normal(x=10.**np.arange(2), lim=(1,10), log=False): if log: return (np.log10(x) - np.log10(lim[0]))/(np.log10(lim[1]) - np.log10(lim[0])) else: return ( x - lim[0] )/( lim[1] - lim[0] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manual_log_like_normal(x, data):\n return np.sum(-np.log(x[1] * np.sqrt(2 * np.pi))-((data-x[0])**2) / (2*x[1]**2))", "def lognormalize(x, temp = 1):\n if type(x) is list: x = np.array(x)\n\n x = x - np.max(x)\n # anneal\n xp = np.power(np.exp(x), temp)\n return xp / xp.sum()", "def logno...
[ "0.7158857", "0.6851452", "0.68302536", "0.6545996", "0.6466075", "0.6381265", "0.63785356", "0.63651615", "0.63540757", "0.63283825", "0.6302705", "0.6288508", "0.61921245", "0.61496204", "0.61307716", "0.6102851", "0.6072035", "0.6043719", "0.6043362", "0.6019191", "0.60123...
0.72985995
0
A region growing algorithm that segments an image into 1 or 0 (True or False). Finds candidate pixels with a Mooreneighborhood (8connectedness). Uses pixel intensity thresholding with the threshold T as the homogeneity criteria. The function takes in a grayscale image and outputs a boolean image
def region_growing(im: np.ndarray, seed_points: list, T: int) -> np.ndarray: ### START YOUR CODE HERE ### (You can change anything inside this block) # You can also define other helper functions segmented = np.zeros_like(im).astype(bool) (H, W) = im.shape for seed_row, seed_col in seed_points: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_white_regions(gray_image):\n\n # First find a mask for regions that have brightness above 225\n white_pixels = gray_image > 225\n thresh_image = gray_image.copy()\n\n # Then do binary erosion (to rid noise), then dilation (to get original shape)\n struct1 = np.ones((11, 11), dtype=bool)\n ...
[ "0.6648838", "0.6528868", "0.6497201", "0.636656", "0.63582313", "0.6329394", "0.63284475", "0.6303414", "0.62921554", "0.6267438", "0.6246574", "0.61579883", "0.61394924", "0.6121879", "0.6101839", "0.60713077", "0.6070972", "0.60701895", "0.6065168", "0.606511", "0.60620165...
0.65259963
2
Convert absolute path /path/to/subjectid/filename.jpg from training or testing set to (subjectid, filename.jpg)
def split(self, f): x = os.path.split(f) subjectid = os.path.split(x[-2])[-1] imagefile = x[-1] return (subjectid, imagefile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_path_from_index(self, index):\n assert self.annotation_set is not None, \"Dataset not initialized\"\n name = self.annotation_set[index] # e.g. 'set00_V010_img00577.xml'\n set_name, video_name, xml_name = name.split('_')\n img_name = os.path.splitext(xml_name)[0] + self.exten...
[ "0.5831769", "0.58125955", "0.5653647", "0.56217664", "0.5571454", "0.55606234", "0.55241346", "0.54663604", "0.5466117", "0.54354864", "0.54273474", "0.5400047", "0.53771037", "0.53575927", "0.5352666", "0.5318393", "0.531668", "0.52961636", "0.52874875", "0.52785796", "0.52...
0.6010791
0
Stop the running thread.
def stop(self): self._running = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._Thread__stop()", "def stop_thread(self):\n t, e = self.workers[0]\n e = e.set() # put event to set True for stop thread\n del self.workers[0]", "def stop(self):\n\n self.stop_thread = True", "def stop_thread(self):\n self.running = False\n ...
[ "0.8653167", "0.85674006", "0.85290724", "0.85144085", "0.84777534", "0.8382715", "0.83336055", "0.82675606", "0.82675606", "0.82533085", "0.8154228", "0.81216735", "0.8100501", "0.8072615", "0.7981251", "0.791498", "0.78865296", "0.7861274", "0.7845408", "0.7825679", "0.7737...
0.77421194
21
Assert that an epistasis map has been attached to the object.
def assert_epistasis(method): @wraps(method) def wrapper(self, *args, **kwargs): if hasattr(self, "epistasis") is False: raise AttributeError( self.__name__ + " does not an epistasis attribute set yet.") return method(self, *args, **kwargs) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testInit(self):\n map_state = MapState(self.event_manager)\n self.assertEqual(map_state.event_manager, self.event_manager)\n self.assertTrue(map_state in self.event_manager.listener_groups[\"default\"].listeners)\n self.assertEqual(map_state.occupied_sectors_by_actor_id, {})\n ...
[ "0.67093813", "0.6680857", "0.6568067", "0.64757395", "0.6331405", "0.6327125", "0.62741727", "0.622787", "0.6161713", "0.61279076", "0.60807395", "0.6067799", "0.60482365", "0.5974958", "0.59296227", "0.5889716", "0.5882609", "0.587864", "0.5870775", "0.585268", "0.5829963",...
0.0
-1
Get the interaction sites, which describe the position of interacting mutations in the genotypes. (type==list of lists, see self._build_interaction_sites)
def sites(self): return self.data.sites.values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutations_site(self):\n return self._mutations_site", "def sites(self):\n struc = self.structure\n pots = self.potentials\n shapes = self.shapes\n\n _, new_pots = self._check_for_CPA(struc, pots)\n site_list = []\n for j in range(len(struc.sites)):\n ...
[ "0.6117244", "0.5913571", "0.5833864", "0.5715718", "0.5715718", "0.56310034", "0.5546764", "0.5546764", "0.5472598", "0.5448355", "0.5445003", "0.5386059", "0.5356822", "0.53503424", "0.5298942", "0.52713543", "0.5260005", "0.52521837", "0.52521837", "0.52521837", "0.5252183...
0.5638787
5
Get values of epistasis for this order.
def values(self): return pd.Series([self._epistasismap.values[int(i)] for i in self.index], index=self.index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigs(self) -> ndarray:\n return self._vals", "def energies(self) -> np.ndarray:\n return np.array([item.energy for item in self])", "def get(self) -> list:\n return self.__expedition", "def get_econs(self):\n eham = self.beads.vpath*self.nm.omegan2 + self.nm.kin + self.forces....
[ "0.6268965", "0.6199211", "0.61650383", "0.61168075", "0.59955007", "0.5995458", "0.59907025", "0.59725106", "0.59725106", "0.5964771", "0.5945267", "0.59204537", "0.5899703", "0.5899703", "0.5899703", "0.5899703", "0.5899703", "0.5899703", "0.5899703", "0.5899703", "0.589970...
0.64559925
0
Returns the data loader instances.
def loader(self, *args, **kwargs): raise NotImplementedError('Cannot instantiate builder base class.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_loaders(opt):\n return find_dataloader_using_name(opt.dataloader)(opt).load_data()", "def getLoaders(self):\n return self.__loaders;", "def get_loaders(opt):\n train_samples, val_samples = get_train_val_metadata(opt.dataset_dir,\n ...
[ "0.75714076", "0.7300755", "0.71798676", "0.7112", "0.7099917", "0.7074906", "0.69264084", "0.6879703", "0.68365645", "0.68313015", "0.68021345", "0.6778962", "0.67704165", "0.66791403", "0.66599554", "0.66568524", "0.66507107", "0.6475691", "0.64735866", "0.645358", "0.64487...
0.0
-1
Return the `torch.device` of the underlying _tensor
def device(self): return self._tensor.device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_of(self, tensor):\n if not tensor.is_cuda:\n return -1\n else:\n return tensor.get_device()", "def get_device_of(tensor: torch.Tensor) -> int:\n if not tensor.is_cuda:\n return -1\n else:\n return tensor.get_device()", "def device(self) -> ...
[ "0.8348275", "0.8312146", "0.81307304", "0.8096191", "0.8003568", "0.79552615", "0.7767073", "0.7348998", "0.733598", "0.731159", "0.7125601", "0.7048999", "0.70297587", "0.6993523", "0.6993523", "0.6993523", "0.6993523", "0.69732535", "0.6937544", "0.6932813", "0.6932813", ...
0.873298
0
Call `torch.Tensor.cpu` on the underlying _tensor
def cpu(self, *args, **kwargs): self._tensor = self._tensor.cpu(*args, **kwargs) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cpu(self):\n self.reader.model.cpu()\n self.reader.device = torch.device(\"cpu\")\n return self", "def cpu(self) -> 'BatchEmbedder':\n self.is_cuda = False\n self.embedding_layer = self.embedding_layer.cpu()\n\n return self", "def real_decorator(f):\n\n def ...
[ "0.6934779", "0.64128035", "0.63429075", "0.6267908", "0.6142139", "0.6120939", "0.6092133", "0.6092133", "0.6003289", "0.5993718", "0.599073", "0.5953026", "0.5951446", "0.5916105", "0.5905498", "0.5904258", "0.58447707", "0.58288544", "0.5758235", "0.5755395", "0.57124424",...
0.80193657
0
Sets _tensor to value
def share(self, value): self._tensor = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTensor(self, tensor):\t\t\n\t\tself.cur_tensor = tensor\n\t\tif tensor is not None:\n\t\t\tself.output_shape[self.cur_id] = self.cur_tensor.size()\n\t\telse:\n\t\t\tself.output_shape[self.cur_id] = None", "def set_value(self, indices, val):\r\n assert len(indices) == 3, indices\r\n if self.m...
[ "0.7578433", "0.7097178", "0.6623086", "0.6623086", "0.6621659", "0.6507399", "0.6393577", "0.62958485", "0.6238598", "0.6224495", "0.62218827", "0.620224", "0.6188264", "0.61602795", "0.6145944", "0.61412245", "0.6098351", "0.6061075", "0.60399836", "0.60399836", "0.60399836...
0.7284344
1
Left shift elements by `value` bits
def lshift_(self, value): assert isinstance(value, int), "lshift must take an integer argument." self.share <<= value return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lshift(self, value):\n return self.clone().lshift_(value)", "def leftshift(x, c):\n return x << c", "def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n", "def rshift(self, value):\n return self.clone().rshift_(value)", "def put_bits( self, value, count ):\n for ...
[ "0.68518436", "0.6542997", "0.6438628", "0.6392415", "0.6372943", "0.6365438", "0.6303218", "0.6223463", "0.6209978", "0.6209978", "0.61686194", "0.61491114", "0.6113452", "0.60584104", "0.5955886", "0.59530956", "0.5951536", "0.5934746", "0.59234434", "0.5899526", "0.5891045...
0.64527094
2
Left shift elements by `value` bits
def lshift(self, value): return self.clone().lshift_(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leftshift(x, c):\n return x << c", "def lshift_(self, value):\n assert isinstance(value, int), \"lshift must take an integer argument.\"\n self.share <<= value\n return self", "def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n", "def rshift(self, value):\n ...
[ "0.6542997", "0.64527094", "0.6438628", "0.6392415", "0.6372943", "0.6365438", "0.6303218", "0.6223463", "0.6209978", "0.6209978", "0.61686194", "0.61491114", "0.6113452", "0.60584104", "0.5955886", "0.59530956", "0.5951536", "0.5934746", "0.59234434", "0.5899526", "0.5891045...
0.68518436
0
Right shift elements by `value` bits
def rshift_(self, value): assert isinstance(value, int), "rshift must take an integer argument." self.share >>= value return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rshift(self, value):\n return self.clone().rshift_(value)", "def rshift(val, n):\n return (val % 0x100000000) >> n", "def rshift(val, n):\n return (val % 0x100000000) >> n", "def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n", "def shift_right(n, b):\n return (n >> b),...
[ "0.69315296", "0.6573621", "0.6573621", "0.65356946", "0.64921165", "0.64855665", "0.64517313", "0.6396309", "0.6328009", "0.62743306", "0.61639845", "0.61424094", "0.6067356", "0.60652095", "0.6060556", "0.6056955", "0.6054523", "0.5849036", "0.5844404", "0.5841907", "0.5837...
0.6530826
4
Right shift elements by `value` bits
def rshift(self, value): return self.clone().rshift_(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rshift(val, n):\n return (val % 0x100000000) >> n", "def rshift(val, n):\n return (val % 0x100000000) >> n", "def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n", "def rshift_(self, value):\n assert isinstance(value, int), \"rshift must take an integer argument.\"\n s...
[ "0.6573621", "0.6573621", "0.65356946", "0.6530826", "0.64921165", "0.64855665", "0.64517313", "0.6396309", "0.6328009", "0.62743306", "0.61639845", "0.61424094", "0.6067356", "0.60652095", "0.6060556", "0.6056955", "0.6054523", "0.5849036", "0.5844404", "0.5841907", "0.58372...
0.69315296
0
Get the line region dict for each line.
def _get_line_regions_from_xml_file(filename: str) -> List[Dict[str, int]]: xml_root_element = ElementTree.parse(filename).getroot() # nosec xml_line_elements = xml_root_element.findall("handwritten-part/line") return [_get_line_region_from_xml_element(el) for el in xml_line_elements]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_regions_by_id(self):\n return {filename.stem: _get_line_regions_from_xml_file(filename) for filename in self.xml_filenames}", "def regions_dict(self):\n regions_dict = dict()\n for i, r in enumerate(self.regions):\n regions_dict[getattr(r, 'ix', i)] = r\n return re...
[ "0.70158386", "0.6421456", "0.63309693", "0.619648", "0.60884124", "0.5891488", "0.5763282", "0.57407", "0.57302594", "0.57297075", "0.56778985", "0.56590027", "0.5658479", "0.5647949", "0.56363666", "0.5622103", "0.56175864", "0.55809015", "0.55723345", "0.5570605", "0.55659...
0.6620557
1
App factory for building Flask application.
def create_app(config_class): # create a Flask application instance app = Flask(__name__) # load configs app.config.from_object(config_class) register_extensions(app) register_blueprints(app) register_error_handlers(app) register_shell_context(app) register_middleware(app) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n return create_app()", "def app():\n app = create_app()\n return app", "def make_app(*args, **kwargs):\n app = Flask(*args, **kwargs)\n Roots(app)\n return app", "def create_app():\n app = Flask(__name__)\n app.config.from_object('app.configs.config')\n app.config.from_...
[ "0.8549126", "0.8463535", "0.84536344", "0.8342451", "0.8264886", "0.82308614", "0.8230643", "0.8170857", "0.8167631", "0.8156028", "0.81398064", "0.8135127", "0.813193", "0.8101652", "0.80684495", "0.8061752", "0.80548096", "0.80447024", "0.80312735", "0.8019222", "0.8013856...
0.7678542
65
Implementation of the gelu activation function.
def gelu(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out", "def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out", "def gelu(x):\n return f_...
[ "0.8188278", "0.8188278", "0.78067553", "0.7555482", "0.752499", "0.7476213", "0.7370755", "0.72336054", "0.72119874", "0.7206583", "0.7196593", "0.7191645", "0.7171082", "0.71561706", "0.6966983", "0.69553304", "0.6948997", "0.6794286", "0.6787408", "0.67737466", "0.67737466...
0.6968394
18
Test that a good event sent invokes the proper response
def test_get_player(player: dict, dynamodb_config: boto3.resource) -> None: # Arrange - get entries from local mock database db_entry = dynamodb_config.get_item(Key={"playerId": "player_hash"}) db_item = db_entry["Item"] del db_item["playerId"] player_from_db = json.loads(json.dumps(db_item, indent=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_future_event(self):\n pass", "def test_send_event_raises():\n send_event('pytest-reportportal', '5.0.5')", "def test_process_packet_event(self):\n pkt = {'type': 'event',\n 'name': 'woot',\n 'endpoint': '',\n 'args': []}\n self.ns.proce...
[ "0.7402743", "0.7136129", "0.69827765", "0.69078034", "0.6830739", "0.68299234", "0.6826386", "0.68213016", "0.6801919", "0.6771055", "0.6766006", "0.66969526", "0.6694061", "0.6684677", "0.66784155", "0.66767514", "0.6645449", "0.6618545", "0.66121304", "0.66070056", "0.6581...
0.0
-1
Test that a good event sent invokes the proper response
def test_update_player(player: dict, dynamodb_config: boto3.resource) -> None: # Arrange - get entries from local mock database original_db_entry = dynamodb_config.get_item(Key={"playerId": "player_hash"}) db_item = original_db_entry["Item"] del db_item["playerId"] original_player_from_db = json.loa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_future_event(self):\n pass", "def test_send_event_raises():\n send_event('pytest-reportportal', '5.0.5')", "def test_process_packet_event(self):\n pkt = {'type': 'event',\n 'name': 'woot',\n 'endpoint': '',\n 'args': []}\n self.ns.proce...
[ "0.7403487", "0.71379566", "0.69837296", "0.6908161", "0.68312675", "0.6829278", "0.6826694", "0.68211216", "0.6802976", "0.6771255", "0.6766258", "0.6697938", "0.66941905", "0.66858655", "0.66788304", "0.6677773", "0.6645063", "0.6619055", "0.6612512", "0.66082674", "0.65814...
0.0
-1
Test that a reset request loads the default players and resets the database
def test_reset_characters( mock_event: dict, player: dict, dynamodb_config: boto3.resource ) -> None: # Arrange expected_player = Player(**player) expected_message = [] expected_action_results = json.dumps( {"Player": asdict(expected_player), "message": expected_message} ) expecte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reset(self):\n p1 = self.player()\n p1.reset()\n self.assertEqual(p1.history, [])\n self.assertEqual(p1.genome[0], C)", "def reset_players(self):\n self.dealer.reset()\n for player in self.players:\n player.reset()\n if player.bank <= 500:\...
[ "0.6801958", "0.6713001", "0.6603796", "0.6555105", "0.6279801", "0.61970437", "0.61538655", "0.6131918", "0.6131918", "0.6127127", "0.61219275", "0.61219275", "0.61219275", "0.61096805", "0.6039118", "0.60343486", "0.59959537", "0.59619063", "0.5943461", "0.5921066", "0.5918...
0.0
-1
Compute the ratio of correctly predicted labels
def accuracy(predicted_logits, reference, argmax=True): if argmax: labels = torch.argmax(predicted_logits, 1) else: labels = predicted_logits correct_predictions = labels.int().eq(reference.int()) return correct_predictions.sum().float() / correct_predictions.nelement()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_accuracies(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (num_correct / preds.size(0)) * 100.0", "def error_rate(predictions, labels):\n return 100.0 - (100*(np.sum(predictions == labels)/float(predictions.shape[0]*predictions.shape[1])))", "def label_errors(preds, ...
[ "0.7995726", "0.76690084", "0.7450171", "0.7354051", "0.733454", "0.731772", "0.7313846", "0.72970223", "0.72789013", "0.7260852", "0.72587603", "0.7215984", "0.7208392", "0.7199179", "0.71807873", "0.7153107", "0.7117906", "0.7084799", "0.7050968", "0.70460194", "0.7039464",...
0.0
-1
Convert examples into lists of indices for keras
def load_for_keras(self, maxlen=float('inf')): labels = [] # int labels examples = [] # examples as int sequences # document number -> label mapping doc2label = n2b2.map_patients_to_labels( self.xml_dir, self.category) # load examples and labels for f in os.listdir(self.cui_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode_to_indices(self, decoder_outputs):\n decoded_indices = []\n batch_size = decoder_outputs.size(1)\n decoder_outputs = decoder_outputs.transpose(0, 1) # S = B x T x V\n\n for b in range(batch_size):\n top_ids = self._decode_to_index(decoder_outputs[b])\n ...
[ "0.640343", "0.6295498", "0.61954474", "0.61627024", "0.6161168", "0.61566395", "0.6152394", "0.61512464", "0.6116965", "0.6080224", "0.6014332", "0.60005325", "0.5995201", "0.598393", "0.5968006", "0.59289", "0.5907594", "0.5881412", "0.58744806", "0.58731973", "0.5870468", ...
0.0
-1
Simple function to translate an XML expression into a dict.
def etree_to_dict(t): d = {t.tag: {} if t.attrib else None} children = list(t) if children: dd = defaultdict(list) for dc in map(etree_to_dict, children): for k, v in dc.items(): dd[k].append(v) d = {t.tag: {k: v[0] if len(v) == 1 else v ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parser_to_dict(self):\n xml = \"\"\"\\\n<foo>\n <bar>baz</bar>\n <quz>\n <wow>works!</wow>\n </quz>\n</foo>\n\"\"\"\n d = x.to_dict(xml, {})\n assert d.bar.text_ == u'baz'\n assert d.quz.wow.text_ == u'works!'", "def xml2dict( xml, sanitize=True, prefix=None):...
[ "0.65882015", "0.6338955", "0.61601275", "0.60219425", "0.5993536", "0.59749836", "0.59266824", "0.5921898", "0.5909809", "0.586965", "0.5741346", "0.57281744", "0.5588443", "0.5546211", "0.5517917", "0.547245", "0.5456146", "0.5441758", "0.539709", "0.5339319", "0.53270096",...
0.5170694
33
Calculates the Intersection over Union (IoU) between a box and k clusters.
def iou(box, clusters): x = numpy.minimum(clusters[:, 0], box[0]) y = numpy.minimum(clusters[:, 1], box[1]) if numpy.count_nonzero(x == 0) > 0 or numpy.count_nonzero(y == 0) > 0: raise ValueError("Box has no area") intersection = x * y box_area = box[0] * box[1] cluster_area = clusters[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_iou(box, boxes):\n\n x_min_A, y_min_A, x_max_A, y_max_A = box[:4]\n x_min_B, y_min_B = boxes[:, 0], boxes[:, 1]\n x_max_B, y_max_B = boxes[:, 2], boxes[:, 3]\n # calculating the intersection\n inner_x_min = np.maximum(x_min_B, x_min_A)\n inner_y_min = np.maximum(y_min_B, y_min_A)\n ...
[ "0.7077763", "0.68575484", "0.68108857", "0.67965525", "0.67381185", "0.67381185", "0.6716572", "0.6683665", "0.66698164", "0.66698164", "0.66698164", "0.6601115", "0.6591887", "0.65869236", "0.652806", "0.65216523", "0.64589316", "0.6450983", "0.64346457", "0.639884", "0.637...
0.6813218
2
Tests initializations with integer weights.
def test_init_list_int(self): coefficients = [1, 3, 4, 5, 6, 7] constant = Constant((0, 1)) fd = FDataBasis(constant, np.array(coefficients).reshape(-1, 1)) lfd = LinearDifferentialOperator(weights=coefficients) self._assert_equal_weights( lfd.weights, list(fd), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights_(self):\n raise NotImplementedError", "def _initialize_weights(self):\n pass", "def test_node_weight_init(self):\n n = Node(value=2.0)\n self.assertEqual(n.weights, None)", "def setWeightInitializer(self,weights):\n self.init_w = weights", "def init_weigh...
[ "0.7286174", "0.72465867", "0.7134316", "0.70466727", "0.6963166", "0.6882427", "0.67630243", "0.6745406", "0.6742847", "0.67075074", "0.6664454", "0.6644224", "0.66403747", "0.66332436", "0.6623099", "0.6544797", "0.6536887", "0.6522665", "0.6512084", "0.64987385", "0.649235...
0.0
-1
Test initialization with functional weights.
def test_init_list_fdatabasis(self): n_basis = 4 n_weights = 6 monomial = Monomial(domain_range=(0, 1), n_basis=n_basis) weights = np.arange(n_basis * n_weights).reshape((n_weights, n_basis)) fd = FDataBasis(monomial, weights) fdlist = [FDataBasis(monomial, w) for w ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_default(self):\n lfd = LinearDifferentialOperator()\n weightfd = [FDataBasis(Constant(domain_range=(0, 1)), 0)]\n\n self._assert_equal_weights(\n lfd.weights, weightfd,\n \"Wrong list of weight functions of the linear operator\")", "def testInitializers(se...
[ "0.72097", "0.6998744", "0.6960517", "0.69309396", "0.6883185", "0.6856995", "0.68459207", "0.68438077", "0.680436", "0.6788351", "0.67861956", "0.66754067", "0.6646478", "0.66315967", "0.66262066", "0.6615866", "0.6594725", "0.65537935", "0.6525179", "0.6482201", "0.6459536"...
0.0
-1
Returns a Distribution that has been moved (xaxis) by the amount of delta.
def move(distribution, delta): # --->>> Copy your previous code here. new_center = distribution.offset + delta new_values = distribution.values new_distribution = Distribution(new_center,new_values) return new_distribution # Replace this by your own result.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dx(self):\n return self.xvalues[1] - self.xvalues[0]", "def moveX(self, delta):\n self.setX(delta + self.getX())", "def dx(self):\n values = self._interpolate_table(\"dx\")\n return values", "def x(self):\n self._sort_measurements()\n return self._distances*np.co...
[ "0.61023647", "0.55260706", "0.548395", "0.5421264", "0.54018706", "0.5388348", "0.53861815", "0.53861815", "0.53532666", "0.5327336", "0.5288723", "0.5257419", "0.5247919", "0.52236307", "0.5220182", "0.5215414", "0.52153325", "0.52153325", "0.52141535", "0.52130115", "0.520...
0.67842925
0
Convert a UTC timestamp string into EST timestamp
def get_est_time(date_str): utc_time = arrow.get(date_str, 'YYYY-MM-DD hh:mm:ss') est_time = utc_time - dt.timedelta(hours = 5) est_time = est_time.strftime(format='%Y-%m-%d %H:%M:%S') return est_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertToEST(timestamp):\n newDateTime = datetime.datetime.fromtimestamp(timestamp/1000)\n return newDateTime.date(), newDateTime.time()", "def gmt_aest(time_str: str) -> str:\n time = parse(time_str)\n aest = tzoffset(\"AEST\", 36000)\n if time.tzname() == \"GMT\" or time.tzname() == \"UTC\":...
[ "0.6824641", "0.6801831", "0.6503063", "0.64016306", "0.6247257", "0.61925924", "0.6099909", "0.6072565", "0.6072272", "0.60573786", "0.6029949", "0.60256696", "0.59924746", "0.5975666", "0.5958234", "0.5936993", "0.59057736", "0.5902081", "0.5899028", "0.5895258", "0.5847874...
0.63324285
4
Return true iff position (row, column) of the board is empty.
def check_empty_space(self, row, column): return self.board[row][column] == ' '
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self, row, column):\n\n return self.board[row][column] == placeholder", "def _position_is_empty_in_board(position, board):\n return board[position[0]][position[1]] == \"-\"", "def is_empty(self, row, col):\n return self._cells[row][col] != FULL", "def checkEmpty(grid):\n for ...
[ "0.84131616", "0.8182075", "0.81364846", "0.8103204", "0.7958075", "0.7859573", "0.7774968", "0.7767946", "0.77678543", "0.77624416", "0.77459276", "0.7731803", "0.76850975", "0.7681816", "0.76562315", "0.7614926", "0.75528437", "0.7510106", "0.7498234", "0.7489949", "0.74711...
0.7249961
40
Returns row NUM of the board as a list.
def return_row(self, num_row): result = [] for i in range(self.num_columns): result.append(self.board[num_row][i]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(self, row: int) -> list:\n index_start = row * 9\n return self.grid[index_start:index_start+9]", "def get_rows(self):\n rowlist = []\n if self.direction == \"horizontal\":\n rowlist.append(int(self.position[0][0]))\n return rowlist\n else:\n ...
[ "0.7048384", "0.694022", "0.6874586", "0.6711021", "0.66610074", "0.6441294", "0.6426471", "0.62375444", "0.5983917", "0.5983169", "0.59825635", "0.59611905", "0.5938515", "0.59217155", "0.5869636", "0.5858212", "0.5848944", "0.58403885", "0.5834972", "0.58007807", "0.5798489...
0.74783283
0
Returns a 3x3 subgrid of the board as a list.
def return_box(self, num): result = [] three = [0, 1, 2] for a in three: #row for b in three: #column result += [self.board[a+((num-1)//3)*3][b+(num%3-1)*3]] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_subgrid(self)->list:\n return [subgrid.Subgrid(i) for i in range(0, 9)]", "def make_grid(self):\n\n\t\tinit_grid = (self.grid_width//2, self.grid_height//2)\n\t\tgrid_list = []\n\n\t\tfor i in range(self.canv_width//self.grid_width):\n\t\t\tfor j in range(self.canv_height//self.grid_height):\n\...
[ "0.7727324", "0.7190092", "0.6812753", "0.67530864", "0.6719052", "0.66985005", "0.6634718", "0.6537218", "0.648752", "0.648445", "0.64716893", "0.6465094", "0.64459974", "0.64347833", "0.6421686", "0.6395544", "0.638574", "0.6338922", "0.63289416", "0.63184464", "0.6306059",...
0.63908315
16
this method checks if a specific box already has a specific number is the board object is the specific number being checked is the box number of the board in row major order, starting from 1 returns true if the box already has the number, false otherwise
def check_box(self, num, box_num): box = self.return_box(box_num) for board_num in box: if num == board_num: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isvalid(board, num, cell):\r\n x, y = cell\r\n row = board[x]\r\n col = transpose(board)[y]\r\n\r\n # check row if num already present\r\n if any(row[i] == num for i in range(9)):\r\n return False\r\n # check col if num already present\r\n if any(col[i] == num for i in range(9)):\r\...
[ "0.68536633", "0.6844319", "0.6729375", "0.6608213", "0.65997434", "0.6557797", "0.65491015", "0.65285784", "0.6495359", "0.63818514", "0.6363351", "0.63407", "0.6319933", "0.6316111", "0.6308907", "0.6290736", "0.6287277", "0.6265746", "0.6264202", "0.6251836", "0.6232412", ...
0.7722514
0
Given 2 lists, check if the items in both the lists are same, regardless of order.
def list_unordered_equal(list1: List[Any], list2: List[Any]) -> bool: list1 = list(list1) # make a mutable copy try: for elem in list2: list1.remove(elem) except ValueError: return False return not list1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_same(lst1, lst2):\n return len(lst1) == len(lst2) and all([x == y for x, y in zip(lst1, lst2)])", "def lists_are_identical(list1, list2):\n if len(list1) != len(list2):\n return False\n for elem1, elem2 in zip(list1, list2):\n if elem1 != elem2:\n return False\n retu...
[ "0.83267015", "0.83095753", "0.81171745", "0.7997169", "0.7842988", "0.7818377", "0.77905387", "0.7731184", "0.77057356", "0.7693256", "0.76555645", "0.76429135", "0.76029575", "0.75828147", "0.75732386", "0.7569201", "0.7550397", "0.7546885", "0.7518027", "0.7418852", "0.736...
0.7374687
20
Test if models are equivalent except for last modified.
def models_are_equivalent(model_a: TopLevelOscalModel, model_b: TopLevelOscalModel) -> bool: # this will change the second model as a side-effect model_b.metadata.last_modified = model_a.metadata.last_modified return model_a == model_b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def original_modified(self):\n if self.modified > self.created:\n return True\n else:\n return False", "def test_save(self):\n first = self.test1.updated_at\n self.test1.save()\n last = self.test1.updated_at\n self.assertNotEqual(first, last)", "d...
[ "0.6941617", "0.66067153", "0.66011834", "0.6537357", "0.6519338", "0.6507159", "0.64628655", "0.6429964", "0.63670886", "0.63546515", "0.6342112", "0.6334731", "0.6327449", "0.63228166", "0.6283504", "0.6243668", "0.6183843", "0.61710185", "0.61476904", "0.6096115", "0.60754...
0.81963605
0
Returns the default collector settings
def get_default_config(self): config = super(PuppetAgentCollector, self).get_default_config() config.update({ 'yaml_path': '/var/lib/puppet/state/last_run_summary.yaml', 'path': 'puppetagent', }) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\r\n config = super(CMDCollector, self).get_default_config()\r\n config.update({\r\n 'enabled': 'True',\r\n 'fs': ',',\r\n 'timeout': 300,\r\n })\r\n return config", "def getDefaultSettings():\n return {}", "def ge...
[ "0.70514023", "0.7008024", "0.69490683", "0.6713433", "0.65743333", "0.65309024", "0.6521635", "0.6515402", "0.6466526", "0.6447688", "0.641337", "0.6397818", "0.63683224", "0.6357208", "0.63517016", "0.6331759", "0.63120294", "0.62353724", "0.6231899", "0.62074906", "0.62016...
0.6380512
12
Returns a list of all available RLlib models.
def models(): return list(alg2module.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_models():\n modelpath = os.path.join(os.path.dirname(__file__), \"train\", \"model\")\n models = sorted(item.name.replace(\".py\", \"\").replace(\"_\", \"-\")\n for item in os.scandir(modelpath)\n if not item.name.startswith(\"_\")\n ...
[ "0.7392179", "0.7366719", "0.73273015", "0.7213558", "0.7167951", "0.7153944", "0.70749456", "0.70749456", "0.70749456", "0.70749456", "0.70596087", "0.70125896", "0.70123786", "0.6991009", "0.6977222", "0.6905536", "0.68745065", "0.68412423", "0.68074715", "0.6799266", "0.67...
0.7106811
6
Return true if light is on.
def is_on(self) -> bool: return self.tuya_device.status.get(DPCODE_SWITCH, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light_is_on(self):\r\n return self._light == \"ON\"", "def light_is_on(self):\n return self._light == \"ON\"", "def is_on(self):\n return self._light_on", "def is_light(self) -> bool:\n return ATTRIBUTE.Light.value in self.type_data.attributes", "def is_light(self) -> bool:\...
[ "0.9035416", "0.89275813", "0.86664206", "0.8008696", "0.8008696", "0.78880787", "0.7866302", "0.7610281", "0.7565963", "0.7415077", "0.7345493", "0.7335999", "0.73116577", "0.7303292", "0.72991306", "0.7243393", "0.71792775", "0.71722543", "0.7157757", "0.7157757", "0.715775...
0.6703632
76
Instruct the light to turn off.
def turn_off(self, **kwargs: Any) -> None: if ( DPCODE_LIGHT in self.tuya_device.status and DPCODE_SWITCH not in self.tuya_device.status ): commands = [{"code": DPCODE_LIGHT, "value": False}] else: commands = [{"code": DPCODE_SWITCH, "value": False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light", "def set_light_off(self):\n self._light = \"OFF\"", "def set_light_off(self):\r\n self._light = \"OFF\"", "def lightning_turnoff(self):\n self.turnOff()", "def turn_off(self, **kwargs: Any) -> None:\n ...
[ "0.9141917", "0.89695406", "0.89557284", "0.89015293", "0.8897358", "0.8873913", "0.8805522", "0.87862444", "0.87764317", "0.86670524", "0.86476165", "0.847877", "0.8473624", "0.84669805", "0.8463841", "0.8435901", "0.8370482", "0.83494097", "0.8275936", "0.82717854", "0.8270...
0.7956067
31
Return color temperature max mireds.
def max_mireds(self) -> int: return MIREDS_MAX
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_temperature(self):\n mini, maxi = ct.c_int(), ct.c_int()\n self.lib.GetTemperatureRange(ct.pointer(mini), ct.pointer(maxi))\n return maxi.value", "def get_max_temp(self):\n self.max_temp = self.domain[1] * 2", "def max_temp(self):\n # return convert_temperature(\n ...
[ "0.7662461", "0.72063756", "0.71416074", "0.71353376", "0.7097931", "0.7094504", "0.7089688", "0.70032066", "0.69695574", "0.6927413", "0.6907269", "0.6888465", "0.6865402", "0.66748756", "0.66258407", "0.65967524", "0.65513724", "0.647426", "0.6466429", "0.6447747", "0.64276...
0.6195818
33
Create a nary mask with n entries (a list of bool with each nth entry True)
def n_ary_mask(d, n, offset): return [(i + offset) % n == 0 for i in range(d)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask_indices(n,mask_func,k=0):\r\n m = ones((n,n),int)\r\n a = mask_func(m,k)\r\n return where(a != 0)", "def maskgroup(x, n):\n # create running lists\n index = []\n length = []\n count = 0\n\n # count indices and lengths of unmasked data groups\n for i in range(x.mask.size):\n ...
[ "0.6913771", "0.6904119", "0.686404", "0.67553955", "0.666902", "0.648185", "0.6381701", "0.6375609", "0.6219823", "0.6201397", "0.6183773", "0.6118564", "0.60896724", "0.6085814", "0.6077635", "0.60493106", "0.6037468", "0.60312146", "0.6023112", "0.59993815", "0.5995904", ...
0.771768
0
Replaces any occurrence of . with
def filter_dash_period(self, string): newstring = string newer_string = newstring.replace("-.", "--") while newstring != newer_string: newer_string = newstring.replace("-.", "--") return newstring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_dot(data):\n data = re.sub(\"[.]\", \" . \", data)\n return data", "def handle_dots(string):\n if '.' in string:\n if string[-1] == '.':\n string = string[:-1]\n else:\n string = string.replace('.', '. ')\n\n return string", "def replace_dots(filename...
[ "0.7969245", "0.7339325", "0.7329618", "0.71263814", "0.7080538", "0.7038176", "0.6831846", "0.6729263", "0.67135686", "0.647264", "0.64201534", "0.63757753", "0.6249208", "0.6189796", "0.6167598", "0.60377914", "0.60210484", "0.6009021", "0.60048974", "0.59990454", "0.593714...
0.0
-1
Replaces any occurrence of . with
def filter_period_dash(self, string): newstring = string newer_string = newstring.replace(".-", "--") while newstring != newer_string: newer_string = newstring.replace(".-", "--") return newstring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_dot(data):\n data = re.sub(\"[.]\", \" . \", data)\n return data", "def handle_dots(string):\n if '.' in string:\n if string[-1] == '.':\n string = string[:-1]\n else:\n string = string.replace('.', '. ')\n\n return string", "def replace_dots(filename...
[ "0.7969245", "0.7339325", "0.7329618", "0.71263814", "0.7080538", "0.7038176", "0.6831846", "0.6729263", "0.67135686", "0.647264", "0.64201534", "0.63757753", "0.6249208", "0.6189796", "0.6167598", "0.60377914", "0.60210484", "0.6009021", "0.60048974", "0.59990454", "0.593714...
0.0
-1