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
gives a formatted timestamp, useful for longer analyses
def timestamp(): return datetime.now().strftime('%H:%M:%S %m-%d')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))", "def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n return time.strftime(\"%Y-%m-%d-%H-%M-%S-{}\".format(moment_us), time.gmtime(moment))", "def timestamp():\n return d...
[ "0.8038685", "0.80155486", "0.79429066", "0.7932328", "0.7925151", "0.78806007", "0.7856388", "0.78220636", "0.78073436", "0.7796272", "0.7789196", "0.77795273", "0.77354836", "0.7732207", "0.7729519", "0.76911116", "0.7683758", "0.76836175", "0.76213574", "0.7598116", "0.754...
0.7882292
5
Get the model name.
def model_name(self) -> str: return "mock-model-name"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_name(self) -> str:\n return self._model_name", "def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String)", "def get_model_name(self) -> str:\n raise NotImplementedError", "def model_name(self):\n setting = self.get_setting_definition...
[ "0.88881665", "0.883052", "0.87915975", "0.84520155", "0.8416848", "0.8376444", "0.83522457", "0.8329777", "0.82505643", "0.8224384", "0.81623787", "0.80150056", "0.7973438", "0.78287315", "0.77966535", "0.77646977", "0.7711224", "0.76936203", "0.76847035", "0.76512337", "0.7...
0.7388494
26
Get the device type.
def device_type(self) -> str: return "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_type(self):\n return self._meta['device_type']", "def device_type(self):\n return self._device_type", "def device_type(self):\n return Context.devtype2str[self.device_typeid]", "def device_type(self):\n return Context.devtype2str[self.device_typeid]", "def device_type...
[ "0.873117", "0.87166053", "0.86315507", "0.86315507", "0.8574871", "0.8475947", "0.8429184", "0.82709247", "0.82565933", "0.82565933", "0.82565933", "0.82303095", "0.8115598", "0.8061328", "0.8059209", "0.80492264", "0.7943201", "0.79121757", "0.78333235", "0.7829751", "0.782...
0.72745216
44
Takes a diagonal matrix converts it to it's full form
def calculate_square_form(diagonal_matrix, total_sorts): n = len(diagonal_matrix) matrix = np.ndarray(shape=(n,n)) for i in range(n): for j in range(len(diagonal_matrix[i])): # Also calculate the dissimilarity matrix matrix[i][j] = 100 - 100 * diagonal_matrix[i][j] / total_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal(matrix):\n if sp.sparse.issparse(matrix):\n diag = np.array(matrix.diagonal())\n else:\n diag = np.diagonal(matrix).copy()\n return diag", "def get_diagonal(matrix):\n\tdegree_vector = tf.reduce_sum(matrix, 1)\n\tdiagonal = tf.diag(degree_vector, name = 'diagonal')\n\treturn d...
[ "0.6925748", "0.67492604", "0.654779", "0.647712", "0.6455163", "0.6417544", "0.64102775", "0.6368405", "0.6294395", "0.6290919", "0.6213763", "0.61852396", "0.61554545", "0.61394686", "0.6138866", "0.607023", "0.60410553", "0.6021352", "0.6013913", "0.6009137", "0.60088104",...
0.553977
63
Renders the home page.
def home(): return render_template( 'index.html', title='Home Page', year=datetime.now().year, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.8061255
42
Renders the about page.
def about(): return render_template( 'about.html', title='About', year=datetime.now().year, message='Your application description page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85651284", "0.85034347", "0.844895", "0.84050864", "0.8394327", "0.82936406", "0.82678735", "0.82434386", "0.8239326", "0.8224289", "0.8208038", "0.820477", "0.81737614", "0.81729555", "0.8096616", "0.8050326", "0.8050326", "0.8050326", "0.8050326", "0.8050326", "0.8050326...
0.827099
17
Renders the about page.
def data(): return render_template( 'data.html', title='Data', year=datetime.now().year, img_tichonet = '/static/pics/tichonet.png', message='Your application description page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.0
-1
Renders the about page.
def nba(): form1 = ExpandForm() form2 = CollapseForm() df = pd.read_csv(path.join(path.dirname(__file__), 'static/Data/injuries_2010-2020.csv')) raw_data_table = '' if request.method == 'POST': if request.form['action'] == 'Expand' and form1.validate_on_submit(): raw_data_table ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.0
-1
Renders the about page.
def Gallery(): return render_template( 'Gallery.html', title='The to 8 NBA players right now', year=datetime.now().year, message='' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.0
-1
Create a gNMI GetRequest.
def _get(stub, paths, username, password): if username: # User/pass supplied for Authentication. return stub.Get( gnmi_pb2.GetRequest(path=[paths], encoding='JSON_IETF'), metadata=[('username', username), ('password', password)]) return stub.Get(gnmi_pb2.GetRequest(path=[paths], encoding='JSON_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createRequest(self):\n self.get_bmc_website()\n self.__createChangeRequest = Create(self.browser)\n self.__createChangeRequest.createNCR()", "def req():\n return Request()", "def newRequest(self):\n return Request( )", "def _get_request(url, params):\n request = requests...
[ "0.6275348", "0.6039188", "0.5644295", "0.5601162", "0.55611426", "0.5554668", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "0.55537415", "...
0.0
-1
VGG 19layer model (configuration "E")
def localizer_vggnet(pretrained=False, **kwargs): model = LocalizerVGG(make_layers(cfg['E']), **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['vgg19'])) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vgg():\n input_shape = (256, 256, 3)\n\n vgg = keras.applications.VGG19(include_top = False , input_shape = input_shape , weights=\"imagenet\")\n features = vgg.get_layer(index = 9).output\n\n model = keras.Model(inputs=[vgg.inputs], outputs=[features])\n return model", "def vgg19(pretr...
[ "0.7938028", "0.7352684", "0.7322909", "0.731347", "0.72912514", "0.72898996", "0.7235066", "0.72287446", "0.7197585", "0.71894604", "0.7084843", "0.707336", "0.7058049", "0.7026087", "0.7002693", "0.69967985", "0.69944525", "0.69195586", "0.6903537", "0.68565315", "0.6850008...
0.0
-1
Drop `None` valued keys from an object.
def _drop_nulls(o): if isinstance(o, (dict, Mapping)): return {k: _drop_nulls(v) for k, v in o.items() if v is not None} elif isinstance(o, list): return [_drop_nulls(v) for v in o if v is not None] elif isinstance(o, set): return {_drop_nulls(v) for v in o if v is not None} else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_none(obj: dict):\n return remap(\n obj, visit=lambda path, key, value: key is not None and value is not None\n )", "def remove_empty_fields(obj: dict) -> dict:\n return {k: v for k, v in obj.items() if v is not None}", "def strip_empty_optional_fields(object_dict):\n return {k: v ...
[ "0.82257617", "0.7622132", "0.7455038", "0.7318793", "0.7178498", "0.71008503", "0.6978789", "0.69149274", "0.68529075", "0.68520445", "0.6845486", "0.68321306", "0.6754147", "0.674078", "0.6731009", "0.671434", "0.6638371", "0.66069853", "0.6593238", "0.6582964", "0.653182",...
0.7540454
2
updates the learning rate using inverse time decay
def learning_rate(epoch): return alpha / (1 + decay_rate * epoch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def update_learning_rate(self...
[ "0.7914394", "0.7914394", "0.7600384", "0.7560176", "0.7499523", "0.74376434", "0.7421272", "0.74188656", "0.73709327", "0.7334627", "0.73209643", "0.7318579", "0.7294742", "0.7198275", "0.7148807", "0.71447504", "0.7119928", "0.70642436", "0.69671065", "0.68856674", "0.68773...
0.679231
28
Returns the ManagementForm instance for this FormSet.
def management_form(self): if self.is_bound: form = AttachmentManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix) if not form.is_valid(): raise ValidationError('ManagementForm data is missing or has been tampered with') else: form = Att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _management_form(self):\n if self.is_bound:\n form = ConcurrentManagementForm(self.data, auto_id=self.auto_id,\n prefix=self.prefix)\n if not form.is_valid():\n raise ValidationError('ManagementForm data is missing or has be...
[ "0.7361065", "0.6664403", "0.6664403", "0.6357645", "0.622903", "0.619828", "0.6129273", "0.6124485", "0.61211973", "0.6112333", "0.6099777", "0.60755575", "0.5937113", "0.58789", "0.5841554", "0.575287", "0.5716436", "0.56436545", "0.5578003", "0.555524", "0.55537564", "0....
0.7139378
1
Returns whether the scene contains an image pixmap.
def hasImage(self): return self._image is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasImage(self):\n if self.getImage():\n return True\n return False", "def has_image(self):\n return hasattr(self, \"_image\") and self._image is not None", "def hasPng(self):\n\t\tif self.isPng:\n\t\t\treturn True\n\t\treturn textureFile( self.path.replace( self.extension, '...
[ "0.7148394", "0.69063604", "0.6811348", "0.6708111", "0.6708111", "0.66627085", "0.63021797", "0.6208606", "0.61569035", "0.613535", "0.6075283", "0.6071318", "0.59205896", "0.59165484", "0.5906985", "0.58777034", "0.5860418", "0.581497", "0.5773688", "0.5759203", "0.57401556...
0.7086305
1
Removes the current image pixmap from the scene if it exists.
def clearImage(self): if self.hasImage(): self.scene.removeItem(self._image) self._image = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearImage(self):\n if self.hasImage():\n self.scene.removeItem(self._pixmapHandle)\n self._pixmapHandle = None\n self.zoom=-1\n self.scene.clear()", "def removeScene(self):\n del self.scene, self.imgPixmapItem", "def clean_all(self):\n self....
[ "0.79136795", "0.7713988", "0.67695427", "0.6741188", "0.6572793", "0.65437007", "0.64187896", "0.63136613", "0.61855835", "0.61837137", "0.61759114", "0.61759114", "0.61453015", "0.61429083", "0.6075483", "0.6035884", "0.6033798", "0.5917658", "0.59154296", "0.5910521", "0.5...
0.7800114
1
Returns the scene's current image pixmap as a QPixmap, or else None if no image exists.
def pixmap(self): if self.hasImage(): return self._image.pixmap() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixmap(self):\n if self.hasImage():\n return self._pixmapHandle.pixmap()\n return None", "def image(self):\n if self.hasImage():\n return self._pixmapHandle.pixmap().toImage()\n return None", "def image(self):\n if self.hasImage():\n retur...
[ "0.7835423", "0.75290245", "0.74141395", "0.67934173", "0.6428947", "0.61595285", "0.6098856", "0.58280176", "0.5742987", "0.5732158", "0.5682366", "0.56738436", "0.5643078", "0.56390196", "0.5633685", "0.5633685", "0.5633685", "0.56182927", "0.5591214", "0.5585604", "0.55093...
0.79953897
0
Returns the scene's current image pixmap as a QImage, or else None if no image exists.
def image(self): if self.hasImage(): return self._image.pixmap().toImage() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixmap(self):\n if self.hasImage():\n return self._image.pixmap()\n return None", "def image(self):\n if self.hasImage():\n return self._pixmapHandle.pixmap().toImage()\n return None", "def pixmap(self):\n if self.hasImage():\n return self...
[ "0.75357985", "0.7390828", "0.7325522", "0.63724256", "0.63046825", "0.60485345", "0.5909091", "0.58557355", "0.58035487", "0.5761733", "0.57425255", "0.5711291", "0.5696588", "0.5677836", "0.5676707", "0.5676707", "0.5676707", "0.5646885", "0.5624013", "0.5589218", "0.557353...
0.7408162
1
Returns the pString that results from iterating this lsystem. Computes it, if needed.
def getResultPString(self): # TODO: WARNING!!! Make sure the resultPstring is emptied if we do some modification to the lsystem!! OR THIS WILL BEHAVE INCORRECTLY! if self.resultPString == None: self.resultPString = self.iterate() return self.resultPString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildString( lsys, iter ):\n\tnstring = getBase(lsys)\n\trule = getRule(lsys, 0)\n\tsymbol = rule[0]\n\treplacement = rule[1]\n\tfor i in range(iter):\n\t\tnstring = nstring.replace( symbol, replacement )\n\treturn nstring", "def get_string(self):\n return (self.loop_level+1) * ' ' + ','.join(map(str,...
[ "0.6028617", "0.59457964", "0.58593225", "0.57503265", "0.57239276", "0.5717773", "0.5690348", "0.56889313", "0.56804085", "0.56782484", "0.5660313", "0.5655957", "0.56339836", "0.5624231", "0.5619703", "0.56152797", "0.56096286", "0.5604201", "0.5588711", "0.5579955", "0.553...
0.7823306
0
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.76044506", "0.74481285", "0.74049824", "0.7280345", "0.7208418", "0.71655464", "0.7157273", "0.7144908", "0.7144908", "0.7144908", "0.7144908", "0.7144908", "0.7144908", "0.7131389", "0.710048", "0.7065451", "0.7064196", "0.70623666", "0.70623666", "0.70623666", "0.7062366...
0.70967406
31
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.74888414", "0.7288112", "0.71588355", "0.7152657", "0.70652217", "0.69849795", "0.6964874", "0.69532984", "0.69120836", "0.6833932", "0.681686", "0.6808751", "0.68043625", "0.68043625", "0.68043625", "0.68043625", "0.68043625", "0.68043625", "0.6785024", "0.6756936", "0.67...
0.67543876
45
Adds a symbol to the set of symbols of the Machine. Sets the blank symbol only if it is not already set.
def _set_symbol(self, symbol, blank=False): self._symbols.add(symbol) try: assert self._blank_symbol == None or not blank if blank: self._blank_symbol = symbol except: raise Exception( f"Machine got blank symbol '{symbol}' whic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, symbol, value):\n if symbol in self.symbol_map:\n raise ValueError(f\"symbol {symbol} already exists in map.\")\n self.symbol_map[symbol] = value", "def add_symbol(self, symbol):\n self.symbols_list.append(symbol)\n self.symbols_list.sort()", "def addSymbol(...
[ "0.737178", "0.71844953", "0.6879582", "0.6751897", "0.6693627", "0.66602457", "0.66042966", "0.65442795", "0.6537731", "0.6475653", "0.6472118", "0.6463029", "0.63761586", "0.63514227", "0.6310761", "0.6297593", "0.62926525", "0.62787044", "0.622642", "0.62097865", "0.619931...
0.8360916
0
Adds a transition to the set of transitions of the Machine.
def _set_transition( self, current_state, current_symbol, next_symbol, direction, next_state ): self._set_symbol(current_symbol) self._set_symbol(next_symbol) self._set_state(current_state) self._set_state(next_state) if self._transitions.get(current_state) is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_transition(self, **kwargs):\n transition = {k: [v] for k, v in kwargs.items()}\n self.add_transitions(**transition)", "def addTransition(self,fromState, toState, testFunc):\n if not self.currentState:\n raise ValueError(\"StateMachine already Started - cannot add new trans...
[ "0.7282933", "0.7242774", "0.7242774", "0.69885457", "0.6903377", "0.68745124", "0.6802694", "0.67786336", "0.6741184", "0.6670267", "0.65890056", "0.65890056", "0.64939916", "0.6307099", "0.6150025", "0.6098735", "0.60669607", "0.60570806", "0.60542333", "0.6012345", "0.5991...
0.49933103
69
Renders basic application layout
def index(request): params = get_user_profile_params(request) competition = Competition.get_active() params['top_competition_id'] = competition.id params['minify_js'] = settings.MINIFY_JS params['first_page_text'] = '' config = Config.objects.all() if config.count() > 0: params['fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n return render_template(\"index.html\", title=\"Home\", heading=\"Dublin Bus\")", "def main():\n return render_template(\"main.html\")", "def main():\n return render_template(\"main.html\")", "def main_page():\n return render_template(\"index.html\")", "def index():\n return r...
[ "0.7066787", "0.6931911", "0.6931911", "0.6863343", "0.68569344", "0.6825769", "0.67722845", "0.6768591", "0.67603266", "0.6751819", "0.6751819", "0.6748155", "0.6736636", "0.67295665", "0.6681644", "0.6681644", "0.66804475", "0.66610783", "0.6634673", "0.6634673", "0.6634673...
0.0
-1
Return the current projects.
def get_projects(self): projects = [] for project in self.server.projects: projects.append({'id': utils.slugify(project), 'name': project}) response.content_type = 'application/json' return json.dumps(projects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n return conf.projects", "def projects(self):\r\n return p.Projects(self)", "def getProjects(self):\n\n return self.__projects", "def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/projects\").json()", "def get_projects(self):...
[ "0.8724896", "0.83391625", "0.8327239", "0.8324768", "0.8268606", "0.80907303", "0.80517626", "0.7972364", "0.7922078", "0.7869921", "0.7847794", "0.78318465", "0.7809198", "0.77894056", "0.7730232", "0.7721734", "0.76871973", "0.766436", "0.7609134", "0.7579387", "0.7574908"...
0.7339555
31
Return the list of states of this plugin.
def plugin_state(self, project_id, plugin_id): from geoffrey.data import datakey criteria = datakey(project=project_id, plugin=plugin_id) response.content_type = 'application/json' return utils.jsonencoder.encode( [s.serializable() for s in self.server.hub.get_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_states(self):\n return self.states", "def States(self) -> List[Callable]:\r\n\t\treturn self.__STATES__", "def getstate(self):\n return [elem.getstate() for elem in self]", "def get_all_states(self):\n return self._states", "def state_list(self) -> Sequence[TState]:\n ...
[ "0.82501197", "0.77690196", "0.76578045", "0.7560449", "0.75386643", "0.75329566", "0.75040877", "0.74932325", "0.735629", "0.71534085", "0.704421", "0.70064116", "0.6995536", "0.69708186", "0.69600093", "0.6959018", "0.69525653", "0.69230497", "0.6873112", "0.6865247", "0.68...
0.6934388
17
Serve index.html redered with jinja2.
def index(self): return {'projects': [p for p in self.server.projects.values()]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(path):\n return render_template(\"main.jinja2.html\")", "def index():\n return app.send_static_file(\"index.html\")", "def index():\n return app.send_static_file('index.html')", "def index():\n return render_template('index.html'), 200", "def index():\n\n return render_template(\"i...
[ "0.84246004", "0.8272775", "0.82501537", "0.8228777", "0.81703055", "0.81307155", "0.8094319", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", ...
0.0
-1
Serve project.html redered with jinja2.
def project(self, project_id): try: return {'project': self.server.projects[project_id]} except KeyError: raise HTTPError(404, "Unknown project")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('project.html')", "def index(path):\n return render_template(\"main.jinja2.html\")", "def index():\n return render_template('home.jinja2')", "def main():\n return render_template('index.html')", "def main():\n return render_template('index.html')", "de...
[ "0.76853174", "0.75702834", "0.7240784", "0.6982168", "0.6982168", "0.6910416", "0.6821985", "0.6790587", "0.67658055", "0.67555386", "0.6735233", "0.6735233", "0.67199844", "0.67199844", "0.6713254", "0.66706204", "0.6651341", "0.6625179", "0.65809524", "0.65652275", "0.6559...
0.0
-1
Create a nicely formatted HTML representation of a singular or list of substitutions.
def format_substitutions(subs: Union[SubstituteTerm, List[SubstituteTerm]]): text = "" if isinstance(subs, SubstituteTerm): term_str = str(subs) for line in term_str.split('\n'): text += Markup.escape(line) + Markup('<br />') text += Markup('<br />') return text f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n t = Template(\n \"\"\"\n <h4>$title</h4>\n $imgs\n $footnotes\n <hr/>\"\"\")\n # Return result.\n return t.substitute({\n \"title\": self.title,\n \"imgs\": self.render_images(),\n \"fo...
[ "0.581361", "0.5800976", "0.57761186", "0.5666923", "0.5624687", "0.5621324", "0.5601476", "0.5572784", "0.5540061", "0.5529508", "0.5505106", "0.5487089", "0.5471752", "0.5471752", "0.5471752", "0.5471752", "0.54387504", "0.54198366", "0.53992283", "0.5394507", "0.53875756",...
0.7432605
0
Compare equality of this value with another. The types must match.
def eq(self: _TT, other: _TT) -> bool: # pylint: disable=invalid-name if type(self) != type(other): raise TypeError("Types do not match") return self.value_in_units(self.default_prefix) == other.value_in_units(self.default_prefix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n\n return self.type == other.type and self.value == other.value", "def __eq__(self, other):\r\n\t\treturn (self.type == other.type and self.value == other.value)", "def _is_equal_same_type(self, other):\n return True", "def __eq__(self, other):\n return self.val...
[ "0.8487615", "0.83492357", "0.8080564", "0.7810967", "0.77573514", "0.7740007", "0.7690485", "0.76048404", "0.7589608", "0.75584024", "0.7516329", "0.7493757", "0.7493757", "0.74235433", "0.74088377", "0.73990095", "0.73897755", "0.73827124", "0.7343608", "0.73415744", "0.734...
0.72294253
37
Compare equality of this value with another. The types must match.
def __eq__(self: _TT, other: object) -> bool: return self.eq(other) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n\n return self.type == other.type and self.value == other.value", "def __eq__(self, other):\r\n\t\treturn (self.type == other.type and self.value == other.value)", "def _is_equal_same_type(self, other):\n return True", "def __eq__(self, other):\n return self.val...
[ "0.8489497", "0.83508813", "0.80812824", "0.7813282", "0.7759384", "0.77418506", "0.7691519", "0.76061225", "0.75919235", "0.7560689", "0.7518358", "0.7496791", "0.7496791", "0.7426171", "0.7410996", "0.7399769", "0.7391777", "0.7384996", "0.73464406", "0.73430836", "0.734204...
0.7189852
43
Compare inequality of this value with another. The types must match.
def ne(self: _TT, other: _TT) -> bool: # pylint: disable=invalid-name if type(self) != type(other): raise TypeError("Types do not match") return not self.eq(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\r\n\t\treturn (self.type != other.type or self.value != other.value)", "def __eq__(self, other):\n return int.__ne__(self, other)", "def __ne__(self, other):\n return not_equal(self, other)", "def __ne__(self, other):\n return int.__eq__(self, other)", "def __n...
[ "0.7789724", "0.7358024", "0.73365855", "0.7321399", "0.73185587", "0.72969794", "0.726275", "0.7210425", "0.71830374", "0.7177267", "0.7163777", "0.7156712", "0.7136913", "0.71352273", "0.71352273", "0.7127493", "0.71195805", "0.7101706", "0.7090631", "0.707465", "0.70697814...
0.74639887
1
Compare inequality of this value with another. The types must match.
def __ne__(self: _TT, other: object) -> bool: return self.ne(other) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\r\n\t\treturn (self.type != other.type or self.value != other.value)", "def ne(self: _TT, other: _TT) -> bool: # pylint: disable=invalid-name\n if type(self) != type(other):\n raise TypeError(\"Types do not match\")\n return not self.eq(other)", "def __eq__(se...
[ "0.7789724", "0.74639887", "0.7358024", "0.73365855", "0.7321399", "0.73185587", "0.72969794", "0.726275", "0.7210425", "0.71830374", "0.7177267", "0.7163777", "0.7156712", "0.7136913", "0.71352273", "0.71352273", "0.7127493", "0.71195805", "0.7101706", "0.7090631", "0.707465...
0.0
-1
Check if self is less than other. The types must match.
def __lt__(self: _TT, other: _TT) -> bool: if type(self) != type(other): raise TypeError("Types do not match") return self.value < other.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n return self.lessThan(other)", "def __lt__(self, other):\n\n # seems like this should be == -1 but we're using a min heap\n return self._comparator.compare_measurements(self, other) == 1", "def __lt__(self, other: Any) -> bool:\n\n if isinstance(other, Valu...
[ "0.8177419", "0.79188776", "0.79169124", "0.7903571", "0.78901744", "0.7861724", "0.78578293", "0.7849604", "0.7845744", "0.78049344", "0.78003174", "0.78003174", "0.77952206", "0.77952206", "0.7792081", "0.7786218", "0.7763305", "0.77572745", "0.77443147", "0.7683894", "0.76...
0.82047075
0
Check if self is less than or equal to other. The types must match.
def __le__(self: _TT, other: _TT) -> bool: if type(self) != type(other): raise TypeError("Types do not match") return self.value <= other.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ge__(self: _TT, other: _TT) -> bool:\n if type(self) != type(other):\n raise TypeError(\"Types do not match\")\n return self.value >= other.value", "def __lt__(self: _TT, other: _TT) -> bool:\n if type(self) != type(other):\n raise TypeError(\"Types do not match\"...
[ "0.8269749", "0.8156888", "0.7959218", "0.782644", "0.77851874", "0.77851874", "0.77802277", "0.7744213", "0.770726", "0.76717806", "0.7658956", "0.7649101", "0.76487803", "0.76363945", "0.76281005", "0.76281005", "0.76222974", "0.7605231", "0.76008826", "0.7593185", "0.75652...
0.8232501
1
Add other and self. The types must match.
def __add__(self: _TT, other: _TT) -> _TT: if type(self) != type(other): raise TypeError("Types do not match") return type(self)(str(self.value + other.value),"")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n raise NotImplementedError(\"Implement this if needed\")", "def _add(self, other):\n raise NotImplementedError(\n \"{} does not support addition\".format(type(self)))", "def __add__(self, other):\n raise NotImplementedError", "def __add__(self, other...
[ "0.84498745", "0.84130085", "0.8263157", "0.8263157", "0.8167373", "0.81477696", "0.81411535", "0.81411535", "0.8125277", "0.8097161", "0.80855507", "0.80210125", "0.80131054", "0.8011747", "0.7838893", "0.7798971", "0.7747998", "0.7718135", "0.77049744", "0.77047026", "0.765...
0.76568204
21
Default is plain degrees Celsius (e.g. "25" > "25 C").
def default_prefix(self) -> str: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fahr_to_celsius(temp):\n tempInCel = (temp - 32) * 5/9\n return tempInCel", "def to_celsius(degrees):\n return (degrees - 32) * (5/9)", "def convert_to_celsius(self):\n try:\n self.root.ids.fahrenheit_input.hint_text = 'Enter amount in Fahrenheit'\n self.root.ids.celsi...
[ "0.7114742", "0.70627195", "0.7028331", "0.70053196", "0.69676816", "0.6908136", "0.68408805", "0.6737831", "0.670488", "0.6697212", "0.6691799", "0.66807866", "0.66803306", "0.6575728", "0.657497", "0.65448105", "0.65448105", "0.65448105", "0.65448105", "0.65448105", "0.6544...
0.0
-1
The role definition name.
def name(self) -> str: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role_definition_id(self) -> str:\n return pulumi.get(self, \"role_definition_id\")", "def role_definition_id(self) -> str:\n return pulumi.get(self, \"role_definition_id\")", "def role(self) -> str:\n\n assert self.data is not None\n return self.data[\"role\"][\"name\"]", "def...
[ "0.7743742", "0.7743742", "0.7698516", "0.7415485", "0.72732705", "0.7130731", "0.7030387", "0.6917913", "0.688072", "0.67929935", "0.6619846", "0.6619846", "0.65851176", "0.65649706", "0.6559848", "0.6522246", "0.64689267", "0.64689267", "0.64689267", "0.6463127", "0.6463127...
0.0
-1
The role definition type.
def type(self) -> str: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role(self):\n _DEPRECATION_ERROR_ATTRIBUTE(\n self, \"role\", \"Use attribute 'construct_type' instead\"\n ) # pragma: no cover", "def role_definition_id(self) -> str:\n return pulumi.get(self, \"role_definition_id\")", "def role_definition_id(self) -> str:\n return ...
[ "0.6698811", "0.6515991", "0.6515991", "0.64343756", "0.6321531", "0.62716305", "0.6129937", "0.6101933", "0.6066323", "0.60542077", "0.60542077", "0.60542077", "0.6051389", "0.60352767", "0.6028405", "0.6020705", "0.59910566", "0.5984608", "0.5984608", "0.5984608", "0.598460...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(LIMITS_STATUS, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.sysid is None: self.sysid = 0 if self.compid is None: self.compid = 0 if self.limits_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794013", "0.7718835", "0.7718835", "0.7685622", "0.76249295", "0.7561895", "0.74385226", "0.74156964", "0.73515606", "0.7307414", "0.72803426", "0.7237456", "0.72262406", "0.7222833", "0.7222833", "0.7218459", "0.72099864", "0.72099864", "0.72099864", "0.72099864", "0.720...
0.0
-1
Generate and return a healthcheck response.
def healthcheck(self, request): statuscode = OK msg = self.make_response('OK') if self.redirector.active_node_ip_port is None: statuscode = SERVICE_UNAVAILABLE msg = self.make_response('No Active Vault') request.setResponseCode(statuscode, message=msg) req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_health_check(self):\n return util.create_response(output=\"OK\")", "def healthcheck():\n return make_response(jsonify(status=200, message='Healthy'), status.HTTP_200_OK)", "def health_check():\n # TODO: implement any other checking logic.\n return '', 200", "def _healthcheck():\n ...
[ "0.802485", "0.77074367", "0.7512624", "0.7500844", "0.7327958", "0.7084402", "0.705349", "0.69670343", "0.6913111", "0.68223006", "0.6725334", "0.67168075", "0.6697383", "0.6569488", "0.6566781", "0.6561923", "0.64547014", "0.6334859", "0.6329124", "0.63058436", "0.6282877",...
0.58168834
48
Return num_items many items of seq, spread evenly. If seq is shorter than num_items, include all items. Otherwise, include first and last items and spread evenly in between. (If num_items is 1, only include first item.)
def select_evenly_spread(seq, num_items): if len(seq) <= num_items: return seq if num_items == 1: return [seq[0]] step_size = (len(seq) - 1) / float(num_items - 1) float_indices = [i * step_size for i in range(num_items)] return [seq[int(round(index))] for index in float_indices]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(np.ceil(i * length / num))]", "def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(ceil(i * length / num))]", "def chunk(si...
[ "0.6699766", "0.66776925", "0.64731294", "0.6373739", "0.6299112", "0.6218917", "0.61767405", "0.6134805", "0.6121701", "0.6070096", "0.6070043", "0.6037862", "0.59886056", "0.59750354", "0.59304655", "0.5926504", "0.59138757", "0.5903377", "0.59028697", "0.5899408", "0.58725...
0.71883833
0
Creates mapping key = word, value = row index
def _create_dictionary(self, document): words = self._normalize_words(document.words) unique_words = frozenset(words) return dict((word, idx) for idx, word in enumerate(unique_words))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_index(text: Iterable) -> Dict[str, List[Tuple[int, int]]]:\n index = defaultdict(list)\n for line_no, line in enumerate(text, 1):\n for match in WORD_RE.finditer(line):\n word = match.group()\n column_no = match.start() + 1\n location = (line_no, column_no)\n...
[ "0.7159948", "0.6949987", "0.66246754", "0.66195613", "0.6606184", "0.6294764", "0.62644446", "0.61882865", "0.61626875", "0.6162056", "0.6147786", "0.6146079", "0.6131257", "0.61265624", "0.6122289", "0.6063121", "0.60443723", "0.60232854", "0.59934974", "0.596981", "0.59339...
0.57246023
36
Test if n is prime, with witness a. Output True if n is prime, False otherwise
def is_prime_by_fermat_test(n, a): output = zn_pow(a, n-1, n) # a^{n-1}, mod n if output == 1: vprint("prime") return True vprint("composite") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(a):\n return all(a % i for i in xrange(2, a))", "def isprime(n):\r\n\treturn is_prime(n)", "def isprime(n):\n\treturn is_prime(n)", "def test_prime(n):\n if SIEVE[n]:\n return True\n else:\n return False", "def is_prime(n):\n return mr_prime(n)", "def if_prime(cls, ...
[ "0.7837422", "0.77885544", "0.7740405", "0.76765877", "0.7637204", "0.75215995", "0.75006753", "0.74756145", "0.7446736", "0.74348235", "0.7434485", "0.7431155", "0.74153996", "0.7403929", "0.7353826", "0.73335487", "0.731264", "0.73082674", "0.73048615", "0.7267132", "0.7265...
0.70814806
55
Speedily computes a^x (mod n)
def fast_exp(a, x, n): x_2 = int2bin(x) vprint("{} = [{}]_2".format(str(x), x_2)) powers = [a % n] vprint("{}^(2^0) = {}^1 = {} \\equiv {}".format(a, a, a, (a % n))) i = 1 while i < len(x_2): # This (hilariously ugly) print statement prints the # intermediary operations in a form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fast_power(a, n, m): # (a ^ n) % m\n result = 1\n value = a\n power = n\n while power > 0:\n if power % 2 == 1:\n result = result * value\n result %= m\n value = value * value\n value %= m\n power = power//2\n return result", "def fast_expo(a, ...
[ "0.79421157", "0.7464723", "0.73651356", "0.7330644", "0.73195386", "0.7313797", "0.72905034", "0.7276198", "0.7246754", "0.7216778", "0.72006136", "0.71849555", "0.71495146", "0.70580775", "0.70481366", "0.7007317", "0.6999108", "0.69729644", "0.6950965", "0.69267964", "0.69...
0.7604963
1
Returns a list of the file's full filespaths from the passed directory.
def get_files_in_dir(dir: str): file_list = [f"{dir}/{file}" for file in listdir(dir) if isfile(join(dir, file))] return file_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_filepaths(self, directory):\n folder_paths = [os.path.join(directory, folder) for folder in os.listdir(directory) if not folder.startswith('.')]\n filepaths = [[os.path.join(cur_folder, cur_file) for cur_file in os.listdir(cur_folder)] for cur_folder in folder_paths]\n return filepath...
[ "0.82656676", "0.8022355", "0.80130976", "0.7965983", "0.7958262", "0.79399973", "0.7929841", "0.7923375", "0.78915095", "0.78915095", "0.78915095", "0.7870893", "0.77364165", "0.76328206", "0.76297075", "0.76133543", "0.7523412", "0.7522805", "0.74846363", "0.74801105", "0.7...
0.7711428
13
Registers a route using Flask's route() method. Depends on make_route() to set attributes, so calling function nests this function after make_route().
def register(app, fn): @functools.wraps(fn) def config_route(**kwargs): """ :param kwargs: str, id of existing entry :return: dict or exception """ return fn(app.config, **kwargs) app.route(*fn.route_args, **fn.route_kwargs)(config_route)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_route(self, route, app):\n assert route not in self.routes\n self.routes[route] = app", "def add_route(self, route: Route, routing_url: str, methods: typing.Iterable[str] = (\"GET\",)):\n # Create an endpoint name for the route.\n route.routing_url = routing_url\n route.me...
[ "0.79209733", "0.7192723", "0.71093345", "0.71085656", "0.6970921", "0.6878834", "0.6854651", "0.6851344", "0.68498003", "0.6847353", "0.682385", "0.68175274", "0.6793829", "0.67623925", "0.6709542", "0.66622424", "0.66376895", "0.6614897", "0.6593398", "0.6571527", "0.655145...
0.6497629
22
! Gets the transformation matrix from dh parameters.
def get_transform_from_dh(a, alpha, d, theta): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhMatrix(self):\n row1 = np.array([np.cos(self.theta), -np.sin(self.theta)*np.cos(self.alpha), np.sin(self.theta)*np.sin(self.alpha), self.a*np.cos(self.theta)])\n row2 = np.array([np.sin(self.theta), np.cos(self.theta)*np.cos(self.alpha), -np.cos(self.theta)*np.sin(self.alpha), self.a*np.sin(s...
[ "0.7223759", "0.7196637", "0.6873913", "0.673187", "0.6503569", "0.6426385", "0.6411647", "0.6405354", "0.6387804", "0.6387804", "0.63843906", "0.6356444", "0.63466644", "0.6344464", "0.6341292", "0.63363296", "0.6311011", "0.6265211", "0.6264327", "0.62036526", "0.6183622", ...
0.6528768
4
gti_data = np.array([ [0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0], [0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0], [0, 0, 5, 5, 5, 5, 5, 5, 2, 2, 2], [0, 0, 5, 5, 5, 5, 5, 5, 2, 2, 2], [0, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2], [0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0], [0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3,...
def instance_boundary(gti_data, gtl_data): out_data = np.full(gti_data.shape, dtype=np.uint8, fill_value=NON_BUILDING) # 5x5 erosion is equivalent to two iterations of a 3x3 erosion kernel = np.ones((3, 3)) for label, submask, rc_off, rc_sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erode(img, kernel = (5,5), iterations = 1):\n\ttmp = grayscale(img)\n\tk = np.ones(kernel, np.uint8)\n\terosion = cv2.erode(tmp, k, iterations= iterations)\n\treturn erosion", "def erode(image, kernel_size=(5, 5)):\n kernel = np.ones(kernel_size, np.uint8)\n image = cv2.erode(image, kernel)\n return...
[ "0.6813081", "0.6655335", "0.6655335", "0.6326385", "0.62629443", "0.6173644", "0.616028", "0.60584724", "0.6048696", "0.60176474", "0.6009464", "0.5972192", "0.59574443", "0.5947122", "0.59254193", "0.5881773", "0.58735096", "0.58453214", "0.5690558", "0.5689311", "0.5658610...
0.55255014
35
Tests the ``to_python()`` method. It should return ``None`` (if ``None`` given), the object if ``MultiLingualTextStructure``, or the object converted to ``MultiLingualTextStructure`` otherwise.
def test_to_python(self): field = MultiLingualTextField() self.assertEqual(None, field.to_python(None), "to_python of None should always return None.") content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_db_value(self):\n field = MultiLingualTextField()\n\n result_none = field.from_db_value(None, None, None)\n self.assertEqual(MultiLingualTextStructure, type(result_none),\n \"from_db_value should always be of type MultiLingualTextStructure\")\n self...
[ "0.57009166", "0.56299824", "0.55680037", "0.5488348", "0.5338049", "0.53207386", "0.5283834", "0.51322764", "0.5092174", "0.50363445", "0.5033038", "0.502039", "0.4997337", "0.49939436", "0.49646625", "0.4963914", "0.4873973", "0.4870973", "0.48417282", "0.48417282", "0.4840...
0.8195778
0
Sets the derived_item_categories of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def derived_item_categories(self, derived_item_categories): self._derived_item_categories = derived_item_categories
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(self, categories):\n self._categories = categories", "def fill_tab_categories(self):\n self.category.fill_tab_categories(self.list_categories, self.mycursor, self.my_database)", "def on_category(self):\n super(ToolSettings, self).on_category()\n selItems = self.tw_cat...
[ "0.42504486", "0.41763225", "0.41738588", "0.4147597", "0.4145194", "0.41436017", "0.41436017", "0.41436017", "0.41436017", "0.41305125", "0.41266572", "0.41144997", "0.40753424", "0.40561587", "0.38878268", "0.38473186", "0.3840825", "0.38260534", "0.38147235", "0.37995836", ...
0.7910564
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DestinyDefinitionsDestinyItemPreviewBlockDefinition): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
aux auf to make '100__a' out of ['100','','','a']
def tagify(parsedtag): tag = "" for t in parsedtag: if t == '': t = '_' tag = tag+t return tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _alphanum_list(x):\n return [_alphanum(y) for y in x]", "def clean(a):\n b = a.lower()\n # en c se encuentra la lista de todos los documentos juntos y limpios\n c = re.sub('[^A-Za-z0-9]+', ' ', b).split()\n return c", "def generate_a_values() -> List[str]:\n return [\"A_1\", \"A_2\", \"A_...
[ "0.626513", "0.5933304", "0.5747301", "0.5679641", "0.55706316", "0.54705375", "0.5390125", "0.53830534", "0.536347", "0.53619814", "0.5348391", "0.53348833", "0.53115875", "0.5304542", "0.5290489", "0.5288956", "0.52829987", "0.5279524", "0.5274321", "0.52679646", "0.5253277...
0.48427668
75
Check username is valid or not
def _check_username(self, username): if self.username_regex.search(username) is not None: print("Correct username") return True else: print("Wrong username") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_username(u):\n return u and USER_RE.match(u)", "def verify_username(entered_username):\n return USER_RE.match(entered_username)", "def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, username)", "def validate_username(username):\r\n\r\n\t\tmi...
[ "0.8540924", "0.84600514", "0.8454873", "0.8400678", "0.8395739", "0.8378274", "0.835083", "0.8337027", "0.833407", "0.8324205", "0.8316021", "0.8305803", "0.8281563", "0.82359076", "0.8227417", "0.81931025", "0.81915444", "0.81847", "0.8122291", "0.8110087", "0.8095193", "...
0.8756299
0
Check password is valid or not
def _check_password(self, password): if self.password_regex.search(password) is not None: print("Correct password") return True else: print("Wrong password") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]))\n\n valid_password(None, pass_field)", "def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass", "def validate_password(data):\n\n ...
[ "0.8513757", "0.8485963", "0.8283479", "0.8146151", "0.8137212", "0.8133873", "0.8050052", "0.80201", "0.80132633", "0.79668003", "0.79447955", "0.7942233", "0.7933791", "0.7915177", "0.7904527", "0.7900205", "0.7898659", "0.78936994", "0.7889744", "0.78833944", "0.78769594",...
0.84296614
2
x1, y1 = p1 x2, y2 = p2 return abs(x1 x2) + abs(y1 y2)
def h(p1, p2): # returns diagonal distance x1, y1 = p1 x2, y2 = p2 dx = abs(x1 - x2) dy = abs(y1 - y2) d = 1 # distance between spots d2 = 1 # diagonal distance between spots h = d * (dx + dy) + (d2 - 2 * d) * min(dx, dy) return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Dist(p1,p2):\n x1, y1 = p1\n x2, y2 = p2\n return (((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)))**0.5", "def add(self, p1, p2):\n if p1 is None:\n return p2\n if p2 is None:\n return p1\n x1, y1 = p1\n x2, y2 = p2\n if x1 != x2:\n l = self.div_mod_...
[ "0.7514179", "0.74884844", "0.7328659", "0.73015", "0.72653985", "0.7218041", "0.7197124", "0.7157154", "0.71298754", "0.70463127", "0.69635034", "0.69025075", "0.6884231", "0.6866224", "0.67430687", "0.66654086", "0.66528803", "0.6624981", "0.6623209", "0.66115046", "0.66099...
0.0
-1
This slot's unique ID, as it appears in the deck definition. This can be used to look up slot details in the deck definition. This is preferred over `.value` or `.__str__()` for explicitness.
def id(self) -> str: return self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slot(self):\n if self.__slot in ApexAP1000.SLOTS:\n return self.__slot\n else:\n raise ValueError('Bad slot number !')", "def unique_id(self) -> str:\n return self.get_unique_id(wallet=self.wallet_id, nonce=self.nonce)", "def unique_id(self):\n return _spac...
[ "0.699074", "0.6705826", "0.66845423", "0.66596943", "0.665877", "0.66267174", "0.65879273", "0.6586923", "0.65740407", "0.652181", "0.6519821", "0.6513885", "0.65122163", "0.6506125", "0.6506125", "0.6482951", "0.6482902", "0.6473385", "0.6457439", "0.6447112", "0.6447112", ...
0.68129075
1
Validate that the email is not already in use.
def clean_email(self): try: user = User.objects.get(email__iexact=self.cleaned_data['email']) except User.DoesNotExist: return self.cleaned_data['email'] raise forms.ValidationError(_("A user with that email already exists."))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_email(self, email):\n if email.data != current_user.email:\n user = User.query.filter_by(email=email.data).first()\n if user:\n raise ValidationError('That email already exists. Please choose another email.')", "def clean_email(self):\n existing = U...
[ "0.7937491", "0.78997964", "0.78647095", "0.77658063", "0.77507335", "0.7686202", "0.76505077", "0.76505077", "0.7643141", "0.7542166", "0.7531488", "0.7512208", "0.749662", "0.7476814", "0.7466274", "0.74633485", "0.74148434", "0.73954046", "0.738715", "0.73804814", "0.73739...
0.6915044
42
Build the Deck Loader for the test
def setUp(self): self.items = [1,2,3,4,5] deckInitializer = DeckInitializer() [deckInitializer.addItem(item, 1) for item in self.items] self.deckLoader = StartingDeckLoader(deckInitializer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loader(config):\n train_transform = [T.Resize((256, 128)), T.RandomHorizontalFlip(), T.ToTensor(),\n T.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])]\n train_transform = T.Compose(train_transform)\n\n test_transform = [T.Resize((256, 128)), T.ToTensor(),\n ...
[ "0.6564545", "0.6360634", "0.63571835", "0.6323059", "0.6245681", "0.62319267", "0.6199012", "0.6186175", "0.6131993", "0.6125377", "0.61228716", "0.6109008", "0.61022186", "0.61013734", "0.60801584", "0.60114074", "0.60013574", "0.5962817", "0.5953434", "0.59507775", "0.5913...
0.62608194
4
Test that the deck is created properly
def deckCreated(self): deck = self.deckLoader.loadDeck() self.assertTrue(all([item in deck for item in self.items]), "Each item in the deck initializer should be in the deck")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDeckInit(self):\n # Test Deck getter and itialization\n cardObj = Card('5','s')\n deckObj = Deck()\n deck = deckObj.get_deck()\n self.assertEquals(str(cardObj), str(deck[4]))", "def create_uno_deck():\r\n pass", "def test_get_deck(self):\n my_deck = get_deck...
[ "0.78386056", "0.78181976", "0.7817289", "0.7801003", "0.75754887", "0.75214285", "0.7520781", "0.7493928", "0.74697274", "0.7254102", "0.72316784", "0.7188871", "0.7113905", "0.7106764", "0.7088169", "0.7034932", "0.698655", "0.6961691", "0.69396377", "0.6931241", "0.6816131...
0.791016
0
Return whether or not there are previous pages from the currently displayed page.
def has_previous(self): return self.page > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_previous(self):\n return self.current_page > 1", "def has_prev(self):\n return self.page > 1", "def has_prev(self):\n return self.page > 1", "def has_previous(self) -> bool:\n return self.published_before().count() != 0", "def previous_page(self):\n\n\t\tif not self.is_p...
[ "0.882928", "0.85812926", "0.85812926", "0.7818793", "0.757213", "0.74441236", "0.72574216", "0.70782685", "0.69289106", "0.68758", "0.6799423", "0.6752267", "0.66575694", "0.66365916", "0.66365916", "0.66365916", "0.65581673", "0.6478808", "0.6467624", "0.6420017", "0.641290...
0.87382364
1
Calculate NDCG. The function assumes, we already sorted everything in the order of decreasing scores.
def __call__(self, relsSortedByScores, qrelDict): idcg = self._dcg(sorted(qrelDict.values(), reverse=True)) return self._dcg(relsSortedByScores) / idcg if idcg > 0 else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndcg(relevances, rank=10):\n best_dcg = dcg(sorted(relevances, reverse=True), rank)\n if best_dcg == 0:\n return 0.\n return dcg(relevances, rank) / best_dcg", "def _dcg(scores, discount=np.log2):\n scores = np.nan_to_num(scores)\n ranks = np.arange(1, len(scores) + 1)\n disc = disco...
[ "0.7706102", "0.7589097", "0.7228468", "0.7171138", "0.7094153", "0.7087854", "0.7068036", "0.70546424", "0.69466734", "0.67094135", "0.67041653", "0.66926247", "0.6691362", "0.66396123", "0.66211337", "0.65662634", "0.6523564", "0.6415667", "0.64123493", "0.6379668", "0.6338...
0.5376932
52
It's a slot which is called when the setting button is pressed This method opens the file manager and if a directory or a file is chosen, it fills edit lines
def files_manage(self): sender = self.sender() if sender == self.mapsDirectoryButton: path_to_map, _ = QFileDialog.getOpenFileName(self, caption="Открыть", directory="/", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_File1_toolButton_clicked(self):\n my_file = QtWidgets.QFileDialog.getOpenFileName(self, u'打开文件', '/')\n if my_file[0]:\n self.File1_lineEdit.setText(my_file[0])\n else:\n QtWidgets.QMessageBox.warning(self, u'警告', u'请选择输入文件')", "def onLoad (self):\n #productiv...
[ "0.7056106", "0.69966835", "0.68940663", "0.68738866", "0.6866713", "0.6858465", "0.6858465", "0.685267", "0.6840944", "0.6735564", "0.67051214", "0.6688198", "0.668139", "0.66708505", "0.6670207", "0.66078514", "0.6606934", "0.6594669", "0.657698", "0.65762657", "0.65483475"...
0.7185551
0
Loads a json file if it nonempty.
def _json_from_file(file: IO[AnyStr]) -> Json: if os.path.getsize(file.name) > 0: return typing.cast(Json, json.load(file)) return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(self):\n if self.file_path.exists():\n with open(self.file_path) as fid:\n self.data = json.load(fid)", "def load_json_file(self, file, default_content=None):\n if os.path.isfile(file) and os.path.getsize(file):\n with open(file, \"r\", encoding=\"utf-...
[ "0.762835", "0.7599969", "0.75057316", "0.7405254", "0.72807854", "0.72572", "0.71229345", "0.70612323", "0.7041013", "0.69666064", "0.6953141", "0.693393", "0.692284", "0.68644524", "0.68295234", "0.6816347", "0.6786634", "0.6776473", "0.67584807", "0.6753719", "0.6745626", ...
0.6703026
23
Gets what column matches which language.
def getorder(columns, langs): order = [] for lang in langs: i = 0 for col in columns: if col == lang: order.append(i) i += 1 if len(order) != len(langs): print("Either missing a language or have a duplicate\n") return order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_column(self, column_or_label):\n c = column_or_label\n if isinstance(c, collections.Hashable) and c in self.column_labels:\n return self[c]\n else:\n assert len(c) == self.num_rows, 'column length mismatch'\n return c", "def _get_col(self, idx):\n ...
[ "0.62636393", "0.61789846", "0.6152711", "0.60966796", "0.6089271", "0.6004885", "0.59756434", "0.5966933", "0.59179723", "0.59012645", "0.58697855", "0.5680194", "0.5678792", "0.5676237", "0.56437963", "0.5629243", "0.56290823", "0.56186384", "0.5599697", "0.559922", "0.5598...
0.0
-1
The pathname of the directory containing the unpacked source distribution. This is the directory that contains a ``setup.py``
def source_directory(self): return self.pip_requirement.source_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPackageDirectory():\n return os.path.dirname(__file__)", "def get_package_dir():\n return Path(__file__).parent", "def get_install_dir(self):\n return EventGenerator.get_install_dir(self) + \"/madgraph5/src\"", "def get_install_dir(self):\n return EventGenerator.get_install_dir(sel...
[ "0.7882261", "0.78249943", "0.7451742", "0.74421036", "0.73956454", "0.73768854", "0.7256142", "0.7101482", "0.70624197", "0.7059278", "0.694501", "0.6943025", "0.6912458", "0.68570054", "0.6847402", "0.68168926", "0.6816051", "0.6813868", "0.6797789", "0.6795502", "0.6794880...
0.7516564
2
``True`` when the requirement is already installed, ``False`` otherwise.
def is_installed(self): return bool(self.pip_requirement.satisfied_by)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_installed(self):\n return not self.dont_install", "def already_installed(lib_spec, options, working_set=None):\n if 'path' in options:\n return False\n\n if not working_set:\n working_set=pkg_resources.WorkingSet(sys.path)\n\n try:\n working_set.require(lib_spec)\n ...
[ "0.77823555", "0.7527283", "0.7521783", "0.7446945", "0.7324295", "0.72457904", "0.721714", "0.71614337", "0.706286", "0.70098406", "0.69969386", "0.69896317", "0.69786394", "0.69777703", "0.6964472", "0.6922492", "0.69222534", "0.6917151", "0.69150466", "0.69119006", "0.6896...
0.79604423
0
Takes a dataframe of processed eviction data and predictions from an ARIMAX model at the month level, as well as the number of months into the future to predict.
def top_down_forecast(original_df,predictions_by_month,months_ahead): group_by_zip_df = top_down_forecast_data_processing(original_df,predictions_by_month) zip_perc_df= pd.DataFrame(np.random.randn(1, 4), columns=['zip_predicted','zip_code','perc_of_month','month_year']) for month in range(months_ahead):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arimax_by_month_forecast_fit_predict (y_train,y_test,months_ahead, months_list):\n predictions_df= pd.DataFrame(np.random.randn(1, 2),\\\n columns=['month_year', 'predicted_evictions'])\n\n now = datetime.datetime.now()\n\n model = pf.ARIMAX(data=y_train,formula='Eviction_Notice~1+CASANF0URN',a...
[ "0.79838103", "0.7393525", "0.725368", "0.69809437", "0.6334739", "0.63147026", "0.6194552", "0.6134306", "0.6121274", "0.6016633", "0.601663", "0.5980682", "0.5806225", "0.57996064", "0.5768583", "0.57633406", "0.5728102", "0.5712658", "0.5658473", "0.5626327", "0.56168824",...
0.6652185
4
takes the original tweet text and returns the preprocessed texts.
def _preprocess_feed(tweet: str): t = tweet.lower() t = re.sub(url_re, " <URL> ", t) t = t.replace("\n", "") t = t.replace("#", " <HASHTAG> ") t = re.sub(mention_re, " <USER> ", t) t = re.sub(smile_re, " <EMOTICON> ", t) t = re.sub(emoji_re, " <EMOJI> ", t) t = re.sub(time_re, " <TIME> "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, text):\r\n return text", "def preprocess(self,text):\n return preprocess.get_tokens(text)", "def preprocess_tweets(tweets):\n tweets = clean_html(tweets)\n tweets = detweettify(tweets)\n tweets = remove_numbers(tweets)\n tweets = remove_punctuation(tweets)\n tw...
[ "0.7566967", "0.7467431", "0.738912", "0.730991", "0.722519", "0.7110993", "0.70971894", "0.7094896", "0.70701337", "0.6990219", "0.69773144", "0.6968755", "0.6935003", "0.68867147", "0.6803225", "0.6801379", "0.6793875", "0.67900354", "0.6776054", "0.6768327", "0.67605615", ...
0.63083714
57
convert the birthyears of a certain range to the center point. This is to reduce the number of classes when doing a classification model over regression on age
def _get_age_class(by): by = int(by) if 1940 <= by <= 1955: return 1947 elif 1956 <= by <= 1969: return 1963 elif 1970 <= by <= 1980: return 1975 elif 1981 <= by <= 1989: return 1985 elif 1990 <= by <= 1999: return 1994
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getagefromyear(year=None):\n if year is None:\n print(\"Please enter the year to assign class to them\")\n try:\n t = datetime.datetime.today()\n b = datetime.datetime.strptime(str(year), '%Y')\n a = (t - b).days / 365\n a = int(a)\n if (a < 10) or (a > 80):\n ...
[ "0.5999794", "0.59221816", "0.5844322", "0.5806519", "0.57929456", "0.5738596", "0.56947285", "0.5682877", "0.56782824", "0.56642705", "0.56635046", "0.5658976", "0.56326574", "0.56149614", "0.5565969", "0.5530023", "0.5472231", "0.546988", "0.54366285", "0.5412874", "0.54118...
0.5842931
4
Center the ava on the screen.
def center_ava(self): self.rect.midbottom = self.screen_rect.midbottom self.x = float(self.rect.x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_mario(self):\n self.rect.midbottom = self.screen_rect.midbottom\n self.x, self.y = float(self.rect.x), float(self.rect.y)", "def center(self):\n self.root.update_idletasks()\n w = self.root.winfo_screenwidth()\n h = self.root.winfo_screenheight()\n size = tupl...
[ "0.7571731", "0.7510738", "0.7266956", "0.72459733", "0.7204455", "0.70775634", "0.70301646", "0.68635684", "0.68635684", "0.6860699", "0.6833622", "0.6829853", "0.6808482", "0.6786134", "0.67701036", "0.6770095", "0.6681063", "0.66643727", "0.66643727", "0.66412467", "0.6638...
0.8325066
0
add a line to a SVG group
def addToGroup(self, frontorback, drawing, svggroup, **extra): super(byA_FB_SideLine, self).addToGroup(drawing, svggroup, **extra)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_svg_line(points_list, parent, style):\n line_attribs = {'style': simplestyle.formatStyle(style),\n inkex.addNS('label', 'inkscape'): 'line',\n 'd': to_path_string(points_list, False)}\n\n inkex.etree.SubElement(parent, inkex.addNS('path', 'svg'), line_attribs)",...
[ "0.6765925", "0.6018009", "0.5968184", "0.5929282", "0.59292215", "0.58818865", "0.5871255", "0.58446777", "0.58432126", "0.5815739", "0.5812686", "0.57987815", "0.57962376", "0.57535255", "0.575127", "0.57409406", "0.571864", "0.56766874", "0.56713814", "0.5660027", "0.56500...
0.7344968
0
Return True if user is in the group, False otherwise.
def is_user_in_group(user, group): if type(group) is not Group: raise ValueError("Not a valid group") if type(user) is not str: raise ValueError("Not a valid user") user_name = find_user(user, group) if user_name == "": return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False", "def is_in_group(user, group_name):\n return is_in_group_user_id(user.id, group_name)", "def is_user_in_group(user, group):\n\n if user == group.get_name():\n return Tr...
[ "0.8791304", "0.84474826", "0.8253319", "0.81782854", "0.8154014", "0.80775934", "0.8077066", "0.7917411", "0.79046553", "0.78879106", "0.7874985", "0.78737533", "0.7837497", "0.7784908", "0.7714273", "0.7684502", "0.76652265", "0.7655611", "0.7571193", "0.7561973", "0.737242...
0.7991211
7
Return True if the number it was passed is an odd number. Return False if the number it was passed is an even number.
def is_odd(number): return number % 2 != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd(number: int) -> bool:\n return number % 2 != 0", "def is_odd(number):\n return (number%2)==1", "def is_odd(n):\n if n % 2:\n return True\n else:\n return False", "def is_odd(x):\n return x % 2 != 0", "def isOdd (n):\n if type(n) != int:\n return False\n ...
[ "0.8910139", "0.88778764", "0.86567736", "0.85502493", "0.84932417", "0.8464938", "0.84520775", "0.8422581", "0.83795774", "0.835107", "0.8337976", "0.83243823", "0.8289874", "0.8273915", "0.8243354", "0.82220197", "0.8118846", "0.8059153", "0.79635155", "0.7933069", "0.79226...
0.8937428
0
Reads data from dataframe data containing path to images in column 'path' and, in case of dataframe, also containing artist name, technique name, and period of creation for given artist. In case of content images we have only the 'path' column.
def get_batch(self, augmentor, batch_size=1): batch_image = [] for _ in range(batch_size): image = scipy.misc.imread(name=random.choice(self.dataset), mode='RGB') if max(image.shape) > 1800.: image = scipy.misc.imresize(image, size=1800. / max(image.shape)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDataOrig(df, path, im_shape, disp_names=False):\r\n X, y = [], []\r\n for i, item in df.iterrows():\r\n if disp_names == True:\r\n print('i={} {} {}\\n'.format(i, path + item[0], path + item[1]))\r\n img = io.imread(path + item[0])\r\n img = transform.resize(img, im_sh...
[ "0.648307", "0.6394734", "0.6227284", "0.6157809", "0.6129117", "0.57942325", "0.57618886", "0.57390696", "0.57257617", "0.56972086", "0.5583221", "0.55744785", "0.5561718", "0.5538594", "0.5533018", "0.5451843", "0.5438273", "0.5414525", "0.53982335", "0.53951627", "0.539413...
0.0
-1
Finds the smallest item in a list starting at a given index
def find_min(start, user_list): minimum = start for j in range(start, len(user_list)): if user_list[minimum].value > user_list[j].value: minimum = j return minimum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(list):\n return find_value_at(list, -1)", "def find_smallest(list):\n smallest_index = 0\n smallest_number = list[0]\n for index, number in enumerate(list):\n if number < smallest_number:\n smallest_index = index\n smallest_number = number\n del list[small...
[ "0.80789644", "0.7943173", "0.7936158", "0.78641474", "0.7806867", "0.77677035", "0.75502586", "0.74800456", "0.7433551", "0.741327", "0.7316826", "0.72551984", "0.7238463", "0.72347677", "0.72340626", "0.71827656", "0.7154592", "0.70994294", "0.7073256", "0.7060353", "0.7023...
0.69554347
24
Generate a presigned URL to share an S3 object
def create_presigned_url(bucket_name, object_name, expiration=3600): # Generate a presigned URL for the S3 object s3_client = boto3.client('s3') try: response = s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_presigned_url(bucket_name, object_name):\n\n logger = logging.getLogger(\"SimpleReplayLogger\")\n\n s3_client = boto3.client('s3')\n try:\n response = s3_client.generate_presigned_url('get_object',\n Params={'Bucket': bucket_name,\n ...
[ "0.7818953", "0.7756839", "0.7680877", "0.7658545", "0.7651632", "0.76490694", "0.7647379", "0.7646296", "0.7609004", "0.75697136", "0.7361706", "0.7353515", "0.73297143", "0.73094666", "0.7162048", "0.7113277", "0.70949465", "0.70596546", "0.70513654", "0.7022255", "0.700629...
0.7818621
1
Given a tree, produces only its leaf nodes
def flatten_tree(tree): if isinstance(tree[1],str): return [tree[1]] if isinstance(tree[1],Terminal): return [tree[1]] s = [] for subtree in tree[1]: s += flatten_tree(subtree) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_nodes(tree: tree_mod.Tree):\n if isinstance(tree, tree_mod.Tree):\n return tree_mod.Tree(tree.label(), [all_nodes(child) for child in tree])\n else:\n return tree_mod.Tree(tree, [])", "def leaves(tree):\n for subtree in tree.subtrees(filter = lambda t: t.node=='NP'):\n yield...
[ "0.71870345", "0.71196705", "0.70777303", "0.6974671", "0.6940172", "0.6906725", "0.6819521", "0.6795652", "0.67752254", "0.6758936", "0.6746931", "0.66662055", "0.6664883", "0.66517955", "0.66445225", "0.6579895", "0.6549478", "0.6466321", "0.646349", "0.6460313", "0.6414969...
0.6141357
39
Get a nested named attribute from an object by a `.` separated name. rgetattr(x, 'y.z') is equivalent to getattr(getattr(x, 'y'), 'z') and x.y.z.
def get_nested_attr(__o: object, __name: str, *args) -> Any: def _getattr(__o, __name): return getattr(__o, __name, *args) return reduce(_getattr, [__o] + __name.split('.')) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getattr_nested(obj, name):\n dots = name.count('.')\n if dots == 0:\n return getattr(obj, name)\n else:\n first, rest = name.split('.', 1)\n return getattr_nested(getattr(obj, first), rest)", "def deepgetattr(obj, attr):\n\t\treturn reduce(getattr, attr.split('.'), obj)", "def...
[ "0.81038344", "0.7947371", "0.7722779", "0.75723994", "0.75492746", "0.73875433", "0.7224347", "0.71812946", "0.7162733", "0.6960191", "0.6960191", "0.6921507", "0.6830315", "0.6812168", "0.679382", "0.6680367", "0.6502294", "0.64958435", "0.6349795", "0.63452977", "0.6267382...
0.7539796
5
Estimates total number of combinations. This does not account for the permutations of "forced" characters, so the real number of combinations will be higher than this estimate.
def estimateCombinations(self): # Note: We use floating point, not exact arithmetic. allCharsCount = 0.0 combinations = 1.0 # Count combinations for the forced characters. for chars in self.categories: combinations *= len(chars) allCharsCount += len(char...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_permutations(self) -> int:\n perms = math.factorial(len(self._word))\n for v in self._char_counts.values():\n if v > 1:\n perms /= math.factorial(v)\n return perms", "def calulate_total_permutations(value):\n if len(value) == len(set(value)):\n ...
[ "0.7253553", "0.66454095", "0.6605841", "0.6605841", "0.6418367", "0.63323903", "0.6286042", "0.626837", "0.61481637", "0.61261785", "0.61043525", "0.6093982", "0.6053244", "0.6052588", "0.60336816", "0.6016115", "0.59903944", "0.5989238", "0.5986413", "0.59780264", "0.594201...
0.7635501
0
Gets the user's color based on the highest role with a color
def get_user_color(user: discord.Member, guild: discord.Guild) -> discord.Colour: # If it's a PM, server will be none if guild is None: return discord.Colour.default() member = guild.get_member(user.id) # type: discord.Member if member is not None: return member.colour return discor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(self):\n role_ids = self.role_ids\n if (role_ids is not None):\n for role in sorted((create_partial_role_from_id(role_id) for role_id in self.role_ids), reverse=True):\n color = role.color\n if color:\n return color\n \n ...
[ "0.72899514", "0.63540584", "0.63388276", "0.6273984", "0.6127805", "0.6099515", "0.6074041", "0.5978563", "0.5909255", "0.5873021", "0.57682693", "0.57585555", "0.57545954", "0.57352877", "0.57330096", "0.5710368", "0.56947976", "0.5676722", "0.5676663", "0.5672378", "0.5671...
0.5847438
10
Checks if the current command context is limited to lite mode. If the guild is in the lite_guilds list, the context is in lite mode. If the guild is in private message, and the message author is in at least ONE guild that is not in lite_guilds, then context is not lite
def is_lite_mode(ctx: commands.Context) -> bool: if is_private(ctx.message.channel): for g in ctx.bot.get_user_guilds(ctx.message.author.id): if g.id not in config.lite_servers: return False else: return ctx.message.guild in config.lite_servers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guild_only():\n\n async def check(ctx):\n if ctx.guild: # In a server\n return True\n await ctx.send('This command is only available in servers!')\n return False\n\n return commands.check(check)", "def is_democraciv_guild():\n\n def check(ctx):\n if not isinst...
[ "0.5691053", "0.5537149", "0.53771347", "0.5297926", "0.5295333", "0.527921", "0.52316976", "0.51805806", "0.51805806", "0.51479936", "0.51479936", "0.51479936", "0.5136715", "0.5086459", "0.50851494", "0.50851494", "0.50851494", "0.50693166", "0.50535107", "0.50369704", "0.4...
0.74545246
0
generates the tracks.csv file
def generateTruths(self, cont): truthf = self.outdir + "/tracks.csv" old = os.dup(1) sys.stdout.flush() os.close(1) os.open(truthf, os.O_WRONLY | os.O_CREAT) cont.printallTruths() sys.stdout.flush() os.close(1) os.dup(old) os.close(old)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_csv(self) -> None:\n csvData = ['Followers', 'Time']\n\n # Create our CSV file header\n with open(self.graphfile, 'w') as csvFile:\n writer = csv.writer(csvFile)\n writer.writerow(csvData)\n csvFile.close()", "def export_csv(self, csvfileobject):\n ...
[ "0.69881463", "0.6790697", "0.655824", "0.64800984", "0.6437634", "0.63966143", "0.6372148", "0.63682956", "0.6363678", "0.63325256", "0.6321618", "0.6250655", "0.6243557", "0.62408864", "0.623884", "0.6227081", "0.62265164", "0.6221201", "0.6196985", "0.6186828", "0.61633295...
0.59437996
46
Show homepage with map
def homepage(): return render_template("home_map.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n m = Map() # Create map html\n return render_template('index.html') # pulls map html using jinja2", "def map_page():\n m = Map() # Create map html\n return render_template('index.html') # pulls map html using jinja2", "def index():\n\n return render_template('index.html', title='Fin...
[ "0.8233349", "0.7650102", "0.74863607", "0.71886957", "0.7183427", "0.70794034", "0.69313073", "0.67315274", "0.6701228", "0.6691717", "0.6683785", "0.6635678", "0.6629475", "0.66146296", "0.66142416", "0.6591016", "0.657642", "0.65759116", "0.65759116", "0.654038", "0.653809...
0.8362454
0
Return a SQLAlchemy session.
def get_session(): return scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session():\n session = scoped_session(sessionmaker(bind=engine))\n return session", "def get_session(self):\n # Create the session\n kwargs = self._get_database_specific_session_args()\n session_factory = orm.sessionmaker(\n bind=self._engine, expire_on_commit=False,...
[ "0.8613249", "0.8455852", "0.82382464", "0.81438994", "0.80603933", "0.8053609", "0.7956509", "0.7910294", "0.7899938", "0.7893864", "0.7799984", "0.7765756", "0.7758646", "0.7723484", "0.7690281", "0.76200527", "0.76080185", "0.7596541", "0.75943327", "0.7565893", "0.755834"...
0.8555524
1
Register an aggregate with this repository. Once an aggregate is registered with the repository, the aggregate is retrievable from the repository via _aggregate_with_id(), _aggregates_with_ids(), and _extant_aggregate_ids()
def _register(self, aggregate_root_entity): if not isinstance(aggregate_root_entity, self._aggregate_root_entity_class()): raise TypeError("{!r} is not of type {} therefore cannot be store in a {}" .format(aggregate_root_entity, self._aggregate_root_entity_class().__name_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_aggregation(\n self,\n f: dd.Aggregation,\n name: str,\n parameters: List[Tuple[str, type]],\n return_type: type,\n replace: bool = False,\n ):\n self._register_callable(\n f,\n name,\n aggregation=True,\n ...
[ "0.6493154", "0.6390233", "0.5721717", "0.5695466", "0.5640757", "0.5489287", "0.5478946", "0.5319596", "0.5287735", "0.5268721", "0.52365905", "0.5200469", "0.5123038", "0.5114808", "0.51092464", "0.50671554", "0.5062453", "0.49744803", "0.4961004", "0.4954799", "0.49456868"...
0.65265906
0
Return with boolen if the object is an instance of the class
def is_same_class(obj, a_class): return (type(obj) == a_class)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __instancecheck__(self, instance):\n\n if isinstance(instance, ObjCInstance):\n return bool(instance.isKindOfClass(self))\n else:\n return False", "def isclassinstance(object):\n if not hasattr(object, \"__class__\"):\n return False\n if isbuiltin(object.__cla...
[ "0.81178784", "0.80528265", "0.79027194", "0.77327365", "0.7720832", "0.7706594", "0.76211834", "0.7617837", "0.7615193", "0.75302887", "0.75302887", "0.7526448", "0.7510782", "0.7493831", "0.74901634", "0.74751526", "0.74582803", "0.74582803", "0.74582803", "0.74582803", "0....
0.6968852
58
Lists all of the secrets that are stored by Secrets Manager in the AWS account. To list the versions currently stored for a specific secret, use ListSecretVersionIds . The encrypted fields ``SecretString`` and ``SecretBinary`` are not included in the output. To get that information, call the GetSecretValue operation.
def list_secrets(self, MaxResults: int = None, NextToken: str = None) -> Dict: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def list_secrets(self):\n pass", "def _all_secrets(cls, *, secretsmanager_client):\n return secretsmanager_client.list_secrets()['SecretList']", "def list_secrets_command(client: KeyVaultClient, args: dict[str, Any]) -> CommandResults:\n vault_name = args['vault_name']\n limit = arg_t...
[ "0.8024093", "0.78251266", "0.7289144", "0.7109478", "0.70714676", "0.6983011", "0.69202316", "0.68090004", "0.6796193", "0.6637247", "0.6608851", "0.65818655", "0.6547432", "0.6445355", "0.64339757", "0.63733447", "0.6365531", "0.63488114", "0.6301166", "0.6298797", "0.62746...
0.69495285
6
Returns the default config (see parent class for full docstring).
def get_default_config() -> Dict[Text, Any]: # please make sure to update the docs when changing a default parameter return { # ## Architecture of the used neural network # Hidden layer sizes for layers before the embedding layers for user message # and labels. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def default(cls) -> 'Config':\n parser: configparser.ConfigParser = configparser.ConfigParser()\n parser.read_dict(dict(wpwatcher=Config.DEFAULT_CONFIG))\n return cls.fromparser(parser)...
[ "0.857237", "0.8296643", "0.8086456", "0.7969869", "0.7921342", "0.78670275", "0.7778315", "0.7736277", "0.771808", "0.761196", "0.7611108", "0.7588063", "0.7546006", "0.75447714", "0.7536708", "0.7524585", "0.7514965", "0.7514965", "0.7502165", "0.7352819", "0.7343861", "0...
0.0
-1
Loads a policy from the storage (see parent class for full docstring).
def load( cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, **kwargs: Any, ) -> TEDPolicy: try: with model_storage.read_from(resource) as model_path: return cls._load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_policy(self, policy_path, tracker):\r\n if not os.path.exists(policy_path):\r\n return {}\r\n try:\r\n with open(policy_path) as f:\r\n return json.load(f)\r\n except (IOError, ValueError) as err:\r\n msg = \"ERROR: loading course policy...
[ "0.7527114", "0.6853302", "0.6738557", "0.67252105", "0.62512743", "0.6236352", "0.6154913", "0.61448526", "0.61282647", "0.6120836", "0.6100583", "0.60317343", "0.5986494", "0.5941951", "0.59372", "0.5917416", "0.5890665", "0.5828857", "0.57957846", "0.57303697", "0.572185",...
0.66870177
4
Test that the Crossref Events DAG has the correct structure.
def test_dag_structure(self): dag = UnpaywallTelescope().make_dag() self.assert_dag_structure( { "check_dependencies": ["check_releases"], "check_releases": ["download"], "download": ["upload_downloaded"], "upload_downloaded": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dag_structure(self):\n\n organisation = Organisation(name=self.organisation_name)\n dag = GoogleBooksTelescope(organisation, accounts=None).make_dag()\n self.assert_dag_structure(\n {\n \"check_dependencies\": [\"list_release_info\"],\n \"list_...
[ "0.680294", "0.6669853", "0.63210905", "0.6311622", "0.6105268", "0.60811025", "0.60449713", "0.6024524", "0.6015868", "0.5979063", "0.596869", "0.5906138", "0.5839312", "0.583271", "0.58317727", "0.583064", "0.5763963", "0.5728018", "0.572314", "0.5720221", "0.57139593", "...
0.6582648
2
Compute the IoUs between bounding boxes.
def iou_bbox(bboxes1, bboxes2): bboxes1 = np.array(bboxes1, np.float32) bboxes2 = np.array(bboxes2, np.float32) intersection_min_y = np.maximum(bboxes1[:, 0], bboxes2[:, 0]) intersection_max_y = np.minimum(bboxes1[:, 0] + bboxes1[:, 2] - 1, bboxes2[:, 0] + bboxes2[:, 2] - 1) intersection_height...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IoUs(box, boxes):\n box_area = (box[2] - box[0]) * (box[3] - box[1])\n area = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])\n xx1 = np.maximum(box[0], boxes[:, 0])\n yy1 = np.maximum(box[1], boxes[:, 1])\n xx2 = np.minimum(box[2], boxes[:, 2])\n yy2 = np.minimum(box[3], boxes[:, 3...
[ "0.79760545", "0.7360302", "0.73063666", "0.7305902", "0.72878903", "0.72744477", "0.695732", "0.695732", "0.6948172", "0.69370276", "0.69283444", "0.69266987", "0.69141793", "0.6910099", "0.6884505", "0.6847904", "0.68431014", "0.6842791", "0.682574", "0.6824961", "0.6815399...
0.688465
14
Unparameterize bounding boxes with respect to anchors. Namely, (ty,tx,th,tw)>(y,x,h,w).
def unparam_bbox(t, anchors, max_shape=None): t = np.array(t, np.float32) anchors = np.array(anchors, np.float32) yx = t[:, :2] * anchors[:, 2:] + anchors[:, :2] hw = np.exp(t[:, 2:]) * anchors[:, 2:] bboxes = np.concatenate((yx, hw), axis=1) if max_shape != None: bboxes = rectify_bbo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_transform_inv(bbox):\n with tf.variable_scope('bbox_transform_inv') as scope:\n xmin = bbox[..., 0]\n ymin = bbox[..., 1]\n xmax = bbox[..., 2]\n ymax = bbox[..., 3]\n w = xmax - xmin + 1.0\n h = ymax - ymin + 1.0\n out_box = np.stack(\n [xmin + 0.5*w, ymin + 0.5*h, w, h],\n ...
[ "0.65151864", "0.6448961", "0.6441325", "0.64217514", "0.6378641", "0.6352084", "0.6197559", "0.61599165", "0.61406326", "0.6111988", "0.60997486", "0.60890275", "0.6063085", "0.6047759", "0.6045166", "0.60417753", "0.59831274", "0.5976186", "0.5973511", "0.59560215", "0.5952...
0.7801747
0
Enlarge bounding boxes by the given factor (without changing their centers).
def expand_bbox(bboxes, max_shape, factor=1.5): bboxes = np.array(bboxes, np.float32) n = bboxes.shape[0] if n == 0: return bboxes H = bboxes[:, 2] * factor W = bboxes[:, 3] * factor Y = bboxes[:, 0] - bboxes[:, 2] * (factor * 0.5 - 0.5) X = bboxes[:, 1] - bboxes[:, 3] * (factor * 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_to_box(im, size):\n #mx = np.max(im.shape[:2])\n\n factors = [size[i]/im.shape[i] for i in range(2)]\n\n f = np.min(factors)\n if f < 1.0:\n return resize_with_factor_new(im, f)\n else:\n return im", "def expand_boxes(boxes, scale):\n w_half = (boxes[:, 2] - box...
[ "0.6589286", "0.6390398", "0.63020176", "0.627091", "0.61904466", "0.61847234", "0.61352766", "0.6132406", "0.6007678", "0.60033876", "0.60017043", "0.59644324", "0.59606093", "0.5915594", "0.5887303", "0.5867812", "0.5867812", "0.5864122", "0.5853104", "0.58528006", "0.58093...
0.66979355
0
Get a discord server given server id
def get_username(self, auth_token, user_id=None): self.headers['Authorization'] = f'Bearer {auth_token}' user = self.http_client.get( f'{self.api_endpoint}/users/@me', self.headers) return f'{user["username"]}#{user["discriminator"]}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server(self, id):\n\t\treturn self.__servers.get_server(id)", "def server(self, server_id):\n response = self._request(\"GET\", [ROUTE_SERVERS, server_id])\n if response.status_code != 200:\n logging.error(\"Error server id::{}\".format(response.text))\n return None\n\...
[ "0.7825828", "0.72106886", "0.7038349", "0.7023757", "0.7018549", "0.6773648", "0.66922504", "0.6597605", "0.6390267", "0.6101905", "0.60674965", "0.6005366", "0.5994605", "0.5986066", "0.5951594", "0.59417343", "0.59400356", "0.5926643", "0.5905813", "0.5848212", "0.58428794...
0.0
-1
Get a discord server given server id
async def get_guild(self, workspace_id) -> Guild: guild = await self.client.fetch_guild(workspace_id) return guild
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server(self, id):\n\t\treturn self.__servers.get_server(id)", "def server(self, server_id):\n response = self._request(\"GET\", [ROUTE_SERVERS, server_id])\n if response.status_code != 200:\n logging.error(\"Error server id::{}\".format(response.text))\n return None\n\...
[ "0.78256756", "0.7210775", "0.70365936", "0.7023663", "0.701742", "0.6772921", "0.66907614", "0.6596807", "0.6389004", "0.6100305", "0.60650533", "0.6006278", "0.5992732", "0.5985209", "0.594971", "0.5941801", "0.59379864", "0.59259915", "0.5905143", "0.5842343", "0.58112395"...
0.584765
19
Get project channel name given project_channel_id using the channel associated with the discord invite url. invite should always be valid.
async def get_project_channel_name(self, workspace: WorkspaceEntity): await self.client.login(os.environ['DISCORD_BOT_TOKEN'], bot=self.is_bot) channel_name = "" try: channel = await self.get_channel(workspace.project_channel_id) except HTTPException as error: # p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def select_project_channel_id(self, workspace: WorkspaceEntity, **kwargs):\n channel_id = \"\"\n\n invite_code = kwargs[\"invite_url\"].rsplit(\"/\", 1)[1]\n invite = self.http_client.get(\n f'{self.api_endpoint}/invites/{invite_code}', self.headers)\n # invite could be...
[ "0.71972173", "0.6902223", "0.64741087", "0.6457699", "0.63657844", "0.6195817", "0.61137605", "0.60998803", "0.60551804", "0.5953863", "0.58828175", "0.58753836", "0.57890105", "0.577792", "0.57777005", "0.57777005", "0.57777005", "0.57777005", "0.57777005", "0.57777005", "0...
0.6246572
5
Is the queue empty?
def is_empty(self): return self.first is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def ...
[ "0.92399496", "0.91864026", "0.91690904", "0.91690904", "0.91463965", "0.9136749", "0.90828764", "0.9066083", "0.9037413", "0.89759874", "0.8937634", "0.89152354", "0.89133626", "0.89084613", "0.88834363", "0.8876832", "0.88767827", "0.88767827", "0.88154984", "0.8768162", "0...
0.0
-1
Return the item least recently added to the queue. Does not modify the queue.
def peek(self): if self.is_empty(): raise ValueError('Queue underflow') return self.first.item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(self): # O(1)\n if not self.queue:\n return None\n return self.queue[0]", "def top(self):\n return self.queue[0]", "def top(self):\n while not self.queue[self.tag].empty():\n temp = self.queue[self.tag].get()\n self.queu...
[ "0.77313817", "0.7498477", "0.74331325", "0.7371703", "0.73413575", "0.73413575", "0.73301995", "0.7303269", "0.7290673", "0.7280591", "0.72582644", "0.72500014", "0.7247659", "0.72432554", "0.72195494", "0.7189716", "0.7187241", "0.71836096", "0.71619004", "0.7147872", "0.71...
0.71401
21