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
Process requests to add new category
def addCategory(): # authentication if 'username' not in login_session: flash('Please login to add category') return redirect(url_for('showCategories')) if request.method == 'POST': name = request.form['name'] description = request.form['description'] # vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_categories_handler():\n rq = request.get_json()\n name = rq['name']\n picture = rq['picture']\n description = rq['description']\n category = addCategory(name, picture, description, g.user.id)\n return jsonify(category=category.serialize)", "def category_add(request: HttpRequest) -> Http...
[ "0.7432951", "0.69306815", "0.68379563", "0.6816585", "0.6750593", "0.6732125", "0.6676255", "0.657299", "0.6532126", "0.65211046", "0.6496525", "0.64803165", "0.64336693", "0.6420921", "0.64061916", "0.6383398", "0.6363358", "0.63617665", "0.63411766", "0.6331797", "0.632594...
0.62543315
26
Process requests to edit existing category
def editCategory(category_id): # authentication if 'username' not in login_session: flash('Please login to edit category') return redirect(url_for('showCategories')) # validation editedCategory = session.query(Category).filter_by(id=category_id).first() if not editedCategory...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_category(category_id):\n if request.args.get('state') != login_session['state']:\n response = make_response(\n json.dumps({'error': 'Invalid state parameter.'}), 401\n )\n response.headers['Content-Type'] = 'application/json'\n return response\n if 'username' n...
[ "0.72925174", "0.72785634", "0.7082263", "0.68611586", "0.6805188", "0.6780994", "0.67628855", "0.6735534", "0.6723635", "0.67222834", "0.6700238", "0.6667792", "0.6665785", "0.66318405", "0.65237856", "0.6505337", "0.6475644", "0.6444941", "0.63996595", "0.6362069", "0.63593...
0.6292338
25
Process requests to delete category
def deleteCategory(category_id): # authentication if 'username' not in login_session: flash('Please login to edit category') return redirect(url_for('showCategories')) # validation deletedCategory = session.query(Category).filter_by(id=category_id).first() if not deletedCate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_category(request):\n try:\n categories = request.POST.getlist('category_id', 0)\n category = Category.objects.filter(pk__in=categories).delete()\n ActionLogger().log(request.user, \"deleted\", \"Knowledgebase Category %s\" % categories)\n return format_ajax_response(True, ...
[ "0.73188466", "0.71327597", "0.7121295", "0.7070812", "0.7059786", "0.6995703", "0.6902705", "0.67928797", "0.67890596", "0.6657313", "0.6652008", "0.6603335", "0.65799075", "0.65242374", "0.6499832", "0.64698887", "0.64639753", "0.6404974", "0.6391405", "0.6381602", "0.62769...
0.0
-1
Serve all items of the category
def showItems(category_id): # validation category = session.query(Category).filter_by(id=category_id).first() if not category: flash('Attempt to view non-existent category') return redirect(url_for('showCategories')) # authorization items = session.query(Item).filter_by(cate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, request):\n item_categories = ItemCategory.objects.all()\n\n serializer = ItemCategorySerializer(\n item_categories, many=True, context={'request': request})\n return Response(serializer.data)", "def item_categories(request):\n all_item_categories = ItemType.obje...
[ "0.6862961", "0.6838752", "0.6832472", "0.6808409", "0.6759815", "0.65026784", "0.650165", "0.64309716", "0.64139295", "0.6298917", "0.6262579", "0.62359995", "0.6208312", "0.6195548", "0.6193358", "0.61109006", "0.6095865", "0.6091328", "0.6034134", "0.60246116", "0.5992183"...
0.6250752
11
Process requests to add new item to existing category
def addItem(category_id): # authentication if 'username' not in login_session: flash('Please login to add item') return redirect(url_for('showItems', category_id=category_id)) # validation category = session.query(Category).filter_by(id=category_id).first() if not category: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item():\n if 'username' not in login_session:\n response = make_response(\n json.dumps({'error': 'User is logged out. This should not happen'}), 401\n )\n response.headers['Content-Type'] = 'application/json'\n return response\n try:\n if request.method =...
[ "0.7216617", "0.69078374", "0.67813146", "0.6769221", "0.66897917", "0.66413176", "0.65893686", "0.65858966", "0.6564129", "0.65386194", "0.6522909", "0.6512884", "0.6506216", "0.64671975", "0.6457213", "0.64316285", "0.6411209", "0.6399066", "0.6387275", "0.63615215", "0.635...
0.63471943
23
Process requests to edit an item
def editItem(category_id, item_id): # authentication if 'username' not in login_session: flash('Please login to edit item') return redirect(url_for('showItems', category_id=category_id)) # validation category = session.query(Category).filter_by(id=category_id).first() if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_item(item_id):\n if 'username' not in login_session:\n response = make_response(\n json.dumps({'error': 'User is logged out. This should not happen'}), 401\n )\n response.headers['Content-Type'] = 'application/json'\n return response\n try:\n if request....
[ "0.7429425", "0.72136", "0.7089612", "0.69257456", "0.68866307", "0.6874315", "0.6870609", "0.6868565", "0.6842629", "0.6841878", "0.6826433", "0.6795387", "0.67505574", "0.6742804", "0.6720107", "0.66976166", "0.6664013", "0.6646604", "0.6633391", "0.6553586", "0.6533593", ...
0.6495844
23
Process requests to delete an item
def deleteItem(category_id, item_id): # authentication if 'username' not in login_session: flash('Please login to add item') return redirect(url_for('showItems', category_id=category_id)) # validation category = session.query(Category).filter_by(id=category_id).first() if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(id):\n return '', 201", "def deleteItem(request, itemid):\n try:\n item = ItemSerializer(Item.objects.get(id=itemid))\n Item.objects.get(id=itemid).delete()\n return Response(item.data)\n\n except Item.DoesNotExist:\n fail = {\n \"item\":\"item does not exist\"\n }\n r...
[ "0.7382746", "0.7378552", "0.73474455", "0.7177358", "0.71043193", "0.7022916", "0.7021426", "0.69820625", "0.6960577", "0.6867974", "0.6857347", "0.6855007", "0.68288106", "0.68246585", "0.6771007", "0.6745836", "0.6733993", "0.67138696", "0.6701832", "0.6698356", "0.6683879...
0.0
-1
Serve login page for OAuth authentication
def showLogin(): # crate anti-forgery state token state = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32)) login_session['state'] = state return render_template('login.html', STATE=state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():\n authorized_redirect_URIs = ['localhost:5000', '127.0.0.1:5000']\n\n disabled = False\n if request.host not in authorized_redirect_URIs:\n flash(Markup(\"\"\"Please use\n <a href='http://localhost:5000/login'>http://localhost:5000</a>\n or\n <a h...
[ "0.7467109", "0.74165416", "0.72552955", "0.72552955", "0.71830577", "0.71404755", "0.7101689", "0.7099405", "0.7098628", "0.70187813", "0.70177853", "0.6995019", "0.69946223", "0.69143796", "0.6893097", "0.68809414", "0.6841462", "0.68344367", "0.6828007", "0.68069416", "0.6...
0.0
-1
validate and exchange authorization code from the client, to get access token
def gconnect(): # Validate state token for CSFP if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return response # Get authorization code from cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_code(self, code):\n data = {\n 'client_id': self.client_id,\n 'client_secret': self.client_secret,\n 'grant_type': 'authorization_code',\n 'code': code,\n 'redirect_uri': self.redirect_uri,\n 'scope': 'identify'\n }\n\n ...
[ "0.7744639", "0.76788116", "0.7625335", "0.75447744", "0.753244", "0.7511808", "0.7451106", "0.74181396", "0.7414495", "0.7338056", "0.73063844", "0.73025167", "0.72988874", "0.7236584", "0.7222722", "0.72194856", "0.7156793", "0.71514153", "0.7142394", "0.70855254", "0.70791...
0.0
-1
revokes access token and cleans up login session data
def gdisconnect(): access_token = login_session.get('access_token') if access_token is None: print('Access Token is None') flash('Current user not connected.') return redirect(url_for('showCategories')) # print('Got access token for the user: {}'. # format(login_sess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self):\r\n self._apiSession.close()\r\n self._oAuthSession.close()\r\n \r\n # Check the access token and refresh if expired\r", "def renew_access_token(self):\n self._access_token = self._get_access_token()", "def logout():\n if 'access_token' in login_session:\...
[ "0.7221822", "0.7016931", "0.6861164", "0.68134", "0.6782752", "0.6766937", "0.675122", "0.6748271", "0.67094326", "0.670661", "0.66800076", "0.6639991", "0.66072917", "0.65591586", "0.6513368", "0.6468912", "0.64560956", "0.6432138", "0.64029115", "0.6357288", "0.6354455", ...
0.594588
61
Helper funtion to create new user on first login
def createUser(login_session): newUser = User_info(name=login_session['username'], email=login_session['email'], picture=login_session['picture']) session.add(newUser) session.commit() user = session.query(User_info).\ filter_by(email=login_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_user():\n pass", "def create_user(self):\n User.objects.create_user('test', 'testing@test.com', 'testing')", "def new_user(cls, user):\r\n pass", "def new_user(cls, user):\n pass", "def create_user(self):\n return User.objects.create_user(**self.user_data)", ...
[ "0.8162708", "0.7810457", "0.77937806", "0.7697306", "0.7654443", "0.7630038", "0.75879747", "0.7573793", "0.7533549", "0.7520767", "0.7514334", "0.7477874", "0.7446988", "0.7440135", "0.73672706", "0.73631763", "0.7349721", "0.7339964", "0.73316425", "0.7318075", "0.7315517"...
0.7302225
21
Helper function to get existing user's details
def getUserInfo(user_id): user = session.query(User_info).filter_by(id=user_id).one() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_details():\n rv = query_db('select * from user')\n return rv[0] if rv else None", "def user_info(user_id):\n return User.query.filter_by(id=user_id).first()", "def get_one_user():", "def user_info(self):\n return self.auth.get_user_by_session()", "def _get_user_info(self, userid):\...
[ "0.7793747", "0.74879813", "0.7446893", "0.7379897", "0.7255161", "0.7247083", "0.7247053", "0.7243749", "0.72173345", "0.7215414", "0.71827084", "0.712416", "0.7108359", "0.7106169", "0.7097898", "0.70841616", "0.7070988", "0.7047814", "0.7045812", "0.70180804", "0.6978364",...
0.6991022
20
helper funtion to get user.id using email
def getUserID(email): try: user = session.query(User_info).filter_by(email=email).one() return user.id except Exception as e: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self, email):\n\n query = self._db.User.select(self._db.User.c.email == email)\n query = query.with_only_columns([self._db.User.c.id_, ])\n\n record = query.execute().fetchone()\n return record[0]", "def find_user_id(email: str):\n user_id = sdk.search_users(email=email)\n...
[ "0.80991805", "0.80331326", "0.79804707", "0.7974303", "0.7971684", "0.7953753", "0.7935821", "0.7935821", "0.78868335", "0.78705585", "0.77772075", "0.7756721", "0.7755162", "0.77276444", "0.75779545", "0.7553001", "0.7553001", "0.75268793", "0.74339384", "0.73698187", "0.73...
0.80812913
1
serves all the categories in JSON format
def getCategoriesJSON(): categories = session.query(Category).all() return jsonify(Categories=[c.serialize for c in categories])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_categories_handler():\n categories = getAllCategories()\n return jsonify(categories=[i.serialize for i in categories])", "def categories():\n\tcategories = [\n\t\t'News',\n\t\t'Technology',\n\t\t'Music',\n\t\t'Sports'\n\t]\n\tresponse = { 'response': categories }\n\treturn jsonify(response)", "de...
[ "0.8531212", "0.8084764", "0.801031", "0.8005425", "0.79798305", "0.78705645", "0.7739593", "0.7732815", "0.7726635", "0.76671535", "0.7634281", "0.7571649", "0.75645876", "0.7531197", "0.74814814", "0.7478168", "0.7441861", "0.7413328", "0.74089295", "0.7299956", "0.726795",...
0.73354685
19
serves requested category in JSON format
def getCategoryJSON(category_id): category = session.query(Category).filter_by(id=category_id).first() if category: return jsonify(Category=category.serialize) else: return jsonify(Category={})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category():\n kwargs = {k: parse(v) for k, v in request.args.to_dict().items()}\n return jsonify(objects=get_categories(**kwargs))", "def show_category_json(category):\n category = (session.query(Categories)\n .filter_by(name=category.replace('-', ' '))\n .one())\n c...
[ "0.7945179", "0.73289764", "0.7300227", "0.72643065", "0.7207552", "0.6955672", "0.685776", "0.6856052", "0.6797764", "0.67846465", "0.67456406", "0.67364615", "0.6680828", "0.667469", "0.6669383", "0.6668816", "0.6662116", "0.6653127", "0.66204476", "0.66094583", "0.65662813...
0.6397505
29
serves all the items in the requested category, in JSON format
def getItemsJSON(category_id): items = session.query(Item).filter_by(category_id=category_id).all() return jsonify(Items=[i.serialize for i in items])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_category_items(category_id):\n items = session.query(Item).filter(Item.category_id == category_id)\n return jsonify(json_list=[i.to_json() for i in items.all()])", "def rest_get_catalogue_handler():\n cats = category.get_all_categories()\n items = item.get_all_items()\n result = {}\n re...
[ "0.76786", "0.76516217", "0.7376697", "0.73265606", "0.72695994", "0.7256238", "0.7242989", "0.71729", "0.7145522", "0.71167827", "0.7065065", "0.70593005", "0.70231986", "0.6977483", "0.6974819", "0.6946737", "0.6919578", "0.6889086", "0.68749416", "0.6867805", "0.68339294",...
0.687
19
serves requested item of the given category in JSON format
def getItemJSON(category_id, item_id): item = session.query(Item).filter_by(id=item_id, category_id=category_id).first() if item: return jsonify(Item=item.serialize) else: return jsonify(Item={})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_item_json(category, item):\n category = (session.query(Categories)\n .filter_by(name=category.replace('-', ' '))\n .one())\n item = (session.query(Items)\n .filter_by(name=item.replace('-', ' '))\n .one())\n return jsonify(item=[item.serialize])...
[ "0.7164484", "0.68920726", "0.6803887", "0.67451644", "0.6729482", "0.6718277", "0.6661368", "0.6609051", "0.6575905", "0.6530226", "0.6504352", "0.640927", "0.636154", "0.63121885", "0.6297817", "0.62344944", "0.6189625", "0.6184388", "0.61678034", "0.61608833", "0.60594255"...
0.61066556
20
Run MonoDepthNN to compute depth maps.
def run(basedir, resize_height=288): print("initialize") img0 = [os.path.join(basedir, 'images', f) \ for f in sorted(os.listdir(os.path.join(basedir, 'images'))) \ if f.endswith('JPG') or f.endswith('jpg') or f.endswith('png')][0] sh = cv2.imread(img0).shape height = resize_hei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_depth_graph(self):\n self.depth_net = DepthNetwork(self.cfg.STRUCTURE, is_training=False)\n images = self.images_placeholder[tf.newaxis]\n poses = self.poses_placeholder[tf.newaxis]\n intrinsics = self.intrinsics_placeholder[tf.newaxis]\n\n # fix the input shape\n ...
[ "0.6300814", "0.6275655", "0.6164095", "0.6144242", "0.5968066", "0.56185687", "0.54817164", "0.5401191", "0.53482395", "0.5347513", "0.52808815", "0.5271927", "0.5261911", "0.5260304", "0.52205527", "0.5203771", "0.5201494", "0.5175203", "0.51535124", "0.5142392", "0.5105308...
0.0
-1
Compares to see if the answer is correct
def compare(account_a, account_b): choice = input(f"Does {account_b['name']} have a higher or lower follower count? :") if choice == 'higher' and account_a['follower_count'] < account_b['follower_count']: return True elif choice == 'higher' and account_a['follower_count'] > account_b['follower_count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_answer(self, ans1, ans2):\r\n internal_result = self.check_formula(ans1, ans2, self.samples)\r\n return internal_result == \"correct\"", "def test_compare_answer(self):\r\n problem = self.build_problem(answer=\"42\")\r\n responder = problem.responders.values()[0]\r\n ...
[ "0.76464015", "0.76271117", "0.75453216", "0.7336775", "0.72446215", "0.7238129", "0.7154825", "0.7143388", "0.6960204", "0.69142133", "0.6783764", "0.67709124", "0.6748881", "0.66396964", "0.66172516", "0.6582584", "0.65661323", "0.65625083", "0.6540212", "0.6539953", "0.649...
0.0
-1
Launch the instance of tensorboard given the directory and port
def launch_tb(logdir: str = None, port: str = '7900'): tb = program.TensorBoard() tb.configure(argv=[None, '--logdir', logdir, '--port', port]) url = tb.launch() print(f'======\nLaunching tensorboard,\nDirectory: {logdir}\nPort: {port}\n======\n') return url
{ "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 run_simple_server(tb_app):\n # ...
[ "0.73095095", "0.6589419", "0.6576443", "0.64658266", "0.6464839", "0.6164005", "0.613992", "0.58848023", "0.58216435", "0.57985985", "0.5750669", "0.5724207", "0.5703905", "0.56819606", "0.567644", "0.5631442", "0.5608709", "0.56047523", "0.55997616", "0.55934083", "0.554290...
0.8142196
0
Plot the graph of the model
def add_graph(writer: torch.utils.tensorboard.SummaryWriter = None, model: torch.nn.Module = None, data_loader: torch.utils.data.dataloader = None, device: torch.device = torch.device('cpu')): # get an example image for running through the network input_batch_dict = nex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_graph(self) -> None:", "def plot(self, filename='model.png'):\n plot_model(self.model, to_file=filename)", "def plot(self):\n pass", "def plot(self):\n\t\tself.plotOfTF().plot()", "def plot_model(self):\n \n plt.figure(figsize=[10,5])\n \n plt.scatter(self...
[ "0.8195825", "0.7812494", "0.76472336", "0.76161516", "0.7545495", "0.74293447", "0.7119183", "0.7100567", "0.7074397", "0.7066181", "0.70557916", "0.70449466", "0.7014498", "0.699573", "0.6911103", "0.6889502", "0.687722", "0.68606293", "0.685891", "0.6836108", "0.6834426", ...
0.0
-1
Random display of 25 fonts
def lf(): return random.sample(font_list, 25)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawtext(self, drawer):\n rand_chars = self.randchars()\n font = ImageFont.truetype(self._font_face, self._font_size)\n font_width, font_height = font.getsize(rand_chars)\n drawer.text(\n ((self._width - font_width) / 2,\n (self._height - font_height) / 2),\n ...
[ "0.6392809", "0.6286903", "0.62738657", "0.6246008", "0.6230189", "0.62171894", "0.616977", "0.61241275", "0.609214", "0.59919924", "0.59631574", "0.59398395", "0.59008574", "0.58772904", "0.5865573", "0.58576256", "0.5825984", "0.5825982", "0.58239526", "0.58212125", "0.5809...
0.8467218
0
An art font that generates random fonts and random colors.
def rd(text, on_color=None, attr=None, width=80, justify="center"): rand_int = random.randint(1, len(font_list)+1) rand_color = color_dict.get(random.randint(30, 38)) rand_font = font_list[rand_int] print(f"Random font: {format(rand_font)}") f = Figlet( font=rand_font, width=width, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lf():\n return random.sample(font_list, 25)", "def test_generate_mine_text(self):\n pg.font.init()\n font_surface = utils.generate_mine_text(1)\n self.assertIsInstance(font_surface, pg.Surface)", "def create(font_name, point):\n return pygame.font.SysFont(font_name, int(point...
[ "0.72884387", "0.64297265", "0.64126635", "0.62243783", "0.6147591", "0.61150885", "0.60803175", "0.60634375", "0.60376585", "0.6032824", "0.60188615", "0.5972626", "0.59216464", "0.59104794", "0.5828189", "0.5799208", "0.57634753", "0.5763224", "0.57085055", "0.565248", "0.5...
0.7143183
1
An art font that generates the effect of the specified parameter.
def gt(text, font=DEFAULT_FONT, color="magenta", on_color=None, attr=None, width=80, justify="center"): f = Figlet( font, width=width, justify=justify ) r = f.renderText(text) return colored(r, color, on_color, attr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(font_name, point):\n return pygame.font.SysFont(font_name, int(point))", "def str_font ( self, font ):\n weight = { wx.LIGHT: ' Light',\n wx.BOLD: ' Bold' }.get( font.GetWeight(), '' )\n style = { wx.SLANT: ' Slant',\n wx.ITALIC:' Italic' }....
[ "0.6588519", "0.63463384", "0.6330239", "0.63217616", "0.6228177", "0.6119717", "0.6058272", "0.60242003", "0.6023994", "0.59942734", "0.59822667", "0.5970251", "0.593382", "0.59017307", "0.59013927", "0.5893405", "0.58381015", "0.58309704", "0.5821103", "0.5811189", "0.57905...
0.0
-1
Given positive integer n, prints the next largesst and next smallest number that have the same number of 1 bits in binary representation.
def get_larger_same_1s(n): # Find the first 1 bit with a 0 bit to the left of it. m = n i = 0 while not (get_bit(m, 0) == 1 and get_bit(m, 1) == 0) and i < 32: m >>= 1 i += 1 if i == 32: return "ERROR. No larger number with the same number of 1 bits exists." # Mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bits(n):\n\n # Create a list of the first 1,000 binary numbers\n binary_list = reverse_binary_list()\n\n # Start by calculating number of 1's for n\n n_ones = num_of_ones(n, binary_list)\n\n # Calculate number of 1's for next value\n next_ones = 0\n while n_ones != next_ones:\n n = ...
[ "0.7440835", "0.724932", "0.68827164", "0.68314093", "0.6821472", "0.68081117", "0.6644813", "0.65879565", "0.6583069", "0.6551128", "0.6506943", "0.6490766", "0.64796764", "0.6454466", "0.64508975", "0.64493287", "0.63515544", "0.6348827", "0.63481504", "0.63389575", "0.6327...
0.71422744
2
Gets the ith bit (zeroindexed).
def get_bit(num, i): return 1 if num & 1 << i else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(num, i):\n return num & (1 << i) != 0", "def __getitem__(self, index):\n nth_int, nth_bit = divmod(index, BitArray._UNSIGNED_INT)\n return self.bits[nth_int] & (1 << nth_bit)", "def _get_bit(byte, ii):\n return (byte >> (7 - ii)) & 1", "def bit_get(val, idx):\n return (...
[ "0.7826954", "0.7410046", "0.7386657", "0.73263216", "0.7222269", "0.7176076", "0.7137559", "0.71253127", "0.6973061", "0.6967496", "0.6958228", "0.69483864", "0.694268", "0.68543786", "0.6816369", "0.6688558", "0.66808105", "0.6567417", "0.6564154", "0.6555715", "0.653013", ...
0.81653005
0
set kromosom dengan cara mencari biner dari solusi untuk dijadikan 8 kromosom
def setKromosom(self,x,y): binx = bin(x)[2:].zfill(4) biny = bin(y)[2:].zfill(4) self.kromosom = list(binx+biny)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getKromosom(self):\n intx = int(\"\".join(self.kromosom[:4]),2)\n inty = int(\"\".join(self.kromosom[4:]),2)\n return [intx,inty]", "def generateKromosom(self):\n result = []\n # looping sebanyak panjangKromosom\n for _ in range(self.panjangKromosom):\n # ...
[ "0.5587814", "0.55320877", "0.55121857", "0.55119824", "0.5262004", "0.5262004", "0.5262004", "0.5262004", "0.5262004", "0.5259152", "0.5237551", "0.5234786", "0.50942725", "0.5071469", "0.5066532", "0.5040176", "0.5033861", "0.50290656", "0.49992993", "0.49971503", "0.499188...
0.7294824
0
mendapatkan nilai desimal dari kromosom yang berbentuk biner
def getKromosom(self): intx = int("".join(self.kromosom[:4]),2) inty = int("".join(self.kromosom[4:]),2) return [intx,inty]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertion_binaire_arbre(self):\r\n binary_code = self.root.conversion_binaire('')\r\n binary_dict = {}\r\n binary_code = binary_code.strip().split(\"\\n\")\r\n for element in binary_code:\r\n binary_dict[element.split(\":\")[0]] = element.split(\":\")[1]\r\n retur...
[ "0.58929366", "0.5839313", "0.58009493", "0.5651811", "0.5627853", "0.5627853", "0.5627853", "0.5627853", "0.5627853", "0.5560764", "0.55160713", "0.54763657", "0.54229146", "0.536898", "0.5294586", "0.5284089", "0.52129805", "0.52038026", "0.51855296", "0.5180604", "0.512408...
0.0
-1
return all the URIs that directly or indirectly share keys with the given URI
def traverse_uris(uri): seen = set() uris_to_check = [uri] while len(uris_to_check) > 0: uri = uris_to_check.pop() if uri not in seen: seen.add(uri) for key in keys_for_uri[uri]: for uri2 in uris_for_key[key]: if uri2 not in seen: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signed_urls(urls, rse, operation='read'):\n result = {}\n for url in urls:\n try:\n endpoint, bucket_name, key_name = _get_endpoint_bucket_key(url)\n\n signed_url = None\n if operation == 'read':\n # signed_url = conn.generate_url(3600, 'GET', bu...
[ "0.5448103", "0.5409984", "0.5319906", "0.5254115", "0.519453", "0.5190271", "0.5170817", "0.5147005", "0.5144864", "0.5075499", "0.50541604", "0.5042928", "0.50086915", "0.50086915", "0.50020605", "0.49731576", "0.49711323", "0.49554473", "0.49431983", "0.49355274", "0.49327...
0.7433617
0
return a sort key for the given URI, based on whether it represents the primary work in the record
def uri_sort_key(uri): if uri.startswith('http://urn.fi/URN:NBN:fi:bib:me:'): priority = int(uri[-2:]) # last two digits are 00 for the primary work, 01+ for other works mentioned else: priority = -1 # higher priority for e.g. authorized agents return (priority, uri)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wiki_sort_key(doc):\n url = doc['url']\n return 1 if url.startswith('https://en.wikipedia') else -1", "def get_row_list_sorting_key(x):\n name, count = x\n if '_' not in name:\n return name\n s = name.split('_')\n e...
[ "0.6385338", "0.6095066", "0.6061569", "0.5977724", "0.5976031", "0.5923008", "0.5896237", "0.58184385", "0.5716709", "0.5716709", "0.5691437", "0.56786144", "0.55717903", "0.5541411", "0.55260164", "0.54876274", "0.54588896", "0.544542", "0.5411701", "0.5399729", "0.5323552"...
0.7179098
0
return the most appropriate URI from the given set of URIs
def select_uri(uris): return sorted(uris, key=uri_sort_key)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_best(a_list, base_url, keyword=TERMS_KEYWORD):\n if not a_list:\n return None\n\n if len(a_list) == 1:\n return get_absolute_url(a_list[0], base_url)\n\n for a in a_list:\n full_url_str = get_absolute_url(a, base_url)\n full_url = URL(full_url_str)\n\n if full...
[ "0.5774539", "0.5353114", "0.5214836", "0.5105618", "0.5089583", "0.5086685", "0.5053703", "0.50328743", "0.50301826", "0.502398", "0.50229007", "0.50123894", "0.5010701", "0.49976727", "0.4970601", "0.4955148", "0.4953455", "0.49447128", "0.49424458", "0.49263084", "0.490907...
0.7494441
0
evt has the (x,y) coordinates and the target under the mouse cursor the getItem function in the rexmodule whatnot, returns an object presentation
def onMouseEnter(self, evt): if evt.target.Type() == "ITEM": self.doneMouseOver = True self.setToolTip(evt.target, tiptype=TooltipFrameItem) """ could prolly use a more generalized function for getting the stuff for items and avatars, but wanted ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetClickedItem( ctrl, evt ):\n return ctrl.HitTest( wx.Point( evt.GetX(), evt.GetY() ) )[0]", "def getItemAtClick(self, event):\n pos = event.pos()\n obj = self.itemAt(pos)\n return obj", "def getItemAtClick(self, event):\n pos = event.pos()\n obj = self.itemAt(pos)\n ...
[ "0.6839574", "0.6483785", "0.6483785", "0.6450797", "0.6385474", "0.6220512", "0.6219859", "0.599929", "0.5964659", "0.5959736", "0.59336543", "0.590918", "0.5886095", "0.5878171", "0.5857269", "0.583248", "0.5800941", "0.5800941", "0.5770369", "0.574279", "0.57005155", "0....
0.64577264
3
Return user details from Kakao account
def get_user_details(self, response): kaccount_email = "" kakao_account = response.get("kakao_account", "") if kakao_account: kaccount_email = kakao_account.get("email", "") properties = response.get("properties", "") nickname = properties.get("nickname") if properti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_data(self, access_token, *args, **kwargs):\n return self.get_json(\n \"https://kapi.kakao.com/v2/user/me\",\n headers={\n \"Authorization\": f\"Bearer {access_token}\",\n \"Content_Type\": \"application/x-www-form-urlencoded;charset=utf-8\",\n ...
[ "0.74495924", "0.7401827", "0.7308182", "0.7220801", "0.7169196", "0.7113641", "0.7105932", "0.70832413", "0.69508857", "0.6946847", "0.69346327", "0.6913946", "0.6912289", "0.6847098", "0.6845799", "0.68399817", "0.6829566", "0.6815086", "0.6811426", "0.6808608", "0.6788369"...
0.77409214
0
Loads user data from service
def user_data(self, access_token, *args, **kwargs): return self.get_json( "https://kapi.kakao.com/v2/user/me", headers={ "Authorization": f"Bearer {access_token}", "Content_Type": "application/x-www-form-urlencoded;charset=utf-8", }, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n\n self.refresh_token()\n\n endpoint = app.config['API']['url'] + 'user/get/' + self._id\n response = requests.get(\n endpoint,\n verify = app.config['API']['verify_ssl'],\n headers = {\n 'Authorization': self.token,\n ...
[ "0.7237133", "0.71659297", "0.6840109", "0.68110734", "0.6732239", "0.6647199", "0.6626025", "0.6564652", "0.6559671", "0.655537", "0.655537", "0.655537", "0.655537", "0.65010494", "0.65010494", "0.6469503", "0.64684176", "0.6422018", "0.640237", "0.6358974", "0.63496375", ...
0.0
-1
Publishes freespace (as measured by e.g. sonar).
def send_free_space(self, distance): self.client.publish('free_space', str(distance))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usedspace(self):\n self.log.info(\"freespace\")\n nbytes = 0\n keys = list(self.downloads.keys())\n keys.sort()\n for key in keys:\n download = self.downloads[key]\n nbytes += download['size']\n self.log.info(\"returning:\" + str(nbytes))\n ...
[ "0.61439735", "0.611649", "0.59722584", "0.59080696", "0.5887496", "0.5801403", "0.57203335", "0.55763495", "0.5572963", "0.55633366", "0.55046725", "0.54344904", "0.5423423", "0.5421534", "0.5417115", "0.5363897", "0.53438485", "0.53435826", "0.5342639", "0.5336582", "0.5308...
0.68613786
0
Get dictionary with proper data from given period of time and for given node
def query(self, startTime, endTime, metricName, instance=None, hostname = "__SummaryInfo__", clusterName = "Openstack"): if metricName is None: raise Exception("Null parameter %s", "metricName") if endTime is None: raise Exception("Null parameter %s", "endTime") if sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nodes():\n\n host = str(request.args['host'])\n days = float(request.args['days'])\n\n to_time = int(time.time())\n to_day = int(time.strftime('%Y%m%d', time.gmtime(float(to_time))))\n from_time = to_time-int(days*24*60*60)\n from_day = int(time.strftime('%Y%m%d', time.gmtime(float(from_t...
[ "0.6423629", "0.61341864", "0.6094603", "0.59688115", "0.5889502", "0.57996786", "0.5787787", "0.57325476", "0.5728645", "0.57078373", "0.5678308", "0.56511354", "0.5642608", "0.5543678", "0.5430835", "0.5422789", "0.5402959", "0.54022866", "0.5385737", "0.53469837", "0.53354...
0.0
-1
Fetch data from RRD archive for given period of time.
def _fetch_data(self, rrdObject, startTime, endTime): #print rrdObject if not path.exists(rrdObject): raise Exception("File not exists: %s" % rrdObject) #print "%s - %s" % (startTime, endTime) rrd_data = None try: rrd_data = rrdtool.fetch(str(rrdObjec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchOHLC(ticker,interval = \"minute\",duration=4):\r\n data = pd.DataFrame(kite.historical_data(ticker,dt.date.today()-dt.timedelta(duration), dt.date.today(),interval))\r\n data.date =data.date.map(lambda t: t.strftime('%Y-%m-%d %H:%M'))\r\n return data", "def fetch_data(self, from_date: float, to...
[ "0.59084827", "0.5897862", "0.58881354", "0.5841368", "0.5826922", "0.58209974", "0.5776042", "0.5727331", "0.56761867", "0.56529486", "0.56008005", "0.5581093", "0.5486558", "0.54823905", "0.54436505", "0.5440745", "0.5436888", "0.5407445", "0.53838426", "0.5374633", "0.5373...
0.6730135
0
0 StoppedState 1 PlayingState 2 PausedState
def onStateChanged(self): state = self.mediaPlayer.state() if state == 0: self.onVideoStop() elif state == 1: self.onVideoStart() elif state == 2: self.onVideoPause() else: raise ValueError("Unknown state {}".format(state))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PAUSED(self):\n self.pause_state = self.get_state() # the state FSM was in before 'op-pause' was called\n self.continue_state = self.pause_state\n self.update_status(self.STATES.PAUSED)", "def state(self) -> MediaPlayerState:\n status = self._state.get(\"status\", None)\n i...
[ "0.6899462", "0.68420255", "0.6793299", "0.67474914", "0.66558725", "0.65322196", "0.65079564", "0.6504134", "0.6499699", "0.6468185", "0.6451179", "0.64418775", "0.6429089", "0.6325549", "0.6303262", "0.6289499", "0.6271189", "0.62341154", "0.620243", "0.61815435", "0.615858...
0.63474345
13
Performance test with large amounts of rows and with several tables at the same time. We just test it for INTERNAL.
def test_multithread_batch_size(sdc_builder, sdc_executor, snowflake, num_tables, parallel_transfers, num_records, batch_size, reader_threads, processor_threads): base_table_name = f'STF_TABLE_{get_random_string(string.ascii_uppercase, 5)}' stage_name = f'STF_STAGE_{get_random_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # Set start and end values\n start, end = 1, 100000\n\n # Build and execute query\n start_ts = time.time()\n query = build_query(start, end)\n query_build_ts = time.time()\n execute_query(query)\n execute_ts = time.time()\n\n # Print runtime results\n query_build_time = ...
[ "0.63689923", "0.6279146", "0.6068501", "0.60484916", "0.5977918", "0.596916", "0.59552807", "0.5939442", "0.5925678", "0.59152704", "0.5867142", "0.5862837", "0.58588886", "0.58356535", "0.5817789", "0.58168185", "0.58129585", "0.57968366", "0.57754725", "0.5747283", "0.5740...
0.579194
18
Download genotype data the save the out put in .data dir
def download_genotype_data(): print("downloading genotype data") download_from_url(PSAM_PATH, dst=f"{GENOTYPE_DATA_PATH}/{MERGED_GENOTYPE_FILE}.psam", desc="downloading psam") download_from_url(PVAR_PATH, dst=f"{GENOTYPE_DATA_PATH}/{MERGED_GENOTYPE_FILE}.pvar.zst", desc="downloading pv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_data(self):\n # Command to get the download data\n pass", "def download_proteome(proteome_id, data_dir, domain=\"Eukaryota\"):\n base = (\"ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/\"\n \"knowledgebase/reference_proteomes\")\n\n url = [base, domain, prote...
[ "0.67733765", "0.6754389", "0.65670013", "0.6480931", "0.64402175", "0.64136404", "0.61601907", "0.6154601", "0.6146112", "0.6115417", "0.60394645", "0.60286486", "0.60172874", "0.59958476", "0.59882545", "0.5964745", "0.59604585", "0.5958659", "0.59532046", "0.5930072", "0.5...
0.87439203
0
create merged genotype file from psam pvar and pgen
def create_merged_genotype_file(snps_file_path): print("creating merged genotype file") plink_runner = Plink2DockerRunner() shutil.copyfile(snps_file_path, f"{GENOTYPE_DATA_PATH}/{SNP_LIST_FILE_NAME}") plink_runner(f"./plink2 --pfile {IMAGE_SHARE_FOLDER_PATH}/{GENOTYPE_DATA_FOLDER}/{MERGED_GENOTYPE_FILE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gmpe_data_file(indata_dir, tmpdir,\n gmpe_file, gmpe_label_file,\n gmpe_group_name):\n # Find SRC file\n basedir = os.path.join(indata_dir, os.listdir(indata_dir)[0])\n src_file = glob.glob(\"%s%s*.src\" % (basedir, os.sep))\n if not len(src_...
[ "0.5435754", "0.52857256", "0.52641356", "0.5249349", "0.5163392", "0.5138307", "0.5133329", "0.5126286", "0.51097524", "0.51070285", "0.5083355", "0.50709164", "0.50644994", "0.50576615", "0.5056252", "0.5051618", "0.50503314", "0.50489813", "0.5036032", "0.5025411", "0.5020...
0.72425526
0
to initialise vectors, its size and randomly allocated centroids
def initialize(self): self.SIZE = self.vectors.shape[0] # todo can use max distance to allocation farthest apart points self.centroids = self.vectors[[random.randint(1, self.SIZE) for x in range(self.K)], :]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_init(self, train_data):\n\n centroids=np.zeros((self.n_clusters_, train_data.shape[1]))\n for c in range(self.n_clusters_):\n for f in range(train_data.shape[1]):\n centroids[c,f]=random.uniform(min(train_data[:,f]), max(train_data[:,f]))\n\n return centroi...
[ "0.7167922", "0.70244765", "0.6918472", "0.6858616", "0.68306804", "0.67281", "0.6684833", "0.65676075", "0.6543686", "0.64338136", "0.6385544", "0.6385496", "0.6346486", "0.63083196", "0.6302265", "0.62757456", "0.618771", "0.6186494", "0.6182182", "0.6167982", "0.6166685", ...
0.83943045
0
Create and update clusters till max iterations or the if change rate drops
def create_clusters(self): ex = 0 print 'Iter - Purity Gini Index' while ex < self.MAX_ITERATION: new_clusters = np.zeros(self.centroids.shape) distances = euclidean_distances(self.vectors, self.centroids).argmin(axis=1) for i in range(self.K):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_algorithm(self):\r\n self.kmeans.set_data(self.tweets)\r\n clusters = self.kmeans.start_algorithm()\r\n min_size = len(self.tweets) * 0.005\r\n if min_size < 50:\r\n min_size = 50\r\n max_size = len(self.tweets) * 0.20\r\n\r\n amount = 0\r\n\r\n ...
[ "0.66686136", "0.63297254", "0.6275724", "0.6267938", "0.62652594", "0.6262859", "0.62307656", "0.622925", "0.6228214", "0.62136155", "0.62105435", "0.61972094", "0.616974", "0.61204106", "0.6116938", "0.6088743", "0.6029347", "0.60194194", "0.6014796", "0.60029143", "0.60001...
0.6292404
2
Internal implementation for `get_files` to combine a parent directory with a file to make a full path to file(s)
def _get_files(path, file, modality): p = Path(path) res = [p/o for o in file if not o.startswith('.') and is_mods(o, modality)] assert len(res)==len(modality) #TODO: Assert message return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_path_with_file(name, path=None):\n return parent_path_with(lambda p: os.path.isfile(os.path.join(p, name)), path=path)", "def get_file_path(cls, file_name, folder_name):\n return cls.file_path.parent / folder_name / file_name", "def opath ( dir_name, file_name = None ):\n if file_na...
[ "0.66820467", "0.6673638", "0.65774965", "0.6394746", "0.6383429", "0.6355136", "0.63011694", "0.62257266", "0.62222934", "0.61762565", "0.61630255", "0.61557174", "0.61168766", "0.61104876", "0.60795975", "0.60564154", "0.60349333", "0.60048866", "0.6001916", "0.5988261", "0...
0.0
-1
This method assumes a list of full paths to the desired files's parent folders and returns NiftiImageTupleList whose item is a nested list with each sublist belonging to its parent folder
def from_folder(cls, folderpaths:FilePathList, modality:Union[str, Collection[str]], presort:bool=False, **kwargs): filepaths=[] for fp in folderpaths: filepath = get_files(fp, modality=modality, presort=True) filepaths.append(filepath) return cls(items=filepaths, pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ReadImageList(list_path):\n # with tf.gfile.GFile(list_path, 'r') as f:\n # image_paths = f.readlines()\n # image_paths = [entry.rstrip() for entry in image_paths]\n # return image_paths\n image_paths=[]\n for dir, subdir, files in os.walk(list_path):\n for file in files:\n image_paths.a...
[ "0.633106", "0.6182086", "0.60495406", "0.6004823", "0.58684045", "0.5851099", "0.58083504", "0.58037215", "0.5783839", "0.5763506", "0.5748211", "0.5731935", "0.57069534", "0.5659177", "0.5637448", "0.56329757", "0.56315774", "0.5613083", "0.56036484", "0.5602641", "0.559801...
0.0
-1
Converts hyperbolic gradient to Euclidean gradient
def _convert_gradient(self, variable): sqnorm = squared_norm(variable.data, dim=-1, keepdim=True) variable.grad.data.copy_(variable.grad.data * ((1 - sqnorm) ** 2 / 4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(cls, x):\n return 1 - TanH.apply(x) ** 2", "def compute_gradient(self): # TODO: try to change to square loss since it's hessian is easier to obtain\n A = np.dot(self.X, self.w)\n m = self.t.shape[0]\n C = -1 * self.t * (1 / (1 + np.exp(A * self.t)))\n return (1 / ...
[ "0.6347816", "0.6257544", "0.6094985", "0.6030704", "0.6028422", "0.5981357", "0.5968479", "0.5941827", "0.5934544", "0.59263563", "0.59210587", "0.5908771", "0.59081846", "0.59067506", "0.590237", "0.5898408", "0.58943975", "0.5885614", "0.58820474", "0.58789206", "0.5878043...
0.58589303
22
For torque actuators it copies the action into mujoco ctrl field. For position actuators it sets the target relative to the current qpos.
def ctrl_set_action(self, action): # @Melissa: This needs to be changed because you have 6DOF on the EndEffector, but this only does the last three for i in (-1, -2, -3): self.sim.data.ctrl[i] = action[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_actuator(self, action):\n deltav = action[0]\n vt = np.clip(self.vt + deltav, -self.maxV, self.maxV)\n self.vt = vt\n p.setJointMotorControl2(bodyUniqueId=self.botId,\n jointIndex=0,\n controlMode=p.VELOCITY_CONTROL,\n targetVelocity=vt)\n p.setJointM...
[ "0.6718842", "0.6568006", "0.64266974", "0.58606946", "0.582333", "0.57714134", "0.5759638", "0.57433766", "0.5733864", "0.5730009", "0.5715882", "0.56873333", "0.5620727", "0.56012464", "0.5545777", "0.550743", "0.5478081", "0.5420566", "0.53832555", "0.5382743", "0.53739023...
0.6429093
2
The action controls the robot using mocaps. Specifically, bodies on the robot (for example the gripper wrist) is controlled with mocap bodies. In this case the action is the desired difference in position and orientation (quaternion), in world coordinates, of the of the target body. The mocap is positioned relative to ...
def mocap_set_action(self, action): # @Melissa: Action = 3DOF Cartesian Position Delta + Quaternion if self.sim.model.nmocap > 0: action, _ = np.split(action, (self.sim.model.nmocap * 7, )) action = action.reshape(self.sim.model.nmocap, 7) pos_delta = action[:, :3] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mocap_set_action(sim, action, mocap_low, mocap_high, ee_name): \n if sim.model.nmocap > 0:\n action, _ = np.split(action, (sim.model.nmocap * 7, ))\n action = action.reshape(sim.model.nmocap, 7)\n\n pos_delta = action[:, :3]\n quat_delta = action[:, 3:]\n\n if np.count_non...
[ "0.6857181", "0.6473455", "0.6208231", "0.61743957", "0.6151875", "0.6096956", "0.58196455", "0.58098626", "0.57758635", "0.57689625", "0.5463688", "0.5459588", "0.542433", "0.5395272", "0.52858716", "0.526483", "0.5258025", "0.525683", "0.52174217", "0.52063286", "0.5194508"...
0.7424087
0
Resets the mocap welds that we use for actuation.
def reset_mocap_welds(self): if self.sim.model.nmocap > 0 and self.sim.model.eq_data is not None: for i in range(self.sim.model.eq_data.shape[0]): if self.sim.model.eq_type[i] == mujoco_py.const.EQ_WELD: self.sim.model.eq_data[i, :] = np.array( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_mocap_welds(sim):\n if sim.model.nmocap > 0 and sim.model.eq_data is not None:\n for i in range(sim.model.eq_data.shape[0]):\n if sim.model.eq_type[i] == mujoco_py.const.EQ_WELD:\n sim.model.eq_data[i, :] = np.array(\n [0., 0., 0., 1., 0., 0., 0.])\n...
[ "0.72712475", "0.6722829", "0.6504008", "0.6271008", "0.62297726", "0.6208428", "0.6196257", "0.6191569", "0.61721665", "0.6122709", "0.607302", "0.60728467", "0.606244", "0.6059849", "0.6052459", "0.60498244", "0.60480326", "0.6044585", "0.6020971", "0.6006914", "0.6000386",...
0.7608869
0
Resets the position and orientation of the mocap bodies to the same values as the bodies they're welded to.
def reset_mocap2body_xpos(self): if (self.sim.model.eq_type is None or self.sim.model.eq_obj1id is None or self.sim.model.eq_obj2id is None): return for eq_type, obj1_id, obj2_id in zip(self.sim.model.eq_type, self.sim.mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_mocap2body_xpos(sim):\n\n if (sim.model.eq_type is None or\n sim.model.eq_obj1id is None or\n sim.model.eq_obj2id is None):\n return\n for eq_type, obj1_id, obj2_id in zip(sim.model.eq_type,\n sim.model.eq_obj1id,\n ...
[ "0.6893635", "0.6499374", "0.6466375", "0.63432604", "0.63174415", "0.6309813", "0.6250218", "0.6250218", "0.6250218", "0.6227424", "0.5993534", "0.59932613", "0.5980894", "0.5974436", "0.5955571", "0.59437466", "0.59390795", "0.5894605", "0.58935535", "0.5870204", "0.5842682...
0.7228065
0
Starts the game loop
def start(self): self.__init__() self.set_n_players() self.init_players() self.init_territory_selection_phase() self.init_troop_deployment_phase() # self.game_phase()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Gameloop():", "def game_loop(self):\n self.interface.game_loop(self)", "def GAME_LOOP():\n pass", "def start_game(self) -> None:\n self.init_game()\n self.play()", "def start_gameloop(self):\n print(\"Game Loop starting...\")\n while True:\n current_...
[ "0.8018915", "0.78910494", "0.7852025", "0.78515756", "0.7785", "0.77718896", "0.77695763", "0.7729435", "0.7723075", "0.7719013", "0.77183735", "0.77107", "0.7690977", "0.7684944", "0.76829237", "0.76266", "0.75755453", "0.7538091", "0.7490758", "0.7461928", "0.74412006", ...
0.0
-1
Sets the number of players in the Game
def set_n_players(self): complain = "" while True: clear_output() try: self.n_players = int( input(f"{complain}Please insert the number of players (between 2 to 6): \n")) if self.n_players >= 2 and self.n_players < 7: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _total_players(self, ctx: Context, number: int):\n\n await self.config.guild(ctx.guild).total_players.set(number)\n\n await ctx.send(_(\"Set total players to `{}`.\").format(number))", "def number_of_players(self) -> int:\n return self.param.number_of_players", "def create_number...
[ "0.76492655", "0.7484225", "0.73777086", "0.6895391", "0.68731314", "0.6814698", "0.6739474", "0.65343845", "0.63675404", "0.63675404", "0.63621116", "0.6286831", "0.61456484", "0.60974157", "0.6082391", "0.6057997", "0.6056437", "0.60563886", "0.6048639", "0.60387874", "0.60...
0.7342402
3
initializes players and their attributes generates player's turn randomly
def init_players(self): complain = "" players_turn = random.sample(range(self.n_players), self.n_players) players_created = {} picked_colors = [] for x in range(self.n_players): while True: clear_output() try: color ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spawn_players(self) -> None:\n # Initialise the players\n self.player1 = Player(self.sensitivity, self.screen_width, self.screen_height, self.screen_width // 2, 50,\n self.player_lives, self.fps, self.player1_bullet, Direction.DOWN, self.debug)\n self.player2 =...
[ "0.68072003", "0.67968637", "0.67901814", "0.6762912", "0.66973114", "0.66346157", "0.6599588", "0.65907806", "0.6511013", "0.6477715", "0.6467021", "0.64137375", "0.6371321", "0.63334036", "0.6294842", "0.6257331", "0.6255094", "0.62245625", "0.61707884", "0.61663854", "0.61...
0.6354506
13
Initializes territory selection phase runs until all of the territories in the game world are selected
def init_territory_selection_phase(self): phase_name = "Territory Selection Phase!\n\n" selected_territories = 0 while selected_territories < len(self.world.territories): for i, player in enumerate(self.players): complain = "" selected_territory = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_initial_state(self):\n # collect the ids of vehicles in the network\n self.ids = self.vehicles.get_ids()\n self.controlled_ids = self.vehicles.get_controlled_ids()\n self.sumo_ids = self.vehicles.get_sumo_ids()\n self.rl_ids = self.vehicles.get_rl_ids()\n\n # dic...
[ "0.54485637", "0.5442429", "0.54404324", "0.53849924", "0.5252147", "0.52514434", "0.5197759", "0.5194349", "0.5169358", "0.51636755", "0.5162915", "0.51623625", "0.5112647", "0.5089078", "0.50820476", "0.50782955", "0.50541395", "0.50344735", "0.5020178", "0.5017316", "0.499...
0.7551169
0
Draw epipolar line on image
def drawlines(img1, img2, lines, pts1, pts2, color): r, c = img1.shape img1 = cv2.cvtColor(img1, cv2.COLOR_GRAY2BGR) img2 = cv2.cvtColor(img2, cv2.COLOR_GRAY2BGR) for r, pt1, pt2, co in zip(lines, pts1, pts2, color): x0, y0 = map(int, [0, -r[2] / r[1] ]) x1, y1 = map(int, [c, -(r[2] + r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_epilines(imgLeft, imgRight, ptsLeft, ptsRight, F):\n color = []\n for i in range(ptsLeft.shape[0]):\n color.append(tuple(np.random.randint(0, 255, 3).tolist()))\n print(color)\n\n # Find epilines corresponding to points in right image (right image)\n linesLeft = cv2.computeCorrespond...
[ "0.69136196", "0.69004893", "0.68730754", "0.6833993", "0.68173313", "0.66363084", "0.6596775", "0.6524032", "0.6493496", "0.6488783", "0.6435435", "0.64166486", "0.63767385", "0.6375655", "0.63190556", "0.6299994", "0.62983435", "0.6244091", "0.62418777", "0.61691374", "0.61...
0.570666
71
finds the epipolar lines in two images given a set of pointcorrespondences
def find_epilines(imgLeft, imgRight, ptsLeft, ptsRight, F): color = [] for i in range(ptsLeft.shape[0]): color.append(tuple(np.random.randint(0, 255, 3).tolist())) print(color) # Find epilines corresponding to points in right image (right image) linesLeft = cv2.computeCorrespondEpilines(pts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_epipolar_lines(self, img1, img2, p1, p2, E, save_path):\n # get fundamental matrix\n F, mask_fdm = cv2.findFundamentalMat(p1, p2, cv2.RANSAC)\n p1_selected = p1[mask_fdm.ravel() == 1]\n p2_selected = p2[mask_fdm.ravel() == 1]\n\n # draw lines\n lines1 = cv2.c...
[ "0.70122874", "0.64854825", "0.6441403", "0.63546497", "0.6317812", "0.6274026", "0.6253232", "0.6238574", "0.61882734", "0.6186069", "0.6170266", "0.61325264", "0.6126266", "0.610908", "0.6090316", "0.6057525", "0.60160977", "0.6001683", "0.6000284", "0.5994642", "0.5993322"...
0.7567746
0
Given an HMM and set of observations, identify the most likely state sequence to have generated the observations using the Viterbi algorithm. This implements a generalization of the Viterbi algorithm where the transition probabilities may be specified in such a way as to change from observation to observation. (Formall...
def viterbi(p_observations_given_state, p_transition, p_initial): p_observations_given_state = numpy.asarray(p_observations_given_state) p_transition = numpy.asarray(p_transition) p_initial = numpy.asarray(p_initial) N, S = p_observations_given_state.shape assert p_transition.shape in {(S, S), (N-1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def viterbi(self, hmm, initial, emissions):\n probabilities = hmm.emission(emissions[0]) * initial\n stack = []\n \n for emission in emissions[5:]:\n trans_probabilities = hmm.transition_probabilities * np.row_stack(probabilities) #Matrix for transition probabilities\n ...
[ "0.73060566", "0.70092326", "0.6774714", "0.64714766", "0.6448113", "0.63569456", "0.6286803", "0.6273223", "0.62709063", "0.62202424", "0.6153085", "0.6139608", "0.606561", "0.60225946", "0.5924896", "0.5884236", "0.5879754", "0.5869845", "0.5869469", "0.5790324", "0.5775143...
0.685088
2
Given a set of observations known to belong to different states, construct an object that will estimate the probability that new observations belong to each state (i.e. the p_observations_given_state matrix)
def __init__(self, state_observations, continuous=True, pseudocount=1): self.continuous = continuous state_observations = [numpy.asarray(so) for so in state_observations] if continuous: self.state_distributions = [kde.gaussian_kde(so) for so in state_observations] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observation_from_state(self, state):\n state_index = self.latent_variable_markov_chain.index_dict[state]\n return np.random.choice(self.observation_states,\n p=self.emission_probabilities[state_index, :])", "def __init__(self, num_states, observation_states, prior_probabil...
[ "0.68669397", "0.6462204", "0.6262085", "0.6136685", "0.6117178", "0.60850716", "0.60375464", "0.59944856", "0.5964485", "0.5952044", "0.59156275", "0.5894562", "0.5868372", "0.5867635", "0.58412325", "0.5838576", "0.5836713", "0.58103794", "0.5797326", "0.5746525", "0.571440...
0.63312227
2
Estimate the p_observations_given_state matrix for a set of observations. If observations is a list/array of length N, returns an array of shape (N, S), where element [t, s] is the probability of the observation at time t assuming the system was in fact in state s.
def __call__(self, observations): observations = numpy.asarray(observations) if self.continuous: state_probabilities = [kde(observations) for kde in self.state_distributions] else: state_probabilities = [hist[observations] for hist in self.state_distributions] ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observation_from_state(self, state):\n state_index = self.latent_variable_markov_chain.index_dict[state]\n return np.random.choice(self.observation_states,\n p=self.emission_probabilities[state_index, :])", "def viterbi(p_observations_given_state, p_transition, p_initial):...
[ "0.6838239", "0.58764845", "0.5864366", "0.5794693", "0.57128555", "0.57071984", "0.5683988", "0.55933166", "0.55871", "0.5572618", "0.552575", "0.55044127", "0.5496997", "0.5407656", "0.53901947", "0.5342929", "0.5342017", "0.52807003", "0.52772355", "0.5257948", "0.5251679"...
0.6578636
1
Given a set of state sequences, estimate the initial and transition probabilities for each state (i.e. the p_initial and p_transition matrices needed for HMM inference).
def estimate_hmm_params(state_sequences, pseudocount=1, moving=True, time_sigma=1): state_sequences = numpy.asarray(state_sequences) n, t = state_sequences.shape s = state_sequences.max() + 1 # number of states initial_counts = numpy.bincount(state_sequences[:,0], minlength=s) + pseudocount p_initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_probabilities_from_trajectories(n_states, trajectories):\n p = np.zeros(n_states)\n\n for t in trajectories:\n p[t.transitions()[0][0]] += 1.0\n\n return p / len(trajectories)", "def init_start_prob(n_states):\n start_prob_est = np.random.rand(n_states, 1)\n start_prob_est /= np...
[ "0.6737312", "0.6540201", "0.643304", "0.64260924", "0.6414045", "0.6372045", "0.6327534", "0.63086444", "0.62992555", "0.62833136", "0.6242119", "0.61996263", "0.61793613", "0.6153507", "0.6136968", "0.6071576", "0.6045001", "0.6036908", "0.6011966", "0.5985723", "0.5974724"...
0.7366758
0
Process time to live.
def ttl(self): return self.app.config.WORKER_TTL
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n super().update()\n self.checkTimeToLive()", "def update_time(self):\n pass # Do nothing", "def uptime(self):\n time_dict = self._get_live_time()\n if time_dict is not None:\n uptime_str = 'The channel has been live for {hours}, {minutes} and {s...
[ "0.65233475", "0.61769414", "0.61722183", "0.61608106", "0.60443676", "0.59487903", "0.5801238", "0.5723729", "0.5722279", "0.56710446", "0.5665724", "0.55977213", "0.558361", "0.5579903", "0.557601", "0.55748713", "0.55747193", "0.55512273", "0.5541806", "0.5539358", "0.5535...
0.0
-1
Prevent to frequent process reaping.
def repeat_delay(self): return self.app.config.WORKER_REAP_DELAY
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _optimise(self):\n pass", "def disarm(self):\n pass", "def _postprocess(self):", "def _perturbInPlaceHard(self):\n die", "def post_process(self):\n pass", "def post_process(self):\n pass", "def post_process(self):\n pass", "def post_process(self):\n ...
[ "0.6147296", "0.6087487", "0.58986795", "0.5870277", "0.5656438", "0.5656438", "0.5656438", "0.5656438", "0.5656438", "0.56234264", "0.5615654", "0.5613333", "0.55935866", "0.555553", "0.55422574", "0.5528313", "0.55076545", "0.5463989", "0.5462463", "0.5456732", "0.54441965"...
0.0
-1
LIWC_sh = path.join(LIWC_home, "LIWC.sh") cmd = " ".join([LIWC_sh, file]) p = Command(cmd, shell=True, universal_newlines=True) (retcode, stdout, stderr) = p.run()
def LIWC(file, LIWC_home=DEFAULT_LIWC_HOME): program = ['java', 'lib/LIWC/LIWC', '-in', 'test.txt', '-out', 'lib/LIWC/myout.txt', '-dic', 'LIWC2007_English080130.dic'] subprocess.call(program) # extract features, unknown from stdout. features = {} unknown = {} location = 0 for line in stdout...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sh(cmd):\r\n return check_call(cmd, shell=True)", "def runCommand(cmd):\n print cmd\n args = shlex.split(cmd)\n p = subprocess.Popen(args) # shell=bash is not recommended. Only use when '>' must be in cmd. \n return p.communicate()\n #p = Popen(cmd.split(' '), stdout=PIPE)\n #return p.co...
[ "0.59562844", "0.5900081", "0.5900081", "0.5900081", "0.5741968", "0.572656", "0.57250684", "0.5723392", "0.5712522", "0.56818235", "0.56596833", "0.5653967", "0.5650253", "0.55789304", "0.5576046", "0.5568389", "0.5551123", "0.5514169", "0.54766566", "0.5451914", "0.5428735"...
0.0
-1
Whether or not the end of data is reached.
def iseod(self): return self.byte_ptr >= len(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eof(self):\r\n\t\treturn self.index == len(self.data)", "def __bool__(self):\n return self.end < len(self.data)", "def is_eof(self) -> bool:\n ...", "def at_eof(self):\n return self._eof and not self._buffer", "def at_eof(self) -> bool:\n ...", "def at_eof(self) -> bool:\n...
[ "0.8353472", "0.805408", "0.7938149", "0.7848355", "0.7802912", "0.7802912", "0.7802912", "0.7802912", "0.7763066", "0.77391446", "0.77107537", "0.7666942", "0.75472575", "0.7281544", "0.7250737", "0.7229121", "0.72207284", "0.7212315", "0.7183002", "0.7034446", "0.70282465",...
0.6588493
40
The bit position getter.
def bit_pos(self): return self.byte_ptr * 8 + self.bit_ptr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_position(self):\n\n return (self._fileobj.tell() - self._pos) * 8 - self._bits", "def get_position(self) -> Tuple[int]:\n return self.position.copy()", "def __getpos__(self, num):\n return self.num_to_pos[num]", "def get_bit(num, position):\n\treturn (num >> position) & 0b1", "...
[ "0.70577097", "0.68061477", "0.67975134", "0.6695327", "0.66924286", "0.6679596", "0.66726327", "0.6656201", "0.661305", "0.6570994", "0.65080434", "0.64964867", "0.64851624", "0.6482087", "0.6471589", "0.64665365", "0.646452", "0.6454277", "0.6441795", "0.64201766", "0.64042...
0.8436633
0
The bit position setter.
def bit_pos(self, bits): if bits > len(self): raise BitReaderError('bit_pos(%s) is out of boundary', bits) self.byte_ptr, self.bit_ptr = divmod(bits, 8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bit_pos(self):\n\n return self.byte_ptr * 8 + self.bit_ptr", "def initializeOffsets(self, bitPosition: int, _value: int) -> int:\n\n return bitPosition + self.bitSizeOf()", "def initializeOffsets(self, bitPosition: int, _value: int) -> int:\n\n return bitPosition + self.bitSizeOf()", ...
[ "0.6843015", "0.6645116", "0.6645116", "0.6591307", "0.65042365", "0.6372688", "0.6217314", "0.62171125", "0.61885184", "0.61506695", "0.6108199", "0.6107682", "0.60736126", "0.6068757", "0.6064724", "0.60437346", "0.60085493", "0.6003586", "0.59972906", "0.5992333", "0.59916...
0.70632917
0
Return the data size in bits.
def __len__(self): return len(self.data) * 8
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_length(self):\n size = self.unpack_dword(0x4)\n if size >= 0x80000000:\n size -= 0x80000000\n return size", "def get_size(self):\n return self._data_size", "def nbytes(self):\n\n return self.data.type.datasize", "def size(self):\n size = 0\n ...
[ "0.8211642", "0.79462075", "0.77893543", "0.768343", "0.7675538", "0.7622575", "0.7622575", "0.75869393", "0.7579677", "0.7570851", "0.7491082", "0.74802375", "0.7462949", "0.7455553", "0.7455553", "0.74541026", "0.74333566", "0.7409426", "0.7388331", "0.7357859", "0.734757",...
0.69409096
53
Read bit_length bits as an integer.
def read(self, bit_length): ret = self.peek(bit_length) self.bit_pos += bit_length return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_integer(self, number_of_bits):\n\n value = 0\n\n for _ in range(number_of_bits):\n value <<= 1\n value |= self.read_bit()\n\n return value", "def extract_bits(data, bit, length=1):\n bits = bitarray(data, endian='big')\n if length > 1:\n out = bits...
[ "0.75628495", "0.7081306", "0.6991238", "0.69427687", "0.67833155", "0.677061", "0.6710745", "0.65669936", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "0.65387785", "...
0.72332305
1
Read bit_length as an integer without advancing pointer.
def peek(self, bit_length): if bit_length < 0: raise BitReaderError('bit_length(%s) should be greater than 0', bit_length) elif self.bit_pos + bit_length > len(self): raise BitReaderError('out of data boundary') ret = 0 byte_ptr,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, bit_length):\n\n ret = self.peek(bit_length)\n self.bit_pos += bit_length\n return ret", "def read_integer(self, number_of_bits):\n\n value = 0\n\n for _ in range(number_of_bits):\n value <<= 1\n value |= self.read_bit()\n\n return va...
[ "0.76766133", "0.6898072", "0.67912096", "0.6730225", "0.6687919", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", "0.65397793", ...
0.6877359
2
Save the model fitted on the input data
def model_fitting(x, y, test_size=0.33, seed=7, pfi_fitted_models=''): x_train, x_test, y_train, y_test = model_selection.train_test_split(x, y, test_size=test_size, random_state=seed) model = MLPClassifier() model.fit(x_train, y_train) if not os.path.exists(pfi_fitted_models): raise ValueErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self) -> None:\n self.saver.save_model_and_weights(self.model)\n self.saver.save_data_shuffle_indices(\n self.data.eval_shuffler.ds_inds\n )\n self.saver.save_input_scaler(self.data.x.scaler)", "def fit_store(X, y):\n print(\"Fitting model to training set......
[ "0.7694407", "0.74876934", "0.74204195", "0.72167534", "0.7141674", "0.70997274", "0.70945215", "0.7089951", "0.7087991", "0.7037308", "0.7020138", "0.69827616", "0.69681054", "0.6948691", "0.69368994", "0.68988425", "0.6893917", "0.68863946", "0.6846946", "0.6843461", "0.679...
0.0
-1
apply a fitted model whose parameters are saved in the given file
def apply_model(pfi_fitted_models, x): model_params = pickle.load(open(pfi_fitted_models, 'rb')) model = MLPClassifier() model.set_params(**model_params) y = model.predict(x) model.predict_proba(x) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, train_file_path: str):\n # TODO write code to extract features from train_file_path and \n # train the model\n return self._model", "def train(self, trainfile):", "def save_fit(self):\n if self.fit is None:\n self.fit_status.setText('Fit not available for sa...
[ "0.62562275", "0.616858", "0.60906965", "0.6030334", "0.5971703", "0.59447086", "0.5929669", "0.59241426", "0.5916277", "0.5896931", "0.5881946", "0.58585066", "0.5857262", "0.58335984", "0.58282506", "0.5796359", "0.57955337", "0.5794343", "0.5792172", "0.5789975", "0.578991...
0.61093897
2
Something like AddAppealBaseBonusChangingHpRateMax > Add appeal base bonus changing hp rate max . Word soup for most enumerated skill names but is a good starting point
def make_systematic_name(name): return " ".join(re.findall(r"([A-Z]+[a-z]*)", name)).capitalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_skill(skill_list, skill): #inputs the skill dictionary and skill\r\n\tif skill==\"Gun Combat\":\r\n\t\tif stellagama.dice(1,6)>=3:\r\n\t\t\tfor item in guns:\r\n\t\t\t\tif item in skill_list:\r\n\t\t\t\t\tskill=item\r\n\t\t\t\telse:\r\n\t\t\t\t\tskill=stellagama.random_choice(guns)\r\n\t\telse:\r\n\t\t\tsk...
[ "0.6916419", "0.6591137", "0.6428846", "0.6233618", "0.618308", "0.6121241", "0.6054015", "0.6052661", "0.6023286", "0.60121036", "0.5803014", "0.5784489", "0.57675666", "0.5760284", "0.57292473", "0.572082", "0.56503713", "0.56480545", "0.5632285", "0.5616963", "0.5607824", ...
0.0
-1
Add image to a webfacet.
def upload_webfacet_image(request): if request.method == 'POST': imageform=ImageAssetForm(request.POST, request.FILES) if imageform.is_valid(): webimage = imageform.save(commit=False) # retrieve the webfacet the image should be associated with webfacet_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_webfacet_image(request):\r\n\r\n if request.method == \"POST\":\r\n add_image_form = AddImageForm(request.POST, request=request)\r\n if add_image_form.is_valid():\r\n webfacet_id = request.POST.get('webfacet')\r\n print \"WEBFACETid: \", webfacet_id\r\n web...
[ "0.6959996", "0.6487224", "0.6455513", "0.62596583", "0.6204542", "0.6056155", "0.6029566", "0.59842545", "0.5923838", "0.5902165", "0.5883469", "0.5882552", "0.5859965", "0.5838259", "0.5744651", "0.57241696", "0.57239974", "0.5716125", "0.5703071", "0.56786585", "0.5642951"...
0.6796275
1
Add image to a printfacet.
def upload_printfacet_image(request): if request.method == 'POST': imageform=ImageAssetForm(request.POST, request.FILES) if imageform.is_valid(): printimage = imageform.save(commit=False) # retrieve the printfacet the image should be associated with printf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_printfacet_image(request):\r\n\r\n if request.method == \"POST\":\r\n add_image_form = AddImageForm(request.POST, request=request)\r\n if add_image_form.is_valid():\r\n printfacet_id = request.POST.get('printfacet')\r\n print \"printFACETid: \", printfacet_id\r\n ...
[ "0.67502946", "0.6580409", "0.632243", "0.6008256", "0.592949", "0.58951735", "0.5798382", "0.5794205", "0.5675219", "0.56320274", "0.56206936", "0.55908996", "0.5578488", "0.5575773", "0.5569376", "0.55510944", "0.5527138", "0.5522937", "0.5520295", "0.5502759", "0.5493519",...
0.63052016
3
Add image to a audiofacet.
def upload_audiofacet_image(request): if request.method == 'POST': imageform=ImageAssetForm(request.POST, request.FILES) if imageform.is_valid(): audioimage = imageform.save(commit=False) # retrieve the audiofacet the image should be associated with audiof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_audiofacet_image(request):\r\n\r\n if request.method == \"POST\":\r\n add_image_form = AddImageForm(request.POST, request=request)\r\n if add_image_form.is_valid():\r\n audiofacet_id = request.POST.get('audiofacet')\r\n print \"audioFACETid: \", audiofacet_id\r\n ...
[ "0.66578627", "0.64728636", "0.61345947", "0.60722554", "0.60476905", "0.60405284", "0.59467155", "0.59415364", "0.5939142", "0.5883977", "0.5809388", "0.5729445", "0.56972593", "0.56908375", "0.5679853", "0.56495744", "0.5649321", "0.564413", "0.5638859", "0.56222016", "0.56...
0.66707206
0
Add image to a videofacet.
def upload_videofacet_image(request): if request.method == 'POST': imageform=ImageAssetForm(request.POST, request.FILES) if imageform.is_valid(): videoimage = imageform.save(commit=False) # retrieve the videofacet the image should be associated with videof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_videofacet_image(request):\r\n\r\n if request.method == \"POST\":\r\n add_image_form = AddImageForm(request.POST, request=request)\r\n if add_image_form.is_valid():\r\n videofacet_id = request.POST.get('videofacet')\r\n print \"videoFACETid: \", videofacet_id\r\n ...
[ "0.6674277", "0.62054956", "0.61609864", "0.6160968", "0.6141157", "0.60072285", "0.598328", "0.5955084", "0.591528", "0.57893074", "0.57588404", "0.5740034", "0.5733411", "0.57132757", "0.56607807", "0.5579022", "0.55734813", "0.5563795", "0.55606425", "0.5558055", "0.555533...
0.65812075
1
Add existing image(s) in the library to another webfacet.
def add_webfacet_image(request): if request.method == "POST": add_image_form = AddImageForm(request.POST, request=request) if add_image_form.is_valid(): webfacet_id = request.POST.get('webfacet') print "WEBFACETid: ", webfacet_id webfacet = get_object_or_4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_printfacet_image(request):\r\n\r\n if request.method == \"POST\":\r\n add_image_form = AddImageForm(request.POST, request=request)\r\n if add_image_form.is_valid():\r\n printfacet_id = request.POST.get('printfacet')\r\n print \"printFACETid: \", printfacet_id\r\n ...
[ "0.62151027", "0.59925026", "0.58333486", "0.583099", "0.5817499", "0.57698077", "0.5705304", "0.56660897", "0.56204855", "0.56093407", "0.54203415", "0.54093826", "0.5408779", "0.5378336", "0.53766954", "0.5346963", "0.5326423", "0.53248286", "0.530735", "0.5260022", "0.5252...
0.676759
0
Add existing image(s) in the library to another printfacet.
def add_printfacet_image(request): if request.method == "POST": add_image_form = AddImageForm(request.POST, request=request) if add_image_form.is_valid(): printfacet_id = request.POST.get('printfacet') print "printFACETid: ", printfacet_id printfacet = get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_component_images(pldm_fw_up_pkg, image_files):\n for image in image_files:\n with open(image, \"rb\") as file:\n for line in file:\n pldm_fw_up_pkg.write(line)", "def addTextureToOcc(self):\n\t\tshas = self._getShapes()\n\t\tfname, _ = QtGui.QFileDialog.getOpenFileN...
[ "0.57439345", "0.5572703", "0.55238974", "0.5361123", "0.53004485", "0.52716833", "0.52288663", "0.51478827", "0.514103", "0.51245344", "0.5079901", "0.5075902", "0.5065897", "0.50491333", "0.5048254", "0.50375414", "0.50358367", "0.50343746", "0.50187576", "0.5002619", "0.49...
0.63303715
0
Add existing image(s) in the library to another audiofacet.
def add_audiofacet_image(request): if request.method == "POST": add_image_form = AddImageForm(request.POST, request=request) if add_image_form.is_valid(): audiofacet_id = request.POST.get('audiofacet') print "audioFACETid: ", audiofacet_id audiofacet = get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_image(self, other):\n newcls = self.__class__(None)\n newcls.polygon = self.union(other)\n\n newcls._members = []\n for v in self.members:\n newcls._members.append(v)\n for v in other.members:\n if v not in newcls._members:\n newcls._m...
[ "0.60004723", "0.58277434", "0.5797199", "0.5697797", "0.5677714", "0.5672392", "0.56353205", "0.5634928", "0.5560553", "0.5501598", "0.5486434", "0.54514974", "0.53752357", "0.5367797", "0.53480774", "0.5342311", "0.53182214", "0.5294023", "0.5289791", "0.528354", "0.5255328...
0.63307816
0
Add existing image(s) in the library to another videofacet.
def add_videofacet_image(request): if request.method == "POST": add_image_form = AddImageForm(request.POST, request=request) if add_image_form.is_valid(): videofacet_id = request.POST.get('videofacet') print "videoFACETid: ", videofacet_id videofacet = get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AppendImages(im1, im2):\r\n im1cols, im1rows = im1.size\r\n im2cols, im2rows = im2.size\r\n im3 = Image.new('RGB', (im1cols+im2cols, max(im1rows,im2rows)))\r\n im3.paste(im1,(0,0))\r\n im3.paste(im2,(im1cols,0))\r\n return im3", "def update(self):\r\n\r\n # Update the vision frames i...
[ "0.63901204", "0.6180752", "0.6117177", "0.60547704", "0.5874692", "0.58704317", "0.583594", "0.5784289", "0.5587664", "0.55786985", "0.55684876", "0.55564696", "0.5547408", "0.5543791", "0.5535397", "0.55188996", "0.5502272", "0.5485581", "0.5461854", "0.54609156", "0.545871...
0.5867339
6
Parses tag input, with multiple word input being activated and delineated by commas and double quotes. Quotes take precedence, so they may contain commas. Returns a sorted list of unique tag names. Adapted from Taggit, modified to not split strings on spaces. Ported from Jonathan Buchanan's `djangotagging
def parse_tags(tagstring): if not tagstring: return [] tagstring = force_str(tagstring) words = [] buffer = [] # Defer splitting of non-quoted sections until we know if there are # any unquoted commas. to_be_split = [] i = iter(tagstring) try: while True: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_tag_input(input):\r\n if not input:\r\n return []\r\n\r\n input = force_unicode(input)\r\n\r\n # Special case - if there are no commas or double quotes in the\r\n # input, we don't *do* a recall... I mean, we know we only need to\r\n # split on spaces.\r\n if u',' not in input an...
[ "0.7517324", "0.7084874", "0.67433536", "0.6539241", "0.6478623", "0.647435", "0.6406252", "0.6402815", "0.6351191", "0.6336805", "0.6259", "0.6208129", "0.61583364", "0.6116425", "0.6097483", "0.6097116", "0.6071633", "0.6025553", "0.5999666", "0.59960186", "0.5952234", "0...
0.6582227
3
Given list of ``Tag`` instances, creates a string representation of the list suitable for editing by the user, such that submitting the given string representation back without changing it will give the same list of tags. Tag names which contain DELIMITER will be double quoted. Adapted from Taggit's _edit_string_for_ta...
def join_tags(tags): names = [] delimiter = settings.TAGGIT_SELECTIZE['DELIMITER'] for tag in tags: name = tag.name if delimiter in name or ' ' in name: names.append('"%s"' % name) else: names.append(name) return delimiter.join(sorted(names))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_string_for_tags(tags):\r\n names = []\r\n use_commas = False\r\n for tag in tags:\r\n name = tag.name\r\n if u',' in name:\r\n names.append('\"%s\"' % name)\r\n continue\r\n elif u' ' in name:\r\n if not use_commas:\r\n use_comm...
[ "0.74842143", "0.61348253", "0.60322964", "0.60187674", "0.5813906", "0.5634633", "0.5617626", "0.55532956", "0.55511045", "0.5493373", "0.54873353", "0.5473861", "0.5438646", "0.54261506", "0.54241925", "0.53745574", "0.53239423", "0.52918303", "0.52737874", "0.5259001", "0....
0.64570826
1
Get OSlevel info about a file path.
def get_file_info(fpath, raw=False): statbuf = os.stat(fpath) try: # Sometimes this fails if sys.platform.startswith('win32'): import win32security sec_desc = win32security.GetFileSecurity( fpath, win32security.OWNER_SECURITY_INFORMATION) owne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lsinfo(path):", "def pathinfo():\n info = {}\n pdir = None\n if 'SUZUPROFDIR' in os.environ:\n pdir = os.environ['SUZUPROFDIR']\n elif sys.platform == 'win32':\n try:\n pdir = os.path.join(os.environ['APPDATA'], 'suzu')\n except KeyError:\n pdir = None\n...
[ "0.5942384", "0.5744108", "0.55750966", "0.5529398", "0.55196834", "0.5390606", "0.53824085", "0.53626615", "0.53495383", "0.5344949", "0.5329773", "0.5282966", "0.5251833", "0.52434486", "0.5234833", "0.52156854", "0.52153987", "0.51712114", "0.5163377", "0.5140932", "0.5110...
0.49944302
27
Returns the home page
def index(): resp = make_response(render_template("index.html", title='Home')) return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home() -> Any:\n return home_page()", "def home_page(self) -> str:\n return self._home_page", "def home():\n\n return render_template('home_page.html')", "def getHomePage(self):\n return self.home_url", "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\...
[ "0.8479578", "0.83854204", "0.83666545", "0.8302552", "0.83024085", "0.8274201", "0.8258742", "0.8161644", "0.8155251", "0.8131846", "0.812928", "0.8122866", "0.8116592", "0.81114167", "0.81114167", "0.81114167", "0.81114167", "0.81114167", "0.81114167", "0.81114167", "0.8111...
0.0
-1
Goes to form with AMOUNT_OF_COURSES text boxes to input courses to schedule, form action=/schedules, method=POST
def how_many_post(): default_courses = ['CS 442', 'CS 392', 'CS 519', 'MA 331'] resp = make_response(render_template( "sched_entry.html", quantity=AMOUNT_OF_COURSES, title='Scheduler', default_vals=default_courses)) resp.set_cookie('course_combos', '', expires=0) return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_form_post():\n text_list = []\n #make list of form inputs\n for i in range(1, AMOUNT_OF_COURSES + 1):\n form_num = 'text' + str(i)\n text_list.append(request.form[form_num])\n #remove items with no input, generate string of courses\n final_list = []\n for text in text_list:\n...
[ "0.7359131", "0.5738121", "0.56755453", "0.56118274", "0.5451969", "0.5445266", "0.5368269", "0.5310079", "0.5273463", "0.5239701", "0.52320564", "0.5225265", "0.52122545", "0.5199207", "0.5196593", "0.5195842", "0.5134032", "0.51298195", "0.5128839", "0.5125523", "0.5111229"...
0.6717341
1
Gets input from form, puts it in a list, gets the schedules, send JSON of course combinations and send then to /sched as a cookie
def my_form_post(): text_list = [] #make list of form inputs for i in range(1, AMOUNT_OF_COURSES + 1): form_num = 'text' + str(i) text_list.append(request.form[form_num]) #remove items with no input, generate string of courses final_list = [] for text in text_list: if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduleMe(page):\n querystring_combos = request.cookies.get('course_combos')\n if not querystring_combos:\n return render_template('404.html'), 404\n combos = json.loads(querystring_combos)\n #print querystring_combos\n\n count = len(combos)\n pagination_needed = count > PER_PAGE\n ...
[ "0.65634745", "0.64576983", "0.62224543", "0.6023303", "0.5766378", "0.5760955", "0.5739446", "0.5460604", "0.5388673", "0.5352139", "0.5332513", "0.53309214", "0.5291213", "0.5275477", "0.524384", "0.524187", "0.52391493", "0.52390355", "0.5194757", "0.51929027", "0.5184178"...
0.81814945
0
Upon a GET request containing csv course names in a query string... Find the combos and send them as JSON
def getCombosAPI(): all_args = request.args.lists() course_list = all_args[0][1][0].split(",") u_COURSE_LIST = map((lambda x: x.upper()), course_list)#make all caps just in case COURSE_LIST = map( str, u_COURSE_LIST)#unicode list -> list of python strs combos = scheduler.schedule(COURSE_LIST) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_courses(self):\n\n self.search([]).unlink()\n token = self.env['odoo.moodle'].search([('create_uid', '=', self.env.user.id)]).token\n domain = \"http://localhost:8888\"\n webservice_url = \"/webservice/rest/server.php?\"\n parameters = {\n \"wstoken\":token,\n ...
[ "0.6156919", "0.6040665", "0.60034776", "0.5928247", "0.5916178", "0.5860666", "0.58110094", "0.57956994", "0.5633802", "0.5619331", "0.5583209", "0.5545663", "0.5522311", "0.5501062", "0.54804116", "0.5449549", "0.54390436", "0.5390255", "0.53620845", "0.53605145", "0.534555...
0.68711597
0
Returns the set of combos for the current page
def getCombosForPage(page_num, per_page, count_of_combos, combos): combos_start = (per_page * (page_num - 1)) + 1 combos_end = combos_start + per_page these_combos = {} for key in range(combos_start, combos_end): try: # if new dict is not an int schedules are not sorted on the page ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combos():\n print 'Loading combo info page'\n\n test_data_folder = os.path.join('data', 'testdata')\n base_file_name = 'CU-PENN.dvw'\n base_file_key = os.path.join(test_data_folder, base_file_name)\n\n parser = Parser(base_file_key)\n combo_list = parser.read_combos()\n\n combo_dicts = [{'...
[ "0.66509014", "0.61322004", "0.5766209", "0.56483555", "0.5634054", "0.56314075", "0.5607587", "0.55948377", "0.55948377", "0.55948377", "0.55948377", "0.55781025", "0.55628926", "0.5496233", "0.54629517", "0.54608715", "0.5457087", "0.54336566", "0.54232746", "0.54089713", "...
0.6515991
1
Return True if this is the last page in the pagination
def isLastPage(page_num, count_of_combos, per_page): if count_of_combos <= (page_num * per_page): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_last_page(self):\n return self.page == self.last_page", "def is_last_allowable_page(self):\n if self.countable:\n return False\n if self.is_last_page:\n return False\n\n # If we have 10-item pages, the max limit is 40, and we've skipped 38,\n # it's...
[ "0.9250832", "0.7880705", "0.7795402", "0.7709388", "0.76870424", "0.7639691", "0.7639691", "0.7639691", "0.75295895", "0.7466775", "0.72136486", "0.7156705", "0.71144503", "0.70103765", "0.69874054", "0.68787843", "0.67651737", "0.66790384", "0.66790384", "0.6663726", "0.664...
0.77416354
3
Display schedules as links and iframes
def scheduleMe(page): querystring_combos = request.cookies.get('course_combos') if not querystring_combos: return render_template('404.html'), 404 combos = json.loads(querystring_combos) #print querystring_combos count = len(combos) pagination_needed = count > PER_PAGE this_page_comb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule(request):\r\n\r\n return render(request, 'editorial/schedule.html', {})", "def schedule(request):\n return render(request, 'vaxcharts/schedule.html')", "def pipeline_schedules(self):\n repo = self.repo_set.filter(forge__source=SOURCES.gitlab, namespace__group=True)\n if repo.ex...
[ "0.65584815", "0.61354864", "0.59361076", "0.58989096", "0.581496", "0.57926965", "0.57579494", "0.57547617", "0.57223916", "0.569846", "0.56313425", "0.56176037", "0.55908644", "0.5577972", "0.55536515", "0.5526475", "0.55013967", "0.5480382", "0.5472223", "0.54437053", "0.5...
0.522789
33
A limited number of items is in the feed.
def test_limit_items(self): AnnouncementFactory( title="Not going to be there", expires_at=timezone.now() - datetime.timedelta(days=1), ) for i in range(5): AnnouncementFactory() response = self.get("announcements:feed") assert "Not going to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit(requestContext, seriesList, n):\n return seriesList[0:n]", "def limit(self, count):\n self._limit = count\n return self", "def test_max_items(self):\r\n timeline = Timeline(connection=self.c1, bucket=self.bucket, max_items=3)\r\n now = datetime.utcnow()\r\n\r\n tim...
[ "0.66845256", "0.6452016", "0.64328825", "0.63778573", "0.63408464", "0.6280421", "0.6278055", "0.62466717", "0.62423396", "0.6150281", "0.6145422", "0.61124396", "0.6075904", "0.60351187", "0.6013344", "0.5996759", "0.59329146", "0.5901975", "0.5897077", "0.5894792", "0.5893...
0.7206275
0
Check the mandatory services.
def check_services(self): for service in self.services: try: self.cloud.search_services(service)[0] except Exception: # pylint: disable=broad-except self.is_skipped = True break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_services_ready(self, services):\n for ser in services:\n services[ser] = False\n response = self.bus.wait_for_response(Message(\n 'mycroft.{}.is_ready'.format(ser)))\n if response and response.data['status']:\n services...
[ "0.68495893", "0.68265027", "0.67144567", "0.6654075", "0.6653682", "0.66230726", "0.64997345", "0.6361119", "0.6352509", "0.62955403", "0.6243788", "0.6225547", "0.6216019", "0.6185492", "0.6181142", "0.61648095", "0.6110558", "0.60903686", "0.60701483", "0.60660607", "0.604...
0.7447906
0
Check the mandatory network extensions.
def check_extensions(self): extensions = self.cloud.get_network_extensions() for network_extension in self.neutron_extensions: if network_extension not in extensions: LOGGER.warning( "Cannot find Neutron extension: %s", network_extension) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_whole_network(self):\n if not self.network.check_network():\n # check_network has failed, issue error\n self._display_semantic_error(\"network\")", "def _sanityCheckExtensions(other):\n if other.useEncryptThenMAC not in (True, False):\n raise ValueError(\...
[ "0.63620454", "0.6263202", "0.59751266", "0.5877078", "0.5833472", "0.5802308", "0.57483894", "0.5673013", "0.56446946", "0.56413287", "0.5634714", "0.5619895", "0.5614505", "0.559705", "0.55942374", "0.5593726", "0.55906713", "0.5572346", "0.5547773", "0.55424345", "0.553969...
0.7781191
0
Read file and return content as a stripped list.
def read_file(filename): with open(filename, encoding='utf-8') as src: return [line.strip() for line in src.readlines()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(file_name):\n\n with open (file_name) as fd:\n content = fd.readlines()\n content = [x.strip() for x in content]\n return content", "def readFile(filePath):\n with open(filePath, 'r') as f:\n return [l.strip() for l in f.readlines()]", "def contents(filepath):\n f...
[ "0.7674723", "0.7563142", "0.72854227", "0.72751176", "0.72298235", "0.7206775", "0.7123672", "0.7109992", "0.7086859", "0.7061591", "0.70553654", "0.7049348", "0.7041807", "0.70393634", "0.6996994", "0.6992688", "0.69166696", "0.6877113", "0.6812788", "0.6768067", "0.6765748...
0.67492896
22
Copy config file to tempest results directory
def backup_tempest_config(conf_file, res_dir): if not os.path.exists(res_dir): os.makedirs(res_dir) shutil.copyfile(conf_file, os.path.join(res_dir, 'tempest.conf'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_config(RESULTSDIR, main_config, io_config):\n print(\"Saving results to: {}\".format(RESULTSDIR))\n\n if not os.path.exists(RESULTSDIR):\n os.makedirs(RESULTSDIR)\n\n mconfig = os.path.join(\n RESULTSDIR, \"copy_main_config_\" + main_config.split(os.sep)[-1]\n )\n dconfig = os...
[ "0.72231483", "0.6721714", "0.6498246", "0.6410498", "0.6409924", "0.6284228", "0.6280437", "0.62706035", "0.6260962", "0.6219964", "0.61791456", "0.6174911", "0.61536056", "0.61037135", "0.6049953", "0.6039108", "0.6026846", "0.6011455", "0.59960604", "0.5987644", "0.5975415...
0.7394381
0
Returns verifier id for current Tempest
def get_verifier_id(): cmd = ("rally verify list-verifiers | awk '/" + getattr(config.CONF, 'tempest_verifier_name') + "/ {print $2}'") with subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) as proc: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_verifier_id():\n cmd = (\"rally verify list-verifiers | awk '/\" +\n getattr(config.CONF, 'tempest_verifier_name') +\n \"/ {print $2}'\")\n proc = subprocess.Popen(cmd, shell=True,\n stdout=subprocess.PIPE,\n stderr=subprocess....
[ "0.6726382", "0.5993047", "0.5835138", "0.57405263", "0.571625", "0.56476825", "0.5630613", "0.5571045", "0.5566842", "0.5514997", "0.5463051", "0.53477794", "0.5343376", "0.5300335", "0.5232395", "0.52306646", "0.52277946", "0.52036935", "0.51771", "0.5170933", "0.5119616", ...
0.6849755
0
Returns installed verifier repo directory for Tempest
def get_verifier_repo_dir(verifier_id): return os.path.join(getattr(config.CONF, 'dir_rally_inst'), 'verification', f'verifier-{verifier_id}', 'repo')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_verifier_repo_dir(verifier_id):\n return os.path.join(getattr(config.CONF, 'dir_rally_inst'),\n 'verification',\n 'verifier-{}'.format(verifier_id),\n 'repo')", "def get_verifier_deployment_dir(verifier_id, deployment_id):\n retur...
[ "0.7211886", "0.6550398", "0.6523984", "0.6448193", "0.6078293", "0.6072598", "0.60545844", "0.6008985", "0.59839743", "0.5949114", "0.591674", "0.58978075", "0.57718587", "0.57658106", "0.57482255", "0.57396054", "0.57301205", "0.57203543", "0.5713774", "0.5703848", "0.56487...
0.71335983
1
Returns Rally deployment directory for current verifier
def get_verifier_deployment_dir(verifier_id, deployment_id): return os.path.join(getattr(config.CONF, 'dir_rally_inst'), 'verification', f'verifier-{verifier_id}', f'for-deployment-{deployment_id}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_verifier_deployment_dir(verifier_id, deployment_id):\n return os.path.join(getattr(config.CONF, 'dir_rally_inst'),\n 'verification',\n 'verifier-{}'.format(verifier_id),\n 'for-deployment-{}'.format(deployment_id))", "def get_verifie...
[ "0.8431518", "0.70921344", "0.7018849", "0.6559742", "0.6509258", "0.6363346", "0.63590264", "0.6337463", "0.62616277", "0.6258049", "0.6232877", "0.618148", "0.6174993", "0.6173079", "0.6141118", "0.613199", "0.61280704", "0.61003804", "0.61003804", "0.6097256", "0.60898834"...
0.8463894
0
Update defined paramters into tempest config file
def update_tempest_conf_file(conf_file, rconfig): with open(TempestCommon.tempest_conf_yaml, encoding='utf-8') as yfile: conf_yaml = yaml.safe_load(yfile) if conf_yaml: sections = rconfig.sections() for section in conf_yaml: if section not in sections:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self):\n pass", "def add_fixed_parameters_from_config_file(self, config_file):\n pass", "def _config(self):\n tmpl = self._template_interface\n for p in tmpl._params:\n setattr(self, p._name, p.get_value())", "def init_config(self):\n super().in...
[ "0.6785864", "0.67507", "0.6741203", "0.6714741", "0.665499", "0.66017467", "0.65827876", "0.6563346", "0.6551377", "0.6543621", "0.6529951", "0.65281457", "0.6466249", "0.6449229", "0.6427723", "0.64180666", "0.63344616", "0.6330431", "0.6310236", "0.62912744", "0.6290963", ...
0.0
-1
Add/update needed parameters into tempest.conf file
def configure_tempest_update_params( tempest_conf_file, image_id=None, flavor_id=None, compute_cnt=1, image_alt_id=None, flavor_alt_id=None, admin_role_name='admin', cidr='192.168.120.0/24', domain_id='default'): # pylint: disable=too-many-branches,too-many-argume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_tempest_update_params(\n tempest_conf_file, image_id=None, flavor_id=None,\n compute_cnt=1, image_alt_id=None, flavor_alt_id=None,\n admin_role_name='admin', cidr='192.168.120.0/24',\n domain_id='default'):\n # pylint: disable=too-many-branches,too-many-arguments,too-ma...
[ "0.6802182", "0.64552474", "0.6451729", "0.63806546", "0.63676286", "0.6205747", "0.6151945", "0.6128843", "0.6123329", "0.6080413", "0.6043109", "0.60316396", "0.60109645", "0.60026515", "0.6000327", "0.5974877", "0.59499687", "0.59417", "0.5926952", "0.5922703", "0.5922703"...
0.67729205
1