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
Checks the passwords entered are the same Checks they meet the complexity criteria
def check_pass(password, confirmed): # Requires at least one digit, a lower case letter, # an upper case letter and has at least 6 characters password_regex = r"^(?=.*?\d)(?=.*?[a-z])(?=.*?[A-Z])[a-zA-Z\d]{6,}$" regex = re.compile(password_regex) if password == confirmed: if regex.match(pas)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_password():\n assert check_password('Longpassword') == False\n assert check_password('123456') == False\n assert check_password('short') == False\n assert check_password('C0rect') == False\n assert check_password('Correct8') == True", "def do_passwords_match(self, password1, passwor...
[ "0.72476536", "0.7238956", "0.7209978", "0.7175978", "0.71610385", "0.7142391", "0.7134592", "0.7098522", "0.70844126", "0.7058614", "0.7052501", "0.70388466", "0.7036679", "0.7034364", "0.7020793", "0.69643396", "0.69606173", "0.693962", "0.6920598", "0.6911224", "0.69087875...
0.0
-1
Performs dijsktras algorithm from a certain node
def dijsktra(graph, initial): # Sets initial node score to 10 visited = {initial: 10} nodes = set(graph.nodes) max_weight = graph.distances[max(graph.distances, key=graph.distances.get)] min_weight = graph.distances[min(graph.distances, key=graph.distances.get)] # Defines the number of nodes t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_correcting_algo(dt, ori_node, des_node, do_return=False):\n # Convert all labels to string\n ori = str(ori_node)\n des = str(des_node)\n dt[[\"start\", \"end\"]] = dt[[\"start\", \"end\"]].astype(str) \n \n # Initialization\n nodes = set(dt.loc[:,\"start\"].unique()) | set(dt.loc[:,\...
[ "0.59614277", "0.5681578", "0.56544733", "0.55270684", "0.5521709", "0.5521709", "0.5468644", "0.54065055", "0.5363926", "0.53576124", "0.5327712", "0.529251", "0.5275726", "0.5270906", "0.5267602", "0.52594185", "0.5239558", "0.5176163", "0.5163248", "0.51169175", "0.5099423...
0.5816856
1
Serves the home page at the '/' route Loads notifications for the logged in user
def index(): try: with Database() as db: notifs = db.getNotifs(session['username']) b_notifs = [] for i in range(len(notifs) - 1, -1, -1): b_notifs.append(notifs[i]) session['notifs'] = b_notifs return render_template( 'inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_view(request):\n if request.authenticated_userid:\n return HTTPFound(location=request.route_url('app_view')) # pragma no cover\n return {} # pragma no cover", "def get(self):\n if self.logged_in:\n self.render('home.html', {\n 'name': self.current_user.name,\n 'server...
[ "0.66011", "0.65371966", "0.6510675", "0.6460462", "0.636571", "0.63617945", "0.63198596", "0.6269688", "0.62398434", "0.6231268", "0.62178016", "0.61766225", "0.6167033", "0.61527145", "0.6149676", "0.61176664", "0.61155385", "0.6103278", "0.61006826", "0.6091367", "0.607030...
0.0
-1
Upload link for files Creates analyser object Serves upload text display page.
def upload_file(): try: global current_file if request.method == "POST": # Validates a file has been uploaded if 'file' not in request.files: flash("No file submitted") return redirect(url_for('index')) f = request.files['file'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload():\n\treturn render_template(\"upload.html\", title=\"Upload a file\")", "def raw_text_upload():\n try:\n global current_file\n if request.method == \"POST\":\n raw_text = request.form['raw_text']\n # Checks text is not empty\n raw_text = raw_text.stri...
[ "0.67696977", "0.66535026", "0.64683944", "0.6226196", "0.61673456", "0.61646247", "0.6144482", "0.6115935", "0.6083226", "0.60172004", "0.6000657", "0.5965749", "0.5825415", "0.5809112", "0.58016574", "0.57651275", "0.57315755", "0.56884503", "0.56718403", "0.5638984", "0.56...
0.6194034
4
Upload path for raw text, creates a text file with the text in Creates analyser object
def raw_text_upload(): try: global current_file if request.method == "POST": raw_text = request.form['raw_text'] # Checks text is not empty raw_text = raw_text.strip('<>') if raw_text != '': if app.config['UPLOAD_FOLDER'] == UPLOAD_FOLD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_text_file(text, path):\n os.makedirs(os.path.dirname(path), exist_ok=True)\n with open(path, \"w\") as f:\n f.write(text)", "def store_lyrics_text(target_path, track_id, text, extension=\".txt\"):\n file_path = os.path.join(target_path, track_id + extension)\n print(file_path)\n wi...
[ "0.63974303", "0.6382405", "0.6246426", "0.62317955", "0.61909753", "0.61618316", "0.6158124", "0.60989183", "0.6093532", "0.6090002", "0.6025201", "0.59735364", "0.59291154", "0.59190583", "0.5890567", "0.5857344", "0.58509505", "0.5835025", "0.5823908", "0.58041954", "0.579...
0.77678305
0
Allows the user to change their password, changes password in database
def changepassword(): try: if request.method == 'POST': # Makes sure the passwords match and that it meets complexity validate = check_pass( request.form['newpass'], request.form['connewpass']) if validate == "Passed": data = [request.form[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_password(self):\n self.test_user.set_password(self.create_user_data()['password1'])\n self.test_user.save()", "def change_password(change_account):\n change_data(change_account, changed_data='password')", "def change_password(self, new_pass):\n self.manager.change_user_passwo...
[ "0.8027422", "0.7864155", "0.7834404", "0.77842826", "0.7754724", "0.77413195", "0.7683205", "0.7681768", "0.76722574", "0.7665951", "0.76569355", "0.7640851", "0.76029825", "0.760133", "0.7560938", "0.7558102", "0.7539255", "0.75238895", "0.75107753", "0.7507648", "0.7468965...
0.7694745
6
Gets the users texts from the database and shows them on their profile page
def profile(username): try: with Database() as database: # Makes sure the user exists user = database.checkForUser(username) if user == session['username']: if session['username'] == username: session['id'] = database.getID(session['use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile(request):\n user = Info.objects.all()\n return render(request, 'kvent/profile.html',{user:'user'})", "def users_page(request):", "def retrieve_user_page():\n users = hl.getUsers()\n groups = hl.getAllGroups()\n requests = hl.retrieveRequests()\n nodes = hl.getAllNodes()\n retur...
[ "0.660658", "0.65475494", "0.6475246", "0.64415663", "0.6368816", "0.6345084", "0.63256514", "0.62959826", "0.6294599", "0.6272487", "0.6256409", "0.624308", "0.6236545", "0.6234458", "0.6203177", "0.61630565", "0.61494046", "0.61314356", "0.6126782", "0.61165947", "0.6114926...
0.60989845
21
Search through texts with titles that contain a specified string
def search_titles(username): try: with Database() as database: user = database.checkForUser(username) if user == session['username']: if session['username'] == username: session['id'] = database.getID(session['username']) search...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_by_contains(self, tl):\n print(\"Search by string\")\n string = input(\"Please enter search string: \")\n return tl.findall_contains(string)", "def search(self, title):\n close_matches = self.get_close_matches_by_title(title)\n count = 0\n for item in self.it...
[ "0.6895403", "0.68408966", "0.67932504", "0.6696992", "0.6536303", "0.6526159", "0.64328575", "0.6326639", "0.63163996", "0.6315477", "0.6232018", "0.6192571", "0.61624473", "0.6138239", "0.6131031", "0.61125135", "0.6083743", "0.607554", "0.6075036", "0.6062325", "0.60302883...
0.0
-1
Looks for texts with a certain keyword and similar keywords
def search_keywords(username): try: with Database() as database: user = database.checkForUser(username) if user == session['username']: if session['username'] == username: session['id'] = database.getID(session['username']) sear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_keywords(text, keywords):\n for keyword in keywords:\n if re.search(r\"\\b\" + keyword + r\"\\b\", text, flags=re.IGNORECASE):\n return True\n return False", "def _keyword_search(id_to_text, raw_keywords, modified_keywords):\n\t# The raw keywords and modified keywords should be ...
[ "0.712303", "0.68108404", "0.67155206", "0.668099", "0.66752326", "0.66552484", "0.6584532", "0.6532232", "0.6453535", "0.6453535", "0.64387393", "0.64295256", "0.6406779", "0.635997", "0.6331261", "0.6328947", "0.6284383", "0.61962557", "0.61889714", "0.6178077", "0.6120695"...
0.0
-1
Gets texts within a certain category
def search_category(username): try: with Database() as database: user = database.checkForUser(username) if user == session['username']: if session['username'] == username: session['id'] = database.getID(session['username']) cate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_text(self, categories, entries):\n text = \" \".join(\n [\n self.podcast.title,\n self.podcast.description,\n self.podcast.keywords,\n self.podcast.authors,\n ]\n + [c.name for c in categories]\n ...
[ "0.72024417", "0.656723", "0.65608114", "0.6502506", "0.64198023", "0.6408471", "0.63583153", "0.6300433", "0.62832785", "0.60738915", "0.6068554", "0.60593975", "0.5932416", "0.5892128", "0.58820987", "0.5877177", "0.5874937", "0.58415854", "0.583352", "0.582695", "0.5822817...
0.0
-1
Search for texts that have a certain language feature Reading age and sentiment are in a certain range
def search_values(username): try: with Database() as database: user = database.checkForUser(username) if user == session['username']: if session['username'] == username: features = ["Alliteration", "Antithesis", "Juxtaposition"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_eligible(text, n, lng):\n for language in detect_langs(text):\n if language.lang == lng:\n probability = language.prob\n word_count = len(text.split(\" \"))\n if probability * word_count > n:\n return True\n else:\n break\n ...
[ "0.57004565", "0.55651575", "0.55386007", "0.5538032", "0.55267215", "0.55050963", "0.549548", "0.5475534", "0.54684144", "0.5442134", "0.5429395", "0.54142946", "0.5403086", "0.5392609", "0.53638613", "0.5359004", "0.53550684", "0.5329151", "0.5324816", "0.53167015", "0.5301...
0.0
-1
Loads a different analysis of a certain text
def changeview(analysis): try: analysed_texts = current_file.analysed_texts text_facts = current_file.stats with Database() as db: categories = db.loadCategories() keywords = '' for word in text_facts['Key Words']: keywords += word[0] + ", " ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webtext(analysis):\n global current_file\n try:\n if request.form[\"url\"] == \"\":\n flash(\"No URL given\")\n return redirect(url_for('index'))\n url = request.form['url']\n current_file = main.Analyser(url)\n analysed_texts = current_file.analysed_text...
[ "0.60592824", "0.59292406", "0.592167", "0.58063495", "0.57186705", "0.5711558", "0.5694043", "0.56910104", "0.5678257", "0.56741613", "0.564287", "0.56425405", "0.5625102", "0.5608563", "0.56067073", "0.55877876", "0.558111", "0.5556692", "0.5546069", "0.55426407", "0.554239...
0.5290827
60
Creates a pdf with the raw text in from a html template
def download(texttitle): try: body = current_file.analysed_texts['Regular'] rendered = render_template('pdf_template.html', title=texttitle, body=body) options = {'encoding': "UTF-8"} pdf = pdfkit.from_string(rendered, False, options=options) response = make_response(pdf) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_to_pdf(template_src, context_dict={}):\n template = get_template(template_src)\n html = template.render(context_dict)\n result = BytesIO()\n pdf = pisa.pisaDocument(BytesIO(html.encode(\"ISO-8859-1\")), result)\n if not pdf.err:\n return HttpResponse(result.getvalue(), content_type...
[ "0.7403683", "0.71494794", "0.71099365", "0.7091731", "0.6857262", "0.6822364", "0.6765777", "0.6644698", "0.65659434", "0.654277", "0.6541064", "0.65084815", "0.63685113", "0.63370645", "0.6314567", "0.6307673", "0.6296097", "0.62153006", "0.6158231", "0.61504066", "0.613498...
0.6280712
17
Shares the text with the user, by creating link in databse
def share_text(texttitle, username): message = session['username'] + \ " shared the text " + texttitle + " with you." with Database() as database: database.share_text(texttitle, username, session["username"]) database.sendNotif(username, message) flash("Text Shared") return redir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_link(cls, user, link):", "def share_link(cls, user, link):", "def insert_link(self, text, href):\n self.insert_text('\\n<a href=\"%s\">%s</a>' % (href, text))", "def paste_text(text, language=\"text\", paste_expire=8640, paste_user=\"paste.py\",\n return_link=True):\n # costruct ur...
[ "0.6997458", "0.6997458", "0.6394542", "0.6387845", "0.63727754", "0.6336196", "0.62323594", "0.59182006", "0.59175485", "0.5866517", "0.585186", "0.5835037", "0.58334965", "0.57938176", "0.5787896", "0.5775299", "0.57594526", "0.5759272", "0.5726179", "0.57058954", "0.569536...
0.7278323
0
Displays the text on upload and allows the analysis to be selected
def textdisplay(textTitle, analysis): try: global current_file with Database() as database: text_owner = database.getTextOwner(textTitle, session['username']) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER + text_owner path = app.config['UPLOAD_FOLDER'] + '/objects/' + textT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_text_upload():\n try:\n global current_file\n if request.method == \"POST\":\n raw_text = request.form['raw_text']\n # Checks text is not empty\n raw_text = raw_text.strip('<>')\n if raw_text != '':\n if app.config['UPLOAD_FOLDER']...
[ "0.7159925", "0.70026785", "0.6800656", "0.6480692", "0.6478881", "0.63340646", "0.6268505", "0.62629604", "0.6173394", "0.61475825", "0.6066088", "0.60618997", "0.60281646", "0.5980928", "0.5969213", "0.5954582", "0.5953171", "0.59319204", "0.59178823", "0.5866974", "0.58288...
0.7547743
0
Deletes text file and wipes any records from the database
def deletetext(texttitle): try: with Database() as database: canDelete = database.checkDelete(texttitle, session['id']) if canDelete: if app.config['UPLOAD_FOLDER'] == UPLOAD_FOLDER: app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER + \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erase_db(file):\n open(file, 'w').close()", "def delete_db(self):\n import os.path\n os.remove(self.filepath)", "def delete(self, filename):\n pass", "def TextDelete(texttitle):\n\n path = app.config['UPLOAD_FOLDER'] + \\\n '/objects/' + texttitle + '.txt'\n with ...
[ "0.7497814", "0.7277273", "0.6885682", "0.680071", "0.6764736", "0.6670453", "0.66297805", "0.6629244", "0.66218156", "0.65419096", "0.6515271", "0.6503777", "0.6454652", "0.6429588", "0.64249486", "0.64119023", "0.64052826", "0.6397928", "0.6392429", "0.63903683", "0.6355564...
0.0
-1
Saves the text object in a text file and saves it in db
def save_text(): try: global current_file if request.method == "POST": current_file.title = request.form['title'].replace(' ', '') with Database() as database: category = database.getCategory(request.form['Category']) current_file.category = ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_text(self):\n if self.tab_control.index(\"current\") == 0:\n text = self.textbox.get(\"1.0\", tk.END)\n if text is not None:\n files = [('Text Document', '*.txt')]\n text_file = asksaveasfile(title=\"Save your text as .txt\", filetypes=files,\n ...
[ "0.7108115", "0.69423765", "0.6938336", "0.68713033", "0.677555", "0.6758945", "0.6651387", "0.659884", "0.65734136", "0.6515245", "0.6488028", "0.64555424", "0.64316326", "0.6394388", "0.6353932", "0.63499653", "0.6315648", "0.6307501", "0.630571", "0.62945545", "0.62737465"...
0.7057494
1
Gets a text from the internet using an API
def webtext(analysis): global current_file try: if request.form["url"] == "": flash("No URL given") return redirect(url_for('index')) url = request.form['url'] current_file = main.Analyser(url) analysed_texts = current_file.analysed_texts text_fact...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_text(self, url, *, timeout, headers):", "def get_text(url):\n try:\n result = requests.get(url, headers=DEFAULT_REQUEST_HEADERS)\n result.raise_for_status()\n except requests.HTTPError as err:\n raise URLGetTextError(err)\n\n return result.text", "def read_text(self, url: ...
[ "0.7869953", "0.730019", "0.70340216", "0.6941515", "0.676543", "0.6755698", "0.66908175", "0.6630932", "0.6549851", "0.6511394", "0.6500466", "0.64911705", "0.6463328", "0.64559066", "0.6447297", "0.6443701", "0.6441239", "0.6439431", "0.6432376", "0.6432075", "0.6420207", ...
0.0
-1
Deletes the users account, their files and texts from the database
def deleteaccount(): try: if app.config['UPLOAD_FOLDER'] == UPLOAD_FOLDER: app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER + \ session['username'] with Database() as db: texts = db.getOwnedTexts(session['id']) for text in texts: TextDel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user():", "def db_delete_user_data(self):\n util.log(\"Clearing all user data\", util.LogLevel.Info)\n self.db.db_clear_data_user()\n util.log(\"Done\", util.LogLevel.Info)", "def delete_user():\n #TODO user delete\n pass", "def delete_user(self) -> None:\n table_...
[ "0.75881016", "0.7571063", "0.73386544", "0.72856486", "0.71325874", "0.70421135", "0.70142746", "0.6962373", "0.6958195", "0.69209486", "0.6919454", "0.6880083", "0.68616986", "0.67589813", "0.6717374", "0.6716456", "0.66849625", "0.6683709", "0.6657697", "0.66400325", "0.66...
0.76813954
0
Logs the user out
def logout(): try: session.clear() app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER flash("You have been logged out") return redirect(url_for('index')) except Exception as e: flash("Oops, something went wrong... Try again.") return render_template('index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout_user():\n pass", "def log_out_user(self):\n flask_login.logout_user()", "def logout():", "def logOut(self):\n self.client.logout()", "def logout(self):\n pass", "def logout():\n login()", "def logout():\n return logout_user()", "def sign_out(self):\n se...
[ "0.8616682", "0.8555834", "0.8535574", "0.8505401", "0.84060234", "0.8363244", "0.8331417", "0.83193165", "0.828638", "0.8264839", "0.8237121", "0.8207617", "0.8191595", "0.81912225", "0.8185386", "0.8086846", "0.8070375", "0.79742473", "0.79740614", "0.7971824", "0.7926226",...
0.0
-1
Allows the user to login
def login_page(): try: if request.method == "POST": with Database() as database: db_password = database.checkPass(request.form['username']) if len(db_password) > 0: db_password = db_password[0][0] if pbkdf2_sha256.verify(req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():", "def login():", "def login_user():\n pass", "def login(self):\n\t\treturn", "def login(self):", "def login():\n pass", "def login_menu(self):\n print(\"\\nPlease enter your email and password\")\n email = self.validate_email()\n password = self.validate_passwor...
[ "0.8591797", "0.8591797", "0.8469158", "0.8464104", "0.8455766", "0.8266615", "0.8212561", "0.8142589", "0.80873966", "0.7950496", "0.7835791", "0.780167", "0.7779753", "0.77034426", "0.76880175", "0.7650659", "0.75441074", "0.7543309", "0.7531979", "0.7497269", "0.7492912", ...
0.0
-1
Allows the user to register
def register_page(): try: if request.method == "POST": form = reg_form(request.form) validation = form.validate() if validation == "Passed": # Hashes the passwords using sha256 password_hash = pbkdf2_sha256.encrypt(form.password.data, round...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user():\n pass", "def register(self):\n first_name = self.first_name_entry.get()\n insertion = self.insertion_entry.get()\n last_name = self.last_name_entry.get()\n zip_code = self.zip_entry.get()\n streetnumber = self.streetnumber_entry.get()\n email = s...
[ "0.8532799", "0.7963627", "0.78872436", "0.7882183", "0.7834774", "0.7823601", "0.7792079", "0.77843577", "0.77785784", "0.7773236", "0.77628666", "0.7750897", "0.7720143", "0.7708544", "0.7683669", "0.7662307", "0.7659337", "0.7658292", "0.764016", "0.76397055", "0.7622419",...
0.0
-1
Initializes a block object.
def __init__(self, raw, style_cls): super(Base, self).__init__() self.raw = raw self.style_cls = style_cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n pyxel.init(windowWidth, windowHeight)\n\n # generates randomly ordered list of [0, 1, 2, 3, 4, 5, 6, 7]\n self.bag = sample(list(range(7)), 7)\n\n # generates a block from last element of self.bag into self.blocks\n self.block = Block(blockData[self.bag.po...
[ "0.7198606", "0.713938", "0.70537674", "0.6927632", "0.6839594", "0.6788867", "0.67439294", "0.6693654", "0.6693117", "0.66663164", "0.66554767", "0.6590122", "0.6525242", "0.6498737", "0.64744353", "0.64673245", "0.64261454", "0.64225394", "0.641554", "0.64104724", "0.640030...
0.0
-1
Parses the given raw text and return a block object representation, if applicable.
def parse(cls, raw, style_cls): return cls(raw, style_cls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseBlock(self, text, prevLineData):\n return self.parser.parseBlock(text, prevLineData)", "def parseChunk(self, parent, text):\r\n self.parseBlocks(parent, text.split('\\n\\n'))", "async def parse(self, raw: str) -> dict:", "def parse_block(\n string: str,\n vars: Dict,\n neg: bo...
[ "0.72058433", "0.6476995", "0.6294301", "0.6247581", "0.62070143", "0.61923724", "0.6171336", "0.6068363", "0.6008469", "0.59850705", "0.59833205", "0.59809935", "0.5980157", "0.5961037", "0.59007657", "0.58809936", "0.5860813", "0.58484924", "0.58467954", "0.5825048", "0.578...
0.55218345
38
204 responses must not return some entity headers
def get204(self): bad = ('content-length', 'content-type') for h in bad: bottle.response.set_header(h, 'foo') bottle.status = 204 for h, v in bottle.response.headerlist: self.assertFalse(h.lower() in bad, "Header %s not deleted" % h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n\n header = \"HTTP/1.1 204 No Content\" + \"\\r\\nDate: \" + date + \"\\r\\n\\r\\n\"\n\n print(header)\n return header.encode(HttpServer.FORMAT)", "def as...
[ "0.7504536", "0.7456752", "0.70702946", "0.7007137", "0.6838798", "0.6740226", "0.66936654", "0.66851264", "0.66362447", "0.65761197", "0.648202", "0.6477876", "0.64216065", "0.6242951", "0.623777", "0.623777", "0.6185526", "0.61398613", "0.61072254", "0.6086671", "0.60757756...
0.83296347
0
304 responses must not return entity headers
def get304(self): bad = ('allow', 'content-encoding', 'content-language', 'content-length', 'content-md5', 'content-range', 'content-type', 'last-modified') # + c-location, expires? for h in bad: bottle.response.set_header(h, 'foo') bottle.status = 304 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_304_response() -> bytes:\n content_data = HttpServer.get_content_data(\"/not_modified.html\")\n date = datetime.datetime.now(datetime.timezone.utc).strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n\n header = \"HTTP/1.1 304 Not Modified\" + \"\\r\\nDate: \" + date + \"\\r\\n\" + content_dat...
[ "0.75092345", "0.7419917", "0.72726953", "0.7164188", "0.7087629", "0.6714187", "0.66934466", "0.6550176", "0.65363", "0.6527774", "0.65198684", "0.6495292", "0.6457777", "0.63518214", "0.6306506", "0.6283255", "0.6283255", "0.6245512", "0.6245413", "0.6172141", "0.6148629", ...
0.82604736
0
Commandline interface to this module.
def main() -> None: cache: Dict[str, Any] = {} datadir = util.get_abspath(sys.argv[1]) for yaml_path in glob.glob(os.path.join(datadir, "*.yaml")): with open(yaml_path) as yaml_stream: cache_key = os.path.relpath(yaml_path, datadir) cache[cache_key] = yaml.load(yaml_stream) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n pass", "def cli():\r\n pass", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "d...
[ "0.8111833", "0.7890598", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", "0.77864957", ...
0.0
-1
Returns an amended copy of the proxies dictionary used by `requests`, it will disable the proxy if the uri provided is to be reached directly.
def config_proxy_skip(proxies, uri, skip_proxy=False): parsed_uri = urlparse(uri) # disable proxy if necessary if skip_proxy: if 'http' in proxies: proxies.pop('http') if 'https' in proxies: proxies.pop('https') elif proxies.get('no'): urls = [] i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_proxies(self) -> dict:\n return self._proxies.copy() if self._proxies else None", "def _proxies_dict(proxy):\r\n if not proxy:\r\n return None\r\n return {'http': proxy, 'https': proxy}", "def proxies(self):\n\n proxies = APIConsumer.get(\"/proxies\").json()\n proxies...
[ "0.66343987", "0.6391098", "0.6165451", "0.6008237", "0.55292976", "0.5497907", "0.5492077", "0.5427683", "0.5362546", "0.5328795", "0.52967983", "0.52951497", "0.52471906", "0.5230866", "0.52142024", "0.5200751", "0.5157269", "0.5149122", "0.5092851", "0.5078898", "0.5063718...
0.6825937
0
Construct an ThothOnixTelescope instance.
def __init__( self, *, dag_id: str, cloud_workspace: CloudWorkspace, publisher_id: str, format_specification: str, bq_dataset_id: str = "onix", bq_table_name: str = "onix", bq_dataset_description: str = "Thoth ONIX Feed", bq_table_descripti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, world: Optional[SimWorld] = None, **kwargs: Any):\n BaseTelescope.__init__(self, **kwargs, motion_status_interfaces=[\"ITelescope\", \"IFocuser\", \"IFilters\"])\n FitsNamespaceMixin.__init__(self, **kwargs)\n\n # init world and get telescope\n from pyobs.utils.simula...
[ "0.6043081", "0.5964881", "0.57800967", "0.57065284", "0.5576632", "0.5284193", "0.5260236", "0.5221126", "0.52082175", "0.51896495", "0.5188457", "0.5174516", "0.5166596", "0.51366943", "0.5117554", "0.51174974", "0.5112744", "0.5068512", "0.50668824", "0.5044727", "0.504393...
0.0
-1
Creates a new Thoth release instance
def make_release(self, **kwargs) -> ThothRelease: snapshot_date = make_snapshot_date(**kwargs) release = ThothRelease(dag_id=self.dag_id, run_id=kwargs["run_id"], snapshot_date=snapshot_date) return release
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_release(self, **kwargs) -> CrossrefEventsRelease:\n\n start_date, end_date, first_release = self.get_release_info(**kwargs)\n\n release = CrossrefEventsRelease(\n self.dag_id, start_date, end_date, first_release, self.mailto, self.max_threads, self.max_processes\n )\n ...
[ "0.64280033", "0.63345087", "0.6219137", "0.62178385", "0.59829724", "0.5792777", "0.5772973", "0.56713486", "0.5646336", "0.56411284", "0.556297", "0.55392003", "0.5535768", "0.55193186", "0.54974574", "0.54897374", "0.54813004", "0.5434569", "0.5398685", "0.5379647", "0.537...
0.74462247
0
Task to download the ONIX release from Thoth.
def download(self, release: ThothRelease, **kwargs) -> None: thoth_download_onix( publisher_id=self.publisher_id, format_spec=self.format_specification, download_path=release.download_path, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _download(self):\n self._system.download(\"http://geant4.web.cern.ch/geant4/support/source/\" + self._tar_name)", "def thoth_download_onix(\n publisher_id: str,\n download_path: str,\n format_spec: str,\n host_name: str = DEFAULT_HOST_NAME,\n num_retries: int = 3,\n) -> None:\n url =...
[ "0.6697182", "0.6280148", "0.62222373", "0.61106557", "0.6080942", "0.5996796", "0.5958443", "0.59322697", "0.5895125", "0.5894148", "0.58753026", "0.580345", "0.57798254", "0.57530046", "0.57020843", "0.5632765", "0.5632071", "0.5620086", "0.56162405", "0.5600442", "0.558787...
0.69096416
0
Upload the downloaded thoth onix XML to google cloud bucket
def upload_downloaded(self, release: ThothRelease, **kwargs) -> None: success = gcs_upload_files(bucket_name=self.cloud_workspace.download_bucket, file_paths=[release.download_path]) set_task_state(success, kwargs["ti"].task_id, release=release)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_finish(self, cloud_file):", "def upload_progress(self, cloud_file, size, uploaded):", "def upload_svg(filename, xml_string):\n s3 = boto3.client('s3')\n response = s3.put_object(\n ACL='public-read',\n Body=xml_string,\n Bucket=BUCKET,\n Key=filename,\n Stora...
[ "0.6021707", "0.56937593", "0.56745994", "0.56631327", "0.56376046", "0.5610331", "0.5573977", "0.55667204", "0.5515031", "0.5492787", "0.5467463", "0.5440767", "0.5401655", "0.538869", "0.5375465", "0.5358939", "0.5349745", "0.5332269", "0.5331079", "0.53214574", "0.52899987...
0.0
-1
Task to transform the Thoth ONIX data
def transform(self, release: ThothRelease, **kwargs) -> None: success, parser_path = onix_parser_download() set_task_state(success, task_id=kwargs["ti"].task_id, release=release) success = onix_parser_execute( parser_path, input_dir=release.download_folder, output_dir=release.transfo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform():", "def transform(self, data):", "def transform():\n pass", "def transform(self):", "def transform(self, X):\n ...", "def transform(self, X):\n ...", "def transform(self, X):\n ...", "def transform(self, X):\n ...", "def transform(self, X):\n ...
[ "0.6583367", "0.63111854", "0.62925464", "0.58286405", "0.58054906", "0.58054906", "0.58054906", "0.58054906", "0.58054906", "0.58054906", "0.58054906", "0.5745898", "0.569793", "0.5667463", "0.5654679", "0.5575874", "0.5546051", "0.5525497", "0.5441114", "0.5440563", "0.5440...
0.59375197
3
Upload the downloaded thoth onix .jsonl to google cloud bucket
def upload_transformed(self, release: ThothRelease, **kwargs) -> None: success = gcs_upload_files( bucket_name=self.cloud_workspace.transform_bucket, file_paths=[release.transform_path] ) set_task_state(success, kwargs["ti"].task_id, release=release)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(jsonfiles):\n # clear S3 Bucket\n bucket = S3Bucket()\n bucket.clear()\n for jsonfile in jsonfiles:\n filename = os.path.basename(jsonfile)\n key = build_key(filename)\n logging.info(\"%s %s\", filename, key)\n # store json in S3 object\n bucket.store(key, ...
[ "0.65068454", "0.6342714", "0.61773777", "0.61429673", "0.61228466", "0.61177385", "0.608761", "0.6081685", "0.6045406", "0.6026031", "0.5962328", "0.59582734", "0.5925211", "0.5922055", "0.59198475", "0.5882836", "0.58755136", "0.5874109", "0.58695334", "0.5841015", "0.58316...
0.0
-1
Task to load the transformed ONIX jsonl file to BigQuery.
def bq_load(self, release: ThothRelease, **kwargs) -> None: bq_create_dataset( project_id=self.cloud_workspace.project_id, dataset_id=self.bq_dataset_id, location=self.cloud_workspace.data_location, description=self.bq_dataset_description, ) uri = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_raw_to_bq(event, context):\n\n import os\n\n\n print(f\"Processing .....\")\n\n file = event\n project = os.environ.get('ENV_PROJECT')\n dataset = os.environ.get('ENV_DATASET')\n bucket = file.get(\"bucket\")\n tableCsv = file.get(\"name\")\n tableDestList = tableCsv.split(\".\")\...
[ "0.6239616", "0.5627366", "0.5611043", "0.5270496", "0.5261157", "0.52611226", "0.52270687", "0.5213831", "0.5192585", "0.5190901", "0.5186956", "0.5167473", "0.51594496", "0.51577294", "0.5153345", "0.5153345", "0.5149505", "0.51362944", "0.5136233", "0.51066357", "0.5101144...
0.52878547
3
Adds release information to API.
def add_new_dataset_releases(self, release: ThothRelease, **kwargs) -> None: dataset_release = DatasetRelease( dag_id=self.dag_id, dataset_id=self.api_dataset_id, dag_run_id=release.run_id, snapshot_date=release.snapshot_date, data_interval_start=kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_release(ctx):\n rel = _get_release()\n rel.update_release(rel.title, rel.raw_data[\"body\"], draft=False)", "def get_release_info(self):\r\n return self.detail_info.get_release_info(self.version)", "def add_new_dataset_releases(self, release: CrossrefMetadataRelease, **kwargs) -> None:...
[ "0.603399", "0.5955066", "0.5925179", "0.5867882", "0.5854016", "0.5843925", "0.58369064", "0.5833375", "0.5751572", "0.5749097", "0.5744806", "0.5743118", "0.5721889", "0.5713864", "0.5705936", "0.5648544", "0.56480837", "0.55830395", "0.55755025", "0.5569443", "0.55320984",...
0.58169043
8
Delete all files, folders and XComs associated with this release.
def cleanup(self, release: ThothRelease, **kwargs) -> None: cleanup(dag_id=self.dag_id, execution_date=kwargs["execution_date"], workflow_folder=release.workflow_folder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup():\n if len(env.releases) > 3:\n directories = env.releases\n directories.reverse()\n del directories[:3]\n env.directories = ' '.join([ '%(releases_path)s/%(release)s' % { 'releases_path':env.releases_path, 'release':release } for release in directories ])\n run('...
[ "0.705404", "0.6923961", "0.6872746", "0.68182623", "0.6804205", "0.67814773", "0.6733583", "0.6713712", "0.667929", "0.66577154", "0.665055", "0.6616377", "0.6591545", "0.65912616", "0.6561124", "0.6556905", "0.6555388", "0.65534294", "0.65193635", "0.65015835", "0.65008426"...
0.0
-1
Hits the Thoth API and requests the ONIX feed for a particular publisher. Creates a file called onix.xml at the specified location
def thoth_download_onix( publisher_id: str, download_path: str, format_spec: str, host_name: str = DEFAULT_HOST_NAME, num_retries: int = 3, ) -> None: url = THOTH_URL.format(host_name=host_name, format_specification=format_spec, publisher_id=publisher_id) logging.info(f"Downloading ONIX XML ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oai_harvest(basic_url, metadata_prefix=None, oai_set=None, processing=None, out_file_suffix=None):\n collection_xpath = \".//oai_2_0:metadata//intact:collection\"\n record_xpath = \".//oai_2_0:record\"\n identifier_xpath = \".//oai_2_0:header//oai_2_0:identifier\"\n token_xpath = \".//oai_2_0:resum...
[ "0.50976276", "0.50819564", "0.5062179", "0.505473", "0.49140215", "0.47646818", "0.47354826", "0.4707565", "0.46446255", "0.46394545", "0.46037316", "0.4576128", "0.45600936", "0.4554681", "0.45524687", "0.4548541", "0.45293865", "0.4528018", "0.4522511", "0.45112112", "0.45...
0.5873819
0
Generates a JSON file with all the Video action based features
def merge_vaxn_features(vaxn_feat_root_path, vaxn_feat_cache_path): if os.path.exists(vaxn_feat_cache_path): print("Found vaxn cache, loading ...") return load_json(vaxn_feat_cache_path) show_names = ["bbt"] vaxn_features = {} for sn in show_names: cur_base_path = os.path.join(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_output():\n\n input_data = \"{}/{}.json\".format(TRANSCRIPTS_VIDEOS_PATH, request.form[\"name\"])\n duration = \"0,{}\".format(int(float(request.form[\"duration\"])))\n movie = \"{}/{}\".format(VIDEOS_PATH, request.form[\"movie\"]) # videos/movie.mp4\n movie_data = \"{}/{}.json\".format(TRANSCRIPTS_...
[ "0.634132", "0.5869211", "0.58267266", "0.566327", "0.5597393", "0.55778354", "0.5547687", "0.5519301", "0.54381615", "0.54166013", "0.5411057", "0.5408507", "0.53804255", "0.53419405", "0.53226936", "0.53097594", "0.53077525", "0.53019357", "0.52878267", "0.5259834", "0.5254...
0.0
-1
This function will import all of the example images sets in the data folder. Returns =======
def preprocess_images(): # Set up the lists to collect the images and measurements images = [] measurements = [] # Set up the path to the data files data_sets_path = 'data' data_sets = [os.path.join(data_sets_path, i) for i in os.listdir(data_sets_path)] # St...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):\n for set_name in self.image_dir_path:\n if self.verbose:\n print('\\n> Loading data files for the set: ' + set_name)\n\n # image dir\n image_dir = os.path.join(self.data_path, self.image_dir_path[set_name])\n\n # annotation fil...
[ "0.71541685", "0.71112", "0.7007383", "0.69861394", "0.69643354", "0.6875159", "0.687149", "0.6793674", "0.6761374", "0.6747905", "0.67314863", "0.67229164", "0.6722691", "0.668295", "0.6682827", "0.6676145", "0.66268", "0.65782994", "0.65700173", "0.654787", "0.65367633", ...
0.0
-1
This function will produce a batch of features and labels for each epoch step to reduce the memory usage.
def generator(features, labels, batch_size): # Create empty arrays to contain batch of features and labels# batch_features = np.zeros((batch_size, 160, 320, 3)) batch_labels = np.zeros((batch_size, 1)) while True: for i in range(batch_size): # choose random index in features ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_features_labels(features, labels, batch_size):\n for start in range(0, len(features), batch_size):\n end = min(start + batch_size, len(features))\n #print(labels[start:end])\n yield features[start:end], labels[start:end]", "def batch_features_labels(features, labels, batch_size)...
[ "0.76270497", "0.7307724", "0.7307669", "0.7307669", "0.7307669", "0.72704774", "0.70929223", "0.69568336", "0.69184935", "0.68820596", "0.6748234", "0.67144907", "0.66818917", "0.66654253", "0.66291654", "0.6627662", "0.66152316", "0.6594451", "0.6584446", "0.6561161", "0.65...
0.7333913
1
Validate and update field value against validator. Raise NoValidatorError if no validator was set.
def validate(self): if self.validator is None: raise NoValidatorError('Field %s has no validator assigned.' % self.id) self.value = self.validator(self.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validator(self, value: Optional[Dict[str, Any]]):\n self._validator = value", "def validate(self):\n for field in self.fields:\n if field.validate():\n self.model.set(field.name, field.model_value)\n else:\n self.errors.append(field.error())\n...
[ "0.62739575", "0.608497", "0.6071332", "0.6071332", "0.6062489", "0.60375136", "0.59934586", "0.5940005", "0.59261507", "0.5883836", "0.5870587", "0.5867741", "0.58644885", "0.5827615", "0.5827615", "0.57252115", "0.5696865", "0.565482", "0.5627075", "0.5613289", "0.5612839",...
0.83141893
0
Shortcut for field.renderer.render(). Raise NoRendererError if no renderer is set.
def render(self): if not self.renderer: raise NoRendererError('Field %s has no renderer assigned.' % self.id) return self.renderer.render(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n try:\n if self.permit():\n return self.renderer.render(self)\n except AttributeError:\n if self.renderer is None:\n raise NotImplementedError(\"Should have implemented a renderer for {0}\".format(self.name))\n else:\n ...
[ "0.7004743", "0.65256923", "0.64937174", "0.63230234", "0.6244154", "0.6143011", "0.60672754", "0.60345244", "0.5998662", "0.59685975", "0.5790698", "0.57647145", "0.57602614", "0.57167757", "0.5699508", "0.5687103", "0.56720227", "0.5661371", "0.563945", "0.5615098", "0.5605...
0.77539104
0
Set the coordinate system for the GeoSeries.
def set_crs(self, crs): crs = _validate_crs(crs) self._crs = crs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setcoordsys(self, csys):\n return _image.image_setcoordsys(self, csys)", "def setGxLocation(self):\n if self.xyz is None:\n gxobs = self.obs.get(None, {}).get(\"GX\")\n if gxobs is not None:\n gxyz = np.array((0.0, 0.0, 0.0))\n ...
[ "0.6976951", "0.6533349", "0.64059937", "0.62488025", "0.6244008", "0.6237713", "0.621931", "0.6195711", "0.61874264", "0.61691636", "0.61650574", "0.6104936", "0.60478747", "0.6043912", "0.6025414", "0.6002747", "0.598583", "0.59691477", "0.5968583", "0.5968583", "0.5968583"...
0.58906555
25
Set the coordinate system for the GeoSeries.
def crs(self, crs): self.set_crs(crs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setcoordsys(self, csys):\n return _image.image_setcoordsys(self, csys)", "def setGxLocation(self):\n if self.xyz is None:\n gxobs = self.obs.get(None, {}).get(\"GX\")\n if gxobs is not None:\n gxyz = np.array((0.0, 0.0, 0.0))\n ...
[ "0.69760185", "0.6532696", "0.6406236", "0.6248199", "0.6238903", "0.62181735", "0.6195803", "0.61864096", "0.616831", "0.61657757", "0.6105004", "0.6046242", "0.604405", "0.6025245", "0.60031265", "0.59855217", "0.5968437", "0.5968437", "0.5968437", "0.5968437", "0.59671736"...
0.62427175
4
Test whether two objects contain the same elements. This function allows two GeoSeries to be compared against each other to see if they have the same shape and geometries (same wkb bytes). NaNs in the same location are considered equal. The column headers do not need to have the same type, but the elements within the c...
def equals(self, other): if not isinstance(other, GeoSeries): return False return self._data.equals(other._data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_identical(self, other):\n return (self.compounddatatype == other.compounddatatype and\n self.min_row == other.min_row and\n self.max_row == other.max_row)", "def similar(self, other):\r\n if self.rows == other.rows and self.columns == other.columns:\r\n ...
[ "0.713626", "0.70874375", "0.6902014", "0.6831683", "0.68126047", "0.67645264", "0.66774386", "0.6625861", "0.6573688", "0.65623236", "0.6527109", "0.6523672", "0.65229714", "0.6514099", "0.6510609", "0.6509781", "0.6501745", "0.64968944", "0.64894736", "0.6446339", "0.644061...
0.6488795
19
Fill NA values with a geometry, which can be WKT or WKB formed.
def fillna( self, value=None, method=None, axis=None, inplace=False, limit=None, downcast=None, ): return super().fillna(value, method, axis, inplace, limit, downcast)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_170612_nullgeom(self):\n spc = parser(get_file('PTSD48_nullgeom.txt'))\n # spc.draw_outlooks()\n spc.sql(self.txn)\n outlook = spc.get_outlook('ANY SEVERE', '0.15', 4)\n self.assertAlmostEqual(outlook.geometry.area, 56.84, 2)", "def test_insert_empty_geometry():\n e...
[ "0.56847125", "0.56693435", "0.56686133", "0.56586635", "0.561771", "0.55634767", "0.55186915", "0.54937625", "0.54811686", "0.53563386", "0.53505456", "0.5311615", "0.52947694", "0.52927846", "0.52743405", "0.52210534", "0.5193054", "0.5190897", "0.5188896", "0.51856804", "0...
0.46377096
93
Detect missing values. NA value in GeoSeries is represented as None.
def isna(self): return super().isna()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pd_isnan(val):\n return val is None or val != val", "def ISNA(value):\n return isinstance(value, float) and math.isnan(value)", "def checkNaN(data):\n if data.isnull().values.any():\n N = data.isnull().sum().sum()\n print(\"There are {} missing values.\".format(N))", "def nan_value(d...
[ "0.7382185", "0.7306854", "0.719385", "0.71861726", "0.71788853", "0.7176771", "0.70606303", "0.6982853", "0.6982853", "0.69516784", "0.6938889", "0.6934969", "0.68899995", "0.68127024", "0.68127024", "0.6808158", "0.678505", "0.67573625", "0.6751283", "0.67491585", "0.671536...
0.6863134
13
Detect nonmissing values. Inverse of isna.
def notna(self): return super().notna()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pd_isnan(val):\n return val is None or val != val", "def ISNA(value):\n return isinstance(value, float) and math.isnan(value)", "def nan_value(data):\n return data.isnull().any()", "def isna(self):\n return super().isna()", "def isna(self):\n # type: () -> np.ndarray\n retur...
[ "0.7560518", "0.74665135", "0.7452157", "0.7438255", "0.73962665", "0.73962665", "0.73709446", "0.7326189", "0.7220557", "0.7139181", "0.7064639", "0.69654924", "0.69546664", "0.6941255", "0.68872374", "0.68794274", "0.6848532", "0.68473583", "0.68365127", "0.682528", "0.6777...
0.7091962
10
Check if each geometry is of valid geometry format.
def is_valid(self): return _property_op(arctern.ST_IsValid, self).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkGeom(geodataframe):\n for geometry in geodataframe.geometry:\n if explain_validity(geometry) != 'Valid Geometry':\n print(explain_validity(geometry))", "def is_valid_geometry(self, value: List) -> bool:\n\n def check_geom(geom):\n if isinstance(geom, (Point, MultiP...
[ "0.7904392", "0.690688", "0.6685605", "0.66615665", "0.6612329", "0.64486986", "0.64352995", "0.6389536", "0.6370707", "0.6149703", "0.6111263", "0.6095195", "0.6012014", "0.59583324", "0.5873552", "0.58691776", "0.58599246", "0.5856493", "0.58545256", "0.58147585", "0.581045...
0.0
-1
Calculate the length of each geometry.
def length(self): return _property_op(arctern.ST_Length, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Lengths(self):\n\n self.__do_essential_memebers_exist__()\n\n if self.element_type == \"line\":\n coords = self.points[self.elements[:,:2],:]\n lengths = np.linalg.norm(coords[:,1,:] - coords[:,0,:],axis=1)\n else:\n # self.GetEdges()\n # coords ...
[ "0.75420904", "0.72353274", "0.70973814", "0.6988344", "0.6942517", "0.6910893", "0.6852218", "0.6681032", "0.6670038", "0.6617122", "0.6555902", "0.6541204", "0.6533393", "0.6511183", "0.65023154", "0.6492468", "0.63879216", "0.6387602", "0.6379638", "0.6348502", "0.63365", ...
0.6313044
23
Check whether each geometry is "simple". "Simple" here means that a geometry has no anomalous geometric points, such as self intersection or self tangency.
def is_simple(self): return _property_op(arctern.ST_IsSimple, self).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_simple(geometry, **kwargs):\n return lib.is_simple(geometry, **kwargs)", "def is_simple(self):\n if not self.is_compact(): return False\n\n for v in self.vertex_generator():\n adj = [a for a in v.neighbors()]\n if len(adj) != self.dim():\n return False...
[ "0.7666004", "0.64723015", "0.6392264", "0.62469393", "0.6124172", "0.6097932", "0.60693663", "0.59628433", "0.59498405", "0.59405744", "0.58801895", "0.5861422", "0.5823311", "0.5766822", "0.5688275", "0.560034", "0.55730313", "0.5571647", "0.5562339", "0.5434933", "0.541820...
0.6210017
4
Calculate the 2D Cartesian (planar) area of each geometry.
def area(self): return _property_op(arctern.ST_Area, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_axis: # Sphere\n for seg in self.segment_tuples:\n x1, ...
[ "0.7063971", "0.6625418", "0.65976596", "0.659629", "0.6554382", "0.6529425", "0.65187824", "0.6507955", "0.64807117", "0.6467007", "0.6453874", "0.6421093", "0.6408375", "0.6345457", "0.6292591", "0.6268464", "0.6240269", "0.6230155", "0.61827403", "0.6177272", "0.6141594", ...
0.0
-1
For each geometry in geometries, return a string that indicates is type.
def geom_type(self): return _property_op(arctern.ST_GeometryType, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometry_type(self) -> ir.StringValue:\n return ops.GeoGeometryType(self).to_expr()", "def getGeometryType(restGeom):\n if \"Polygon\" in restGeom:\n return \"POLYGON\"\n elif \"Polyline\" in restGeom:\n return \"POLYLINE\"\n elif \"Point\" in restGeom:\n return \"POINT\"...
[ "0.6874476", "0.6696634", "0.6290559", "0.62605953", "0.6224997", "0.619825", "0.5985244", "0.575593", "0.569537", "0.56879616", "0.55618614", "0.54778594", "0.54542613", "0.5450805", "0.54445904", "0.5382666", "0.53738856", "0.53256947", "0.5278076", "0.5276421", "0.52664536...
0.626888
3
Compute the centroid of each geometry.
def centroid(self): return _property_geo(arctern.ST_Centroid, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcCentroid(self):\n size = len(self.vectors)\n # zip all features together\n zipped = zip(*self.vectors)\n # Calculate the mean for each feature/column\n centroid = [math.fsum(column)/size for column in zipped]\n \n return centroid", "def centroid(self): # ...
[ "0.80138916", "0.7795813", "0.7621316", "0.7526914", "0.74279696", "0.72885245", "0.7254839", "0.7190571", "0.7184448", "0.7174818", "0.71524346", "0.71008474", "0.70810723", "0.70650667", "0.7009923", "0.69806325", "0.69658154", "0.6955261", "0.6946786", "0.68795633", "0.678...
0.72300625
7
For each geometry, compute the smallest convex geometry that encloses all geometries in it.
def convex_hull(self): return _property_geo(arctern.ST_ConvexHull, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_geometry(self):\n geometry = self._geometry\n for geo in self._holes:\n geometry = geometry.difference(geo) \n return geometry", "def concave_hull(hull:list, points:list, max_iterations:int=None, min_length_fraction:float=0, min_angle:float=90)->list:\n tweet.info(\"Cre...
[ "0.60205543", "0.5530485", "0.5502788", "0.54940367", "0.54893094", "0.5410566", "0.5404145", "0.5397154", "0.5388533", "0.53502923", "0.5344877", "0.5302913", "0.5264694", "0.5254407", "0.5252312", "0.52518874", "0.5245833", "0.5226095", "0.5222082", "0.5200354", "0.5196485"...
0.5312225
11
Calculates the points number for each geometry.
def npoints(self): return _property_op(arctern.ST_NPoints, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_points_number(self):\n ncontour = self.get_contours_number\n npoints = []\n for i in range(0, ncontour):\n npoints.append(len(self.x[i]))\n return npoints", "def GetNumberOfPoints(self):\n return self.GetNumberOfElements(ArrayAssociation.POINT)", "def nr_po...
[ "0.6741213", "0.65841794", "0.6553323", "0.65361804", "0.65322703", "0.62996763", "0.6286703", "0.6274652", "0.6244351", "0.618118", "0.6174774", "0.61558765", "0.61459893", "0.60894793", "0.6071493", "0.60674316", "0.60643", "0.6039086", "0.60236716", "0.58761185", "0.586858...
0.6183094
9
Compute the doubleprecision minimum bounding box geometry for each geometry.
def envelope(self): return _property_geo(arctern.ST_Envelope, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_minimal_bounding_box(self):\n\n big = (95.06, -11.0, 141.0, 5.9)\n mid = [103.28, -8.46, 109.67, -4.68]\n sml = (106.818998, -6.18585170, 106.82264510, -6.1810)\n\n min_res = 0.008333333333000\n eps = 1.0e-4\n\n # Check that sml box is actually too small\n ...
[ "0.69018716", "0.643876", "0.6386188", "0.6372415", "0.62286246", "0.61563987", "0.6153013", "0.59914505", "0.59569925", "0.59569925", "0.59372354", "0.5932275", "0.5924669", "0.5921674", "0.5911022", "0.5888883", "0.58672947", "0.5848557", "0.5837018", "0.5832062", "0.579750...
0.0
-1
Convert curves in each geometry to approximate linear representation, e.g., CIRCULAR STRING to regular LINESTRING, CURVEPOLYGON to POLYGON, and MULTISURFACE to MULTIPOLYGON. Useful for outputting to devices that can't support CIRCULARSTRING geometry types.
def curve_to_line(self): return _unary_geo(arctern.ST_CurveToLine, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_segments(segments):\n polygons = []\n interiors = []\n linestrings = []\n for segment in segments:\n ls = LineString(segment)\n if segment[0][0] == segment[-1][0] and segment[0][1] == segment[-1][1]:\n lr = LinearRing(ls)\n if not lr.is_ccw:\n ...
[ "0.5612656", "0.5605624", "0.55674744", "0.55128264", "0.54048735", "0.5354755", "0.53211635", "0.52772313", "0.52101445", "0.5138058", "0.5118836", "0.5081327", "0.5062001", "0.5044732", "0.50275433", "0.49676812", "0.49635187", "0.4959512", "0.49567842", "0.4953524", "0.494...
0.51644486
9
Transform each geometry to a different coordinate reference system. The ``crs`` attribute on the current GeoSeries must be set.
def to_crs(self, crs): if crs is None: raise ValueError("Can not transform with invalid crs") if self.crs is None: raise ValueError("Can not transform geometries without crs. Set crs for this GeoSeries first.") if self.crs == crs: return self return _u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_geometries(datasource, src_epsg, dst_epsg):\n # Part 1\n src_srs = osr.SpatialReference()\n src_srs.ImportFromEPSG(src_epsg)\n dst_srs = osr.SpatialReference()\n dst_srs.ImportFromEPSG(dst_epsg)\n transformation = osr.CoordinateTransformation(src_srs, dst_srs)\n layer = datasource.GetLa...
[ "0.6502866", "0.62526053", "0.61256564", "0.6086267", "0.60835266", "0.6010616", "0.5969945", "0.5863563", "0.5861438", "0.5789306", "0.5703812", "0.56789464", "0.5665309", "0.5656348", "0.56265503", "0.5570779", "0.5527477", "0.5501872", "0.5500846", "0.5494727", "0.5475225"...
0.7170733
0
Returns a "simplified" version for each geometry using the DouglasPeucker algorithm.
def simplify(self, tolerance): return _unary_geo(arctern.ST_SimplifyPreserveTopology, self, tolerance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify(self, tolerance, preserve_topology=...): # -> BaseGeometry:\n ...", "def simplify(uniques, intersections, tolerance):\n uniques_sm = [u.simplify(tolerance=tolerance) for u in uniques]\n\n intersections_sm = [[None for i in range(len(uniques))] for j in range(len(uniques))]\n for i,s...
[ "0.637332", "0.6203799", "0.5494519", "0.54518986", "0.541968", "0.5412575", "0.54017067", "0.5362468", "0.5342239", "0.53284794", "0.53053784", "0.52785295", "0.5266336", "0.5264212", "0.52319866", "0.5184626", "0.51542795", "0.5133027", "0.5126322", "0.51219654", "0.5120376...
0.5490384
3
For each geometry, returns a geometry that represents all points whose distance from this geos is less than or equal to "distance".
def buffer(self, distance): return _unary_geo(arctern.ST_Buffer, self, distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges_dwithin(\n self, lon: float, lat: float, distance: float, sort: bool = False\n ) -> Iterable[EdgeTuple]:\n # TODO: document self.network.edges instead?\n return self.network.edges.dwithin_edges(lon, lat, distance, sort=sort)", "def compute_signed_distance_and_closest_geometry(sc...
[ "0.56591654", "0.54377896", "0.5347388", "0.5315113", "0.5289874", "0.52756774", "0.5231627", "0.5228826", "0.522027", "0.5200996", "0.5199149", "0.51547587", "0.51416624", "0.51387566", "0.5124852", "0.5111418", "0.510608", "0.50760573", "0.5072427", "0.50680065", "0.5067088...
0.0
-1
For the coordinates of each geometry, reduce the number of significant digits to the given number. The last decimal place will be rounded.
def precision_reduce(self, precision): return _unary_geo(arctern.ST_PrecisionReduce, self, precision)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roundSigfigs(num, sigfigs):\n if num != 0:\n return str(round(num, -int(math.floor(math.log10(abs(num))) - (sigfigs - 1))))\n else:\n return str(0.0) # Can't take the log of 0", "def roundSigfigs(num, sigfigs):\n if num != 0:\n return str(round(num, -int(math.floor(math.log10(a...
[ "0.60132486", "0.60132486", "0.58656776", "0.573517", "0.5606471", "0.5581084", "0.55775976", "0.54481006", "0.54399276", "0.5426035", "0.54122615", "0.54122615", "0.53650385", "0.535975", "0.5348461", "0.5318411", "0.5297865", "0.52699935", "0.52645403", "0.52614075", "0.524...
0.52493805
20
Create a valid representation of each geometry without losing any of the input vertices. If the geometry is alreadyvalid, then nothing will be done. If the geometry can't be made to valid, it will be set to None value.
def make_valid(self): return _unary_geo(arctern.ST_MakeValid, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometry():\n return Geometry()", "def fromVertices(cls,\n xp0, yp0, zp0, xp1, yp1, zp1,\n xp2, yp2, zp2, xp3, yp3, zp3,\n origin,\n group_index=None,\n reference=None):\n if len(xp0) == len(yp0) == le...
[ "0.55397016", "0.547042", "0.54656315", "0.53561056", "0.53190964", "0.5298444", "0.52899414", "0.5283208", "0.52193624", "0.517035", "0.5165746", "0.51519984", "0.5132783", "0.51110107", "0.51100355", "0.50842196", "0.50837195", "0.50727284", "0.507113", "0.50376564", "0.503...
0.5022376
21
Return a geometry that represents the union of all geometries in the GeoSeries.
def unary_union(self): return GeoSeries(arctern.ST_Union_Aggr(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergeGeometries(self):\n self.geometry = reduce(lambda p1,p2 : p1.union(p2) ,map(lambda tax : tax.biomeGeometry,self.taxonomies))\n return self.geometry", "def union(self, other):\n return self._geomgen(capi.geom_union, other)", "def unary_union(self) -> ir.GeoSpatialScalar:\n r...
[ "0.73016036", "0.685745", "0.6835243", "0.6767258", "0.67599726", "0.64897877", "0.63472724", "0.634694", "0.60967267", "0.60640794", "0.60346997", "0.5986849", "0.59392625", "0.58512485", "0.5828639", "0.57456577", "0.5710652", "0.568876", "0.5681035", "0.56726", "0.5660516"...
0.7909888
0
Compute the doubleprecision minimum bounding box geometry for the union of all geometries.
def envelope_aggr(self): return GeoSeries(arctern.ST_Envelope_Aggr(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(self):\n if len(self.elements) == 0:\n return None\n if not (self._bb_valid and\n all(ref._bb_valid for ref in self.get_dependencies(True))):\n bb = numpy.array(((1e300, 1e300), (-1e300, -1e300)))\n all_polygons = []\n fo...
[ "0.64559424", "0.63894683", "0.63460636", "0.6325376", "0.62859964", "0.62129617", "0.60120475", "0.60054564", "0.5887245", "0.58749264", "0.5857979", "0.58571696", "0.5831913", "0.58012956", "0.5794952", "0.57558835", "0.57558835", "0.5743555", "0.57128584", "0.5684636", "0....
0.0
-1
Check whether each geometry intersects other (elementwise).
def intersects(self, other): return _binary_op(arctern.ST_Intersects, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self, other): # -> bool:\n ...", "def intersects(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\r\n return False", "def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRig...
[ "0.75880086", "0.74986064", "0.73812044", "0.72191447", "0.7136789", "0.71249735", "0.701634", "0.69970363", "0.68745273", "0.6840998", "0.6757996", "0.67431086", "0.6726097", "0.6692108", "0.6664353", "0.6642848", "0.663825", "0.66000044", "0.6524565", "0.6524129", "0.651469...
0.68560857
9
Check whether each geometry is within other (elementwise).
def within(self, other): return _binary_op(arctern.ST_Within, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"...
[ "0.7524902", "0.73729897", "0.71685326", "0.7139274", "0.7030789", "0.702235", "0.70122725", "0.6991214", "0.6973276", "0.6951702", "0.69121456", "0.6908521", "0.6871371", "0.6854054", "0.6852921", "0.6798403", "0.6786245", "0.6746447", "0.6740402", "0.6731472", "0.67281044",...
0.6281432
82
Check whether each geometry contains other (elementwise).
def contains(self, other): return _binary_op(arctern.ST_Contains, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"...
[ "0.6927342", "0.6813174", "0.67808735", "0.6683514", "0.6608095", "0.66048783", "0.6543079", "0.651822", "0.6502066", "0.6419477", "0.64123785", "0.6408629", "0.6377291", "0.63678026", "0.63514185", "0.63224965", "0.6319783", "0.6301619", "0.6301403", "0.62778205", "0.6274065...
0.0
-1
Check whether each geometry and other(elementwise) "spatially cross". "Spatially cross" here means two geometries have some, but not all interior points in common. The intersection of the interiors of the geometries must not be the empty set and must have a dimensionality less than the maximum dimension of the two inpu...
def crosses(self, other): return _binary_op(arctern.ST_Crosses, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(*args):\r\n if len(args) == 2:\r\n p0, p1, p2, p3 = *args[0], *args[1]\r\n elif len(args) == 4:\r\n p0, p1, p2, p3 = args\r\n else:\r\n raise AttributeError(\"Pass 2, 2-pnt lines or 4 points to the function\")\r\n #\r\n # ---- First check ---- np.cross(p1-p0, p3...
[ "0.6487575", "0.63430226", "0.63197684", "0.63048565", "0.62401897", "0.62110454", "0.60857844", "0.60824424", "0.60203683", "0.6004619", "0.60024345", "0.5978805", "0.595224", "0.59431404", "0.5899379", "0.5882534", "0.5864912", "0.5863718", "0.5834981", "0.58330286", "0.583...
0.0
-1
Check whether each geometry is "spatially equal" to other. "Spatially equal" means two geometries represent the same geometry structure.
def geom_equals(self, other): from pandas.api.types import is_scalar if is_scalar(other): other = self.__class__([other] * len(self), index=self.index) this = self if not this.index.equals(other.index): warn("The indices of the two GeoSeries are different.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def are_equal(self, sp1, sp2):\n return True", "def are_equal(self, sp1, sp2):\n for s1 in sp1.keys():\n spin1 = getattr(s1, \"spin\", 0)\n oxi1 = getattr(s1, \"oxi_state\", 0)\n for s2 in sp2.keys():\n spin2 = getattr(s2, \"spin\", 0)\n ...
[ "0.6802465", "0.67805123", "0.66960746", "0.66589355", "0.6498028", "0.6484803", "0.62827766", "0.6278034", "0.6247545", "0.6240349", "0.6240165", "0.62319565", "0.6208261", "0.6191864", "0.61298805", "0.6103202", "0.6102807", "0.6097758", "0.6073104", "0.6059349", "0.6056827...
0.6046562
21
Check whether each geometry "touches" other. "Touch" means two geometries have common points, and the common points locate only on their boundaries.
def touches(self, other): return _binary_op(arctern.ST_Touches, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self):\n match = False\n for i in range(len(self.__points) - 1):\n p1 = self.__points[i]\n p2 = self.__points[i + 1]\n bounds = self.__line_segment(p1, p2)\n if not bounds is None:\n xmin = bounds[0]\n ymin = bounds[1]\n xmax = bounds[0]\n ymax =...
[ "0.65426964", "0.6534798", "0.64519405", "0.6406436", "0.6399988", "0.637896", "0.6334022", "0.6320897", "0.6273946", "0.6238817", "0.6082561", "0.60700196", "0.6025307", "0.601121", "0.59974545", "0.59330696", "0.59228545", "0.59096324", "0.58627254", "0.5842866", "0.5815128...
0.65202117
2
Check whether each geometry "spatially overlaps" other. "Spatially overlap" here means two geometries intersect but one does not completely contain another.
def overlaps(self, other): return _binary_op(arctern.ST_Overlaps, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_overlap(self):\n return False", "def span_overlap(a: Tuple[int, int], b: Tuple[int, int]) -> bool:\n return not (a[0] > b[1] or a[1] < b[0])", "def overlaps(self, other): # -> bool:\n ...", "def overlap(component1, component2):\n if component1[0].start <= component2[0].stop a...
[ "0.7119898", "0.69237816", "0.6911162", "0.68759036", "0.6854764", "0.6843278", "0.6818101", "0.6797722", "0.67557263", "0.67337745", "0.67266196", "0.670879", "0.6697069", "0.6681085", "0.6661396", "0.66502994", "0.6640487", "0.66175556", "0.66064024", "0.6606194", "0.660260...
0.68331456
6
Calculates the minimum 2D Cartesian (planar) distance between each geometry and other.
def distance(self, other): return _binary_op(arctern.ST_Distance, self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_distance(object_1, object_2):\n\n # package import\n import numpy as np\n\n # main algorithm\n minimum_distance = 100000\n\n for coord_1 in object_1:\n for coord_2 in object_2:\n distance_btwn_coords = np.linalg.norm(coord_1 - coord_2)\n if distance_btwn_coor...
[ "0.6431486", "0.63372993", "0.61613613", "0.6061822", "0.6057627", "0.60562485", "0.6043775", "0.60295826", "0.60089844", "0.6001629", "0.5990504", "0.59392023", "0.5931772", "0.5912168", "0.5911987", "0.59024376", "0.58987397", "0.588519", "0.5879089", "0.5869567", "0.586037...
0.0
-1
Return minimum distance in meters between two lon/lat points. Uses a spherical earth and radius derived from the spheroid defined by the SRID.
def distance_sphere(self, other): if not self.crs == getattr(other, "crs", "EPSG:4326") == "EPSG:4326": raise ValueError("Only can calculate spherical distance with 'EPSG:4326' crs.") return _binary_op(arctern.ST_DistanceSphere, self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spherical_distance(lat1,lat2,long1,long2):\n lat1,lat2,long1,long2= float(lat1),float(lat2),float(long1),float(long2)\n q=radians(lat2-lat1)\n r=radians(long2-long1)\n lat2r=radians(lat2)\n lat1r=radians(lat1)\n a=sin(q/2)*sin(q/2)+cos(lat1r)*cos(lat2r)*sin(r/2)*si...
[ "0.68833476", "0.68543684", "0.6664104", "0.66225034", "0.6614609", "0.6551876", "0.6545566", "0.6468671", "0.64259017", "0.63936806", "0.63863176", "0.63863176", "0.63863176", "0.63863176", "0.63863176", "0.638405", "0.6378784", "0.6377177", "0.63747877", "0.63671356", "0.63...
0.6405948
9
Returns the Hausdorff distance between each geometry and other. This is a measure of how similar or dissimilar 2 geometries are.
def hausdorff_distance(self, other): return _binary_op(arctern.ST_HausdorffDistance, self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hausdorff_distance(self, other):\n ...", "def hausdorff_distance(image1, image2):\n image1_int = image1.clone(\"unsigned int\")\n image2_int = image2.clone(\"unsigned int\")\n\n libfn = utils.get_lib_fn(\"hausdorffDistance%iD\" % image1_int.dimension)\n d = libfn(image1_int.pointer, image2...
[ "0.759283", "0.7179202", "0.7101328", "0.689909", "0.6858431", "0.6837336", "0.67604476", "0.6683294", "0.66194665", "0.66013527", "0.6569919", "0.65585876", "0.6527269", "0.6473583", "0.6433952", "0.6392746", "0.63679177", "0.63628966", "0.6316012", "0.63065404", "0.6305005"...
0.76239663
0
Calculate the point set intersection between each geometry and other.
def intersection(self, other): return _binary_geo(arctern.ST_Intersection, self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(self, other): # -> BaseGeometry:\n ...", "def intersection(self, other):\n return self._geomgen(capi.geom_intersection, other)", "def intersection(x, y, f, p):", "def intersection(*entities):\n from entity import GeometryEntity\n\n entities = GeometryEntity.extract_entit...
[ "0.7651218", "0.74701786", "0.7083056", "0.6893054", "0.67865145", "0.67679137", "0.67574686", "0.6725878", "0.665778", "0.6639866", "0.65870994", "0.65796703", "0.65796703", "0.65796703", "0.65796703", "0.6557968", "0.6526289", "0.6521376", "0.65168005", "0.65129095", "0.647...
0.69138277
3
Transform each geometry to WKT formed string.
def to_wkt(self): return _property_op(arctern.ST_AsText, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_list_to_wkt(self, geom):\n if geom['type'] == \"Polygon\":\n coords = [f\"{coord[0]} {coord[1]}\" for coord in geom['coordinates'][0]]\n return f\"POLYGON (( {', '.join(coords)} ))\"\n else:\n raise Exception(f\"Unknown type of Geometry in GeoJSON of {geom...
[ "0.6284619", "0.5979369", "0.588133", "0.5870684", "0.58419377", "0.5840937", "0.5709922", "0.5570101", "0.5550173", "0.5397603", "0.5344564", "0.534022", "0.5335962", "0.53175837", "0.5316207", "0.52969074", "0.5270357", "0.5260585", "0.5257257", "0.5244518", "0.52068967", ...
0.52084917
20
Transform each geometry to WKB formed bytes object.
def to_wkb(self): return _property_op(lambda x: x, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wkb(self): # -> bytes:\n ...", "def ToBytes (self):\n return zlib.compress (json.dumps (self.containments, 2).encode ('utf-8'), 9)", "def test_geotransform2bbox(self):\n\n M = 5\n N = 10\n for gt in GEOTRANSFORMS:\n bbox = geotransform2bbox(gt, M, N)\n\n ...
[ "0.615493", "0.54587793", "0.5230626", "0.52266526", "0.5186636", "0.513073", "0.51119035", "0.5024733", "0.502031", "0.5013838", "0.5013339", "0.49796233", "0.49733862", "0.49601117", "0.4927707", "0.49172413", "0.49162441", "0.49131826", "0.49010167", "0.48981664", "0.48796...
0.53376216
2
Transform each to GeoJSON format string.
def as_geojson(self): return _property_op(arctern.ST_AsGeoJSON, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geojson(self):\n return {\n \"type\": \"FeatureCollection\",\n \"features\": [f.geojson(i) for i, f in self._features.items()]\n }", "def get_geojson(self, sql, context):\n result = self.db.query(sql).getresult()\n geo_objects = []\n\n for poly in resu...
[ "0.62960416", "0.6181512", "0.59290135", "0.589605", "0.58446467", "0.5824667", "0.57942975", "0.5702228", "0.569644", "0.56767356", "0.566967", "0.56581604", "0.5653806", "0.5648496", "0.56391734", "0.5633548", "0.5613218", "0.561292", "0.55785376", "0.55779", "0.5575015", ...
0.5802877
6
Transform each arctern GeoSeries to GeoPandas GeoSeries.
def to_geopandas(self): import geopandas import shapely return geopandas.GeoSeries(self.apply(lambda x: shapely.wkb.loads(x) if x is not None else None), crs=self.crs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raster_to_geodataframe(*a, **kw) -> gpd.GeoDataFrame:\n kw[\"geo\"] = True\n return raster_to_dataframe(*a, **kw)", "def convert_to_geopandas(df):\n df['geometry'] = [Point(xy) for xy in zip(df.latitude, df.longitude)]\n crs = {'init': 'epsg:4326'}\n df = gpd.GeoDataFrame(df, crs=crs, geometry...
[ "0.63202363", "0.6096996", "0.603656", "0.598663", "0.59274143", "0.5879244", "0.5840413", "0.5799306", "0.5705398", "0.56461185", "0.5643855", "0.55626243", "0.55617464", "0.5537935", "0.5530619", "0.5516425", "0.5465296", "0.5460588", "0.54439163", "0.5427812", "0.5421134",...
0.6296897
1
Construct polygon(rectangle) geometries from arr_min_x, arr_min_y, arr_max_x, arr_max_y and special coordinate system. The edges of polygon are parallel to coordinate axis.
def polygon_from_envelope(cls, min_x, min_y, max_x, max_y, crs=None): crs = _validate_crs(crs) return cls(arctern.ST_PolygonFromEnvelope(min_x, min_y, max_x, max_y), crs=crs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePolygons():", "def draw_polygon(\n i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,\n offsets, values, xs, ys, yincreasing, eligible,\n *aggs_and_cols\n ):\n # Initialize values of pre-allocated buffers\n xs.fill(np.nan)\n ys.fill(np.nan)\n yi...
[ "0.6298787", "0.6130665", "0.5995941", "0.59403425", "0.59305", "0.5916149", "0.58777076", "0.58749014", "0.5831342", "0.5804383", "0.57978517", "0.578452", "0.5773578", "0.5768583", "0.5755375", "0.57550496", "0.57409936", "0.5726229", "0.57090235", "0.5684887", "0.5683477",...
0.6215077
1
Construct Point geometries according to the coordinates.
def point(cls, x, y, crs=None): crs = _validate_crs(crs) return cls(arctern.ST_Point(x, y), crs=crs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_points(data):\n #TODO list comprehension\n for row in data:\n\n if row[\"x\"] and row[\"y\"]:\n try:\n row[\"geometry\"] = point.Point(float(row[\"x\"]), float(row[\"y\"]))\n except:\n row[\"geometry\"] = None\n...
[ "0.6530858", "0.6457091", "0.64059484", "0.640297", "0.6357891", "0.6344461", "0.6337387", "0.6316078", "0.62294465", "0.6183091", "0.6170689", "0.613722", "0.613722", "0.60727257", "0.60714775", "0.6061231", "0.60591716", "0.59994185", "0.59989065", "0.59790605", "0.5955864"...
0.5411405
95
Construct geometry from the GeoJSON representation string.
def geom_from_geojson(cls, json, crs=None): crs = _validate_crs(crs) return cls(arctern.ST_GeomFromGeoJSON(json), crs=crs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_geometry(self, val):\n g = OGRGeometry(val)\n return json.loads(g.json)", "def json2polygon(geojson_str):\n geojson_object = geojson.loads(geojson_str)\n return geometry.shape(geojson_object)", "def get_geojson_feature(id, raw_bbox_string, properties_dict):\n coords = raw_bbox_s...
[ "0.64928246", "0.6445108", "0.62764484", "0.62726635", "0.6204472", "0.61289346", "0.59531116", "0.5860503", "0.5817557", "0.5810382", "0.5739932", "0.5705384", "0.56882906", "0.5613755", "0.56050944", "0.5557749", "0.5536399", "0.55300456", "0.5526873", "0.5519496", "0.54749...
0.6517472
0
Construct geometries from geopandas GeoSeries.
def from_geopandas(cls, data): import geopandas as gpd import shapely.wkb if not isinstance(data, gpd.GeoSeries): raise TypeError(f"data must be {gpd.GeoSeries}, got {type(data)}") if data.crs is not None: crs = data.crs.to_authority() or data.crs.source_crs.to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_geoseries(self, dataframe):\n geo_list = []\n with click.progressbar(dataframe.iterrows(), label='Pulling site plans and geographic title data', length=len(dataframe)) as d:\n for index, row in d:\n geo_list.append(self.map_property(row['linc']))\n\n geo_ser...
[ "0.6760645", "0.66406184", "0.6611926", "0.65941155", "0.65144163", "0.63927484", "0.6314211", "0.62846774", "0.62605417", "0.61809194", "0.5986733", "0.5974453", "0.59539646", "0.5952975", "0.59197783", "0.5875279", "0.5856764", "0.5832553", "0.58124745", "0.58063805", "0.57...
0.663567
2
Decorator to check and update session attributes.
def check_session(wrapped): def check(request, *arg, **kwargs): collection = request.GET.get('collection', None) journal = request.GET.get('journal', None) document = request.GET.get('document', None) range_start = request.GET.get('range_start', None) under_development = req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_modify_authenticated_session_var(self):\r\n cursor = self.db.cursor()\r\n cursor.execute(\"INSERT INTO session VALUES ('john', 1, 0)\")\r\n cursor.execute(\"INSERT INTO session_attribute VALUES \"\r\n \"('john', 1, 'foo', 'bar')\")\r\n\r\n req = Mock(authn...
[ "0.68283325", "0.6451606", "0.61932784", "0.61213243", "0.60973513", "0.597331", "0.5921812", "0.5765885", "0.5700388", "0.5672152", "0.5666347", "0.5607734", "0.5568922", "0.5488824", "0.5479005", "0.5472188", "0.54597175", "0.54507554", "0.53897274", "0.53520393", "0.531647...
0.5884659
7
Decorator to load common data used by all views
def base_data_manager(wrapped): @check_session def wrapper(request, *arg, **kwargs): @cache_region.cache_on_arguments() def get_data_manager(collection, journal, document, range_start, range_end): code = document or journal or collection data = {} xylose_do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data():\n return app_views", "def data_for_all(request):\n data = common_data(request)\n data.update({\"tags\": Tag.used_tags(),\n \"archive_qualifier\": \"\",\n \"recent_active_months\": Blog.recent_active_months()})\n return data", "def common_context(request):...
[ "0.6341154", "0.5741006", "0.5648095", "0.559915", "0.5597389", "0.55743283", "0.5551376", "0.5519761", "0.5490871", "0.54798126", "0.5479319", "0.5315314", "0.5302181", "0.5232341", "0.522839", "0.52071565", "0.5182045", "0.5180877", "0.51765704", "0.51497936", "0.51259214",...
0.5870001
1
Constructor. Unless otherwise specified it has a perfect quantum efficiency, samples at a rate of once per second and has a 0.1s integration time
def __init__(self, quantum_efficiency=1.0, sample_rate_times_per_second=1.0, integration_time_seconds=0.1): self.quantum_efficiency = quantum_efficiency self.sample_rate_times_per_second = sample_rate_times_per_second self.integration_time_seconds = integration_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, time_constant: float, sampling_time: float):\n self.alpha = sampling_time / (time_constant + sampling_time)\n self.state = None", "def __init__(self, timer=120, rate=1, percent=0):\n self.timer = timer\n self.rate = rate\n self.percent = percent", "def __init__(sel...
[ "0.6873452", "0.6581009", "0.6519729", "0.6232511", "0.6232355", "0.6188222", "0.616987", "0.61652625", "0.6155164", "0.61493057", "0.6139855", "0.6118475", "0.610823", "0.6098916", "0.6088264", "0.60863924", "0.60642815", "0.6009342", "0.60072887", "0.60061246", "0.59945565"...
0.80746883
0
Demeans data assuming that each row is a timecourse and divides the row by it's standard deviation to enforce unit variance.
def scale_timecourse_data(V): # Get the mean of each row V_mean = V.mean(axis=1) # Get the std of each row V_std = V.std(axis=1) # Change zeros to ones (avoid dividing zero columns by zero) V_std[V_std==0] = 1 V_std = V_std.T[:, np.newaxis] # Feature scale the rows of V V = np.di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stdev(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tmean_values=column_matrix.std(0)\n\tstd_values=mean_values.tolist()\n\treturn std_values", "def standard_deviation(data):\n\n return np.sqrt(variance(data))", "def standard_deviation(data):\n\n return np.sqrt(variance(data))", "def ge...
[ "0.67038697", "0.65886843", "0.65886843", "0.6443919", "0.6354485", "0.62777156", "0.62359643", "0.6214864", "0.6205753", "0.61780286", "0.6169963", "0.61327285", "0.6082657", "0.6057745", "0.6053649", "0.60294616", "0.6019821", "0.60037726", "0.5991898", "0.5970491", "0.5953...
0.54657185
96
Creates new task window
def new_task(self, widget): my_task_window = taskwindow.TaskWindow(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_task(event):\n manager = event.workbench.get_plugin('exopy.tasks')\n dialog = BuilderView(manager=manager,\n parent=event.parameters.get('parent_ui'),\n future_parent=event.parameters.get('future_parent'))\n result = dialog.exec_()\n if result:...
[ "0.7113246", "0.70224667", "0.6907756", "0.68215317", "0.6519921", "0.6381383", "0.637192", "0.6319704", "0.62721485", "0.6223385", "0.61893445", "0.6168583", "0.61627823", "0.6148006", "0.6140917", "0.6093474", "0.5996884", "0.5986673", "0.5972583", "0.59595525", "0.5941826"...
0.81975675
0
Shows a window with all the tasks and alarms
def see_tasks(self, widget): my_task_list = tasklistwindow.TaskListWindow(self.task_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard_showall():\n tasks = Task.query.all()\n return render_template('home/taskshowall/dashboard_showall.html',\n tasks=tasks, title=\"Tasks\")", "def show_tasks():\n\n task = Task(connection=connection, cursor=cursor)\n\n all_tasks = task.get_all_tasks()\n\n cont...
[ "0.6601088", "0.6460697", "0.628572", "0.6235331", "0.61510676", "0.6129666", "0.6097378", "0.607427", "0.6070758", "0.6047063", "0.59771895", "0.59053344", "0.58603084", "0.58067805", "0.58024603", "0.57794356", "0.57792646", "0.5776163", "0.57633907", "0.5740602", "0.571361...
0.69399023
0
Delete the given profile from the server
def delete_profile(subscription_key, profile_id): helper = VerificationServiceHttpClientHelper.VerificationServiceHttpClientHelper(subscription_key) helper.delete_profile(profile_id) print('Profile {0} has been successfully deleted.'.format(profile_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fusion_api_delete_server_profile(self, name=None, uri=None, param='', api=None, headers=None):\n return self.profile.delete(name=name, uri=uri, param=param, api=api, headers=headers)", "def delete_network_profile(self, profile):\r\n return self.delete(self.network_profile_path % profile)", ...
[ "0.8142084", "0.80761915", "0.7869769", "0.7786373", "0.76816595", "0.7514914", "0.7442937", "0.7420244", "0.74095243", "0.739577", "0.7388937", "0.7387069", "0.7378266", "0.737173", "0.73160154", "0.72956455", "0.72497237", "0.7233755", "0.7171392", "0.7163262", "0.7143254",...
0.7901775
2
Calculates maximum likelihood estimates
def aicmle(timeSeries, distribution): mlevals = {} if distribution == 'pareto': mlevals['xmin'] = np.min(timeSeries) mlevals['mu'] = 1 - timeSeries.shape[0] / (timeSeries.shape[0] * np.log(mlevals['xmin']) - np.sum(np.log(timeSeries))) elif distribution == 'lognormal': mlev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxlikelihood(self):\n\n chi2 = lambda *args: -2 * lnlikelihood.lnlike(*args) \n # print('***DEBUGGING*** chi2 = ', chi2)\n # print('***DEBUGGING*** self.theta_guess = ', self.theta_guess)\n # print('***DEBUGGING*** self.transinfo = ', self.transinfo)\n # print('***D...
[ "0.70915174", "0.66576946", "0.6527788", "0.64514744", "0.6386824", "0.6367023", "0.6366287", "0.63379896", "0.631658", "0.62785214", "0.61752355", "0.60306334", "0.6018936", "0.5992277", "0.59862584", "0.5976006", "0.59672964", "0.59648114", "0.5962802", "0.5960479", "0.5950...
0.0
-1
Calculates natural log likelihood values
def aiclike(timeSeries, params, distribution): if distribution == 'pareto': nloglval = -(timeSeries.shape[0] * np.log(params['mu']) + timeSeries.shape[0] * params['mu'] * np.log(params['xmin']) - (params['xmin']+1) * np.sum(np.log(timeSeries))) return nloglval elif distribution == 'logn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood(self):\r\n return (-0.5 * self.num_data * self.output_dim * np.log(2.*np.pi) -\r\n 0.5 * self.output_dim * self.K_logdet + self._model_fit_term() + self.likelihood.Z)", "def nloglikeobs(self, params):\n lambda_ = params[0]\n\n ll_output = self._LL(self.endog, rate=lambd...
[ "0.73833865", "0.7282104", "0.72731364", "0.7224237", "0.72090906", "0.72088003", "0.7207167", "0.71788365", "0.7166103", "0.7160064", "0.7155805", "0.71335495", "0.71213716", "0.7114622", "0.7103507", "0.70852166", "0.70822245", "0.70803833", "0.70540184", "0.7014505", "0.70...
0.0
-1
Generates the values for the probability distributions
def aicpdf(xvals, distribution, params): if distribution == 'pareto': pvals = (params['xmin'] * params['mu'] ** params['xmin']) / (xvals ** (params['xmin'] + 1)) return pvals elif distribution == 'lognormal': #import pdb; pdb.set_trace() pvals = np.exp(-(np.log(xvals) - para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_samples(self):\n self.analytic_probability()", "def generate_probabilities(self):\n k = 1\n v= 10\n for g in self.class_probabilities:\n curr_list = self.class_probabilities[g]\n for l in range(0,28):\n for w in range(0,28):\n ...
[ "0.7003688", "0.6883407", "0.6792984", "0.67818236", "0.666771", "0.66444635", "0.6615368", "0.6597994", "0.65978616", "0.6579974", "0.6578962", "0.6567796", "0.6556646", "0.6516561", "0.64934367", "0.64649326", "0.640872", "0.6397725", "0.6374798", "0.6366242", "0.6345269", ...
0.0
-1
aic(timeSeries, ssc=0) > data, max_weight, max_weight_params
def aic(timeSeries, ssc=0): if np.min(timeSeries) <= 0: timeSeries = timeSeries + -np.min(timeSeries) + .01 # create histogram to determine plot values # note that the original uses hist centers, this uses edges. It may matter counts, plotvals_edges = np.histogram(timeSeries, 50) plot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aic_ms(distribution):\n print(\"TESTING: AIC model selection for %s distribution\" % distribution.upper())\n params = dist.DISTRIBUTIONS[distribution][dist.KEY_TEST_PARAMS]\n print(\" creating sample\")\n test_sample = dist.samples(distribution, params)\n print(\" calculating AIC for all ...
[ "0.52783775", "0.5277361", "0.51554257", "0.5079259", "0.5041149", "0.5019891", "0.49585706", "0.49330664", "0.49314007", "0.4872369", "0.4855907", "0.48519504", "0.48410013", "0.4838592", "0.47834566", "0.47363517", "0.47308505", "0.47119272", "0.47084534", "0.47058246", "0....
0.5706766
0
Add item to heap
def add_item(self, new_value): # Allocate more memory if necessary # This keeps add_item to O(1), generally. # Otherwise, have to duplicate ndarray every time # last_item is an index, heap_size is a limit (index + 1) if self.last_item >= self.heap_size - 1: # Allocat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item):\n heapq.heappush(self.heap, item)", "def heappush(heap, item):\n heap.append(item)\n Heap.siftdown(heap, 0, len(heap) - 1)", "def heappush(heap, item):\n pass", "def push(self, item: tuple):\n self.__heap.append(item)\n self.__sift_up(self.__len__()...
[ "0.86743045", "0.85555136", "0.84952396", "0.8408714", "0.83693314", "0.83544827", "0.8334501", "0.82352614", "0.8180887", "0.79542404", "0.7924978", "0.7850471", "0.78375816", "0.7834717", "0.7763897", "0.7657202", "0.764088", "0.7628112", "0.7622526", "0.76175183", "0.76170...
0.7952556
10
Show line of asterisks to demarcate bounds of heap
def demarcate_heap(hgt=self.level, cell_wid=minimum_cell): # Number of nodes on bottom is 2^hgt max_nodes = int(np.power(2, hgt)) print (''.center(cell_wid * max_nodes, '*'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_heap(self):\n for i in range(1, (self.size//2)+1): \n print(\" PARENT : \"+ str(self.Heap[i])+\" LEFT CHILD : \"+ \n str(self.Heap[2 * i])+\" RIGHT CHILD : \"+\n str(self.Heap[2 * i + 1]))", "def min_heap(self): \n \n ...
[ "0.6224625", "0.6115098", "0.60877067", "0.6073852", "0.58567894", "0.5810459", "0.57655525", "0.57655525", "0.5722967", "0.5565458", "0.55614096", "0.55261725", "0.55241466", "0.550935", "0.5506681", "0.54333556", "0.54333556", "0.54319435", "0.5421225", "0.54208", "0.541896...
0.6630077
0
Get index of parent node
def get_parent_index(i): # Indexing for i_parent == i // 2 is NOT ZERO-INDEXED pos = i + 1 parent_pos = pos // 2 parent_index = parent_pos - 1 return parent_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent_index(self):\n return (self.index - 1) // 2", "def get_left_child_index(self, parent):\n return 2*parent+1", "def parent(self, index):\n if index == 0:\n print(\"index 0 has no parent\")\n return None\n return (index - 1) // 2", "def get_parent...
[ "0.8496504", "0.82781035", "0.8254789", "0.82179976", "0.81770974", "0.81386656", "0.8075585", "0.8044404", "0.8016533", "0.79629314", "0.79252255", "0.7716487", "0.74751145", "0.7472065", "0.7414298", "0.7355776", "0.7355776", "0.7342362", "0.7312784", "0.7292973", "0.726240...
0.81710243
5
Get index of left child
def get_left_index(i): pos = i + 1 left_pos = 2 * pos left_index = left_pos - 1 return left_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_left_child_index(self):\n return (2 * self.index) + 1", "def left_child(self, index):\n return 2 * index + 1", "def left_child(self, index):\n return 2 * index", "def get_left_child_index(self, parent):\n return 2*parent+1", "def left_child_idx(idx):\n return (idx << ...
[ "0.9122641", "0.88522995", "0.8762248", "0.86230975", "0.83617294", "0.8189093", "0.80934316", "0.80934316", "0.79510504", "0.77594656", "0.76739126", "0.76264703", "0.7587339", "0.7570154", "0.750047", "0.7485209", "0.74505705", "0.74247074", "0.72877926", "0.7251152", "0.72...
0.75896484
12