query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Indicates that the parser enters into an unsupportedattributestag group.
def unsupported_attributes_tag(self) : self._curattributes = self._unsupported_attributes return self.parseTag()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unknown_starttag(self, tag, attrs):\n if tag in self.valid_tags:\n self.result.append('<' + tag)\n for k, v in attrs:\n if string.lower(k[0:2]) != 'on' and", "def test_fetchParserUnknownAttribute(self):\n p = imap4._Fet...
[ "0.5917786", "0.5775716", "0.56351364", "0.5381743", "0.53326553", "0.5275372", "0.5197594", "0.5179682", "0.5155139", "0.509307", "0.5074497", "0.5070778", "0.5019276", "0.49966884", "0.49966884", "0.49716008", "0.4971445", "0.49685493", "0.49527672", "0.49197876", "0.491650...
0.70035094
0
Indicates that the parser enters into a subscriptionattributestag group.
def subscription_attributes_tag(self) : self._curattributes = self._subscription_attributes return self.parseTag()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __on_group_created(self, logger, *args):", "def on_subscribe( client, userdata, mid, granted_qos ):\n logging.info( \"Topic successfully subcribed with QoS: %s\" %granted_qos )", "def log_group_arn(self) -> str:\n ...", "def process(self, event):\n matchgroups = {}\n try:\n ...
[ "0.5545517", "0.48461246", "0.47890064", "0.4731607", "0.46983153", "0.4677109", "0.4675229", "0.4673879", "0.46679845", "0.4644136", "0.4639828", "0.4598391", "0.4586624", "0.4523136", "0.45071408", "0.45024773", "0.4499094", "0.4495115", "0.4495115", "0.4495115", "0.4485821...
0.53500694
1
Indicates that the parser enters into an eventnotificationattributestag group.
def event_notification_attributes_tag(self) : self._curattributes = self._event_notification_attributes return self.parseTag()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __on_group_created(self, logger, *args):", "def unknown_starttag(self, tag, attrs):\n if tag in self.valid_tags:\n self.result.append('<' + tag)\n for k, v in attrs:\n if string.lower(k[0:2]) != 'on' and", "def visit_event(s...
[ "0.53819436", "0.49599183", "0.49296498", "0.4853252", "0.48404688", "0.48267183", "0.4818338", "0.48151654", "0.47872686", "0.47819456", "0.47710592", "0.47700667", "0.47468475", "0.47368065", "0.4735554", "0.47104743", "0.46678525", "0.466398", "0.4663215", "0.46572715", "0...
0.59145147
0
Finner geometritype og antall koordinatpunkt i WKT streng
def koordinatpunkt( wktstring ): wkt_type = wktstring.split()[0] if 'Z' in wktstring[0:30].upper(): wkt_type += ' Z' wktstring = re.sub( r'[a-zA-Z]+', '', wktstring) wktstring = re.sub( r'\(+', '', wktstring) wktstring = re.sub( r'\)+', '', wktstring) antall_koordinatpunkt = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wgs84_wkt():\n return WGS84.to_wkt()", "def spatial(self):", "def geo_transform(self):\n pass", "def point2wgs84(self, crsop):\n latr = math.radians(self.lat)\n lngr = math.radians(self.lng)\n \n # a is the semi-major axis of given datum.\n a = crsop.Semimajor...
[ "0.69687706", "0.69472766", "0.6695512", "0.64280033", "0.64193696", "0.64041555", "0.6368389", "0.61432874", "0.59421605", "0.5880003", "0.5833728", "0.5769047", "0.57581174", "0.57469046", "0.5734468", "0.5733256", "0.57178426", "0.5708388", "0.5700761", "0.5630413", "0.561...
0.60767895
8
Lager statistikk over antall lenker og utbredelse til NVDB stedfesting
def veglenkestatistikk( stedfesting ): antall_stedfestingelementer = len( stedfesting ) utbredelse = None unike_veglenker = None if 'type' in stedfesting[0]: if stedfesting[0]['type'] == 'Linje': utbredelse = sum( [ k['sluttposisjon']-k['startposisjon'] for k in stedfestin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query3() :", "def update_vluln_table():", "def ustvari(self):\n raise NotImplementedError", "def get_total_stateless(db):\n pass", "def stats(self):", "def overheadstats(sdb, obsdate, update=True):\n bvs_updated = 0\n scams=0\n #for a given obsdate get the night info\n nid=getnighti...
[ "0.57543916", "0.55784565", "0.55619425", "0.5497133", "0.54629505", "0.5411191", "0.5397337", "0.52770716", "0.524446", "0.52380294", "0.5190501", "0.51876616", "0.5183608", "0.5163349", "0.5152543", "0.51474845", "0.5139914", "0.50777394", "0.5056625", "0.50381786", "0.5028...
0.6221996
0
Using eigen value decomposition (eigendecomposition) for dimensionality reduction. Outputs the components that explain X% of the variance in the data. (X% is the quality_percent). TAKES TOO MUCH TIME, BECAUSE OF THE COVARIANCE MATRIX.
def fit_evd(self): # EVD only work on square matrices as we need to compute the eigenvalues and eigenvectors # For this we compute the covariance matrix K # K should be n x n matrix (pixels x pixels) # The covariance matrix is nxn self.cov_matrix = np.zeros(shape=[self.n_featur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigen_decomposition(X, features):\n # Center to average\n Xctr = X - X.mean(0)\n # covariance matrix\n Xcov = np.cov(Xctr.T)\n\n # Compute eigenvalues and eigenvectors\n eigen_values, eigen_vectors = sp.linalg.eigh(Xcov)\n\n # Sort the eigenvalues and the eigenvectors descending\n sorte...
[ "0.65321", "0.6287839", "0.6122023", "0.6052969", "0.60071176", "0.5969323", "0.58543324", "0.5676435", "0.5669116", "0.56286806", "0.5590691", "0.55898774", "0.5563641", "0.5545428", "0.5533987", "0.5528895", "0.5517526", "0.54985064", "0.54313755", "0.5378376", "0.5334669",...
0.68186647
0
Dimensionality reduction using singular value decomposition (SVD). Outputs the components that explain X% of the variance in the data. (X% is the quality_percent)
def fit_svd(self): # U has the eigenvectors of G.Gt as columns () # S has square roots of the eigenvalues of G.Gt and Gt.G in its diagonal # The square roos of the eigenvalues are called singular values # V has the eigenvectors of Gt.G as columns () # full_matrices set to false ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svd(self, X): # [5pts]\n N,D = X.shape[0],X.shape[1]\n if X.ndim == 3:\n U = np.zeros((N,N,3))\n S = np.zeros((min(N,D),3))\n V = np.zeros((D,D,3))\n for i in range(3):\n U_temp,S_temp,V_temp = np.linalg.svd(X[:,:,i],compute_uv=True, full...
[ "0.69040626", "0.68697", "0.6656673", "0.6501096", "0.6389488", "0.6386059", "0.6347023", "0.6329251", "0.6273901", "0.62269294", "0.62042505", "0.61884207", "0.61802185", "0.61400044", "0.6100364", "0.605698", "0.6007152", "0.6001164", "0.598117", "0.5975402", "0.5959942", ...
0.70182264
0
Uses the components from the fit functions to transform an Image_matrix (of the training or testing set)
def transform(self, image_matrix): # Centering the data mean = np.mean(image_matrix, axis=0) image_matrix = image_matrix - mean # Dimension reduction is done by multiplying the original matrix with the components transformed_matrix = np.dot(image_matrix, self.components.T) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_transform(self, x: Array2D) -> Array2D:", "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", "def apply_transf...
[ "0.6525222", "0.6483429", "0.6483429", "0.6235002", "0.6186154", "0.6173184", "0.61298996", "0.60044026", "0.5990308", "0.59790784", "0.5963861", "0.5924043", "0.5909698", "0.59093964", "0.59062135", "0.5882084", "0.583149", "0.58172005", "0.5807438", "0.5804453", "0.5762179"...
0.6286367
3
Loads class labels at 'path'
def load_classes(path): fp = open(path, "r") names = fp.read().split("\n")[:-1] # -1까지 하는 이유 마지막에 공백이 있다. print("Load Class Nums : ",len(names)) return names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_labels(self, pathLabel):\n self.pathLabel = pathLabel\n self.labelList = os.listdir(pathLabel)", "def load_label(path: str) -> dict:\n if not os.path.exists(path):\n print(f\"Warning, try to load non-exist label {path}\")\n return None\n return np.load(path, allow_pickl...
[ "0.76263887", "0.70822763", "0.6987063", "0.6917422", "0.6886614", "0.684222", "0.6831526", "0.67475176", "0.67435664", "0.6732817", "0.66995424", "0.6691952", "0.6691952", "0.6649412", "0.66031843", "0.6593739", "0.65641505", "0.649268", "0.6491007", "0.6329085", "0.6310958"...
0.6657494
13
Compute true positives, predicted scores and predicted labels per sample
def get_batch_statistics(outputs, targets, iou_threshold): batch_metrics = [] for sample_i in range(len(outputs)): # output 은 배열형태 if outputs[sample_i] is None: continue output = outputs[sample_i] pred_boxes = output[:, :4] pred_scores = output[:, 4] pred...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction():\r\n\r\n\r\n\tpredictVal = []\r\n\taccuracy = 0.0\r\n\r\n\t# Calculate accuracy for each class in testData\r\n\tfor item in testData:\r\n\t\tclass0Prediction = posProb / 100\r\n\t\tclass1Prediction = negProb / 100\r\n\t\t\r\n\t\t# Multiply the prior probablities for negative and positive reviews b...
[ "0.7230884", "0.72161835", "0.72122383", "0.72010857", "0.7200459", "0.7191637", "0.7166481", "0.7063089", "0.70126003", "0.70126003", "0.6979515", "0.69782597", "0.69651514", "0.6958174", "0.6927955", "0.6899901", "0.6873471", "0.6863262", "0.6822898", "0.68122464", "0.68022...
0.0
-1
Parse content and metadata of markdown files.
def read(self, source_path): self._source_path = source_path self._md = Markdown(extensions=self.extensions) # Custom handling of ^include.html^ self._md.inlinePatterns['include_html'] = IncludeHtmlPattern(self) with pelican_open(source_path) as text: content = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_markdown(self):\n renderer = MyRenderer()\n md = mistune.Markdown(renderer=renderer)\n md.render(self._markdown_text)\n self._bash_commands = renderer._bash_commands", "def read(self, source_path):\r\n\r\n self._md = Markdown(extensions=self.extensions)\r\n wi...
[ "0.703052", "0.6902194", "0.6663789", "0.66204745", "0.6522781", "0.64834344", "0.6438712", "0.63117796", "0.6289006", "0.6217851", "0.6162338", "0.61167693", "0.60662013", "0.6044367", "0.59481674", "0.5941305", "0.59341216", "0.5924921", "0.5914844", "0.5913281", "0.5899294...
0.6742364
2
Parse content and metadata of .yml files
def read(self, source_path): content = None metadata = dict() self._source_path = source_path with pelican_open(source_path) as text: metadata = yaml.load(text) # Turn these into expected objects # 'author': pelican.urlwrappers.Author object if 'auth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_yamls(folder):\n for item in iglob(folder + \"/*.yaml\"):\n data_file = os.path.join(folder, item)\n data = yaml.load(open(data_file))\n load_data(data)", "def parse(file_contents, file_name):\n\n try:\n yaml.load(file_contents)\n except Exception:\n\n _, e...
[ "0.63108075", "0.61328685", "0.6085054", "0.60793495", "0.6052815", "0.6027979", "0.5993412", "0.5960239", "0.591337", "0.59100944", "0.590964", "0.58585054", "0.584181", "0.5835282", "0.58184296", "0.57883096", "0.5787211", "0.573365", "0.5728019", "0.5714711", "0.5706502", ...
0.6347969
0
Called when the Readers instance has parsed the READERS settings. Associate all Markdown file extensions with the MarkdownExtReader.
def on_readers_init(readers): for fmt in MarkdownExtReader.file_extensions: readers.reader_classes[fmt] = MarkdownExtReader
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registerExtensions(self, extensions, configs):\n for ext in extensions:\n try:\n if isinstance(ext, util.string_type):\n ext = self.build_extension(ext, configs.get(ext, []))\n if isinstance(ext, Extension):\n ext.extendMarkd...
[ "0.5789195", "0.5561572", "0.5184722", "0.5121114", "0.5109936", "0.51069635", "0.506897", "0.5020507", "0.4993649", "0.49655452", "0.49195173", "0.4918681", "0.4900654", "0.48862994", "0.48733476", "0.48583728", "0.4821897", "0.48209038", "0.47776324", "0.47749218", "0.47437...
0.8195992
0
Check all the posts in the subreddit for
def parse_sub_reddits(sub_reddit: str, match_words: list): url_to_open = f"https://www.reddit.com/r/{sub_reddit}.json" success_status = 0 while success_status != 200: try: response = urlopen(url_to_open, timeout=10) success_status = response.status ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iteratePosts(self):\n try:\n replies = self.soup.find('div','vt_postrow_holder').findAll('div', 'vt_postrow_rest')\n if not replies:\n log.info(self.log_msg('No posts found in url %s'%self.currenturi))\n return False\n replies.reverse()\n ...
[ "0.66930366", "0.6662355", "0.65778077", "0.6348439", "0.6179751", "0.6077247", "0.6058444", "0.6025194", "0.5994543", "0.5980211", "0.5944144", "0.58667725", "0.58650124", "0.5832116", "0.58242166", "0.57604986", "0.5733013", "0.57307196", "0.5701638", "0.56455827", "0.56387...
0.5699975
19
Generates a pandas dataframe with scraped comments and replies data. Will concatenate replies with comments
def comment_data(post_id: str, sub_reddit: str): url_to_open = f"https://www.reddit.com/r/{sub_reddit}/comments/{post_id}.json" success_status = 0 while success_status != 200: try: response = urlopen(url_to_open, timeout=10) success_status = response.status ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_comments(**kwargs):\r\n\r\n # Log in to get cookies.\r\n cookies = _login(**kwargs)\r\n\r\n if 'r' not in kwargs:\r\n # This is the first comments request.\r\n # Make the comments request and set an empty list.\r\n kwargs['r'] = requests.get('https://news.ycombinator.com/thre...
[ "0.6028869", "0.59971136", "0.594456", "0.59385234", "0.592934", "0.5916526", "0.5916526", "0.5870459", "0.58392066", "0.58221716", "0.5795665", "0.5788009", "0.57595724", "0.5736693", "0.5731914", "0.5636468", "0.56259465", "0.56077534", "0.5583711", "0.5546369", "0.552571",...
0.6636042
0
Appends to CSVs and removes any duplicated tweets or users before saving
def stream_to_db(subreddit: str, df_dict: dict, db_path: str) -> None: file_lkps = {'posts': f"reddit-{subreddit}-posts.csv", 'comments': f"reddit-{subreddit}-comments.csv"} for _key in df_dict: if df_dict.get(_key) is None: pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file(self) -> None:\n with open(self.output_file_path, mode='w', newline='') as csv_file:\n tweet = ['id', 'created_time', 'text']\n writer = csv.DictWriter(csv_file, fieldnames=tweet)\n writer.writeheader()\n for tweet in self.clean_unique_tweets:\n ...
[ "0.6951189", "0.6666629", "0.63679606", "0.6294705", "0.62620443", "0.6217467", "0.61684036", "0.60575086", "0.6054395", "0.60091347", "0.5874869", "0.58692265", "0.5854355", "0.58093345", "0.57850754", "0.5769864", "0.5757674", "0.5757009", "0.57195675", "0.5675526", "0.5671...
0.0
-1
The identity block is the block that has no ConvGRU layer at shortcut. Arguments
def identity_block(input_tensor, kernel_size, filters, stage, block): filters1, filters2, filters3 = filters if K.image_data_format() == 'channels_last': bn_axis = 3 else: bn_axis = 1 conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_block(self,X,stage,block):\n conv_name_base='res'+str(stage)+block+'_branch'\n bn_name_base='bn'+str(stage)+block+'_branch'\n \n #retrieve the filters\n #F1,F2,F3=filters\n \n X_shortcut=X\n \n #first component of main path\n X=Conv...
[ "0.7053969", "0.6951196", "0.69148076", "0.69123244", "0.69026166", "0.6895569", "0.68718547", "0.68239397", "0.67982614", "0.6778847", "0.6770707", "0.6738197", "0.67351675", "0.67298466", "0.67144144", "0.67034507", "0.67034507", "0.66972566", "0.6693836", "0.66613907", "0....
0.7369076
0
A block that has a conv layer at shortcut. Arguments
def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)): filters1, filters2, filters3 = filters if K.image_data_format() == 'channels_last': bn_axis = 3 else: bn_axis = 1 conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)", "def _convolution_block(self, X, filters, f, s, stage, block):\n\n\t\tconv_layer_name = 'res' + str(stage) + block + '_branch'\n\t\tbn_layer_name = 'bn' + str(stage) + block + ...
[ "0.72210574", "0.6797653", "0.67508686", "0.673468", "0.6702727", "0.66709983", "0.66706705", "0.6638113", "0.6602907", "0.6602907", "0.65983295", "0.65591985", "0.6556552", "0.6553555", "0.6531844", "0.65101147", "0.650745", "0.6479069", "0.6421294", "0.64118993", "0.6391051...
0.6319449
30
CallChangeOption Helper function used to call Config.ChangeOption.
def CallChangeOption(event, option, val, IdRange=0): Config.ChangeOption(option, val, IdRange)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cb_config(data, option, value):\n option_name = option.split(\".\")[-1]\n if option_name in vimode_settings:\n vimode_settings[option_name] = value\n return weechat.WEECHAT_RC_OK", "def __call__(self, givenEvent):\n return self._options[givenEvent]()", "def config_option(func):\n\n ...
[ "0.5770124", "0.56601584", "0.5591877", "0.54953575", "0.541492", "0.5305409", "0.52639145", "0.524375", "0.5221593", "0.51719373", "0.51574725", "0.5091422", "0.5087586", "0.502432", "0.5001329", "0.49955308", "0.4986194", "0.49639228", "0.49518788", "0.49281865", "0.4927516...
0.8534425
0
CallChangeColorFile Used to call ChangeColorFile
def CallChangeColorFile(event, item, newcolor): ChangeColorFile(item, newcolor) event.Skip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_file_change(op_list_file):\n if os.path.exists(\"flag_change_file.txt\"):\n print(\n \"-----maybe op_file has changed, so don't need to change again------\"\n )\n else:\n run_multi_thread(op_list_file)", "def setColorDiffuse(*args):", "def _color(self, args):", "...
[ "0.5624063", "0.5616077", "0.55919427", "0.5476601", "0.5475762", "0.546004", "0.54469645", "0.54314727", "0.5325275", "0.5319817", "0.5314164", "0.5309682", "0.53093964", "0.52945733", "0.52685404", "0.5266808", "0.5259466", "0.52457315", "0.524514", "0.52394056", "0.5238474...
0.82037705
0
ToggleSpinner Disables or enables the suplied widget depending on the arguments.
def ToggleSpinner(event, state, widget): if state == True: widget.Enable() else: widget.Disable() event.Skip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle(self):\n if self.is_enabled:\n self.disable()\n else:\n self.enable()", "def getSpinControl(*args):", "def toggle(self, **kwargs):\n self.on = False if self.on else True", "def spin(self):\n spinner = self._spinner_dict.get(self._current_gui, lambd...
[ "0.60068536", "0.5711606", "0.5626328", "0.559918", "0.5583677", "0.55804306", "0.55801517", "0.5556936", "0.5454728", "0.5453252", "0.54468673", "0.54066956", "0.5290974", "0.5263952", "0.5262461", "0.5248748", "0.5246615", "0.5209481", "0.5189879", "0.5189879", "0.5099715",...
0.82428086
0
__init__ Builds the entire frame GUI and binds their events across 3 Notebook tabs.
def __init__(self, IdRange, parent=None): wx.Frame.__init__(self, parent, -1, 'Settings', size=(300, 500)) self.SetIcon(wx.Icon('icons/gEcrit.png', wx.BITMAP_TYPE_PNG)) ConfigBook = wx.Notebook(self) dflt_text_win = DefaultCodeFr(self, -1) ConfigPanel = wx.Panel(ConfigBook) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,*args, **kwargs):\n tk.Tk.__init__(self, *args, **kwargs)\n self.winfo_toplevel().title(\"ElogQP\")\n self.container = tk.Frame(self)\n self.container.pack(side=\"top\", fill=\"both\", expand=True)\n self.container.grid_rowconfigure(0, weight=1)\n self.co...
[ "0.7510324", "0.7279233", "0.7052397", "0.6984583", "0.6961576", "0.6837817", "0.67607445", "0.67595774", "0.67372406", "0.6733946", "0.67217106", "0.67028195", "0.6688515", "0.6667774", "0.6654397", "0.6649185", "0.66375756", "0.6632218", "0.66252106", "0.6616836", "0.661658...
0.0
-1
ShowMe Makes window visible.
def ShowMe(self, event): self.Show(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_window(self):\n self.show()", "def show(self):\n self._window.show()", "def show(self, window):\r\n\r\n return", "def show(self):\n self.wid.show()", "def show_window(self):\n self._window.grab_set()\n self._window.wait_window()", "def show(self):\n ...
[ "0.78528696", "0.7491415", "0.734914", "0.72472316", "0.7217072", "0.7105373", "0.709106", "0.70552", "0.6812878", "0.68034613", "0.6783857", "0.67171425", "0.66291493", "0.66144276", "0.65156806", "0.65005463", "0.6489242", "0.6466619", "0.6453149", "0.6444627", "0.6414573",...
0.7963508
0
HideMe Hides the window.
def HideMe(self, event): self.Hide()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide (self):\n \n self.top.withdraw()", "def hide(self):\n\n self.stop_repl()\n self.visible = False\n self.withdraw() # Hide window", "def hideWindow(*args, **kwargs):\n\targs[0].hide()\n\treturn True # Prevents windows from being destroyed", "def hide_gui():\n ...
[ "0.7509359", "0.74262136", "0.74119747", "0.7347229", "0.7313304", "0.7259042", "0.72342604", "0.72129107", "0.712137", "0.71150166", "0.70670795", "0.695298", "0.695298", "0.69347274", "0.69264334", "0.68977106", "0.6878487", "0.6852868", "0.68457806", "0.68457806", "0.66689...
0.8016458
0
viewLog Creates child class and the required controls to view the log file.
def viewLog(self, event): logcontent = "" if Config.GetOption("ActLog") == True: logFrame = wx.Frame(None, -1, "View Log", size=(500, 500)) panel5 = wx.Panel(logFrame) data = wx.richtext.RichTextCtrl(panel5, pos=(0, 0), size=(500, 500)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onViewLog(self):\n view_log.ViewLog(self.root, self.log)", "def __init__(self, log):\n self.log = log\n self.logger = logging.getLogger(self.__class__.__name__)", "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.log = logging.getLogger(logg...
[ "0.7140692", "0.6262259", "0.6205708", "0.6183581", "0.6140777", "0.6120262", "0.6110456", "0.6074646", "0.6068381", "0.5992768", "0.59753233", "0.59445345", "0.5932987", "0.59261584", "0.5916817", "0.5870651", "0.5854801", "0.582109", "0.5819214", "0.57651544", "0.57493365",...
0.6518171
1
Deletes a database (including all of its content)
def dropDatabase(database: str) -> int: bd = _database(database) if bd: mode = bd["modo"] val = -1 if mode == "avl": val = avl.dropDatabase(database) elif mode == "b": val = b.dropDatabase(database) elif mode == "bplus": val = bp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete():\n\n from slicr.extensions import db\n\n click.echo('deleting database...')\n\n db.drop_all()", "def delete_db():\n db.drop_all()", "def delete_database(self, db_name):\n seqids = self.read_sequence_ids()\n if seqids.has_key(db_name):\n del seqids[db_name]\n ...
[ "0.8474899", "0.8428532", "0.8335932", "0.8017926", "0.7911105", "0.78136265", "0.77087384", "0.76592094", "0.7650008", "0.7644191", "0.76279265", "0.76096135", "0.75515336", "0.7541356", "0.7520412", "0.7507527", "0.7507527", "0.7507527", "0.7507527", "0.7507527", "0.7507527...
0.6470409
85
Show stored tables in a database
def showTables(database: str) -> list: bd = _database(database) if bd: temp = [] for tabla in bd["tablas"]: temp.append(tabla["nombre"]) return temp else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tables(db_name):\n output = execute_sql(db_name, \"SELECT name FROM sqlite_master WHERE type='table';\")\n return output", "def print_all_tables(self):\n conn = self.connect()\n cursor = conn.cursor()\n cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table';\")\n ...
[ "0.8200163", "0.81605095", "0.7972206", "0.79212195", "0.7688659", "0.76660615", "0.74795884", "0.74692786", "0.725298", "0.72428435", "0.7228695", "0.7196219", "0.71868455", "0.7164307", "0.71335703", "0.71097875", "0.70934194", "0.7086187", "0.7042627", "0.7024616", "0.6973...
0.7387159
8
Shows the content of a table in a database
def extractTable(database: str, table: str) -> list: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.extractTable(database, table) elif mode == "b": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_table():\n\n title_list = ('ID', 'Platform', 'Producer', 'Year', 'Elements')\n \n return table, title_list", "def show_table(table):\n # id: string\n # Unique and random generated (at least 2 special char()expect: ';'),\n # 2 number, 2 lower and 2 upper case letter)\n # title: strin...
[ "0.7212587", "0.71289164", "0.70197195", "0.6874066", "0.68284047", "0.68177825", "0.6747309", "0.6714994", "0.671255", "0.66996676", "0.6638418", "0.6635951", "0.66036886", "0.65979177", "0.6573617", "0.6500042", "0.64614534", "0.6458373", "0.6449587", "0.6435649", "0.640571...
0.0
-1
Shows the content whitin a range of a table in a database
def extractRangeTable(database: str, table: str, columnNumber: int, lower: any, upper: any) -> list: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.extractRangeT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range_table(self):\n raise NotImplementedError('Abstract method.')", "def show_from_database(self, table_model):\n arr = [4, 1]\n # TODO", "def stellar_parameter_range(database, wg=None):\n\n if wg is None:\n nodes = database.retrieve(\"SELECT id, wg, name FROM nodes\")\n ...
[ "0.6461188", "0.6133613", "0.6034139", "0.60295755", "0.59628725", "0.58607167", "0.5770134", "0.574829", "0.57135546", "0.5680441", "0.5577699", "0.55736077", "0.5572799", "0.55701166", "0.5559747", "0.5543442", "0.55161947", "0.551111", "0.5509736", "0.5483184", "0.5446467"...
0.6045047
2
Adds a PK to a table in a database
def alterAddPK(database: str, table: str, columns: list) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.alterAddPK(database, table, columns) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_primary_key(conn, schema, table, pk_col):\n sql_str = \"\"\"alter table {schema}.{table} add primary key ({col})\"\"\".format(\n schema=schema, table=table, col=pk_col)\n\n conn.execute(sql_str)", "def _add_pk(self, conn, *, tblname, pk_columns):\n idx_metadatum = partition_utils.Inde...
[ "0.797413", "0.7212407", "0.69147974", "0.64817303", "0.63581043", "0.63272965", "0.6162341", "0.61356944", "0.5969361", "0.5936504", "0.59194344", "0.5830549", "0.5788693", "0.5765031", "0.5741231", "0.5717886", "0.5691602", "0.56784236", "0.5649651", "0.5644707", "0.5643967...
0.59272844
10
Deletes PKs of a table in a database
def alterDropPK(database: str, table: str) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.alterDropPK(database, table) elif mode == "b": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deletePlayers():\n executeNonQuery(\"TRUNCATE TABLE players CASCADE;\")", "def deletePlayers():\n\n conn, c = main.connect()\n\n c.execute(\"TRUNCATE player CASCADE\")\n\n conn.commit()\n conn.close()", "def _delete (self):\n self._exec ('delete from table_name where id=%(id)s')", "...
[ "0.67841387", "0.67500883", "0.66656727", "0.66598505", "0.6647046", "0.6556503", "0.64608335", "0.6454066", "0.6424887", "0.63952935", "0.635271", "0.6331988", "0.63253903", "0.63232535", "0.6317377", "0.6269487", "0.62475073", "0.62289524", "0.620775", "0.61977184", "0.6180...
0.5870445
50
Renames a table in a database
def alterTable(database: str, tableOld: str, tableNew: str) -> int: bd = _database(database) if bd: tb = _table(database, tableOld) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.alterTable(database, tableOld, tableNew) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_table(base, tablename: str, table: Table) -> str:\n return snake_to_camel(tablename, upper=True)", "def rename_table(self):\n\n return \"\"\"ALTER TABLE \"users\" RENAME TO \"core\\\"\"\"\"", "def test_rename_table(self):\n name_column = Varchar()\n name_column._meta.name = \...
[ "0.7940475", "0.74909514", "0.7356303", "0.7134465", "0.70825166", "0.6972991", "0.6942648", "0.6555865", "0.64656806", "0.6425714", "0.6373571", "0.6366362", "0.6279711", "0.62735", "0.626685", "0.6241444", "0.6194818", "0.61261487", "0.60878855", "0.6052213", "0.6016514", ...
0.54558754
54
Appends a column to a table in a database
def alterAddColumn(database: str, table: str, default: any) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.alterAddColumn(database, table, default) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addColumn(self, table, column, init_data):\n\t\tcommand = \"ALTER TABLE \" + table + \" ADD COLUMN \" + str(column) + \" \" + getSQLiteType(init_data)\n\t\ttry:\n\t\t\tself._run_command(command)\n\t\texcept sqlite3.OperationalError:\n\t\t\tprint(\"Column \" + str(column) + \" already exists!\")", "def add_c...
[ "0.76016784", "0.7577322", "0.74984765", "0.73872393", "0.7291336", "0.7279017", "0.7264292", "0.7258774", "0.72526145", "0.7250797", "0.7218453", "0.70894194", "0.7047689", "0.7037254", "0.6983311", "0.69097465", "0.6874578", "0.6850834", "0.68338376", "0.6822801", "0.682184...
0.56772554
98
Deletes a column of a table in a database
def alterDropColumn(database: str, table: str, columnNumber: int) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.alterDropColumn(database, table, columnN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_column(self, fieldname):\n ...", "def deleteColumn(self, table: Table, column: Column,\n noLine, noColumn):\n database = SymbolTable().useDatabase\n if not database:\n desc = f\": Database not selected\"\n ErrorController().add(4, 'Execution'...
[ "0.80468893", "0.7498241", "0.7320566", "0.7136943", "0.7135099", "0.7094313", "0.67570573", "0.67331475", "0.6698586", "0.6558055", "0.65470445", "0.6537746", "0.6529836", "0.65186834", "0.65159416", "0.6453438", "0.6452822", "0.6425234", "0.628794", "0.6216746", "0.6178394"...
0.6225687
19
Deletes a table in a database (including all of its content)
def dropTable(database: str, table: str) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.dropTable(database, table) elif mode == "b": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_table(self, db, table_name):\n pass", "def deleteTable(self):\n return self.db.table_drop(self.entity).run(self.r)", "def delete_table(db, table_name):\n global DB_CONNECTIONS\n con = DB_CONNECTIONS.get(db, None)\n if con is not None:\n db_name = Path(db).name\n ...
[ "0.8282871", "0.8208072", "0.81827366", "0.794374", "0.79349744", "0.7882655", "0.78345776", "0.7790499", "0.7784332", "0.7678593", "0.76676506", "0.7639929", "0.76353526", "0.75528246", "0.7545451", "0.750076", "0.7459097", "0.74460846", "0.74400544", "0.74296826", "0.741218...
0.0
-1
Inserts a register into a table in a database
def insert(database: str, table: str, register: list) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: encoding = bd["encoding"] mode = tb["modo"] for y in register: if type(y) == str: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, username, password, phone, email):\n \n cur = self.db.cursor()\n query = \"\"\"INSERT INTO users( username, password, phone, email)\n VALUES(%s, %s, %s, %s) RETURNING username, password, phone, email;\"\"\"\n \n data = (username, password, phone, email)\...
[ "0.73191357", "0.7190302", "0.7068214", "0.6826038", "0.6779107", "0.67736864", "0.6741166", "0.6665618", "0.66551596", "0.6636065", "0.65866435", "0.6579655", "0.6553802", "0.651125", "0.64816", "0.64687675", "0.6458481", "0.64559144", "0.64423525", "0.64351416", "0.6427935"...
0.66108173
10
Loads a csv file and inserts its content into a table in a database
def loadCSV(file: str, database: str, table: str) -> list: bd = _database(database) if bd: tb = _table(database, table) encoding = bd["encoding"] if tb: mode = tb["modo"] try: with open(file, 'r', encoding='utf-8-sig') as leer: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_table_from_csv(csv_file, csv_encoding='iso-8859-15'):\n try:\n with open(file=csv_file, mode='r', encoding=csv_encoding) as input_file:\n # Could find a good place to add iterators/generators/comprehensions elsewhere, so made a new function\n # Also, yet another pylint ...
[ "0.77925056", "0.74694026", "0.7324558", "0.7270698", "0.7181123", "0.7180284", "0.71793205", "0.7163057", "0.71629786", "0.71574324", "0.71534336", "0.71316504", "0.70502", "0.704839", "0.69889295", "0.69630796", "0.6903439", "0.68700767", "0.6814116", "0.6785114", "0.677750...
0.0
-1
Shows a register of a table in a database
def extractRow(database: str, table: str, columns: list) -> list: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.extractRow(database, table, columns) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_register_form():\n return render_template(\"register-form.html\")", "def show(self):\n return view('auth/register', {'app': application, 'Auth': Auth(self.request), 'json': json})", "def register_form():\n\n return render_template(\"register.html\")", "def register_form():\n\n return...
[ "0.62542564", "0.61312747", "0.6043063", "0.5966525", "0.59552217", "0.59499764", "0.5833451", "0.58298564", "0.5817573", "0.58131176", "0.57852143", "0.57403255", "0.5733492", "0.57310855", "0.56588715", "0.5648972", "0.5645039", "0.5632103", "0.5623753", "0.5616882", "0.558...
0.0
-1
Updates a register into a table in a database
def update(database: str, table: str, register: dict, columns: list) -> int: datosAntiguos = False nombreST = str(database) + '-' + str(table) if BC.EsUnaTablaSegura(nombreST, _main_path): datosAntiguos = extractRow(database, table, columns) bd = _database(database) if bd: tb = _t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, username, password, phone, email):\n \n cur = self.db.cursor()\n query = \"\"\"INSERT INTO users( username, password, phone, email)\n VALUES(%s, %s, %s, %s) RETURNING username, password, phone, email;\"\"\"\n \n data = (username, password, phone, email)\...
[ "0.6516402", "0.6428764", "0.6402065", "0.6328693", "0.6220912", "0.6200072", "0.6200072", "0.617463", "0.61485815", "0.6130257", "0.6029388", "0.5936732", "0.59345907", "0.5929567", "0.589191", "0.5871383", "0.5854142", "0.58514607", "0.58431804", "0.5804175", "0.576566", ...
0.5758869
21
Deletes a register into a table in a database
def delete(database: str, table: str, columns: list) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.delete(database, table, columns) elif mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n DBSESSION.delete(self)\n DBSESSION.commit()\n LOG.info(f\"Register of {self.str_representation} with id = {self.id} was successfully deleted.\")", "def delete_table(self, name: str) -> None:", "def _delete_table(self, db, table_name):\n pass", "def delete_table...
[ "0.7344221", "0.7181427", "0.706336", "0.7025284", "0.70190406", "0.6915389", "0.6836861", "0.67948556", "0.66886204", "0.6609935", "0.6599953", "0.65704", "0.65645623", "0.65645623", "0.65297383", "0.65135294", "0.6495734", "0.6492094", "0.6489976", "0.6486023", "0.64838046"...
0.0
-1
Deletes the content of a table in a database
def truncate(database: str, table: str) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.truncate(database, table) elif mode == "b": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_table(self, db, table_name):\n pass", "def delete_table(self, name: str) -> None:", "def deleteTable(self):\n return self.db.table_drop(self.entity).run(self.r)", "def _delete (self):\n self._exec ('delete from table_name where id=%(id)s')", "def delete_table_data():\n t...
[ "0.808416", "0.7975429", "0.7945793", "0.7791311", "0.77786446", "0.7748327", "0.77452457", "0.7692215", "0.76638746", "0.7551619", "0.75302505", "0.74895793", "0.7483878", "0.74780554", "0.7450529", "0.7442677", "0.7392804", "0.73516816", "0.73074657", "0.72962385", "0.72219...
0.0
-1
Restructures a database inner structure
def alterDatabaseMode(database: str, mode: str) -> int: try: bd = _database(database) if bd: if bd["modo"] == mode or mode not in ["avl", "b", "bplus", "dict", "hash", "isam", "json"]: return 4 data = [] lista_tablas = showTables(database) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_database(self):\n self.DBDict = self.data_df.to_dict(orient=\"index\")\n\n # calculate weight ratio\n self.DBDict = {k: self.calc_compound_weight_ratio(\n self.DBDict[k]) for k in self.DBDict}\n\n # export as dataframe\n self.converted_df = pd.DataFrame(sel...
[ "0.6076564", "0.58922535", "0.579", "0.5749501", "0.5711321", "0.56398124", "0.54710424", "0.5437469", "0.5436171", "0.5378796", "0.5349269", "0.53385985", "0.53322494", "0.5315631", "0.52831435", "0.52700615", "0.5260067", "0.5251986", "0.5149641", "0.5125559", "0.5113474", ...
0.0
-1
Restructures a table inner structure
def alterTableMode(database: str, table: str, mode: str) -> int: try: bd = _database(database) if bd: tb = _table(database, table) if tb: if tb["modo"] == mode or mode not in ["avl", "b", "bplus", "dict", "hash", "isam", "json"]: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_table(self):\n i = 0\n for item in ['DN[-]', 'd_out[mm]', 'tl_trub[mm]', 'roztec_trub[mm]', 'delka[mm]', 'roztec_prep[mm]', 'vyska_prep[mm]']:\n self.table.insertColumn(i)\n self.table.setHorizontalHeaderItem(i, QTableWidgetItem(item))\n i += 1\n fo...
[ "0.60329634", "0.5926206", "0.59235996", "0.59156257", "0.5842843", "0.5792483", "0.57503146", "0.57097197", "0.5705552", "0.56952924", "0.5677851", "0.5660064", "0.5639272", "0.5616803", "0.5605774", "0.55533993", "0.55469185", "0.5540514", "0.55137295", "0.5497372", "0.5477...
0.0
-1
Adds a foreign key to a table
def alterTableAddFK(database: str, table: str, indexName: str, columns: list, tableRef: str, columnsRef: list) -> int: bd = _database(database) if bd: tb = _table(database, table) tb_r = _table(database, tableRef) if tb and tb_r: if len(columns) != len(columnsRef): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_foreign_key(self, table_name, column, fk_table, fk_column, name=None):\n if not table_name:\n table_name = self.name\n if not name:\n name = self.new_fk_index_name(column, fk_column)\n try:\n self.execute(self.commands.add_foreign_key(\n ...
[ "0.77914417", "0.6499988", "0.6481544", "0.64692926", "0.6452423", "0.63490236", "0.63257205", "0.6283345", "0.62422293", "0.61913806", "0.61483616", "0.60246605", "0.5972212", "0.5967249", "0.5918298", "0.5869725", "0.56648976", "0.56552577", "0.5639564", "0.56316566", "0.56...
0.63679653
5
Deletes a foreign key
def alterTableDropFK(database: str, table: str, indexName: str) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: fk = _foreign_key(database, indexName) if fk: return tb["foreign_keys"].delete(indexName) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_foreign_key(self, fk_table_name, fk_name):\n self.execute(self.commands.drop_foreign_key(fk_table_name, fk_name))\n self.commit()", "def delete(self):\n query = \"DELETE FROM \" + self.table + \" WHERE \" + self.idfield + \"=%s\"\n dbh = dbstuff.getRW(self.dbh_key)\n try:\n c...
[ "0.7307489", "0.6532903", "0.6432936", "0.6427881", "0.64237875", "0.6300452", "0.6284552", "0.6283573", "0.62751234", "0.6270331", "0.6258694", "0.620709", "0.620648", "0.620648", "0.620648", "0.620648", "0.620648", "0.620648", "0.620648", "0.620648", "0.620648", "0.618526...
0.60653955
29
Adds an unique index to a table
def alterTableAddUnique(database: str, table: str, indexName: str, columns: list) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: tb["unique_index"].insert([indexName, table, columns]) return 0 else: return 3 else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_table_indexes(collection) -> None:\n # Unique ticker event ID\n collection.create_index('data.u', unique=True)\n # The symbol, e.g. BTCUSDT\n collection.create_index('data.s')\n # The time for sorting.\n collection.create_index('time')", "def create_index(self, indexname, table, colu...
[ "0.6950932", "0.66842467", "0.667532", "0.6672381", "0.6609532", "0.6567683", "0.63993394", "0.63612676", "0.6354538", "0.6333292", "0.6333292", "0.632288", "0.6283021", "0.62678844", "0.6257337", "0.62452674", "0.6228201", "0.61746067", "0.6142951", "0.60947925", "0.602906",...
0.70561254
0
Deletes an unique index
def alterTableDropUnique(database: str, table: str, indexName: str) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: fk = _unique_index(database, indexName) if fk: return tb["unique_index"].delete(indexName) el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_index( env, logger ):\n global adapter_glob\n if adapter_glob is not None:\n adapter = adapter_glob\n else:\n logger.warning( u\"Connecting to index...\" )\n adapter = adapter_file.adapter(env)\n adapter_glob = adapter\n adapter.delete( queries=[\"*:*\"] )\n a...
[ "0.7866251", "0.7690482", "0.7287023", "0.7146124", "0.71191764", "0.7003967", "0.69910884", "0.69812775", "0.6978048", "0.6943532", "0.6943532", "0.69430524", "0.68292207", "0.6732258", "0.672679", "0.66857874", "0.6668518", "0.66267395", "0.6616685", "0.6585095", "0.6505377...
0.62490404
35
Adds an index to a table
def alterTableAddIndex(database: str, table: str, indexName: str, columns: list) -> int: bd = _database(database) if bd: tb = _table(database, table) if tb: tb["index"].insert([indexName, table, columns]) return 0 else: return 3 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_index(self, index):\n self.add_index_sig(IndexSignature.from_index(index))", "def add_index(self, index):\n self.add_index_sig(IndexSignature.from_index(index))", "def create_index():", "def post(self):\n args = table_index_create.parse_args(req=None, strict=False)\n retur...
[ "0.73783195", "0.73783195", "0.71194965", "0.70425427", "0.69791955", "0.69791514", "0.69791514", "0.6961796", "0.6901625", "0.6799187", "0.6746161", "0.6639124", "0.6572811", "0.6415044", "0.637327", "0.6346673", "0.6333546", "0.63302356", "0.6294157", "0.6294157", "0.628760...
0.7019514
4
Changes a database encoding
def alterDatabaseEncoding(database: str, encoding: str) -> int: bd = _database(database) if bd: if encoding not in ["utf8", "ascii", "iso-8859-1"]: return 3 else: bd["encoding"] = encoding try: table = bd["tablas"] for t in ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_encoding(self, encoding):\n\n self._encoding = encoding", "def setEncoding(self,value):\n self.PDFreactorConfiguration.in1[\"encoding\"] = value", "def encoding(self, enc):\n self._encoding = enc", "def setEncoding(self, value):\n return self._set(encoding=value)", "def chan...
[ "0.67461425", "0.64060473", "0.634873", "0.623026", "0.619429", "0.61455333", "0.6030758", "0.5986381", "0.5978252", "0.59553367", "0.5942807", "0.5934476", "0.5905521", "0.5881358", "0.5742639", "0.5733933", "0.5719861", "0.56561494", "0.5630939", "0.562058", "0.5567001", ...
0.78333086
0
Generates a database checksum
def checksumDatabase(database: str, mode: str) -> str: bd = _database(database) if bd: if mode not in ["MD5", "SHA256"]: return None return ch.checksumDatabase(database,mode) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksumTable(database: str, table: str, mode: str) -> str:\n\n bd = _database(database)\n\n if bd:\n\n tb = _table(database, table)\n\n if tb:\n\n if mode not in [\"MD5\", \"SHA256\"]:\n return None \n\n return ch.checksumTable(database, tabl...
[ "0.66937816", "0.6190386", "0.61403894", "0.60973465", "0.60893285", "0.6068533", "0.60548466", "0.5977226", "0.5915417", "0.59037364", "0.589102", "0.58852303", "0.58622736", "0.58616817", "0.5835881", "0.5829948", "0.5826346", "0.57996047", "0.5776036", "0.5759001", "0.5728...
0.7103147
0
Generates a table checksum
def checksumTable(database: str, table: str, mode: str) -> str: bd = _database(database) if bd: tb = _table(database, table) if tb: if mode not in ["MD5", "SHA256"]: return None return ch.checksumTable(database, table, mode) else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum_full_table(self):\n # Calculate checksum for old table\n old_checksum = self.query(\n sql.checksum_full_table(self.table_name, self._old_table.column_list)\n )\n\n # Calculate checksum for new table\n new_checksum = self.query(\n sql.checksum_fu...
[ "0.64989996", "0.6389361", "0.60043424", "0.5984078", "0.5979633", "0.5943067", "0.59368956", "0.5757987", "0.574514", "0.57429785", "0.5741921", "0.5712693", "0.566631", "0.56360173", "0.5609682", "0.5606184", "0.5592736", "0.5590365", "0.5528552", "0.5523038", "0.55114263",...
0.6832998
0
Encrypts a database backup
def encrypt(backup: str, password: str) -> str: try: return comp.encriptar(backup, password) except: return '1'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup():\n backup_shift(os, config.utils.tasks.backup_depth)\n if config.utils.tasks.secret_key is None:\n shutil.copyfile(config.core.database_name, config.core.database_name+'.1')\n else:\n data = get_encrypted_database()\n with open(config.core.database_name+'.1', 'wb') as f:\...
[ "0.76307666", "0.68583685", "0.6519847", "0.6505042", "0.63152915", "0.62139744", "0.6127814", "0.6040174", "0.6035554", "0.5945199", "0.5941164", "0.5670987", "0.56525385", "0.5643152", "0.56106496", "0.5586842", "0.5586417", "0.55854", "0.55685306", "0.55681694", "0.5545194...
0.6583493
2
Encrypts a database backup
def decrypt(cipherBackup: str, password: str) -> str: try: return comp.desencriptar(cipherBackup, password) except: return '1'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup():\n backup_shift(os, config.utils.tasks.backup_depth)\n if config.utils.tasks.secret_key is None:\n shutil.copyfile(config.core.database_name, config.core.database_name+'.1')\n else:\n data = get_encrypted_database()\n with open(config.core.database_name+'.1', 'wb') as f:\...
[ "0.76307666", "0.68583685", "0.6583493", "0.6519847", "0.6505042", "0.63152915", "0.62139744", "0.6127814", "0.6040174", "0.6035554", "0.5945199", "0.5941164", "0.5670987", "0.56525385", "0.5643152", "0.5586842", "0.5586417", "0.55854", "0.55685306", "0.55681694", "0.5545194"...
0.56106496
15
Enables safe mode for a table in a database
def safeModeOn(database: str, table: str) -> int: nombreST = str(database) + '-' + str(table) if not _database(database): return 2 if not _table(database, table): return 3 if BC.EsUnaTablaSegura(nombreST, _main_path): return 4 try: BC.CreateBlockChain(nombreST, _ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safeModeOff(database: str, table: str) -> int:\n\n nombreST = str(database) + '-' + str(table)\n\n if not _database(database):\n return 2\n\n if not _table(database, table):\n return 3\n\n if not BC.EsUnaTablaSegura(nombreST, _main_path):\n return 4\n\n try:\n BC.Dele...
[ "0.6526765", "0.649856", "0.649856", "0.64588463", "0.6081784", "0.60203445", "0.599737", "0.576383", "0.57122225", "0.566805", "0.56553423", "0.56194913", "0.5618057", "0.55770737", "0.555558", "0.55528665", "0.5505558", "0.54966724", "0.5485075", "0.5333716", "0.53314537", ...
0.6587872
0
Disables safe mode for a table in a database
def safeModeOff(database: str, table: str) -> int: nombreST = str(database) + '-' + str(table) if not _database(database): return 2 if not _table(database, table): return 3 if not BC.EsUnaTablaSegura(nombreST, _main_path): return 4 try: BC.DeleteSafeTable(nombreS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(mode='soft'):\n Qdb().disable(mode)", "def allow_syncdb(self, db, model):\n return True", "def allow_syncdb(self, db, model):\n return True", "def safeModeOn(database: str, table: str) -> int:\n nombreST = str(database) + '-' + str(table)\n if not _database(database):\n ...
[ "0.6601288", "0.63316554", "0.63316554", "0.62221414", "0.6210767", "0.615746", "0.59436333", "0.58665496", "0.5816745", "0.5745367", "0.5609925", "0.5590738", "0.55830115", "0.5501912", "0.5471799", "0.54703504", "0.54557586", "0.54145384", "0.5412278", "0.54096645", "0.5406...
0.72843796
0
Graphs a database ERD
def graphDSD(database: str) -> int: db = _database(database) if db: return graph.graphDSD(database) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_sql(self, table_name=None):\n\t\tlabels={}\n\t\tif table_name in self.DiG:\n\t\t\tsubgraph = self.get_subgraph(table_name)\n\t\t\tfor node in subgraph:\n\t\t\t\tlabels[node] = node\n\t\t\tprint(labels)\n\t\t\tnx.draw_spring(subgraph,labels=labels,font_size=8,node_size=300,alpha=0.7)\n\t\t\tplt.draw()\n\t\...
[ "0.70083284", "0.6847605", "0.6845175", "0.6487676", "0.6411189", "0.6335492", "0.6328995", "0.63088155", "0.6299614", "0.62519145", "0.624884", "0.62116575", "0.62056077", "0.61232126", "0.6097815", "0.60871184", "0.6086293", "0.60786444", "0.6057168", "0.6048504", "0.602116...
0.5324098
90
Graphs a table s functional dependencies
def graphDF(database: str, table: str) -> int: db = _database(database) if db: return graph.graphDF(database,table) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_dependencies(tables):\n tables = list(tables)\n graph = {}\n def visit_foreign_key(fkey):\n if fkey.use_alter:\n return\n parent_table = fkey.column.table\n if parent_table in tables:\n child_table = fkey.parent.table\n if parent_table is n...
[ "0.645483", "0.5654069", "0.5640785", "0.561997", "0.55941105", "0.55789673", "0.55632514", "0.5560617", "0.5552409", "0.55237514", "0.55124575", "0.5441507", "0.54151005", "0.53559804", "0.53465724", "0.5327631", "0.53274393", "0.52924687", "0.52850795", "0.5280849", "0.5220...
0.0
-1
Returns a dataset with the noliposome condition values subtracted.
def background_subtract_data(data): bgsub_data = data.copy() bax_concs = data.columns.levels[0] lipo_concs = data.columns.levels[1] for bax_conc in data.columns.levels[0]: timecourses = data.xs(bax_conc, axis=1, level='Bax') bg = timecourses[0.] for lipo_conc in lipo_concs: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_negative_data(self):\n negative_df = pd.DataFrame(columns=HeatStrokeDataFiller.important_features, index=np.arange(self.num_negative))\n for field in negative_df.columns:\n parameter_distribution = HeatStrokeDataFiller.negative_default[field]\n negative_df[field].loc[:] ...
[ "0.6519424", "0.5944461", "0.58864164", "0.58284235", "0.576742", "0.5748784", "0.5742863", "0.5741857", "0.57243454", "0.57041985", "0.5657011", "0.5646586", "0.5629784", "0.56278014", "0.5496016", "0.5485245", "0.54735637", "0.54533195", "0.54512817", "0.54376525", "0.53877...
0.0
-1
Convert daily Github issues from mongodb to BigARTM format (UCI Bagofwords)
def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("-t", "--target-dir", required=True, help="Directory to store bigARTM files") parser.add_argument("--start-date", default="2015-12-01", help="Start date(YYYY-MM-DD) to convert mongodb f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n verbose = False\n online = True\n\n if online:\n TOKEN = \"\"\n g = Github(base_url=\"https://github.ibm.com/api/v3\", login_or_token=TOKEN)\n repo = g.get_repo(\"Raphael-Lambert/test_note\")\n\n path = \"C:/Users/RaphaelLambert/Documents/git_issues\"\n onlyfiles =...
[ "0.5371995", "0.5351099", "0.5217168", "0.5203004", "0.51921064", "0.5157592", "0.50705695", "0.5066366", "0.5036247", "0.4937896", "0.47906277", "0.47864658", "0.47658864", "0.4753645", "0.47526726", "0.47179803", "0.47064632", "0.47028103", "0.46983656", "0.46869716", "0.46...
0.5855663
0
Run experiment n_pulls times. Updates return Q on each iteration.
def experiment(self, n_pulls: int): self.N = np.zeros(self.n_arms) self.Q = np.zeros(self.n_arms) Q_history = np.array([]) for pull in range(n_pulls): action = self.get_action(pull) reward = self.get_reward(action, pull) Q = self.update_Q(action, rewa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_pulls():\n for repo in Repository.objects.all():\n # distribute pulls by delaying evenly across an hour\n pk_hash = hashlib.sha256(str(repo.pk).encode())\n delay_s = int(pk_hash.hexdigest(), 16) % (60 * 60)\n\n pull.apply_async(\n args=(repo.remote_id, repo.pr...
[ "0.58870846", "0.58440375", "0.5743763", "0.5656772", "0.55926", "0.55351824", "0.5529241", "0.5444302", "0.54419786", "0.54373276", "0.5437268", "0.5400262", "0.5295067", "0.5259368", "0.5251553", "0.5244251", "0.5202766", "0.51938194", "0.51859874", "0.51479423", "0.5139781...
0.6956549
0
Execute command or private command.
def execute(cmd, msg, private=False): cmd_dict = private_cmds if private else cmds if cmd in cmd_dict: return cmd_dict[cmd](msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_command(self, command):\n raise NotImplementedError", "def execute_command(self):\n raise Exception(\"Not implemented\")", "def execute(self, command, user_context=None):\n return self.parse(command, user_context).execute()", "def execute(cmd_string):\n pass", "def execu...
[ "0.7519614", "0.74905926", "0.7160174", "0.7044931", "0.701376", "0.6983892", "0.69729316", "0.6947648", "0.6915622", "0.6850946", "0.68431306", "0.68125206", "0.6798981", "0.6782056", "0.6780938", "0.6709017", "0.66989166", "0.66972363", "0.6690021", "0.6674003", "0.6674003"...
0.73234296
2
Wire type" is a part of the "key" that carries enough information to parse value from the wire, i.e. read correct amount of bytes, but there's not enough informaton to interprete in unambiguously. For example, one can't clearly distinguish 64bit fixedsized integers from 64bit floats, signed zigzagencoded varints from r...
def wire_type(self): if hasattr(self, '_m_wire_type'): return self._m_wire_type if hasattr(self, '_m_wire_type') else None self._m_wire_type = self._root.Pair.WireTypes((self.key.value & 7)) return self._m_wire_type if hasattr(self, '_m_wire_type') else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self):\n return struct.unpack('<B', self.raw_data[0])[0]", "def pkt_type(self):\n return uint16_packer.unpack(self[32:34])[0]", "def Type(self, String):\r\n\r\n if (String == \"byte\") or (String == \"sbyte\"):\r\n return 1\r\n elif (String == \"word\") or (Strin...
[ "0.64454204", "0.6344862", "0.6177453", "0.5958382", "0.5952993", "0.5889277", "0.5840352", "0.5823337", "0.5787412", "0.577655", "0.5731551", "0.5713418", "0.56753224", "0.5661148", "0.564763", "0.56469196", "0.5632343", "0.56118524", "0.55602056", "0.55430776", "0.55326146"...
0.6732522
0
Identifies a field of protocol. One can look up symbolic field name in a `.proto` file by this field tag.
def field_tag(self): if hasattr(self, '_m_field_tag'): return self._m_field_tag if hasattr(self, '_m_field_tag') else None self._m_field_tag = (self.key.value >> 3) return self._m_field_tag if hasattr(self, '_m_field_tag') else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_field(cls, fullpath, buf, offset, record):\n cur_offset = offset\n field_id, length = struct.unpack_from('>HH', buf, cur_offset)\n cur_offset += 4\n if field_id != 0xFFFF and length > 0:\n field_name, decoder = cls.named_fields().get(field_id, (None, None))\n ...
[ "0.5957529", "0.59060884", "0.5869169", "0.5820498", "0.58075804", "0.5749224", "0.571788", "0.5674136", "0.56662714", "0.56519926", "0.5555956", "0.5481811", "0.5475428", "0.54737663", "0.54220575", "0.54131275", "0.54060864", "0.5402144", "0.5399504", "0.5397118", "0.537876...
0.54832816
11
creates combination of item based and content based recommender system
def incl_city_business(user_id, business_id, city): frame1 = pd.concat([pd.DataFrame(REVIEWS[x]) for x in REVIEWS if x == city]) businesses = pd.DataFrame() for business1 in BUSINESSES[city]: for business2 in BUSINESSES[city]: if business2['business_id'] != business_id and business1["b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recommender(self):\n\n self._build_sample_graph()\n\n # set skill sa score to 1.0 and skill sb score to 0.5\n measure_sa = competency.SuccessRateCompetencyMeasure.load(\n self.user_id, self.sa.id)\n measure_sa.add_score(1.0)\n measure_sa.save()\n measur...
[ "0.5934041", "0.5860087", "0.5854633", "0.58486146", "0.5600619", "0.5563894", "0.54696375", "0.54542816", "0.5449051", "0.5337651", "0.5331255", "0.5322723", "0.52529424", "0.52458346", "0.5242455", "0.5231326", "0.52107245", "0.5176489", "0.5176489", "0.5160324", "0.5156272...
0.0
-1
creates item based recommender system
def itembase(user_id): frame1 = pd.concat([pd.DataFrame(REVIEWS[x]) for x in REVIEWS]) filtered_data = recommender.filtering_not_city() businesses = pd.DataFrame(filtered_data).set_index('business_id') frame2 = frame1.drop_duplicates(subset=["user_id", "business_id"], keep='last', inplace=False) ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recommender(self):\n\n self._build_sample_graph()\n\n # set skill sa score to 1.0 and skill sb score to 0.5\n measure_sa = competency.SuccessRateCompetencyMeasure.load(\n self.user_id, self.sa.id)\n measure_sa.add_score(1.0)\n measure_sa.save()\n measur...
[ "0.6218103", "0.6210257", "0.61855394", "0.6122803", "0.58560014", "0.58560014", "0.5693004", "0.56778383", "0.5650346", "0.5633571", "0.557751", "0.5532578", "0.54750973", "0.53958327", "0.53644466", "0.5362876", "0.5344367", "0.53431237", "0.5330568", "0.5299743", "0.528890...
0.50555146
38
given a userId and BusinessId, this function returns the corresponding review
def get_review(reviews, userId, BusinessId): reviews = reviews[(reviews['business_id'] == BusinessId) & (reviews['user_id'] == userId)] if reviews.empty: return np.nan elif len(reviews) > 1: return float(reviews['stars'].max()) else: return float(reviews['stars'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_reviews():\n print(\"***** Find Reviews of a Business *****\")\n while (True):\n print()\n business_object = query_business_name()\n if business_object == \"back\":\n return\n elif business_object is None:\n continue\n id = business_object['bu...
[ "0.6462504", "0.63464046", "0.61958796", "0.6140048", "0.6079224", "0.59808564", "0.58458614", "0.5808643", "0.5693213", "0.55099154", "0.5501791", "0.54506606", "0.54472685", "0.5408173", "0.5311152", "0.528549", "0.52852464", "0.5272833", "0.52651584", "0.524855", "0.523621...
0.7737348
0
takes a review table as input and computes the utility matrix
def pivot_reviews(reviews): businessIds = reviews['business_id'].unique() userIds = reviews['user_id'].unique() pivot_data = pd.DataFrame(np.nan, columns=userIds, index=businessIds, dtype=float) for user in userIds: for business in businessIds: pivot_data.loc[business][user] = get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def performance_matrix(df):\r\n total = df.count()\r\n nP = df.filter((F.col('prediction') == 1)).count()\r\n nN = df.filter((F.col('prediction') == 0)).count()\r\n TP = df.filter((F.col('prediction') == 1) & (F.col('label') == 1)).count()\r\n FP = df.filter((F.col('prediction') == 1) & (F.col('labe...
[ "0.5854542", "0.58525765", "0.58460265", "0.57699704", "0.57382894", "0.5730551", "0.57017535", "0.5652791", "0.5607779", "0.5496936", "0.5473677", "0.5467458", "0.54510313", "0.5397981", "0.53845805", "0.5378737", "0.5375182", "0.5365264", "0.53591096", "0.53335047", "0.5329...
0.0
-1
computes the euclidean similarity
def similarity_euclid(matrix, business1, business2): selected_features = matrix.loc[business1].notna() & matrix.loc[business2].notna() if not selected_features.any(): return 0 features1 = matrix.loc[business1][selected_features] features2 = matrix.loc[business2][selected_features] distance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairwise_euclidean_similarity(x, y):\n s = 2 * torch.mm(x, torch.transpose(y, 1, 0))\n diag_x = torch.sum(x * x, dim=-1)\n diag_x = torch.unsqueeze(diag_x, 0)\n diag_y = torch.reshape(torch.sum(y * y, dim=-1), (1, -1))\n\n return s - diag_x - diag_y", "def euc_dist(self, squared=True):", "de...
[ "0.7442795", "0.7366634", "0.73303705", "0.72702587", "0.7191978", "0.71874243", "0.7170478", "0.71292555", "0.7122205", "0.71213186", "0.7113179", "0.71043175", "0.7030621", "0.70219976", "0.70203394", "0.70122296", "0.69272286", "0.692671", "0.69088495", "0.6883007", "0.682...
0.74360234
1
creates the similarity matrix based on euclidean distance
def create_similarity_matrix_euclid(matrix): similarity_matrix_euclid = pd.DataFrame(0, index=matrix.index, columns=matrix.index, dtype=float) for business1 in matrix.index: for business2 in matrix.index: similarity_matrix_euclid[business1][business2] = similarity_euclid(matrix, business1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_euclidean_matrix(df):\n df.reset_index(drop=True, inplace=True)\n\n # foods = df['food_names']\n # food_examples = []\n # indices = list(range(0, len(foods)))\n # for i in indices:\n # food_examples.append(str(foods[i]) + str(i))\n # food_examples = pd.Series(food_examples)\n fo...
[ "0.7097548", "0.69869065", "0.6850637", "0.68024546", "0.6692717", "0.6652696", "0.6636552", "0.6619056", "0.6616738", "0.6589348", "0.6544284", "0.6532676", "0.6520318", "0.6496218", "0.64808625", "0.6429152", "0.64220136", "0.64193624", "0.6398457", "0.6395359", "0.6357025"...
0.6689488
5
selects all items with similarity > 0
def select_neighborhood(similarity_matrix, utility_matrix, target_user, target_business): items_dict = {} new_matrix = utility_matrix[target_user].dropna() for business in new_matrix.index: if new_matrix[business] and similarity_matrix[business][target_business] > 0: items_dict[business...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_ratio_matches(matches, kp1, kp2, ratio=0.7):\n new_kp1, new_kp2, new_matches = [], [], []\n ctr = 0\n for i, (m, n) in enumerate(matches): #\n if m.distance < ratio * n.distance:\n new_kp1.append(kp1[m.queryIdx])\n new_kp2.append(kp2[m.trainIdx])\n new_m...
[ "0.5755423", "0.5642819", "0.5585275", "0.5528982", "0.549568", "0.54791164", "0.54765606", "0.5459276", "0.54465127", "0.5431656", "0.54239976", "0.5412709", "0.5372484", "0.53679526", "0.53638303", "0.53536546", "0.53348994", "0.5329641", "0.5297915", "0.52857894", "0.52804...
0.0
-1
computes the weighted mean
def weighted_mean(neighborhood, utility_matrix, user_id): if neighborhood.sum() != 0: return ((utility_matrix[user_id] * neighborhood).sum()) / neighborhood.sum() else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weightedMean(numlist, weights):\n\twxsum = 0.0\n\twsum = 0.0\n\n\tassert len(numlist) == len(weights)\n\n\tfor (x,w) in zip(numlist, weights):\n\t\twxsum += x*w\n\t\twsum += w\n\tif wsum == 0.0:\n\t\treturn 0.0\n\treturn wxsum/wsum", "def average_weights(w):\n w_avg = copy.deepcopy(w[0])\n for key in w...
[ "0.7932049", "0.78005934", "0.78005934", "0.78005934", "0.7797064", "0.7758014", "0.7724132", "0.766356", "0.76569927", "0.76120603", "0.7507334", "0.7482594", "0.7392918", "0.7322675", "0.73218936", "0.72820747", "0.72085583", "0.7199587", "0.71674925", "0.7164931", "0.71561...
0.666516
42
Iterator for page links
def iter_page_links(self) -> Iterable[str]: base_url = 'https://health.mil/About-MHS/OASDHA/Defense-Health-Agency/Resources-and-Management/DHA-Publications' yield base_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_links(self):", "def iter_page_links(self) -> Iterable[str]:\n base_url = 'https://www.med.navy.mil'\n r = requests.get(self.starting_url, verify=CERTIFICATE_DIR + '/cat3.pem')\n soup = bs4.BeautifulSoup(r.content, features=\"html.parser\")\n\n # get target column of list item...
[ "0.80651504", "0.75957644", "0.7370286", "0.73280376", "0.69186187", "0.69141686", "0.6908116", "0.6793799", "0.67863417", "0.6741017", "0.66748494", "0.6670355", "0.66565365", "0.6593838", "0.65873545", "0.65807104", "0.6502916", "0.6478992", "0.64505965", "0.64059603", "0.6...
0.750158
2
Parse document objects from page of text
def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]: # get the data data = requests.get(page_url) # load data into bs4 soup = BeautifulSoup(data.text, 'html.parser') # links = [] pdf_dis = [] dates = [] table = [] v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]:\n # parse html response\n url = \"https://www.med.navy.mil/directives/Pages/Publications.aspx\"\n base_url = 'https://www.med.navy.mil'\n parsed_docs = []\n doc_name_list = []\n if (page_u...
[ "0.6943239", "0.69207364", "0.6807848", "0.6564104", "0.6440653", "0.6434585", "0.6419085", "0.6406201", "0.63876253", "0.6367041", "0.6246994", "0.62138414", "0.6203199", "0.6178067", "0.6176524", "0.61475307", "0.6122435", "0.6108919", "0.60970265", "0.6094376", "0.6085055"...
0.71913856
0
run this CT model with other models CT input
def run(self, ct_data, state): transformed_input = copy.deepcopy(ct_data) output = self.model.run(ct_data, state) result = {"output": output, "transformed input": transformed_input} return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests():\n source1 = TextModel('prep')\n source1.add_file('source_model_1.txt')\n \n source2 = TextModel('athletes')\n source2.add_file('source_model_2.txt')\n\n new1 = TextModel('my_writing')\n new1.add_file('my_writing.txt')\n new1.classify(source1, source2)\n\n # Add code for ...
[ "0.6460919", "0.6433101", "0.63607436", "0.6235969", "0.6233244", "0.62312454", "0.61591774", "0.61472887", "0.6144754", "0.6134827", "0.61335844", "0.612184", "0.6115578", "0.6104375", "0.61010057", "0.6084759", "0.60830665", "0.607298", "0.60646755", "0.60414994", "0.600721...
0.62978494
3
Get the Men's Bathroom status.
def get_bathroom_buddy_mens_status(message): status = subscribe.simple( "Home/mens/state", hostname="m16.cloudmqtt.com", auth={'username': os.environ['USERNAME'], 'password': os.environ['SLACK_PASS']}, port=21775, tls={'ca_certs': certifi.where()}) return(status.payload)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power_status(self):\n response = self.parent.power_manager.get_status()\n if response is not None:\n response = response[0]\n\n batteries = []\n for batt in response[\"batt_data\"]:\n batteries.append(batt)\n response[\"batt_data\"] =...
[ "0.6127522", "0.6055546", "0.599644", "0.59283227", "0.5925165", "0.58408403", "0.5754333", "0.575369", "0.57490945", "0.57337254", "0.57331556", "0.57121", "0.57121", "0.57121", "0.57066834", "0.5702639", "0.5657467", "0.5653847", "0.56426734", "0.5628258", "0.5618401", "0...
0.54959536
35
Get the Women's Bathroom status.
def get_bathroom_buddy_womens_status(message): status = subscribe.simple( "Home/womens/state", hostname="m16.cloudmqtt.com", auth={'username': os.environ['USERNAME'], 'password': os.environ['SLACK_PASS']}, port=21775, tls={'ca_certs': certifi.where()}) return(status.payloa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):\n return STATUSES.get(self._mower_status, {}).get('message', self._mower_status)", "def get_power_status(self):\n response = self.parent.power_manager.get_status()\n if response is not None:\n response = response[0]\n\n batteries = []\n for ...
[ "0.6468318", "0.6393942", "0.6363238", "0.63195926", "0.60368097", "0.6002562", "0.59756094", "0.59639066", "0.59639066", "0.59282535", "0.590928", "0.590928", "0.590928", "0.5900921", "0.5868397", "0.58677864", "0.58677864", "0.58677864", "0.58677864", "0.58677864", "0.58677...
0.63199383
3
The following function returns the current weather for South Bend, IN....
def get_weather_south_bend(message): weather_api = 'http://api.openweathermap.org/data/2.5/weather?id=4926563&&units=imperial&appid={}'.format( os.environ['WEATHER_KEY']) weather = requests.get(weather_api).json() return("The current weather at Notre Dame is {} with a temperature of {}.".format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weather_helper():\n\n weather = get_weather('Chicago')\n conditions = weather['weather'][0]['description']\n temperature = weather['main']['temp']\n location = weather['name']\n\n curr_weather = 'It is currently %s degrees with %s in %s' % (temperature, conditions, location)\n return curr_wea...
[ "0.6748897", "0.6651157", "0.65632546", "0.654174", "0.64824337", "0.62617576", "0.6250446", "0.62484175", "0.611307", "0.609392", "0.6065452", "0.60488474", "0.60212094", "0.59851736", "0.5981115", "0.5960446", "0.5955273", "0.5950651", "0.59499425", "0.5916722", "0.5912138"...
0.67351866
1
Prometheus helper to quickly see the time in London.
def get_uk_time(message): time_api = 'http://worldtimeapi.org/api/timezone/Europe/London.json' london_time = requests.get(time_api).json() return("The current time in London, England is {}".format( london_time['datetime'][11:16]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time(self):\n return self.run_command('get_time')[0]", "def timezone():\n \n pass", "def get_time_info(self):\n\n raise NotImplementedError", "def get_nightly_start_time():\n return 14 # 2PM local Tucson time", "def get_time():\n # Use this one for production:\n now...
[ "0.59689367", "0.59094346", "0.5783251", "0.57631344", "0.57395995", "0.5718757", "0.5704612", "0.5699259", "0.56886494", "0.5673247", "0.5653273", "0.5640289", "0.56305677", "0.558655", "0.5577585", "0.5576624", "0.5555275", "0.55360794", "0.5501735", "0.54946667", "0.548418...
0.5973397
0
Return the scoreboard information for games matching the parameters as a dictionary.
def scoreboard(year, month, day): # Get data from mlbgame library data = mlbgame.data.get_scoreboard(year, month, day) # Parse through returned data parsed = etree.parse(data) root = parsed.getroot() output = [] # Loop through the list of games that are returned for game in root: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoreboard(year, month, day, home=None, away=None):\n # get data\n data = mlbgame.data.get_scoreboard(year, month, day)\n # parse data\n parsed = etree.parse(data)\n root = parsed.getroot()\n games = {}\n output = {}\n # loop through games\n for game in root:\n if game.tag == ...
[ "0.6896654", "0.6882706", "0.6848933", "0.6711905", "0.63978255", "0.6303648", "0.6230028", "0.6196659", "0.61953855", "0.61835605", "0.61832064", "0.6141031", "0.6121574", "0.60932535", "0.60710603", "0.60630333", "0.60620886", "0.60424584", "0.60335046", "0.60295945", "0.60...
0.68596184
2
This function will fetch yesterday's mlb scores and return them in a similar fashion to how nhl scores are being returned.
def get_mlb_scores(message): yesterday = datetime.date.today() - datetime.timedelta(days=1) games = scoreboard(yesterday.year, yesterday.month, yesterday.day) scores = [] for game in games: home = "{} {}\n".format( game['home_team'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDayAheadMarketLBMPZonal(self):\n\n\t\t# Variables\n\t\ttoday = self.helper.getYear() + self.helper.getMonth() + self.helper.getDay()\n\t\turl = 'http://mis.nyiso.com/public/csv/damlbmp/'+today+'damlbmp_zone.csv' \n\t\tresponse = urllib2.urlopen(url)\n\t\tmarket_data = sorted(csv.reader(response...
[ "0.5864733", "0.5720611", "0.5628312", "0.54834133", "0.54429305", "0.54429305", "0.5391816", "0.53706133", "0.5342564", "0.52987903", "0.5291811", "0.52855325", "0.52515596", "0.5246376", "0.51850957", "0.51413584", "0.50993174", "0.50862217", "0.5074362", "0.5064369", "0.50...
0.7069956
0
This function gets updated Covid stats for the state of Indiana.
def get_indiana_covid_stats(message): api_link = "https://corona.lmao.ninja/v2/states" get_stats = requests.get(api_link) for state in get_stats.json(): if state['state'] == "Indiana": cases = state['cases'] deaths = state['deaths'] covid_message = ":coronavirus: In Ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_covid_stats_for_all_states():\n url = \"https://corona.lmao.ninja/v2/states/\"\n response = requests.get(url)\n data = response.json()\n\n states = []\n\n for state in data:\n stateName = state[\"state\"]\n\n cases = state[\"cases\"]\n todaysCases = state[\"todayCases\"]...
[ "0.5786061", "0.57647926", "0.5751267", "0.5653311", "0.5646003", "0.5581366", "0.5580781", "0.55658996", "0.5481031", "0.5458222", "0.54489946", "0.5434017", "0.54039675", "0.5381794", "0.5363166", "0.5323404", "0.5323404", "0.52979153", "0.52888215", "0.5287419", "0.5280991...
0.55448335
8
Returns a random Chuck Norris joke.
def chuck_norris_jokes(message): joke = requests.get("https://api.chucknorris.io/jokes/random").json() return joke['value']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_chuck_norris_joke():\n response = requests.get(\"https://api.chucknorris.io/jokes/random\")\n json_data = response.json()\n return json_data[\"value\"]", "def get_joke(self):\n if not self.jokes:\n self.__init__()\n index = random.randint(0, len(self.jokes) - 1)\n ...
[ "0.7100957", "0.6707431", "0.6292626", "0.62484074", "0.6244774", "0.62309253", "0.5957998", "0.56890154", "0.56367815", "0.5604061", "0.5515048", "0.5499996", "0.54988563", "0.54531413", "0.5436678", "0.5425449", "0.5397241", "0.53819555", "0.537299", "0.5371237", "0.5358155...
0.61729395
6
Returns a random bit of advice.
def random_advice(message): advice = requests.get("https://api.adviceslip.com/advice").json()['slip']['advice'] return advice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_test(self):\r\n return 1", "def random_test(self):\r\n return 1", "def randomHelmet():\n return random.choice(HELMETS)", "def randomMethod(self):\n return random.random()", "def RandomAgentProgram(actions):\n return lambda percept: random.choice(actions)", "def Rando...
[ "0.6780925", "0.6780925", "0.6756225", "0.6611887", "0.64579284", "0.64579284", "0.64425486", "0.6346136", "0.63369906", "0.6270907", "0.6244317", "0.6233644", "0.62298036", "0.62264895", "0.62022316", "0.61940515", "0.61672014", "0.6140617", "0.6140617", "0.61395633", "0.612...
0.6908676
0
Return the lyrics of the song submitted.
def song_lyrics(message): spaceless_message = message.partition(' ')[2] if ":" in spaceless_message: # Try and find the lyrics. band_name = spaceless_message[0] song_title = spaceless_message[2] response = requests.get("https://api.lyrics.ovh/v1/{}/{}".format(band_name, song_tit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lyrics(self):\n return get_lyrics(self.artist, self.title,'')", "def get_lyrics(self):\n\t\treturn self._lyrics_list", "def get_lyrics(self):\n url = 'http://api.lyricsnmusic.com/songs?api_key=[5358b25688164e6c2f771954f17460&q]=' + self.artist + '%20' + self.name\n r = requests.get(url...
[ "0.7824739", "0.723227", "0.7111751", "0.70720786", "0.6978943", "0.6744991", "0.66379493", "0.6558411", "0.65524745", "0.6528179", "0.6459133", "0.64329433", "0.6395972", "0.6361504", "0.6232909", "0.61920947", "0.61873704", "0.61732334", "0.6150045", "0.61318433", "0.599009...
0.6255102
14
Test that the package provides customization_data that defines the function
def test_function_definition(self): func = get_function_definition(PACKAGE_NAME, FUNCTION_NAME) assert func is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_confirm_customization_details(self):\n pass", "def pytest_funcarg__generate_golden_data(request):\r\n return request.config.option.generate_golden_data", "def test_function_definition(self):\n func = get_function_definition(PACKAGE_NAME, FUNCTION_NAME)\n assert func", "def test...
[ "0.6495841", "0.62949693", "0.622999", "0.622999", "0.6012674", "0.5847949", "0.5794979", "0.5786388", "0.56368995", "0.5633291", "0.5617154", "0.55914575", "0.5590488", "0.55788755", "0.55642676", "0.55561197", "0.5555672", "0.5555672", "0.5554121", "0.5550097", "0.55453503"...
0.602669
11
Test pattern_search using mocked response.
def test_pattern_search(self, mock_get, circuits_app, umbinv_regex, umbinv_start_epoch, umbinv_start_relative, umbinv_limit, umbinv_include_category): keys_outer = ["matches", "limit", "totalResults", "expression", "moreDataAvailable"] keys_match = ["name", "securityCategories", "firstSeen", "name", "f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_reddit_search_response(\n ) -> Dict:\n with open(\n \"util/reddit_search_response.json\"\n ) as static_response:\n mock_response = json.load(static_response)\n\n return(mock_response)", "def test_search(self):\n d = self._search()\n self._response([2, 5, 1...
[ "0.6732833", "0.66641694", "0.63938046", "0.6325752", "0.62485534", "0.6154589", "0.6144737", "0.6090113", "0.60500705", "0.60500705", "0.60500705", "0.60223466", "0.60047615", "0.60046566", "0.59748423", "0.58795416", "0.587042", "0.5864914", "0.58384216", "0.58313507", "0.5...
0.70248115
0
convert name to number
def name_to_number(name): if name == "rock": number = 0 elif name == "Spock": number = 1 elif name == "paper": number = 2 elif name == "lizard": number = 3 elif name == "scissors": number = 4 else: print "Name is invalid!" return 1 retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_to_number(self, name):\r\n try:\r\n return self._numbers[name]\r\n except KeyError:\r\n raise KeyError(\"No field named %s in %r\" % (name, self._numbers.keys()))", "def name_to_number(name):\r\n \r\n if name == \"rock\":\r\n return 0\r\n elif name == ...
[ "0.7741844", "0.7352965", "0.7345282", "0.7291842", "0.72166365", "0.6983042", "0.6895514", "0.67996234", "0.67324436", "0.66536355", "0.65847605", "0.6520935", "0.6479899", "0.6476801", "0.64197266", "0.64054585", "0.6389672", "0.6386971", "0.63465", "0.6332023", "0.6235999"...
0.7410772
1
convert number to name
def number_to_name(number): if number == 0: name = "rock" elif number == 1: name = "Spock" elif number == 2: name = "paper" elif number == 3: name = "lizard" elif number == 4: name = "scissors" else: print "Number is invalid!" return 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_to_name(self, number):\r\n return self._names[number]", "def number_to_name(number):\r\n\r\n if number == 0:\r\n return \"rock\"\r\n elif number == 1:\r\n return \"Spock\"\r\n elif number == 2:\r\n return \"paper\"\r\n elif number == 3:\r\n return \"lizar...
[ "0.8246705", "0.7550283", "0.7530132", "0.74987745", "0.7460435", "0.7435132", "0.7311404", "0.7058323", "0.68847036", "0.6775639", "0.67526454", "0.67350024", "0.6674833", "0.66491246", "0.6633272", "0.658147", "0.64966327", "0.6492684", "0.64624995", "0.6456531", "0.6436228...
0.77541053
1
get choices and print out the results(main function)
def rpsls(player_choice): print print "Player chooses " + player_choice player_number = name_to_number(player_choice) comp_number = random.randrange(0, 5) comp_choice = number_to_name(comp_number) print "Computer chooses " + comp_choice if 0 < (player_number - comp_number) % 5 <= 2: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n\n print('\\n')\n for key, val in self.option.items():\n print(key, val, '\\n') # make it more confortable to read\n self.get_choice() # launch automaticly the choice method after display", "def print_choice_msg(self) -> None:\n pass", "def get_optio...
[ "0.69602454", "0.6944757", "0.68645734", "0.6550031", "0.6543791", "0.6523811", "0.6480258", "0.6450604", "0.64299273", "0.6420929", "0.6349661", "0.62972635", "0.6249721", "0.62495476", "0.624387", "0.6237897", "0.6218892", "0.62085146", "0.61473715", "0.6147141", "0.6134839...
0.0
-1
Returns a dictionary that maps attribute name to a tuple of (type, description).
def get_class_attributes(cls) -> Dict[str, Tuple[Any, str]]: try: source = inspect.getsource(cls.__init__) or "" if not source: return {} except TypeError: return {} source = utils.join(source.split("\n")) node = ast.parse(source) attr_list: List[Tuple] = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}", "def _attribs(self, name=None, description=None):\n a = {}\n if name:\n a['name'] = name\n if description:\n a['description'] = description\n retu...
[ "0.6793609", "0.6674305", "0.6664413", "0.6616096", "0.64803094", "0.64548177", "0.64188623", "0.63728285", "0.63316894", "0.62979114", "0.6276313", "0.62762487", "0.6258179", "0.62334234", "0.62087464", "0.6139291", "0.61141795", "0.6099927", "0.6081081", "0.6017317", "0.598...
0.56027544
47
Returns a dictionary that maps attribute name to a tuple of (type, description).
def get_module_attributes(module) -> Dict[str, Tuple[Any, str]]: try: source = inspect.getsource(module) or "" if not source: return {} except (OSError, TypeError): return {} node = ast.parse(source) attr_list: List[Tuple] = [] globals = dict(inspect.getmembers(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}", "def _attribs(self, name=None, description=None):\n a = {}\n if name:\n a['name'] = name\n if description:\n a['description'] = description\n retu...
[ "0.67931277", "0.6674969", "0.6665792", "0.6615514", "0.6481953", "0.64552104", "0.6419755", "0.6372921", "0.63325536", "0.63000596", "0.6278388", "0.6277224", "0.62586933", "0.62347186", "0.6207894", "0.61394423", "0.6115364", "0.61008304", "0.6080403", "0.6016657", "0.59896...
0.5934517
24
Returns a dictionary that maps attribute name to a tuple of (type, description).
def get_dataclass_attributes(cls) -> Dict[str, Tuple[Any, str]]: fields = cls.__dataclass_fields__.values() attrs = {} for field in fields: if field.type != InitVar: attrs[field.name] = field.type, "" return attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}", "def _attribs(self, name=None, description=None):\n a = {}\n if name:\n a['name'] = name\n if description:\n a['description'] = description\n retu...
[ "0.6793609", "0.6674305", "0.6664413", "0.6616096", "0.64803094", "0.64548177", "0.64188623", "0.63728285", "0.63316894", "0.62979114", "0.6276313", "0.62762487", "0.6258179", "0.62334234", "0.62087464", "0.6139291", "0.6099927", "0.6081081", "0.6017317", "0.59891033", "0.598...
0.61141795
16
Returns a dictionary that maps attribute name to a tuple of (type, description).
def get_attributes(obj) -> Dict[str, Tuple[Any, str]]: if is_dataclass(obj): return get_dataclass_attributes(obj) elif inspect.isclass(obj): return get_class_attributes(obj) elif inspect.ismodule(obj): return get_module_attributes(obj) return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}", "def _attribs(self, name=None, description=None):\n a = {}\n if name:\n a['name'] = name\n if description:\n a['description'] = description\n retu...
[ "0.67937475", "0.6673932", "0.6665609", "0.6616133", "0.6480975", "0.645589", "0.6419423", "0.6373563", "0.63325965", "0.62991995", "0.62763846", "0.6275178", "0.62591964", "0.6234089", "0.6209144", "0.61401665", "0.61152714", "0.61013734", "0.60815376", "0.6018292", "0.59895...
0.57462233
35
Time complexity > O(n) Space complexity > O(1)
def subtract_product_and_sum(n): product = 1 addition = 0 while n > 0: element = n % 10 n = n // 10 product *= element addition += element return product - addition
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_complexities():\n return \"Best Case: O(n), Average Case: O(n), Worst Case: O(n)\"", "def sem_repetidos (l): # n = len(l), O(n^2)\n resultado = []\n for e in l: # n vezes\n if not e in resultado: # 1 + O(n)\n resultado.append(e) # O(1)\n return resultado", "def fn(i):\n ...
[ "0.634884", "0.5989984", "0.5891454", "0.58846223", "0.58472943", "0.5787732", "0.57261235", "0.56967765", "0.56430763", "0.564266", "0.5621399", "0.5620132", "0.5600542", "0.5588314", "0.55832464", "0.5568193", "0.553908", "0.5530704", "0.5509698", "0.5506223", "0.5499427", ...
0.0
-1
Calculate the number of digits in a number and the armstrong_sum. Return true if the armstrong_sum equals the armstrong_candidate
def is_armstrong_number(armstrong_candidate: int) -> bool: if armstrong_candidate < 0: return False nr_digits = nr_digits_number(armstrong_candidate) a_sum = armstrong_sum(armstrong_candidate, nr_digits) return True if a_sum == armstrong_candidate else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def armstrong_sum(armstrong_candidate: int, nr_digits: int) -> int:\n a_sum = 0\n\n while armstrong_candidate != 0:\n digit_in_armstrong_candidate = armstrong_candidate % 10\n a_sum += digit_in_armstrong_candidate ** nr_digits\n armstrong_candidate = int(armstrong_candidate / 10)\n re...
[ "0.79819995", "0.73977816", "0.71560806", "0.6935217", "0.68870246", "0.66913134", "0.65789026", "0.6340746", "0.6177836", "0.6057625", "0.5992606", "0.59754694", "0.5964514", "0.5883641", "0.5847304", "0.57634735", "0.57392144", "0.5727389", "0.5718226", "0.56865513", "0.558...
0.807842
0
Estimate the number of digits in a number. Return the number of digits.
def nr_digits_number(armstrong_candidate: int) -> int: number_of_digits = 0 while armstrong_candidate != 0: armstrong_candidate = int(armstrong_candidate / 10) number_of_digits += 1 return number_of_digits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _number_of_digits(number: int) -> int:\n return int(log10(number)) + 1", "def count_digits(n):\n return len(str(n))", "def ndigits(n):\n return len(str(abs(n)))", "def count_digits(n):\n count = 0\n n=abs(n)\n while n!=0:\n count += 1\n n = n // 10\n return coun...
[ "0.8419208", "0.79809237", "0.7913502", "0.7809456", "0.76983887", "0.75223655", "0.72983843", "0.72151583", "0.716701", "0.7089731", "0.7057321", "0.6973305", "0.6938531", "0.6913356", "0.68830156", "0.6864402", "0.682758", "0.680548", "0.67883587", "0.67420894", "0.6736806"...
0.7020397
11
Calculate and return the armstrong_sum
def armstrong_sum(armstrong_candidate: int, nr_digits: int) -> int: a_sum = 0 while armstrong_candidate != 0: digit_in_armstrong_candidate = armstrong_candidate % 10 a_sum += digit_in_armstrong_candidate ** nr_digits armstrong_candidate = int(armstrong_candidate / 10) return a_sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(self):\n return self.vsum", "def calculate_sum(self):\n\n left_sum = self.left.calculate_sum() if self.left else 0\n right_sum = self.right.calculate_sum() if self.right else 0\n return self.data + left_sum + right_sum", "def summation(self):\n return sum(self.read_in...
[ "0.6603156", "0.6591869", "0.627234", "0.62047184", "0.61978614", "0.6112021", "0.60509235", "0.5939432", "0.5937607", "0.5934721", "0.5928078", "0.5926152", "0.5860448", "0.5854603", "0.58539337", "0.58510864", "0.58500665", "0.5822862", "0.581909", "0.58153033", "0.57878613...
0.69721985
0
Split data by options of an attribute
def splitBy(data, attribute_id): col = getColumn(data, attribute_id) values = set(col) split_data = [] for i in values: subset = [row for row in data if row[attribute_id] == i] split_data.append(subset) return split_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNewData(self, data, splitIndex, attrVal):\n newData = []\n for record in data:\n if record[splitIndex] == attrVal:\n newRecord =[]\n lenRecord = len(record)\n\n for i in range(lenRecord):\n # doesnt include the split at...
[ "0.5996887", "0.5792106", "0.5760196", "0.575071", "0.57116055", "0.5524944", "0.55180806", "0.55036134", "0.5439692", "0.542324", "0.54069096", "0.53839254", "0.5351785", "0.5330941", "0.53060323", "0.51633775", "0.51120734", "0.50981104", "0.5087688", "0.50799423", "0.50781...
0.65550715
0
Calculate the information gain
def informationGain2(data, attribute): split_data = splitBy(data, attribute) weighted_entropies = 0 for set in split_data: weighted_entropies += len(set) / len(data) * entropy2(set) columnIG = entropy2(data) - weighted_entropies return columnIG
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _information_gain(self, feature, node):\n return node.entropy() - self._entropy(feature, node)", "def info_gain(self, left, right, current_uncertainty):\n p = float(len(left)) / (len(left) + len(right))\n return current_uncertainty - p * self.gini(left) - (1 - p) * self.gini(right)", "...
[ "0.71510774", "0.7104761", "0.7051002", "0.70116246", "0.70019746", "0.6977662", "0.6969875", "0.6891857", "0.6791996", "0.6740312", "0.6715083", "0.66847247", "0.6643833", "0.661401", "0.6557161", "0.65524924", "0.652679", "0.65203816", "0.64868385", "0.64760065", "0.6475174...
0.60878724
38
Get the attribute with the highest IG
def maxIG(data): index = -1 max_gain = -1 for i in range(len(data[0]) - 1): gain = informationGain2(data, i) if gain > max_gain: index = i max_gain = gain return (index, max_gain)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imax(self):\n return self.elem.index(max(self))", "def _best_individual(self):\n return max(self._population, key=attrgetter(\"fitness\"))", "def get_max_key(dico):\n our_max = 0\n argmax = None\n for key, val in dico.items():\n if val > our_max:\n argmax = key\n ...
[ "0.6761436", "0.66377854", "0.64832205", "0.645513", "0.6428963", "0.6424145", "0.63717365", "0.62889665", "0.6267934", "0.62075317", "0.62063825", "0.6203469", "0.62030816", "0.62002635", "0.61884105", "0.6144686", "0.6144686", "0.6144686", "0.6144686", "0.6144686", "0.61446...
0.6309714
7