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
Main entry point for module execution
def main(): required_if = [ ("state", "merged", ("config",)), ("state", "replaced", ("config",)), ("state", "overridden", ("config",)), ("state", "rendered", ("config",)), ("state", "parsed", ("running_config",)), ] mutually_exclusive = [("config", "running_config")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n pass", "def main():\n return", "def main(self) -> None:\n pass", "def main(self):\r\n pass", "def main():\n module = IRODSPermissionModule()\n module.run()", "def main():\n obj = UnityFilesystem()\n obj.perform_module_operation()", "def run():\n main...
[ "0.7655644", "0.7578341", "0.7490611", "0.7369463", "0.7361173", "0.7284486", "0.72742957", "0.7261932", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0.72615725", "0....
0.0
-1
Return bounding box of biggest object of selected category.
def filter_inference_results(self, predictions, object_category='person'): if predictions is not None and len(predictions) == 3: bboxes, labels, confs = predictions # Only return bounding boxes for the selected object category. category_bboxes = [(bbox, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\n return None", "def select_best_animal(found_animals: Dict[AnimalType, List[yolo.BoundBox]]) \\\n -> Tuple[AnimalType, yolo.BoundBox]:\n lb_size = 0.0\n largest_box = None\n lb_animal = \"\"\n for animal in found_animals.keys():\n ...
[ "0.6700369", "0.66861564", "0.65738463", "0.65710014", "0.65018713", "0.6487645", "0.64403796", "0.64005184", "0.63451606", "0.63279337", "0.6325666", "0.62589586", "0.6235425", "0.6235425", "0.62083435", "0.61787564", "0.61704993", "0.61611485", "0.615791", "0.61494553", "0....
0.6020185
38
Asynchronous update of detection results to return object center.
def update(self, predictions, frame, frameCenter): if len(predictions) > 0: (x, y, w, h) = predictions[0][0] objectX = int(x + (w / 2.0)) objectY = int(y + (h / 2.0)) return ((objectX, objectY), predictions) else: return (frameCenter, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, frame, frameCenter):\n\t\t# GrayScale conversion from OpenCV\n\t\tgray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\n\n\t\t# call the detector for the multiple faces from the input \n\t\trects = self.detector.detectMultiScale(gray, scaleFactor=1.05,\n\t\t\tminNeighbors=9, minSize=(30, 30),\n\t\t\tfla...
[ "0.57625234", "0.5705489", "0.5599008", "0.5552633", "0.5551374", "0.55429983", "0.55101174", "0.5507732", "0.5487247", "0.54679406", "0.5435144", "0.5432267", "0.5403248", "0.53964525", "0.53791773", "0.5375063", "0.5355548", "0.53444505", "0.532095", "0.53023297", "0.528739...
0.5430607
12
call after request or when request failed
def teardown_request(exception): if db.session is not None: db.session.close() else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onfinish( request ):", "def onfinish( request ):", "def on_success(self) -> None:", "def _handle_first_request(self):\n pass", "def on_failure(self):\n pass", "def _process_request(self, request, response):\n ...", "def on_request_error(locust_instance, exception, tb, **kwargs)...
[ "0.7010329", "0.7010329", "0.6895634", "0.6813143", "0.68018883", "0.6787187", "0.6726384", "0.6631935", "0.6589202", "0.64847404", "0.64845294", "0.64152426", "0.6392727", "0.6372866", "0.63498706", "0.63338596", "0.63268614", "0.6297562", "0.6294351", "0.6294351", "0.626538...
0.0
-1
get today's date and show it
def get_today(): return dict(today = str(datetime.today())[:10])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_date_today() -> str:\n return datetime.now().strftime(\"%Y-%m-%d\")", "def get_today_date():\n return date.today()", "def get_current_date():\n return datetime.datetime.today().strftime(constants.DATE_FORMAT)", "def todayDate(self):\n return time.strftime(\"%m/%d/%Y\", time.lo...
[ "0.8333997", "0.81344694", "0.810984", "0.8056313", "0.8011519", "0.7931398", "0.7928051", "0.7920088", "0.78313667", "0.7784978", "0.777743", "0.7743336", "0.76993936", "0.7690719", "0.7687875", "0.7673903", "0.76170886", "0.753422", "0.74367076", "0.73783803", "0.7342855", ...
0.6360048
84
show all the entries in the index page
def show_entries(): books = Entries.query.order_by(Entries.title).all() if 'adminname' in session and session['adminname'] is not None : user = User.query.filter_by(username=session['adminname']).first() books = map(encrypt_book_record, books) return render_template('show_entries_admin....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(request):\n return EntryView.__index(request)", "def show_entries():\n db = get_db()\n cur = db.execute('select distinct name,repo_id,stars, description from python_repos order by stars desc')\n entries = cur.fetchall()\n # get api\n results = get_api()\n # The update operation ...
[ "0.75725347", "0.7508032", "0.73154354", "0.73004013", "0.7294184", "0.72144544", "0.72119045", "0.7202788", "0.71877694", "0.7158893", "0.7112895", "0.711037", "0.7086761", "0.7053778", "0.6993657", "0.6922468", "0.6921215", "0.6899069", "0.68835634", "0.68834364", "0.683068...
0.0
-1
show all the entries in the index page for administrators
def show_entries_admin(): books = map(encrypt_book_record, Entries.query.order_by(Entries.title).all()) if 'adminname' in session and session['adminname'] is not None : user = User.query.filter_by(username=session['adminname']).first() return render_template('show_entries_admin.html', books=book...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all_information():\n if not g.user:\n flash(\"Please login to access\", \"danger\")\n return redirect(\"/\")\n if g.user.is_admin == False:\n flash (\"Unauthorized\", \"danger\")\n return redirect(\"/login\")\n\n employees = Employee.query.all()\n all_certs = employ...
[ "0.708475", "0.69935346", "0.69554603", "0.68892956", "0.68528265", "0.6792956", "0.6771388", "0.6751204", "0.6734227", "0.6723165", "0.668644", "0.667853", "0.65929514", "0.6547838", "0.6539842", "0.6528335", "0.64986575", "0.64170974", "0.63448447", "0.6293383", "0.62927675...
0.74598587
0
add entry if admin is logged in
def add_entry(): if not check_admin_logged() : abort(403) title = request.form['title'] category = request.form['category'] buydate = request.form['buydate'] introduction = request.form['introduction'] if not check_items_in_form(title, category, buydate): return redirect(url_fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _ad_add(self, ctx, member: discord.Member):\n new_admin = sql.TalosAdmin((ctx.guild.id, member.id))\n if new_admin not in self.database.get_admins(ctx.guild.id):\n self.database.save_item(new_admin)\n await ctx.send(f\"Added admin {member.name}!\")\n else:\n ...
[ "0.6794541", "0.6406035", "0.63694054", "0.62817025", "0.62354743", "0.62257415", "0.6197102", "0.61642706", "0.6162293", "0.6114971", "0.60939115", "0.60805875", "0.60700405", "0.6014684", "0.60051566", "0.60028654", "0.5984586", "0.5975538", "0.5967393", "0.5945101", "0.593...
0.0
-1
edit entry if admin is logged in
def edit_entry(): if not check_admin_logged() : abort(403) title = request.form['title'] category = request.form['category'] buydate = request.form['buydate'] ssid = decrypt_book_record(request.form['ssid']) if not check_items_in_form(title, category, buydate): return redirect(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_edituser():\n\tpass", "def edit(self):\n\n pass", "def edit():", "def show_entries_admin():\n books = map(encrypt_book_record, Entries.query.order_by(Entries.title).all())\n if 'adminname' in session and session['adminname'] is not None :\n user = User.query.filter_by(username=se...
[ "0.6982155", "0.68434054", "0.6830316", "0.68228346", "0.6598078", "0.6589584", "0.657738", "0.6559947", "0.6493951", "0.64575356", "0.64395964", "0.63735574", "0.63637996", "0.6351722", "0.6277955", "0.6240855", "0.62261134", "0.62225854", "0.62117785", "0.6188642", "0.61860...
0.6233252
16
delete entry if admin is logged in
def delete_entry(): if not check_admin_logged() : abort(403) title = request.args.get('title', default='') category = request.args.get('category', default='') buydate = request.args.get('buydate', default='') ssid = decrypt_book_record(request.args.get('ssid')) pre_delete_entry = Entri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_entry():\n u_id = request.args(0) or redirect(URL('moderation', 'new_entries'))\n db(db.lioli_main.unique_id == u_id).delete()\n redirect(URL('new_entries'))\n return dict()", "def on_model_delete(self, model):\n if not current_user.is_active or not current_user.is_authenticated:\n ...
[ "0.7008891", "0.6864175", "0.670782", "0.66472805", "0.66187227", "0.66040117", "0.6559425", "0.6545127", "0.6515902", "0.6462635", "0.63835216", "0.63565546", "0.63554716", "0.63477015", "0.63192195", "0.6278768", "0.6272764", "0.62542844", "0.6252763", "0.62128603", "0.6204...
0.0
-1
As this is a tiny private library system, it is not need to let strangers to log in or log up. So just add your friends in the app.config
def login(): error = None form = Form() # only support POST if request.method == 'POST' : username = request.form['username'] password = request.form['password'] # if the user is not an administrator if username not in app.config['ADMINNAME'] : # if the user ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gotConfig(self, mode, buddylist, permit, deny):\n global screename\n\n # add someone to our deny list?\n self.add_deny([])\n\n # add ourself to our buddy list\n self.add_buddy([screenname])\n\n # finish up the signon procedure\n self.signon()", "def init_wecha...
[ "0.6370695", "0.59829766", "0.5262678", "0.51919115", "0.51740307", "0.5138567", "0.5136739", "0.5124632", "0.50850356", "0.5025734", "0.5023", "0.49943757", "0.4994048", "0.49868828", "0.4981748", "0.49735132", "0.49378282", "0.49377882", "0.49318695", "0.49210507", "0.49122...
0.0
-1
get the view of book according to the title. title [string] the title of the relative book
def get_book_view(title): # 使用来自数据库的数据来动态生成页面而不是映射到对应的静态页面上去 # 目前对于这个小应用还可以,在将来可能需要修改 if not check_title_is_existed(title) : return redirect(url_for('show_entries')) category = request.args.get('category', default='') buydate = request.args.get('buydate', default='') selected_entry = E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, book_title):\n return qh.get_book_title(book_title)", "def getBook(self, title):\n return self._books.get(title, None)", "def book(title):\n\n # Make sure user is logged in\n if \"username\" not in session:\n return render_template(\"index.html\", message=\"Please login...
[ "0.70195967", "0.6880717", "0.6197569", "0.5954362", "0.5864457", "0.58029574", "0.5758659", "0.5707605", "0.5605071", "0.5558975", "0.5505221", "0.55045694", "0.55041933", "0.5483169", "0.5453215", "0.5435752", "0.5412766", "0.5356288", "0.5307087", "0.52594316", "0.525346",...
0.7128281
0
the view of borrow page. Users can fill the form of borrowing and submit it to the administrators. Then the administrator will be noticed to handle it. username [sting] the username of User
def borrow(user_id): user = User.query.filter_by(user_id=user_id).first_or_404() # make sure the user who will fill the form is the user # whose user_id is reponsitive to the URL if user.username == session.get('username') or \ user.username == session.get('adminname') : book_ids = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_buss(request):\n current_user = request.user\n \n return render(request,'main_templates/view_buss.html')", "def renewborrower():\n if not g.userInfo:\n return redirect(url_for('base_page.index', user=None))\n error = None\n if request.method == 'POST':\n if g.userInfo[8] ...
[ "0.66166013", "0.62493306", "0.6241006", "0.61999243", "0.6088848", "0.60641193", "0.5907898", "0.5905894", "0.5887535", "0.58647573", "0.58345824", "0.583217", "0.5806807", "0.5792316", "0.5774784", "0.57665324", "0.57563657", "0.5755857", "0.5753773", "0.5753773", "0.574071...
0.7075745
0
the view of reborrow page. Users can fill the form of reborrowing and submit it to the administrators. Then the administrator will be noticed to handle it. username [sting] the username of User
def reborrow(user_id): user = User.query.filter_by(user_id=user_id).first_or_404() # make sure the user who will fill the form is the user # whose user_id is reponsitive to the URL if user.username == session.get('username') or \ user.username == session.get('adminname') : book_ids ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renewborrower():\n if not g.userInfo:\n return redirect(url_for('base_page.index', user=None))\n error = None\n if request.method == 'POST':\n if g.userInfo[8] in ['clerk']:\n bid = request.form['bid'].encode('utf-8')\n match = TableOperation.sfw('Borrower', ['*'], ...
[ "0.67607075", "0.608056", "0.60169417", "0.59693", "0.5887694", "0.5813947", "0.57972085", "0.5781515", "0.5766197", "0.57499635", "0.5727291", "0.57140523", "0.5690077", "0.56435955", "0.563414", "0.5603867", "0.5584838", "0.5575254", "0.55746365", "0.5572139", "0.5563708", ...
0.66658294
1
the view of return page. Users can fill the form of return book and submit it to the administrators. Then the administrator will be noticed to handle it. username [sting] the username of User
def return_book(user_id): user = User.query.filter_by(user_id=user_id).first_or_404() # make sure the user who will fill the form is the user # whose user_id is reponsitive to the URL if user.username == session.get('username') or \ user.username == session.get('adminname') : book_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_main_page():\n username = sign_up.get_username()\n if username:\n main_var = dict(user = username, stat_rows = STATS, location = LOCATION)\n return bottle.template('main', main_var = main_var)\n else:\n bottle.redirect('/login')", "def index():\n if request.method == \"P...
[ "0.652459", "0.64362925", "0.63072705", "0.62538195", "0.6228235", "0.6204274", "0.62004447", "0.6089296", "0.6054652", "0.6028118", "0.59808975", "0.59808975", "0.59639364", "0.58927494", "0.58544517", "0.584234", "0.5839047", "0.5837261", "0.582492", "0.5820283", "0.5818793...
0.54864395
81
Return True if session is localized.
def db_session_is_localized(self): return self.__dict__.has_key('db_session')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ctx_has_locale() -> bool:\n ctx = _get_current_context()\n if ctx is None:\n return False\n return hasattr(ctx, 'babel_locale')", "def IsLoaded(*args, **kwargs):\n return _gdi_.Locale_IsLoaded(*args, **kwargs)", "def getIsMultilingual(self):\n return self.getOrDefault(self.isM...
[ "0.650045", "0.61962056", "0.611111", "0.6054472", "0.5953662", "0.5830956", "0.58225954", "0.5765789", "0.5690028", "0.56166595", "0.55772704", "0.5532859", "0.5453551", "0.54300606", "0.54264396", "0.5391326", "0.53821754", "0.53780025", "0.53728426", "0.5369159", "0.535767...
0.80610275
0
Open a new SQLAlchemy session. This new session is assigned to L{db_session} of this widget and all descendant widgets until either L{db_session_commit_and_globalize} or L{db_session_rollback_and_globalize} is called on this widget.
def db_session_localize(self): if self.db_session: engine = self.db_session.bind else: engine = self.session.program.DBModel.engine self.db_session = engine.Session() # Keep track of session self.session.worm_localized.add(self.db_session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self):\n self._session = self.session_open()", "def _set_session(self):\n self.__session = sessionmaker(bind=self.__engine)()", "def open_session(self):\n return self.Session()", "def db_session(request, config):\n from h import db\n engine = db.make_engine(config.registry...
[ "0.6899055", "0.68543345", "0.65129745", "0.64536434", "0.63311404", "0.6317526", "0.62793005", "0.6276834", "0.6266114", "0.62572324", "0.62396383", "0.6225321", "0.6216103", "0.6184517", "0.61438495", "0.6094303", "0.60222036", "0.6020307", "0.6011334", "0.5982175", "0.5963...
0.64901483
3
Commit the current local SQLAlchemy session (created with L{db_session_localize} on this widget) and remove/close the session, making the global session visible to this widget and descendant widgets again. You might want to do self.db_session.expire() after this to make any changes to your local session visible in the ...
def db_session_commit_and_globalize(self): self.db_session.commit() self.session.worm_localized.remove(self.db_session) del self.db_session # FIXME: Update all nested localized sessions. self.db_session.expire_all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_session_rollback_and_globalize(self):\n self.db_session.rollback()\n self.session.worm_localized.remove(self.db_session)\n del self.db_session", "def save_before_close(self):\n if self.db_window:\n self.db_window.destroy()\n self.destroy()", "def commit(self...
[ "0.67239785", "0.66214174", "0.64808667", "0.64619935", "0.63480055", "0.6337384", "0.6296969", "0.6253922", "0.6190622", "0.612898", "0.6086176", "0.6084393", "0.6043479", "0.598818", "0.59869117", "0.5958185", "0.59485453", "0.5934197", "0.5917074", "0.5917074", "0.5917074"...
0.78256214
0
Rollback the current local SQLAlchemy session (created with L{db_session_localize} on this widget) and remove/close the session, making the global session visible to this widget and descendant widgets again.
def db_session_rollback_and_globalize(self): self.db_session.rollback() self.session.worm_localized.remove(self.db_session) del self.db_session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_session_commit_and_globalize(self):\n self.db_session.commit()\n self.session.worm_localized.remove(self.db_session)\n del self.db_session\n # FIXME: Update all nested localized sessions.\n self.db_session.expire_all()", "def _close(self):\n if self.__session is n...
[ "0.69830817", "0.6831465", "0.6580956", "0.63987786", "0.63065374", "0.6255354", "0.6255354", "0.6255354", "0.62003577", "0.619857", "0.61350036", "0.60096955", "0.6001342", "0.5989135", "0.59747803", "0.59709346", "0.59528714", "0.5927543", "0.5882605", "0.58783174", "0.5874...
0.78382546
0
Rollbacks the current (local) SQLAlchemy session and appends the current exception and backtrace to the list of error messages for this widget.
def append_exception(self, message=u''): if isinstance(sys.exc_info()[1], sqlalchemy.exceptions.SQLAlchemyError): self.db_session.rollback() Webwidgets.Widget.append_exception(self, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback(self):\n raise TransactionRollback('rollback called outside of transaction')", "def rollback(self):\n\n if not self.is_active:\n return\n\n if self.is_context_active:\n raise states.RolledBack(self)\n else:\n self.__do_rollback()\n ...
[ "0.68692607", "0.68417865", "0.6727358", "0.6682666", "0.66604054", "0.66078806", "0.6595147", "0.6576987", "0.65565866", "0.6475917", "0.63871044", "0.62523556", "0.62087405", "0.61652637", "0.61646914", "0.6125406", "0.6104549", "0.61016774", "0.6100832", "0.6083901", "0.60...
0.72351116
0
Sync to_directory with from_directory by copying each file in to_directory with new contents. Files in to_directory will be overwritten by files of the same name in from_directory. We need to keep two copies of the log directory because otherwise TensorBoard picks up temp files from `aws s3 sync` and then stops reading...
def _sync_directories(from_directory, to_directory): if not os.path.exists(to_directory): os.mkdir(to_directory) for root, dirs, files in os.walk(from_directory): to_root = root.replace(from_directory, to_directory) for directory in dirs: to_child_dir ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_metadata(from_dir, to_dir):\n if not FLAGS.dry_run:\n tf.io.gfile.makedirs(to_dir)\n for fname in tfds.core.utils.list_info_files(from_dir):\n from_path = os.path.join(from_dir, fname)\n to_path = os.path.join(to_dir, fname)\n logging.info('cp %s %s', from_path, to_path)\n if not FLAGS.d...
[ "0.6270665", "0.60585004", "0.5803349", "0.5785908", "0.57809067", "0.57445365", "0.5681512", "0.563036", "0.5578538", "0.557493", "0.5568786", "0.5554208", "0.5548205", "0.55205566", "0.54880303", "0.54073787", "0.53864986", "0.53833014", "0.5359479", "0.53504395", "0.535022...
0.78838134
0
Context manager for a temporary directory. This is similar to tempfile.TemporaryDirectory in python>=3.2.
def _temporary_directory(): name = tempfile.mkdtemp() try: yield name finally: shutil.rmtree(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_temp_dir():\n directory = tempfile.mkdtemp()\n try:\n yield directory\n finally:\n shutil.rmtree(directory)", "def tempdir():\n\n class ctx(object):\n\n def __enter__(self):\n self.prevdir = os.getcwd()\n self.tempdir = tempfile.mkdtemp()\n ...
[ "0.8151143", "0.80606616", "0.79753256", "0.79536724", "0.79371685", "0.79356587", "0.79355663", "0.7912876", "0.78649515", "0.78183824", "0.7785393", "0.7777123", "0.77747816", "0.7705706", "0.7695398", "0.7673213", "0.7660842", "0.76580966", "0.7650998", "0.7628625", "0.761...
0.8148666
1
Ensure that TensorBoard and the AWS CLI are installed. These dependencies are required for using TensorBoard.
def validate_requirements(self): if not self._cmd_exists('tensorboard'): raise EnvironmentError( 'TensorBoard is not installed in the system. Please install TensorBoard using the' ' following command: \n pip install tensorboard') if not self._cmd_exists('aws'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_aws():\n sub_install_packages()\n sub_install_virtualenv()\n sub_create_virtualenv()\n sub_install_python_requirements_aws()", "def install_sm_local_dependencies(framework, job_type, image, ec2_conn, ec2_instance_ami):\n python_invoker = get_python_invoker(ec2_instance_ami)\n # In...
[ "0.577606", "0.557087", "0.55209863", "0.5308761", "0.51443", "0.5119925", "0.50857913", "0.50799906", "0.50063074", "0.49969366", "0.49491173", "0.4945465", "0.4945246", "0.4934019", "0.489118", "0.48885366", "0.48777446", "0.48691902", "0.4865129", "0.48568448", "0.4839932"...
0.7782969
0
Create a TensorBoard process.
def create_tensorboard_process(self): port = 6006 for _ in range(100): p = subprocess.Popen( ["tensorboard", "--logdir", self.logdir, "--host", "localhost", "--port", str(port)], stdout=subprocess.PIPE, stderr=subprocess.PIPE ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_tensorboard(self):\n python_path = sys.executable\n option = '--logdir=' + self.instance.instance_summary_folder_path\n args_ = [python_path, tensorboard_dir(), option]\n self.open_subprocess(args_=args_, subprocess_key=\"tensorboard\")", "def create_new_board():\n\n board...
[ "0.5967794", "0.5926481", "0.59220135", "0.5821974", "0.581349", "0.5765901", "0.57170624", "0.56288046", "0.5552559", "0.5532915", "0.5530233", "0.55097836", "0.5477901", "0.54768014", "0.5469086", "0.541693", "0.5408603", "0.5384963", "0.53506166", "0.5337728", "0.5313522",...
0.69384116
0
Initialize a ``TensorFlow`` estimator.
def __init__(self, training_steps=None, evaluation_steps=None, checkpoint_path=None, py_version='py2', framework_version=None, model_dir=None, requirements_file='', image_name=None, script_mode=False, distributions=None, **kwargs): if framework_version is None: LOGG...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_tf_estimator(desc_file, model_dir):\n sess_config = tf.compat.v1.ConfigProto()\n sess_config.gpu_options.allow_growth = True\n config = tf.estimator.RunConfig(\n model_dir=model_dir, session_config=sess_config)\n model = ModelZoo().get_model(desc_file)\n\n def _model_fn(features, la...
[ "0.6552767", "0.6466512", "0.6449601", "0.6394394", "0.6393175", "0.63629436", "0.6302219", "0.62377006", "0.62219465", "0.62131083", "0.62071836", "0.61888766", "0.61823803", "0.615833", "0.6128869", "0.6120501", "0.60965437", "0.6055643", "0.60521173", "0.60483944", "0.6043...
0.6599906
0
Train a model using the input training dataset.
def fit(self, inputs=None, wait=True, logs=True, job_name=None, run_tensorboard_locally=False): def fit_super(): super(TensorFlow, self).fit(inputs, wait, logs, job_name) if run_tensorboard_locally and wait is False: raise ValueError("Tensorboard is not supported with async fit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train(self, dataset, model_dir):\n raise NotImplementedError", "def train_model(dataset):\n\n # clear the session so that we can train more than one model\n K.clear_session()\n\n # initialize the model\n mo...
[ "0.8336931", "0.8285992", "0.8002057", "0.7980904", "0.7916354", "0.78606725", "0.77298415", "0.76773417", "0.7635647", "0.75519866", "0.754373", "0.7486066", "0.74526685", "0.7441079", "0.7425182", "0.7388736", "0.73418176", "0.73383117", "0.7329356", "0.73053706", "0.727627...
0.0
-1
Convert the job description to init params that can be handled by the class constructor
def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None): init_params = super(TensorFlow, cls)._prepare_init_params_from_job_description(job_details, model_channel_name) # Move some of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name, job):\n self.name = name\n self.job = job\n self.runspecs = []", "def __init__(self, jobArgs):\n logging.info(\"Constructing job with args %r\" % jobArgs)\n self.args = jobArgs\n\n self._setup()", "def __init__(self, job: str=None): #...
[ "0.6796401", "0.67320555", "0.6613759", "0.64385927", "0.6432858", "0.64260584", "0.64236677", "0.64035034", "0.6401971", "0.63969374", "0.6380496", "0.6379365", "0.63259536", "0.62696606", "0.6234088", "0.62133336", "0.62065643", "0.61886764", "0.61812884", "0.61811143", "0....
0.6507478
3
Create a SageMaker ``TensorFlowModel`` object that can be deployed to an ``Endpoint``.
def create_model(self, model_server_workers=None, role=None, vpc_config_override=VPC_CONFIG_DEFAULT, endpoint_type=None): role = role or self.role if endpoint_type == 'tensorflow-serving' or self._script_mode_enabled(): return self._create_tfs_model(role=role, vpc_confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self) -> tf.keras.models.Model:\n raise NotImplementedError()", "def _make_model(self):\n self._model = tf.estimator.Estimator(model_fn=self.model_fn,\n model_dir=self.model_dir,\n config=self._config...
[ "0.6819635", "0.65104693", "0.6498425", "0.64926046", "0.64838105", "0.6425016", "0.63994265", "0.63273954", "0.63156533", "0.6306389", "0.61792016", "0.6173705", "0.6173564", "0.61605144", "0.6146582", "0.6115818", "0.607953", "0.6077646", "0.60186505", "0.6012362", "0.59610...
0.7037425
0
Return hyperparameters used by your custom TensorFlow code during model training.
def hyperparameters(self): hyperparameters = super(TensorFlow, self).hyperparameters() self.checkpoint_path = self.checkpoint_path or self._default_s3_path('checkpoints') mpi_enabled = False if self._script_mode_enabled(): additional_hyperparameters = {} if 'pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hyper_params():\n #################################\n ##### INSERT YOUR CODE HERE #####\n layers_size = [4096, 4096, 10]\n activation = 'relu'\n lr = 0.3\n epochs = 30\n dropout_rate = 0.2\n init_kind = 'xavier'\n ##### END YOUR CODE HERE ########\n ###########################...
[ "0.70930415", "0.7077545", "0.7065782", "0.7065782", "0.7055262", "0.7031362", "0.677347", "0.65879756", "0.6468851", "0.6413826", "0.64121133", "0.6412008", "0.6360292", "0.6342025", "0.6325073", "0.62614775", "0.6248047", "0.6244461", "0.62323964", "0.6215574", "0.62067944"...
0.70037484
6
Returns True if row and col are valid values
def valid_input(self, row, col): return ((row, col) not in self.marks and row <= WIDTH and row > 0 and col in COL_MAP)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self,row,col) -> bool:\n if(row >=0 and col>=0 and row<self.row and col<self.col and self.array[row][col]==-1 ):\n return True\n return False", "def is_valid(self):\n if self.get_row() != -1 and self.get_column() != -1:\n return True\n else:\n ...
[ "0.8091675", "0.80864257", "0.7924023", "0.78902096", "0.7659951", "0.75877786", "0.7548906", "0.75047547", "0.7499336", "0.74562085", "0.74394834", "0.7436682", "0.7368682", "0.7337169", "0.73290545", "0.73265445", "0.7304924", "0.7300693", "0.7293138", "0.7280832", "0.72412...
0.8213445
0
Place a piece on the board at position ROWCOL raises a ValueError if row or column is invalid
def mark(self, row, col, piece): if self.valid_input(row, col): self.marks.add((row, col)) self.place_at(row - 1, COL_MAP[col], piece) else: raise ValueError("invalid row and column supplied: row={}, col={}" .format(row, col))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_at(self, row, col, piece):\n self.board[row + PADDING][col + PADDING] = piece", "def place_piece(piece, px, py, pc):\n \n\n for i, j in piece:\n x = px + i\n y = py + j\n if not (0 <= x < BOARD_WIDTH):\n continue\n if not (0 <= y < BOARD_HEIGHT):\n ...
[ "0.8029984", "0.7447671", "0.7363715", "0.709779", "0.7061457", "0.6989181", "0.69663006", "0.69336915", "0.6894504", "0.68795395", "0.6845852", "0.6845852", "0.6838324", "0.6800873", "0.6779366", "0.66910005", "0.66720957", "0.66690725", "0.66428804", "0.6642121", "0.6630201...
0.71148443
3
Get the piece at the zero indexed row and column
def piece_at(self, row, col): return self.board[row + PADDING][col + PADDING]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_piece(self, row, column):\n return self._board[row][column]", "def __getitem__(self, index):\n x, y = index\n if 0 <= x < self.width and 0 <= y < self.height:\n return self.cells[x + y * self.width]\n else:\n return None", "def get(self,row,col):\r\n ...
[ "0.7295416", "0.7274309", "0.7000315", "0.6965118", "0.6947245", "0.6947245", "0.693291", "0.6913047", "0.68802345", "0.68495584", "0.6844074", "0.67958635", "0.67958635", "0.67958635", "0.67885065", "0.6768237", "0.67560166", "0.67495924", "0.6747535", "0.67233706", "0.67163...
0.7676288
0
Place the piece at the zero indexed row and column
def place_at(self, row, col, piece): self.board[row + PADDING][col + PADDING] = piece
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_piece(piece, px, py, pc):\n \n\n for i, j in piece:\n x = px + i\n y = py + j\n if not (0 <= x < BOARD_WIDTH):\n continue\n if not (0 <= y < BOARD_HEIGHT):\n continue\n board[y][x] = pc", "def put_piece(self, piece, row, col):\n self...
[ "0.661512", "0.64310443", "0.6252745", "0.6204028", "0.61396724", "0.61396724", "0.6106943", "0.60911864", "0.6088476", "0.60754514", "0.60331696", "0.59899485", "0.5988769", "0.5980728", "0.59770834", "0.59721535", "0.59702325", "0.5960619", "0.5960619", "0.5957366", "0.5940...
0.7319728
0
Check if the last mark added at (r,c) creates a winning state
def has_win(self, r, c, mark): row = r - 1 col = COL_MAP[c] cnt = 0 board_range = xrange(-1 * PADDING, PADDING + 1) # check vertical for dr in board_range: cnt = cnt + 1 if self.piece_at(row + dr, col) == mark else cnt if cnt == WIDTH: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_win():\r\n for mark in markers:\r\n if loc[0] == mark and loc[1] == mark and loc[2] == mark:\r\n return True\r\n if loc[0] == mark and loc[3] == mark and loc[6] == mark:\r\n return True\r\n if loc[0] == mark and loc[4] == mark and loc[8] == mark:\r\n ...
[ "0.70109254", "0.6833651", "0.66280854", "0.6573794", "0.6418051", "0.6405248", "0.64018345", "0.6397932", "0.63818234", "0.63676876", "0.6360904", "0.63500106", "0.63415575", "0.6315963", "0.63062656", "0.62958235", "0.62924767", "0.62854916", "0.6272178", "0.62693036", "0.6...
0.6819999
2
Returns true if a tie exists on this board
def tie_exists(self): return len(self.marks) == 9
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_tie(board):\n return 0 not in board[0]", "def game_tie(self):\n\n shape = self.board.shape\n if np.count_nonzero(self.board) == (shape[0] * shape[1]):\n # The board is full\n player = 0\n return True\n else:\n return False", "def _is...
[ "0.7543741", "0.74421966", "0.7174385", "0.7158319", "0.70751244", "0.6951705", "0.6935137", "0.6933638", "0.68399227", "0.6839235", "0.67778605", "0.66985226", "0.6692007", "0.6671597", "0.6668072", "0.66296566", "0.6591076", "0.655537", "0.65299284", "0.6523104", "0.6508229...
0.75141263
1
At version 4, L{PrivateApplication} should be an L{ITemplateNameResolver} powerup on its store.
def test_powerup(self): application = self.subStore.findUnique(PrivateApplication) powerups = list(self.subStore.powerupsFor(ITemplateNameResolver)) self.assertIn(application, powerups)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unknown_app(self):\n self.make_unknown()", "def test_unshare_template_registration(self):\n pass", "def test_share_template_registration(self):\n pass", "def test_default_app_exclusion(self):\n mock_apps = Apps(collections.OrderedDict([\n ('project', AppConfig('/tm...
[ "0.60529256", "0.55721647", "0.55654305", "0.5417136", "0.52996993", "0.52925515", "0.5281819", "0.524015", "0.5176775", "0.5120206", "0.5104463", "0.5077667", "0.507308", "0.50712687", "0.50686026", "0.50586444", "0.50278133", "0.5021658", "0.5019095", "0.5005884", "0.498781...
0.66232014
0
At version 5, L{PrivateApplication} should be an L{IWebViewer} powerup on its store.
def test_webViewer(self): application = self.subStore.findUnique(PrivateApplication) interfaces = list(self.subStore.interfacesFor(application)) self.assertIn(IWebViewer, interfaces)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsApplicationTrustedToRun(self) -> bool:", "def hide_web(self) -> bool:\n return pulumi.get(self, \"hide_web\")", "def is_web_exhibit(self):\n return self.web_exhibit", "def getApp(self):\n raise Exception('Not implemented.')", "def hide_web(self) -> Optional[pulumi.Input[bool]]:\n ...
[ "0.60877794", "0.60449106", "0.5861428", "0.58399016", "0.5555351", "0.5555351", "0.5517078", "0.55023813", "0.55023813", "0.5469189", "0.5369433", "0.52974826", "0.5247031", "0.52344793", "0.5140546", "0.51220024", "0.5096964", "0.5088554", "0.5088383", "0.50786066", "0.5077...
0.74925315
0
All of the attributes of L{PrivateApplication} should have the same values on the upgraded item as they did before the upgrade.
def test_attributes(self): application = self.subStore.findUnique(PrivateApplication) self.assertEqual(application.preferredTheme, PREFERRED_THEME) self.assertEqual(application.privateKey, PRIVATE_KEY) website = self.subStore.findUnique(WebSite) self.assertIdentical(application....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_version_invalid_attributes(self):\n return self._allow_version_invalid_attributes", "def test_back_compat_attributes(self):\n #Populate all fields from older version\n att = AttestationMechanism.create_with_tpm(DUMMY_EK, DUMMY_SRK)\n\n #Check back compat\n self.assert...
[ "0.6245698", "0.5929279", "0.5904795", "0.58279717", "0.55963385", "0.5523848", "0.54675084", "0.54672045", "0.54174125", "0.54007536", "0.5341977", "0.528145", "0.5236794", "0.51826143", "0.5157563", "0.5117754", "0.5107747", "0.510474", "0.5098657", "0.50835973", "0.5053894...
0.6672605
0
invoke local "sendmail" program to send a message. `from_addr' is envelope sender string (may be empty) `to_addrs' is list of envelope recipient addresses string will be treated as a list with 1 address. `msg' is headers and body of message to be sent `mail_options' is iterable of options ('8bitmime')
def sendmail(self, from_addr, to_addrs, msg, mail_options=()): # -i flag: do NOT treat bare dot as EOF cmd = [self.SENDMAIL, '-i'] if from_addr: # envelope sender? cmd.append('-f%s' % from_addr) if isinstance(to_addrs, tuple): # be liberal to_addrs = li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(self, fromaddr, addrs, message=\"\"):\n smtp = smtplib.SMTP(self._server, self._port)\n smtp.sendmail(fromaddr, addrs, message)\n smtp.quit()", "def send(self, to_addrs, subject, message, from_addr=None):\n if not from_addr: from_addr = self.user\n data = \"From:...
[ "0.6988561", "0.68563634", "0.6601052", "0.6585389", "0.64585745", "0.63953036", "0.6283752", "0.61753005", "0.61150044", "0.6057249", "0.60445815", "0.5993516", "0.5962057", "0.59512377", "0.58791", "0.5838177", "0.5820097", "0.57974416", "0.5784525", "0.5771491", "0.5750710...
0.82503575
0
Returns data for given view.
def get(view): vid = view.id() if vid not in __view_data: __view_data[vid] = ViewData() return __view_data[vid]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_data_from_view(self):\n self.log.info(\"Getting data from view: vw_AllSurveyData \")\n view_data = self.db.execute_pandas_query(self._get_query('vw_survey_data'))\n self._export_data_to_csv(view_data, 'fresh_survey_data.csv')", "def data():\n return app_views", "def get(self):\...
[ "0.69719744", "0.65511465", "0.6454514", "0.6106453", "0.60731554", "0.6032415", "0.6002862", "0.5964178", "0.5920505", "0.59087116", "0.5887843", "0.5873122", "0.5873122", "0.58712596", "0.58350617", "0.57830334", "0.57830334", "0.57830334", "0.57790315", "0.5770231", "0.572...
0.8006146
0
Clears data for given view.
def clear(view): vid = view.id() if vid in __view_data: del __view_data[vid]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n for key in self.__data.keys():\n del self.__data[key]", "def clear(self):\r\n self._state[\"data\"].clear()\r\n self._state[\"session\"].request_rerun()", "def clear(self):\r\n self._state[\"data\"].clear()\r\n self._state[\"session\"].request_re...
[ "0.62898004", "0.62870723", "0.62870723", "0.62837917", "0.62837917", "0.62837917", "0.62777203", "0.62517434", "0.6241923", "0.62245846", "0.6216914", "0.61368096", "0.60570216", "0.59968454", "0.59798944", "0.59653443", "0.5953536", "0.5953536", "0.59517497", "0.5935838", "...
0.8280418
0
Returns the appropriate options for positioning the editor at the end of the file. This function attempts to parse the random weird values people set EDITOR to, including bare commands, commands with arguments, and commands with paths.
def at_end_options(editor): # Trim off any trailing command-line arguments editor = editor.split()[0] path, binary = os.path.split(editor) return AT_END.get(binary, [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVKBEditMode(self):\r\n return eval(self.phone.sx('(send (get-text-editor-manager) get-edit-mode)', convertToString=True).title())", "def parameter_tweaks( cls, ):\n cls.file_text_editor.add_command( cls.parameters.ex_editor )\n print( f\"parameter tweaks {cls.text_editors}\" ) #", ...
[ "0.5471067", "0.5408208", "0.5314189", "0.52699107", "0.52628803", "0.5101266", "0.5094795", "0.50926393", "0.50667274", "0.50158817", "0.49822855", "0.49191922", "0.48989746", "0.4889055", "0.48730737", "0.48699728", "0.4853894", "0.48388448", "0.4837549", "0.48262706", "0.4...
0.6475677
0
a) create a list of the dict's keys and values; b) return the key with the max value
def keywithmaxval(d): v=list(d.values()) k=list(d.keys()) return k[v.index(max(v))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keywithmaxval(dictionary): # from https://stackoverflow.com/questions/268272/getting-key-with-maximum-value-in-dictionary/12343826#12343826 \n\tv=list(dictionary.values())\n\tk=list(dictionary.keys())\n\treturn k[v.index(max(v))]", "def keywithmaxval(d): \r\n v=list(d.values())\r\n k=list(d.keys())\r...
[ "0.853163", "0.8514927", "0.8256926", "0.8177595", "0.8094488", "0.79967916", "0.7868477", "0.78300834", "0.7704722", "0.76255924", "0.7562913", "0.75439674", "0.7499252", "0.73198014", "0.7308097", "0.72959465", "0.72901344", "0.7287315", "0.72506607", "0.71176517", "0.70939...
0.8609644
1
This Method removes a user from users dictonary using his/her unique email
def remove_user(self, email): try: self.users.pop(email) except KeyError: raise UserDoesNotExist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user_by_email(tx: Transaction, user_email: str) -> BoltStatementResult:\n query = f\"\"\"\n MATCH(n: Person {{email: '{user_email}'}})\n OPTIONAL MATCH(n)--(p: Post)\n DETACH DELETE n, p\"\"\"\n return tx.run(query)", "def delete_user():", "def remove_user(self, email):\n retur...
[ "0.69708824", "0.6968639", "0.6901791", "0.68791765", "0.676308", "0.6720373", "0.67113143", "0.6665886", "0.6653795", "0.6613853", "0.6590403", "0.65338796", "0.65085775", "0.64608604", "0.6459394", "0.645211", "0.6443287", "0.6443287", "0.6443287", "0.6426062", "0.63953745"...
0.7922419
0
Pull features from a Django queryset into a Mapnik MemoryDatasource.
def get_mapnik_ds(self,**kwargs): if not self.geometry_field: raise ValueError('Geometry field not found') import itertools ids = itertools.count(0) assert hasattr(mapnik,'MemoryDatasource'), "mapnik.MemoryDatasource requires >= mapnik 2.1" ds = mapnik.MemoryDatasour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_sources(self, obj):\n page = self.context['request'].GET.get('page', 1)\n per_page = settings.PAGINATE_VIEW_FEATURE\n if self.context.get('include_child_pages'):\n # Paginate the full descendant tree\n child_queryset = self.get_all_descendants(obj, per_page)\n ...
[ "0.5736881", "0.5424447", "0.5375144", "0.53365606", "0.52723587", "0.5213967", "0.5206796", "0.5202837", "0.5145447", "0.51072246", "0.5096067", "0.50892884", "0.50744784", "0.5070945", "0.50434893", "0.5042958", "0.5004544", "0.49874857", "0.49811295", "0.4974702", "0.49594...
0.70629114
0
Transform the raw SQL from a Django queryset into a Mapnik subquery.
def _as_mapnik_sql(self,**kwargs): # running multidb available in django 1.2 if hasattr(self.qs.query,'get_compiler'): compiler = self.qs.query.get_compiler(self.qs.db) sql, args = compiler.as_sql() gqn = compiler.connection.ops.geo_quote_name else: sq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qs_from_raw_sql(self, request, search_term):\n parent_id = request.GET.get('parent_id', False)\n\n ocr_lang = request.user.preferences['ocr__OCR_Language']\n ocr_lang = ocr_lang.lower()\n\n sql = \"\"\n\n if parent_id:\n descendent_ids = [\n str(...
[ "0.5818013", "0.5739249", "0.5636696", "0.558741", "0.5584599", "0.55839396", "0.5517639", "0.54935175", "0.5489652", "0.5447503", "0.5412583", "0.54007304", "0.5360466", "0.535188", "0.53101003", "0.5300829", "0.52986085", "0.5288278", "0.5281991", "0.52807224", "0.5270242",...
0.67043734
0
Groupwise groupwise resnik similarity assumes no negative phenotypes
def groupwise_sim_gic( self, profiles: Iterable[Iterable[str]], predicate: Optional[URIRef] = RDFS['subClassOf']) -> float: # Filter out negative phenotypes profile_union = set() profile_intersection = set() is_first = True for profile in prof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similarity_search(self):\n self.ssr = {gene: self.ssw.get_phenotypically_similar_genes(phenotypes, taxon=self.taxon) for gene, phenotypes in self.gene2phenotype_associations.items()}\n self.results = [ssr.get_results() for ssr in self.ssr.values()]\n self.phenogene_score = reduce(lambda x,...
[ "0.6073969", "0.5990463", "0.58325976", "0.5827893", "0.58159024", "0.57934237", "0.57741135", "0.5741468", "0.57067496", "0.56141937", "0.5591263", "0.55796385", "0.55761456", "0.5559249", "0.55478936", "0.5541832", "0.551966", "0.54970336", "0.5482063", "0.5480211", "0.5455...
0.0
-1
Groupwise groupwise resnik similarity assumes no negative phenotypes
def groupwise_jaccard( self, profiles: Iterable[Iterable[str]], predicate: Optional[URIRef] = RDFS['subClassOf']) -> float: # Filter out negative phenotypes profile_union = set() profile_intersection = set() is_first = True for profile in prof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similarity_search(self):\n self.ssr = {gene: self.ssw.get_phenotypically_similar_genes(phenotypes, taxon=self.taxon) for gene, phenotypes in self.gene2phenotype_associations.items()}\n self.results = [ssr.get_results() for ssr in self.ssr.values()]\n self.phenogene_score = reduce(lambda x,...
[ "0.6074496", "0.5989522", "0.58322316", "0.58266366", "0.5814719", "0.57938486", "0.5773829", "0.5740542", "0.5705434", "0.56132936", "0.55909264", "0.55784863", "0.5575504", "0.555807", "0.554731", "0.5541382", "0.5519505", "0.549608", "0.54813904", "0.54790777", "0.5456131"...
0.0
-1
Groupwise jaccard similarty Negative phenotypes must be prefixed with a ''
def jaccard_sim( self, profile_a: Iterable[str], profile_b: Iterable[str], predicate: Optional[URIRef] = RDFS['subClassOf']) -> float: # Filter out negative phenotypes profile_a = {pheno for pheno in profile_a if not pheno.startswith("-")} profile_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testStereo(self):\r\n smi_and_cansmi = [\r\n ('OC(=O)[C@@H](CCC(N)=O)N', 'NC(=O)CC[C@@H](N)C(=O)O'),\r\n ('OC(=O)[C@H](CCC(N)=O)N', 'NC(=O)CC[C@H](N)C(=O)O'),\r\n ('N[C@@H](C(O)=O)CCC(N)=O', 'NC(=O)CC[C@@H](N)C(=O)O'),\r\n ('N[C@H](C(O)=O)CCC(N)=O', 'NC(=O)CC[C@H](N)C(=O)O'),\r\n ('OC(=O)[C@H](N)CCC(N)=...
[ "0.5364827", "0.5348201", "0.5263061", "0.5240012", "0.5231654", "0.5199887", "0.51645106", "0.51091814", "0.50867844", "0.5067651", "0.50156325", "0.5011522", "0.49848363", "0.49847978", "0.4957041", "0.49460623", "0.49384376", "0.49353865", "0.4918157", "0.49098793", "0.490...
0.0
-1
Only implemented for same species comparisons
def _get_optimal_matrix( self, profile: Iterable[str], is_same_species: Optional[bool]=True, sim_measure: Union[PairwiseSim, None]= PairwiseSim.IC ) -> List[List[float]]: score_matrix = [] if is_same_species: for pheno in profile: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSpeciesRichnessCorrect(self):\n self.assertEqual(136, self.coal.get_species_richness(1))\n self.assertNotEqual(self.coal.get_species_richness(2), self.coal.get_species_richness(1))\n self.assertNotEqual(self.coal.get_species_richness(3), self.coal.get_species_richness(2))", "def test...
[ "0.6305768", "0.6258834", "0.6234448", "0.617779", "0.61766046", "0.6141808", "0.6101611", "0.6086989", "0.60863626", "0.6077502", "0.606582", "0.606582", "0.59950227", "0.5986544", "0.5962659", "0.5879858", "0.5867814", "0.58432573", "0.58421534", "0.58362603", "0.583577", ...
0.0
-1
return a dictionary containing the wordfrequencies in txt
def countwords(txt): words = {} pattern = re.compile("[a-zA-Z][a-zA-Z0-9]*") for word in pattern.findall(txt): words[word.lower()] = words.get(word,0)+1 # i'd rather do this in the prior step # but i need to be able to eliminate dupes # which may or may not be more expensive than # going this route. ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_frequency():\n\n song = open(\"data/yellow_submarine.txt\")\n d = dict()\n for line in song:\n line = line.strip()\n line = line.lower()\n punctuations = \"\"\"!()-[]{};:'\"\\,<>./?@#$%^&*_~\"\"\" # remove punctuation https://www.programiz.com/python-programming/examples/rem...
[ "0.82302076", "0.7872736", "0.78641933", "0.7768951", "0.7765616", "0.77622294", "0.7686021", "0.76753926", "0.7661278", "0.7654679", "0.7622297", "0.75752175", "0.75617474", "0.7512178", "0.75015754", "0.74849534", "0.7483613", "0.74421275", "0.7441345", "0.74296606", "0.741...
0.7190278
39
test loading the odmldictionary from an odmlfile
def test_load_from_file(self): filename = 'tmp_testfile.odml' doc = create_small_test_odml() odml.tools.xmlparser.XMLWriter(doc).write_file(filename) self.test_table.load_from_file(filename) os.remove(filename) self.assertDictEqual(self.test_table._odmldict[0], self.expec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_from_odmldoc(self):\n doc = create_small_test_odml()\n self.test_table.load_from_odmldoc(doc)\n self.assertEqual(self.test_table._odmldict, self.expected_odmldict)", "def test_xml_from_dict(self):\n d = make_section_dict() # using default values\n e = dict_to_xm...
[ "0.73493034", "0.63768405", "0.6335154", "0.63199216", "0.62739456", "0.6160915", "0.60899967", "0.6007868", "0.5986313", "0.5972034", "0.5949016", "0.5922218", "0.5849775", "0.5839075", "0.5780473", "0.57775825", "0.5774112", "0.5765218", "0.5759872", "0.56869483", "0.568534...
0.69646496
1
test loading the odmldictionary from a function that generates an odmldocument in python
def test_load_from_function(self): self.test_table.load_from_function(create_small_test_odml) self.assertEqual(self.test_table._odmldict, self.expected_odmldict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_from_odmldoc(self):\n doc = create_small_test_odml()\n self.test_table.load_from_odmldoc(doc)\n self.assertEqual(self.test_table._odmldict, self.expected_odmldict)", "def test_xml_from_dict(self):\n d = make_section_dict() # using default values\n e = dict_to_xm...
[ "0.7055841", "0.6399399", "0.629624", "0.6255766", "0.6005849", "0.58549315", "0.5843046", "0.57319105", "0.56690025", "0.56592035", "0.5652724", "0.564667", "0.56174755", "0.5470184", "0.5461585", "0.5424229", "0.5419281", "0.5410989", "0.5406271", "0.53566486", "0.5356169",...
0.6571868
1
test loading the odmldictionary from an odmldocument in python
def test_load_from_odmldoc(self): doc = create_small_test_odml() self.test_table.load_from_odmldoc(doc) self.assertEqual(self.test_table._odmldict, self.expected_odmldict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_xml_from_dict(self):\n d = make_section_dict() # using default values\n e = dict_to_xml_str(d)\n e = prettify(e)\n\n if SHOW_RESULTS:\n print(e)\n\n xml_file = StringIO(unicode(e))\n self.assertTrue(verify_files(xml_file, open(SECTION_DTD_FILENAME, 'r...
[ "0.66436166", "0.6631061", "0.63010484", "0.6263932", "0.6065434", "0.5871491", "0.5856726", "0.58290565", "0.5812052", "0.57576835", "0.570343", "0.56942403", "0.569137", "0.56734204", "0.5655634", "0.5608455", "0.5434966", "0.54257333", "0.54153776", "0.5407967", "0.5405757...
0.7528738
0
test writing the odmldict back to an odmlfile
def test_write2odml(self): file1 = 'test.odml' file2 = 'test2.odml' doc = create_showall_test_odml() self.test_table.load_from_odmldoc(doc) odml.tools.xmlparser.XMLWriter(doc).write_file(file1) self.test_table.change_header(Path=1, SectionName=2, SectionType=3, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_write_otu_map(self):\r\n write_otu_map(self.otu_map1, self.tmp_fp1)\r\n actual = fields_to_dict(open(self.tmp_fp1))\r\n self.files_to_remove.append(self.tmp_fp1)\r\n self.assertEqual(actual, dict(self.otu_map1))", "def test_to_yaml_file(self):\n\n output_file = \"this_...
[ "0.6853921", "0.6311872", "0.6305071", "0.62486225", "0.6163576", "0.61575305", "0.6150572", "0.60996205", "0.60490966", "0.60289615", "0.6019624", "0.59853345", "0.5928576", "0.5922343", "0.5919674", "0.59140754", "0.58988816", "0.58934546", "0.588118", "0.5879751", "0.58667...
0.73333204
0
Tests simple changing of the header
def test_simple_change(self): self.test_table.change_header(Path=1, SectionType=2, Value=3) self.assertListEqual(self.test_table._header, ["Path", "SectionType", "Value"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_writeHeader(self):\n output = StringIO()\n self.builder._writeHeader(output, \"Super Awesometastic 32.16\")\n self.assertEquals(\n output.getvalue(),\n \"Super Awesometastic 32.16\\n\"\n \"=========================\\n\"\n \"\\n\")", "def t...
[ "0.7544321", "0.72812474", "0.7119248", "0.7069106", "0.6896639", "0.67925715", "0.6785979", "0.6742433", "0.67369777", "0.6679956", "0.66730666", "0.6649584", "0.66406304", "0.6597778", "0.6588827", "0.65872717", "0.65521425", "0.654375", "0.6513251", "0.6502351", "0.6430927...
0.72789085
2
Test change_header with using the index 0
def test_index_zero(self): # TODO: change as exception is changed with self.assertRaises(Exception): self.test_table.change_header(Path=0, SectionType=1, Value=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_change(self):\n self.test_table.change_header(Path=1, SectionType=2, Value=3)\n self.assertListEqual(self.test_table._header, [\"Path\", \"SectionType\", \"Value\"])", "def new_run_header(self, changed):\n self.header = changed['value']", "def _change_header(self, add=False...
[ "0.7514613", "0.73269546", "0.7090908", "0.6776127", "0.6765592", "0.6551269", "0.64034045", "0.6308649", "0.63084644", "0.6293947", "0.62860954", "0.6206916", "0.61824155", "0.6169314", "0.6143755", "0.6130622", "0.6123333", "0.6118251", "0.6113637", "0.6082598", "0.60699934...
0.7285697
2
Test change_header with using a negative index
def test_negative_index(self): # TODO: change Exception with self.assertRaises(Exception): self.test_table.change_header(Path=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_zero(self):\n # TODO: change as exception is changed\n with self.assertRaises(Exception):\n self.test_table.change_header(Path=0, SectionType=1, Value=2)", "def test_same_indizes(self):\n # TODO: Exception\n with self.assertRaises(Exception):\n sel...
[ "0.7354142", "0.64738077", "0.6425895", "0.63688374", "0.61984", "0.61857456", "0.59954756", "0.5904068", "0.58630556", "0.58415335", "0.5813083", "0.5781785", "0.57639337", "0.5730791", "0.5705134", "0.5682688", "0.5682038", "0.5677502", "0.5618707", "0.56174624", "0.5609100...
0.7583559
0
Test change_header leaving empty columns, while it is allowed
def test_empty_cols_allowed(self): self.test_table.allow_empty_columns = True self.test_table.change_header(Path=1, SectionType=3, Value=4) self.assertEqual(self.test_table._header, ["Path", None, "SectionType", "Value"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_change(self):\n self.test_table.change_header(Path=1, SectionType=2, Value=3)\n self.assertListEqual(self.test_table._header, [\"Path\", \"SectionType\", \"Value\"])", "def _reset_header(self):\n new_header = []\n for col_name in self.header:\n is_left = sel...
[ "0.6876637", "0.6858973", "0.6649065", "0.6589102", "0.653656", "0.6475096", "0.63742524", "0.63540417", "0.6284676", "0.6265562", "0.6252437", "0.62409395", "0.6202884", "0.615543", "0.6141923", "0.61178464", "0.61132544", "0.6090016", "0.607988", "0.6033929", "0.60301864", ...
0.85452604
0
Test change_header with two columns with same indizes
def test_same_indizes(self): # TODO: Exception with self.assertRaises(Exception): self.test_table.change_header(Path=1, SectionType=1, Value=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_change(self):\n self.test_table.change_header(Path=1, SectionType=2, Value=3)\n self.assertListEqual(self.test_table._header, [\"Path\", \"SectionType\", \"Value\"])", "def _reset_header(self):\n new_header = []\n for col_name in self.header:\n is_left = sel...
[ "0.6910554", "0.6474417", "0.6402902", "0.61666656", "0.6098005", "0.596861", "0.5965617", "0.59317005", "0.5931326", "0.5920516", "0.59009284", "0.5865192", "0.58465254", "0.58213437", "0.5803442", "0.5784145", "0.5766657", "0.57511395", "0.5730093", "0.5730093", "0.571732",...
0.74366283
0
Test using change_header with a wrong keyword
def test_wrong_keyword(self): # TODO: Exception with self.assertRaises(Exception): self.test_table.change_header(Path=1, Sectionname=2, Value=3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_run_header(self, changed):\n self.header = changed['value']", "def test_simple_change(self):\n self.test_table.change_header(Path=1, SectionType=2, Value=3)\n self.assertListEqual(self.test_table._header, [\"Path\", \"SectionType\", \"Value\"])", "def _change_header(self, add=False...
[ "0.70798177", "0.68661684", "0.6820545", "0.6649878", "0.65113676", "0.62895864", "0.627641", "0.61753476", "0.6167877", "0.6147109", "0.6130923", "0.61227626", "0.6109308", "0.6108079", "0.6078093", "0.6064625", "0.6055945", "0.6051071", "0.6036362", "0.60006654", "0.5975634...
0.71992046
0
test filter function for exceptions
def test_filter_errors(self): with self.assertRaises(ValueError): self.test_table.filter() with self.assertRaises(ValueError): self.test_table.filter(mode='wrongmode', Property='Property')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no():\n errors = generate_errors(10, 5)\n assert NoFiltering().filter(errors) == errors", "def test_filter_wea_zero_entry():\n pass", "def test_filter_function_settings_fail(self):\n with self.assertRaises(TypeError):\n self.es.register_filter('test')", "def test_filter_ar...
[ "0.7335465", "0.70461434", "0.7042257", "0.69304", "0.68743324", "0.6845471", "0.6814179", "0.6778311", "0.6695239", "0.66767067", "0.66699195", "0.6629892", "0.6619967", "0.66138077", "0.6492127", "0.64911723", "0.6485241", "0.6461823", "0.64462775", "0.64022386", "0.6386639...
0.7170186
1
testing mode='and' setting of filter function
def test_filter_mode_and(self): self.test_table.filter(mode='and', invert=False, SectionName='Section2', PropertyName='Property2') num_props_new = len(self.test_table._odmldict) self.assertEqual(4, num_props_new)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_mixed_function(self):\n for none_type in (False, True):\n for all_type in (False, True):\n for any_type in (False, True, None):\n result = none_type is False and all_type is True \\\n and (any_type is None or any_type is Tru...
[ "0.71120757", "0.7084195", "0.6975936", "0.69528186", "0.6931888", "0.68448734", "0.6841734", "0.6730904", "0.66951007", "0.6671455", "0.665661", "0.6653067", "0.66391844", "0.66206056", "0.65459645", "0.65271086", "0.6492255", "0.6486859", "0.64367616", "0.6436344", "0.64327...
0.72008437
0
testing mode='or' setting of filter function
def test_filter_mode_or(self): self.test_table.filter(mode='or', invert=False, SectionName='Section2', PropertyName='Property2') num_props_new = len(self.test_table._odmldict) self.assertEqual(17, num_props_new)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_mixed_function(self):\n for none_type in (False, True):\n for all_type in (False, True):\n for any_type in (False, True, None):\n result = none_type is False and all_type is True \\\n and (any_type is None or any_type is Tru...
[ "0.7074164", "0.70579433", "0.68908054", "0.66604334", "0.6529262", "0.6468033", "0.6421366", "0.64113307", "0.64006317", "0.6384421", "0.63657236", "0.63148713", "0.631061", "0.6309568", "0.62671715", "0.62601864", "0.61788315", "0.6172945", "0.6154431", "0.6132411", "0.6123...
0.73522913
0
testing invert setting of filter function
def test_filter_invert(self): num_props_original = len(self.test_table._odmldict) self.test_table.filter(mode='or', invert=True, SectionName='Section2', PropertyName='Property2') num_props_new = len(self.test_table._odmldict) self.assertEqual(num_props_or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __invert__(self):\n not_filter = proto.FilterExpression()\n not_filter.filter_not.filter_expression.MergeFrom(self.filter)\n self.filter = not_filter\n return self", "def test_correct_inverted(self):\n tests = [\n 'test.1',\n 'test.2',\n ]\n expected = '-test.1:...
[ "0.6876437", "0.68602055", "0.6728277", "0.6673018", "0.6657147", "0.6627065", "0.6543956", "0.6442179", "0.6409801", "0.6360206", "0.63267076", "0.6269517", "0.62632096", "0.62427104", "0.6204994", "0.61974835", "0.6171017", "0.61681014", "0.61410177", "0.61259997", "0.61069...
0.6857319
2
testing recursive setting of filter function
def test_filter_recursive(self): # total_number of properties doc = self.test_table.convert2odml() tot_props = len(list(doc.iterproperties())) sec2s = list(doc.itersections(filter_func=lambda x: x.name == 'Section2')) sec2_props = sum([len(list(sec.properties)) for sec in sec2s]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_files(self):\n expected = [\n (\"/subdir1/fichier1\", False),\n (\"/subdir1/fichier4\", False),\n (\"/subdir1/subsubdir1\", False),\n ]\n files = [\n (\"/subdir1/fichier1\", False),\n (\"/subdir2/fichier2\", False),\n ...
[ "0.6639373", "0.65807915", "0.6568952", "0.6459897", "0.6399126", "0.6363952", "0.6329797", "0.632054", "0.62691253", "0.6231018", "0.6215396", "0.6181549", "0.61160463", "0.6099278", "0.6092511", "0.608301", "0.60665554", "0.6002192", "0.599707", "0.59557116", "0.5904092", ...
0.59760326
19
keeping/removing all properties by providing True/False as comparison function
def test_filter_comparison_func_false(self): num_props_original = len(self.test_table._odmldict) self.test_table.filter(comparison_func=lambda x, y: True, PropertyName='') self.assertEqual(len(self.test_table._odmldict), num_props_original) self.test_table.filter(comparison_func=lambda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_by(self, property):\n for length in range(len(self)):\n for p in list(self[length]):\n if not property(p):\n self[length].remove(p)", "def all_safe_properties(obj):\n return tuple(set(all_properties(obj)).difference(__leave_alone_properties))", ...
[ "0.6667049", "0.6053444", "0.6053444", "0.5640798", "0.5633678", "0.5573169", "0.5535688", "0.5483396", "0.5426049", "0.5421662", "0.5421662", "0.5421662", "0.5421662", "0.53535455", "0.5340078", "0.533519", "0.52904385", "0.52695805", "0.52648556", "0.52213174", "0.52142584"...
0.6413872
1
To get a list of online, offline and expired minions
def minion_connection_stats(self, minions): online_minions = list() offline_minions = list() expired_minions = list() for minion_obj in minions: # get UTC current date time current_datetime = datetime.datetime.utcnow() current_datetime = current_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_online_list(self) -> list:\n return self._get_json(self._URLS['GetOnlineList'])[1:]", "def online_users(room):\n threshold = datetime.now() - timedelta(seconds=10)\n authorizations = models.Authorization.gql(\"WHERE room = :room AND last_checked_in >= :threshold\", room=room, threshold=threshold...
[ "0.6179117", "0.5670039", "0.56596464", "0.56206715", "0.5576873", "0.5521085", "0.55119115", "0.54945326", "0.5451108", "0.5447861", "0.54452866", "0.5332441", "0.5273542", "0.5248664", "0.52449083", "0.52443904", "0.5243403", "0.52403325", "0.5237741", "0.52286935", "0.5225...
0.6905272
0
To show the key stats for the minions
def minion_key_stats(self, minions): accepted_minions = list() deleted_minions = list() pending_minions = list() for minion_obj in minions: # get a list of accepted if minion_obj.key_status == 0: # accepted accepted_minions.append(minion_obj) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats(self):", "def printMajors(self):\n import mush\n skills = mush.combatSkills+mush.magicSkills+mush.stealthSkills\n for className, stats in sorted(self.classStats.items()):\n print className,'-------------------------------'\n skillStats = [(key,value) for key,v...
[ "0.58576655", "0.58070374", "0.57535034", "0.5691368", "0.56557524", "0.562826", "0.5623027", "0.5588611", "0.5494763", "0.5487488", "0.548133", "0.54804647", "0.5475366", "0.5453144", "0.54470354", "0.5429701", "0.5409322", "0.5399024", "0.5391455", "0.5381971", "0.5376132",...
0.6644181
0
Send JSON statistics for AngularJS to consume
def list(self, request, *args, **kwargs): # get minions per target tid = self.request.QUERY_PARAMS.get("tid", None) # get minions per target qtid = self.request.QUERY_PARAMS.get("qtid", False) if tid: try: target_obj = Target.objects.get(id=tid) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats():\n return jsonify(shorten.get_stats(get_db(), app.config['MINI_URL_BASE']))", "def ajax_get_statistics():\r\n return jsonify(generate_statistics())", "def stats():\n stats = {\n \"Amenity\": \"amenities\",\n \"City\": \"cities\",\n \"Place\": \"places\",\n \"Rev...
[ "0.705334", "0.70310396", "0.65896904", "0.652585", "0.64211756", "0.6405187", "0.6320912", "0.63191676", "0.62984854", "0.6242644", "0.6215966", "0.61851025", "0.61801594", "0.6151943", "0.61514914", "0.61466897", "0.61080056", "0.6086823", "0.60247207", "0.60211957", "0.600...
0.0
-1
poll_git._retrieve_data Recursive function to retrieve all the repositories returned from git containing the supplied keyword. Git paginates the return values instead of supplying the entire list. Initially this call will retrieve page 1 and then recursively call itself incrementing the page number until an error code ...
def _retrieve_data(keyw, limit, page=1): # Max results per page is 100 per_page = limit if limit < 100 else 100 url = BASE_URL + QUALIFIERS % (keyw, per_page, page) req = requests.get(url) r_json = req.json() if limit > 100: r_json['items'].extend(_retrieve_data(keyw, limit - 100, pag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, *args, **kwargs):\r\n\r\n if not self.current_repo:\r\n # get the first available repository\r\n self.current_repo = next(self.repo_list)\r\n\r\n if self.current_repo in self.repo_done:\r\n try:\r\n # get the next available repository\r\n...
[ "0.610186", "0.545425", "0.53882384", "0.5294301", "0.52345854", "0.5152139", "0.514462", "0.5143252", "0.50355893", "0.50099504", "0.5008395", "0.4898757", "0.4895922", "0.48570067", "0.4837202", "0.4826648", "0.48244652", "0.48124608", "0.4810986", "0.47822344", "0.4771593"...
0.4916661
11
poll_git.filter_dict Utility method to remove all keys from a dict except those in the key set
def _filter_dict(src_dict, key_set): for k in set(src_dict.keys()) - key_set: src_dict.pop(k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanse_dict(original):\n return {k: v for k, v in original.items() if \"_pass\" not in k}", "def _cleanse_dict(original):\n return dict((k, v) for k, v in original.items() if \"_pass\" not in k)", "def clean_dict(dictionary):\n return {k: v for k, v in dictionary.items() if v}", "def clean_dic...
[ "0.7563569", "0.7440057", "0.7419116", "0.7418322", "0.740843", "0.73695225", "0.72462183", "0.72018117", "0.71871424", "0.7120856", "0.7070811", "0.70674783", "0.70619494", "0.70096827", "0.69330645", "0.69295365", "0.6927854", "0.6914809", "0.69089794", "0.6890785", "0.6881...
0.81835246
0
The main function Print a JSON dictionary by polling github for the repositories containing a given keyword, ordered by the number of forks (descending). This main fun
def main(): # parse for provided arguments parser = argparse.ArgumentParser() # main is expecting only one arg - that being the test mode flag # test mode flag will be used to optionally commit the db updates # (i.e., if we are in test mode don't commit, do a rollback) parser.add_argument('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\t\tn = 0 \n\t\tfor page in range(pages):\n\t\t\t\tpageNumber = str(page + 1)\n\t\t\t\tprint \"Processing page number \" + pageNumber\n\t\t\t\tpageUrl = 'https://api.github.com/users/' + USER + '/gists?page=' + pageNumber + '&per_page=' + str(int(perpage))\n\t\t\t\tu = urlopen (pageUrl)\n\t\t\t\tgist...
[ "0.6452412", "0.637317", "0.6333379", "0.627017", "0.6170934", "0.5965858", "0.59548104", "0.5907087", "0.58560294", "0.57858473", "0.5683087", "0.5675596", "0.56318", "0.5599372", "0.5572108", "0.552574", "0.55018026", "0.5483693", "0.5472313", "0.5417226", "0.54059106", "...
0.74229103
0
Constructor. socket to remote server to send data to lastmessage class containg the last recived message condition condition synchronization object
def __init__(self, socket,lastmessage, condition): threading.Thread.__init__(self) self.lastmessage = lastmessage self.condition = condition self.socket = socket
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, sock, address, name=\"\"):\n socket.setdefaulttimeout(0.01)\n self.socket = sock\n self.address = address\n self.name = name\n self.msg_id = 0", "def __init__(self, serversocket, byte_count_size=BYTES_PER_SHORT):\n self.socket_, self.ip = serversocket....
[ "0.6586863", "0.6553067", "0.65429056", "0.64001745", "0.63081723", "0.62766576", "0.6269248", "0.62473345", "0.61494416", "0.6128056", "0.60948056", "0.60921746", "0.6078823", "0.60623664", "0.6059222", "0.6054902", "0.6017394", "0.5991975", "0.5985619", "0.59840095", "0.597...
0.80534434
0
Thread run method. Waits for reciver thread to release the condition then takes the last message if it exists and sends it to the remote server Inte ultimat kommer bli mycket samma data i slutandan om manga enheter skickar data
def run(self): macId, sensorId = getRequest(self.socket) try: while True: self.condition.acquire() while True: data = self.lastmessage.readData(macId, sensorId) self.socket.send(str(data) + '\n') #sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n errors = 0\n while ALIVE:\n try:\n self.maintainConn()\n try:\n line = self.reader.readerq.get(True, 5)\n except Empty:\n continue\n self.sendq.append(line)\n t...
[ "0.7166642", "0.69733244", "0.65547436", "0.6510656", "0.6484803", "0.648338", "0.64669335", "0.6461319", "0.6408202", "0.6400174", "0.639893", "0.63459706", "0.6325677", "0.63164294", "0.62975806", "0.6293658", "0.6275294", "0.62307036", "0.62262607", "0.62159586", "0.621569...
0.7115101
1
Allow dictstyle item access by index (row id), or by row name ("key" column).
def __getitem__(self, i): if isinstance(i, int): if i >= len(self._section): return Error('COPY.%s.%i [row index outside range]' % (self.name, i)) return self._section[i] if i not in self._section: return Error('Could not find attribute %s' % i) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n return self.row[item]", "def __getitem__(self, rowcol):\n row, col = rowcol\n if col in self.colnames:\n col = self.colnames.index(col)\n return dict.__getitem__(self, (row, col))", "def __getitem__(self, key):\n # Both row index and ...
[ "0.7226161", "0.7202655", "0.7111144", "0.68057585", "0.6513975", "0.6475214", "0.6341877", "0.63327605", "0.63160837", "0.6302959", "0.6272936", "0.62418556", "0.61779606", "0.61148566", "0.6079819", "0.60519147", "0.6024012", "0.60066617", "0.596928", "0.5942441", "0.593256...
0.0
-1
Allow dictstyle item access by sheet name.
def __getitem__(self, name): print self, name if name not in self._copy: return Error('COPY.%s [sheet does not exist]' % name) return self._copy[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, name):\n return self.entry[name]", "def getSheet(self, sheet_name):\r\n return self.workbook.Sheets(sheet_name)", "def __getitem__(self, name):\n return self._items[name.lower()][1]", "def get_sheet_by_name(book, name):\n i = 0\n for sheetname in book.sheetnam...
[ "0.57084394", "0.56994104", "0.5615424", "0.55837756", "0.5518013", "0.54978603", "0.54660934", "0.542593", "0.5327343", "0.5314083", "0.5306283", "0.5261978", "0.525484", "0.51877034", "0.5173072", "0.51332927", "0.5125193", "0.5108615", "0.50948066", "0.50918025", "0.508553...
0.6302345
0
Parses the downloaded Excel file.
def load(self): try: with open(self._filename) as f: doc = archieml.load(f) except IOError: raise CopyException('"%s" does not exist. Have you run "fab update_copy"?' % self._filename) for section in doc: self._copy[section] = Section(section,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_ra():\r\n fname = 'parse/File1.xlsx'\r\n sheet_name = 'Sheet1'\r\n\r\n ra_sheet = get_sheet(fname, sheet_name)\r\n return parse_sheet(ra_sheet)", "def Excel_Load_Data( self, ExcelFilename ):\n pass", "def parse_xlsx(filename):\n from openpyxl import load_workbook\n\n workbook...
[ "0.6445948", "0.58994526", "0.58873886", "0.573046", "0.5705608", "0.569733", "0.56871164", "0.56281763", "0.5570489", "0.5560211", "0.555015", "0.5517005", "0.5507791", "0.54691666", "0.5464367", "0.54502684", "0.54298306", "0.53358257", "0.5281962", "0.52774864", "0.5259692...
0.0
-1
backSub = cv.createBackgroundSubtractorKNN() kernel1 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2)) kernel2 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2)) kernel1 = np.ones((3,3),np.uint8) kernel2 = np.ones((3,3), np.uint8) fgMask = cv.threshold(fgMask, 100, 255, cv.THRESH_BINARY)[1] f...
def img_process(fgMask): backSub = cv.createBackgroundSubtractorKNN() kernel1 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2)) kernel2 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2)) #kernel1 = np.ones((3,3),np.uint8) #kernel2 = np.ones((3,3), np.uint8) fgMask = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backgroundSubtraction(kmin, kmax, kwin=10,\n indir=IMG_DIR, inpattern=IMG_PATTERN,\n outdir=DIFF_DIR, outpattern=DIFF_PATTERN,\n verbose=True):\n\n def equalize_color(img):\n \"\"\"Apply histogram equalization to each channel...
[ "0.7177756", "0.6724952", "0.66178995", "0.65937954", "0.65740156", "0.64842683", "0.62351716", "0.62128395", "0.6182483", "0.61607844", "0.61557305", "0.6147242", "0.6139487", "0.61274254", "0.6097421", "0.6093765", "0.60761654", "0.606649", "0.605861", "0.60537887", "0.6052...
0.8908296
0
login to get a access token
def login(self): if not request.is_json: return jsonify({"msg": "Invalid JSON format in request"}), 400 username = request.json.get('username', None) password = request.json.get('password', None) if not username: return jsonify({"msg": "Missing username"}), 400 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n r = self._login_token()", "def login():\n req = request.get_json(force=True)\n username = req.get('username', None)\n password = req.get('password', None)\n user = guard.authenticate(username, password)\n ret = {'access_token': guard.encode_jwt_token(user)}\n return re...
[ "0.7869619", "0.75151825", "0.7474016", "0.73700917", "0.7323191", "0.72778314", "0.7277398", "0.7256978", "0.72330046", "0.72143346", "0.7192071", "0.7190282", "0.7180875", "0.71671444", "0.71606505", "0.71599936", "0.7129657", "0.71291435", "0.712277", "0.7092429", "0.70635...
0.7270558
7
The m1 flavors are the original devstack flavors
def _filter_m1_flavors(self, results): new_results = [] for flavor in results: if flavor['name'].startswith("m1."): new_results.append(flavor) return new_results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flavors(self, **kwargs):\n raise NotImplementedError", "def flavors(self, **kwargs):\n if kwargs is None:\n result = self.get_list(self.cloudman.compute.flavors(),\n kind=\"flavor\")\n if \"name\" in kwargs:\n result = self.flavor(n...
[ "0.7495386", "0.6508931", "0.63442314", "0.61788255", "0.6131679", "0.60157377", "0.60098404", "0.5906056", "0.5867811", "0.5835011", "0.5785769", "0.56962883", "0.5615338", "0.55481666", "0.5546179", "0.55272484", "0.5484042", "0.5467828", "0.54599243", "0.54354995", "0.5431...
0.6475194
2
Gets the title and ID of all tech skill entries
def to_tech_tuples(sort_index=None, reverse=False) -> List[Tuple[str, int]]: global TSKILL_TITLEIDS if TSKILL_TITLEIDS is None: TSKILL_TITLEIDS = [(s.title, s.id) for s in Skill.query.all() if s.is_tech()] if sort_index is None: return TSKILL_TITLEIDS else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_skill(self):\n return ', '.join([skill.name for skill in self.skill.all()[:3]])", "async def all_skills_data(self) -> AllSkillsData:\n return AllSkillsData(**await self.get(\"/skill/all\"))", "def skill(self):\n return self._get(\"skill\")", "def all_skill_list(self):\n ...
[ "0.6109518", "0.6009882", "0.59634143", "0.5927496", "0.5860163", "0.5798118", "0.5749347", "0.567642", "0.56626165", "0.5646677", "0.5619657", "0.5611926", "0.55326295", "0.55326295", "0.54883397", "0.5464825", "0.5450459", "0.5429305", "0.5427211", "0.5374632", "0.5367275",...
0.5712788
7
Gets the title and ID of all business skill entries
def to_biz_tuples(sort_index=None, reverse=False) -> List[Tuple[str, int]]: global BSKILL_TITLEIDS if BSKILL_TITLEIDS is None: BSKILL_TITLEIDS = [(s.title, s.id) for s in Skill.query.all() if s.is_biz()] if sort_index is None: return BSKILL_TITLEIDS else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_skill_list(self):\n data_skill_list = self.data_skill_list()\n self.skill_list = []\n for i in range(len(self.data_profile)):\n if 'skills' in self.data_profile[i].keys():\n for j in range(len(self.data_profile[i]['skills'])):\n for skills i...
[ "0.612198", "0.58380324", "0.58018816", "0.56096494", "0.5537682", "0.5537494", "0.5492644", "0.54438794", "0.5375623", "0.5314642", "0.5282276", "0.52786386", "0.524643", "0.52381927", "0.52173907", "0.5148513", "0.51434356", "0.5092051", "0.5056292", "0.5050178", "0.504325"...
0.503975
22
Converts the education experience to a single int representing the minimum qualifications held. This is one higher than the EducationLevel values (0 = no education, 1 = certification, etc.)
def min_edu_level(self) -> int: if len(self._history_edus) == 0: return 0 # add one since allocating 0 for 'none' return int(max([e.education_lvl for e in self._history_edus])) + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_experience(self) -> int:\n return self._base_experience", "def min_weight(self):\n return self.experiences.min_weight", "def scoreEducation(self, employee_ed, name):\n\n university = self.university\n schools = [school for school in name if school != \"\"]\n rank = [...
[ "0.6091574", "0.60766613", "0.5663413", "0.5663034", "0.5594252", "0.5542864", "0.5542864", "0.54906315", "0.5470742", "0.54238975", "0.5421171", "0.53634584", "0.5359417", "0.5359417", "0.5327927", "0.5322198", "0.53167486", "0.5293654", "0.5291187", "0.5285667", "0.5284425"...
0.7296643
0
Get's the abbreviated degree name of the min education level.
def min_edu_abbv(self) -> str: lvl = self.min_edu_level if lvl == 0: return "None" elif lvl == 1: return "Cert" elif lvl == 2: return "A.S." elif lvl == 3: return "B.S." elif lvl == 4: return "M.S." elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_descriptive_name(self):\r\n long_name = str(self.year) + ' ' + self.make + ' ' + self.model\r\n #Mostrar_Grande = long_name.upper()\r\n #return long_name.upper()\r\n #return Mostrar_Grande #Funciona Com Return TAMBÉM, mas olhe na linha 39 como seria necessário usar.\r\n p...
[ "0.62686497", "0.6171701", "0.61384463", "0.6117577", "0.601304", "0.5911395", "0.5890063", "0.587878", "0.5854062", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58505285", "0.58...
0.70609176
0
Calculates the number of years of job experience held.
def years_job_experience(self) -> int: return sum([job.years_employed for job in self._history_jobs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_age(self):\n return CURRENT_YEAR - self.year", "def get_age(self):\n return CURRENT_YEAR - self.year", "def years_to_pay(self) -> float:\n return round(self.term / self.term_multiplier * self.n_periods / 12, 1)", "def calculate_current_age(dob):\n today = datetime.date.today()...
[ "0.69628876", "0.69628876", "0.695793", "0.68692875", "0.6789864", "0.67852265", "0.6754551", "0.6731187", "0.6647829", "0.6566959", "0.65495574", "0.652794", "0.6518666", "0.6416457", "0.63934374", "0.6276981", "0.62368333", "0.62318367", "0.6229864", "0.6219878", "0.6218481...
0.83394194
0
Converts an instance of this class to a dictionary (e.g., for JSONifying it)
def to_dict(self) -> dict: d = dict() d['id'] = self.id d['name'] = self.full_name d['email'] = self._user.email d['phone'] = self.phone_number d['location'] = self.location ww = int(self.work_wanted) d['work_types'] = { 'full': ww & 1 > 0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self) -> Dict[str, Any]:\n return self.__dict__.copy()", "def to_obj(self):\n return dict()", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(cls) -> dict:\n raise NotImplementedError()", "def as_dict(self):\n return asdict(self)", "def to...
[ "0.8173195", "0.81439555", "0.81402457", "0.8138447", "0.8130105", "0.81093574", "0.80859", "0.8084972", "0.80840886", "0.8073715", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669", "0.80669...
0.0
-1
Converts technical skills possessed to an integer. Only looks at whether the seeker added it to their profile.
def encode_tech_skills(self) -> int: # skill_id skill_level tskill_ids = [s.skill_id for s in self._skills if s._skill.is_tech()] enc = ['0' for _ in range(Skill.count())] for _id in tskill_ids: enc[_id - 1] = '1' return int(''.join(enc), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_roll_value_for_skill(self) -> int:\n if not self.skill:\n return 0\n base = self.character.traits.get_skill_value(self.skill)\n return StatWeight.get_weighted_value_for_skill(base)", "def encode_biz_skills(self) -> int:\n # skill_id skill_level\n bskill_ids =...
[ "0.58784425", "0.58267003", "0.58267003", "0.568689", "0.5582021", "0.54769146", "0.543507", "0.5429695", "0.5407055", "0.5396066", "0.5337476", "0.53325754", "0.531957", "0.53009146", "0.51986206", "0.5195058", "0.5187859", "0.5186852", "0.5176883", "0.5173365", "0.5173365",...
0.6798149
1
Converts business skills possessed to an integer. Only looks at whether the seeker added it to their profile.
def encode_biz_skills(self) -> int: # skill_id skill_level bskill_ids = [s.skill_id for s in self._skills if s._skill.is_biz()] enc = ['0' for _ in range(Skill.count())] for _id in bskill_ids: enc[_id - 1] = '1' return int(''.join(enc), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_roll_value_for_skill(self) -> int:\n if not self.skill:\n return 0\n base = self.character.traits.get_skill_value(self.skill)\n return StatWeight.get_weighted_value_for_skill(base)", "def encode_tech_skills(self) -> int:\n # skill_id skill_level\n tskill_ids ...
[ "0.5716588", "0.5670153", "0.5670153", "0.5512762", "0.5461399", "0.5459458", "0.5413066", "0.540013", "0.5399135", "0.53972685", "0.53957635", "0.5329288", "0.5315077", "0.52612674", "0.52327406", "0.52209467", "0.52209467", "0.51780355", "0.5174286", "0.51525414", "0.513392...
0.67850846
1
Converts attitudes possessed to an integer. Only looks at whether the seeker added it to their profile.
def encode_attitudes(self) -> int: # skill_id skill_level att_ids = [s.attitude_id for s in self._attitudes] enc = ['0' for _ in range(Attitude.count())] for _id in att_ids: enc[_id - 1] = '1' return int(''.join(enc), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_int(self, flag_dict):\n int_out = 0\n for key in list(flag_dict.keys()):\n fmask = self.flag_masks.get(key)\n if fmask is None:\n raise ValueError(\"key %s does not belong to this flag space\" % key)\n if flag_dict[key]:\n int...
[ "0.5455803", "0.54509205", "0.51860356", "0.5156996", "0.49522758", "0.4859521", "0.4824676", "0.4801027", "0.47986278", "0.4791375", "0.47847626", "0.47815135", "0.47674224", "0.4722442", "0.47131926", "0.47098625", "0.47098625", "0.46894836", "0.4670891", "0.46690366", "0.4...
0.6402386
1
A string to represent the age of this post.
def age(self) -> str: tdelta = dt.now() - self.created_timestamp if tdelta.days >= 548: # enough to round it up to 2 years return f'about {tdelta.days/365:.0f} years' elif tdelta.days >= 345: # enough to round it up to 1 year (so it doesn't report '12 months') return f'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age(self):\n\n years, months, days = calculate_age(self.birthdate)\n if years:\n return \"%d year%s old\" % (years, \"s\" if years > 1 else \"\")\n elif months:\n return \"%d month%s old\" % (months, \"s\" if months > 1 else \"\")\n else:\n return \"...
[ "0.82187986", "0.77554965", "0.7717731", "0.7594224", "0.7593773", "0.7579443", "0.75256914", "0.7522066", "0.7522066", "0.7522066", "0.75171536", "0.7515912", "0.74829715", "0.74518067", "0.74498564", "0.7447325", "0.7446756", "0.73713535", "0.7241897", "0.7241897", "0.71139...
0.8177297
1
Converts technical skills possessed to an integer. Only looks at whether the seeker added it to their profile.
def encode_tech_skills(self) -> int: # skill_id skill_level tskill_ids = [s.skill_id for s in self._skills if s._skill.is_tech()] enc = ['0' for _ in range(Skill.count())] for _id in tskill_ids: enc[_id - 1] = '1' return int(''.join(enc), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_roll_value_for_skill(self) -> int:\n if not self.skill:\n return 0\n base = self.character.traits.get_skill_value(self.skill)\n return StatWeight.get_weighted_value_for_skill(base)", "def encode_biz_skills(self) -> int:\n # skill_id skill_level\n bskill_ids =...
[ "0.58784425", "0.58267003", "0.58267003", "0.568689", "0.5582021", "0.54769146", "0.543507", "0.5429695", "0.5407055", "0.5396066", "0.5337476", "0.53325754", "0.531957", "0.53009146", "0.51986206", "0.5195058", "0.5187859", "0.5186852", "0.5176883", "0.5173365", "0.5173365",...
0.6798149
0
Converts business skills possessed to an integer. Only looks at whether the seeker added it to their profile.
def encode_biz_skills(self) -> int: # skill_id skill_level bskill_ids = [s.skill_id for s in self._skills if s._skill.is_biz()] enc = ['0' for _ in range(Skill.count())] for _id in bskill_ids: enc[_id - 1] = '1' return int(''.join(enc), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_roll_value_for_skill(self) -> int:\n if not self.skill:\n return 0\n base = self.character.traits.get_skill_value(self.skill)\n return StatWeight.get_weighted_value_for_skill(base)", "def encode_tech_skills(self) -> int:\n # skill_id skill_level\n tskill_ids ...
[ "0.5716588", "0.5670153", "0.5670153", "0.5512762", "0.5461399", "0.5459458", "0.5413066", "0.540013", "0.5399135", "0.53972685", "0.53957635", "0.5329288", "0.5315077", "0.52612674", "0.52327406", "0.52209467", "0.52209467", "0.51780355", "0.5174286", "0.51525414", "0.513392...
0.67850846
0
Converts attitudes possessed to an integer. Only looks at whether the seeker added it to their profile.
def encode_attitudes(self) -> int: # skill_id skill_level att_ids = [s.attitude_id for s in self._attitudes] enc = ['0' for _ in range(Attitude.count())] for _id in att_ids: enc[_id - 1] = '1' return int(''.join(enc), base=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_int(self, flag_dict):\n int_out = 0\n for key in list(flag_dict.keys()):\n fmask = self.flag_masks.get(key)\n if fmask is None:\n raise ValueError(\"key %s does not belong to this flag space\" % key)\n if flag_dict[key]:\n int...
[ "0.5455803", "0.54509205", "0.51860356", "0.5156996", "0.49522758", "0.4859521", "0.4824676", "0.4801027", "0.47986278", "0.4791375", "0.47847626", "0.47815135", "0.47674224", "0.4722442", "0.47131926", "0.47098625", "0.47098625", "0.46894836", "0.4670891", "0.46690366", "0.4...
0.6402386
0
Converts a city and state (both optional) to the key expected by this table.
def to_location(city: str = None, state: str = None) -> str: if city is None and state is None: return "USA" elif city is None or state is None: return f"{city or ''}{state or ''}, USA" return f"{city}, {state} USA"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def site_to_key(site, state=\"\"):\n if type(state) != str:\n raise Exception(\"`state` must be a string.\")\n return \",\".join([str(l) for l in site]) + state", "def _state_agg_key(location_type, record: dict) -> Optional[str]:\n if record[f\"{location_type}_state_code\"] is None:\n retu...
[ "0.60184586", "0.5755065", "0.54741406", "0.54564816", "0.5452006", "0.52865285", "0.50954854", "0.50830144", "0.5069444", "0.50618964", "0.5060401", "0.5007043", "0.49998912", "0.49536315", "0.49146366", "0.49133226", "0.49112546", "0.48750046", "0.48591265", "0.48470807", "...
0.5396536
5
Gets the coordinates for the given city and/or state. If fallback is true, it will attempt to get the closest matching result (just state if city cannot be found, otherwise just 'USA')
def get(city: str = None, state: str = None, fallback=True) -> Tuple[float, float]: loc_id = LocationCoordinates.to_location(city, state) row = LocationCoordinates.query.get(loc_id) if row is None: # not present, create then return loc_obj = geolocator.geocode(loc_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coordinates_for_city(city, state=None):\n search_str = ', '.join([city, state]) if state else city\n db_coords = get_coordinates_from_db(search_str)\n if db_coords:\n return (search_str, db_coords)\n else:\n page_title, coords = get_coordinates_from_wikipedia(search_str)\n ...
[ "0.68224823", "0.6361756", "0.615891", "0.6116001", "0.60422117", "0.5858442", "0.58064425", "0.5731553", "0.5635527", "0.5595735", "0.5581862", "0.5567429", "0.5552811", "0.5550357", "0.5547978", "0.5525822", "0.5514432", "0.5505999", "0.55029947", "0.5498044", "0.5496425", ...
0.79270655
0
Run once, or forever, depending on config.
def run(self): if self.config.daemon(): self.logger.info("Running forever, in a loop") self.run_forever() else: self.logger.info("Running once, to completion") self.run_once()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_forever(self):\n while True:\n self.run_once()\n\n self.logger.info(f\"Sleeping for {self.config.sleep()} seconds\")\n time.sleep(self.config.sleep())", "def run_forever(self):\n self.factory.manager.run_forever()", "def _run_once(self):\n try:\n s...
[ "0.72144735", "0.6544273", "0.65426034", "0.6278244", "0.62634057", "0.62595147", "0.62210196", "0.6201465", "0.6139407", "0.6137481", "0.61167115", "0.61131215", "0.6071008", "0.6063917", "0.6063917", "0.60003394", "0.59724736", "0.59668356", "0.5963748", "0.5945622", "0.593...
0.73165596
0
Run each source once, passing artifacts to each operator.
def run_once(self): # Track some statistics about artifacts in a summary object. summary = collections.Counter() for source in self.sources: # Run the source to collect artifacts. self.logger.info(f"Running source '{source}'") try: # get the g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\t\tfor source in self.sources:\n\t\t\tstringutil.print_color(Fore.GREEN, 'Downloading from Source: %s' % source.get_alias())\n\t\t\tfor r in source.get_elements():\n\t\t\t\tr.set_source(source)\n\t\t\t\tself._queue.put(r)\n\n\t\t\t\t# Extra tracking stuff below:\n\t\t\t\twith self._c_lock:\n\t\t\t...
[ "0.6483219", "0.62053764", "0.59726936", "0.5708577", "0.56067014", "0.5595243", "0.5565407", "0.55493075", "0.5513938", "0.5458577", "0.54373556", "0.53742665", "0.5362166", "0.5355955", "0.5340015", "0.53185433", "0.53077227", "0.5302345", "0.5282659", "0.52769977", "0.5276...
0.77062124
0
Run forever, sleeping for the configured interval between each run.
def run_forever(self): while True: self.run_once() self.logger.info(f"Sleeping for {self.config.sleep()} seconds") time.sleep(self.config.sleep())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop_forever(self):\n while self.running:\n time.sleep(0.01)", "def loop_forever(self):\n self.running = True\n while self.running:\n time.sleep(0.1)", "def run(self, forever=False, interval=300):\n\n bot_start_time = time.time()\n\n while True:\n ...
[ "0.79261065", "0.769201", "0.72684103", "0.71911734", "0.7044903", "0.70315796", "0.70266116", "0.69642824", "0.6942898", "0.68407226", "0.6816066", "0.6797461", "0.6692905", "0.6683687", "0.6659617", "0.6603098", "0.65500087", "0.64913917", "0.64811295", "0.6433807", "0.6433...
0.83757216
0
Return a dictionary with counts of each artifact type.
def artifact_types(artifact_list): types = {} for artifact in artifact_list: artifact_type = artifact.__class__.__name__.lower() if artifact_type in types: types[artifact_type] += 1 else: types[artifact_type] = 1 return types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_freq(self, types=1):\n count_dict = {}\n if types == 1:\n for cat in self.categories:\n num_images = sum(\n [1 for i in self.data['annotations'] if i['category_id'] == self.cats_idx[cat]])\n count_dict[cat] = num_images\n el...
[ "0.66775286", "0.6509573", "0.645103", "0.64237165", "0.6420531", "0.6405249", "0.6346786", "0.62873185", "0.6284339", "0.6173281", "0.6121569", "0.60898113", "0.606048", "0.5977172", "0.5975826", "0.5950914", "0.5877489", "0.5843365", "0.5820288", "0.5796875", "0.5769143", ...
0.817184
0