query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Tests bootstrap output for a query without entities
def test_bootstrap_query_no_entity(query_factory): query_text = "cancel the timer" query = query_factory.create_query(query_text) confidence = { "domains": {"times_and_dates": 0.95, "espionage": 0.05}, "intents": {"stop_timer": 0.9, "start_timer": 0.07, "cut_blue_wire": 0.03}, "entit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_query_1(self):\n with app.test_request_context():\n agency_none = db.session.query(\n Agency).filter_by(name=\"not here\").first()\n self.assertTrue(agency_none is None)", "def test_030_query_nothing(self):\n\n testflow.step(\"Querying for nothing\")\n ...
[ "0.6694098", "0.6574159", "0.6511202", "0.620657", "0.61994797", "0.6164516", "0.6136299", "0.6130935", "0.6130935", "0.61131424", "0.6108807", "0.61063397", "0.61010396", "0.6095861", "0.6091593", "0.6080903", "0.6066135", "0.6047089", "0.6026459", "0.60221076", "0.5990712",...
0.70461386
0
Convert YOLO labeling to Label Studio JSON
def convert_yolo_to_ls(input_dir, out_file, to_name='image', from_name='label', out_type="annotations", image_root_url='/data/local-files/?d=', image_ext='.jpg'): tasks = [] logger.info('Reading YOLO notes and categories from %s', input_dir) # build categories...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_to_labels(data):\n labels = []\n for item in data:\n labels.append(Label(item['title'], item['color'], item['desc']))\n return labels", "def assign_labels(basename, data_folder=Path(\"/data\"), verbose=False):\n urls_path = data_folder / \"graphs\" / basename / (basena...
[ "0.6576859", "0.6448267", "0.640491", "0.6289115", "0.622445", "0.6154998", "0.6152666", "0.6131772", "0.6101098", "0.5968711", "0.593742", "0.59179133", "0.5915148", "0.5907004", "0.58835936", "0.58758223", "0.5861672", "0.58601296", "0.58599573", "0.58378345", "0.58145404",...
0.663362
0
Returns html source of current page.
def get_page_source(self): return self.driver.page_source
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def viewSource(self):\n\t\treturn self.driver.page_source", "def page_source(driver: webdriver) -> str:\n return driver.page_source", "def get_page_source(self):\n return self.driver.page_source.replace('xmlns=\"http://www.w3.org/1999/xhtml\"', '')", "def current_html(self):\n return unicode...
[ "0.7155583", "0.7022889", "0.7003634", "0.6971946", "0.692043", "0.66324115", "0.66088915", "0.65470284", "0.6442402", "0.64235646", "0.63958484", "0.63401985", "0.63178897", "0.6282121", "0.6246109", "0.62448454", "0.622899", "0.62236017", "0.61363053", "0.6114558", "0.61085...
0.74206686
0
Calls time.sleep for specified seconds, defaults to 60.
def sleep(self, seconds=60): time.sleep(seconds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(seconds):\r\n time.sleep(seconds)", "def sleep(seconds):\n time.sleep(seconds)", "def sleep(seconds):\n time.sleep(seconds)", "def sleep(self, seconds):\n time.sleep(seconds)", "def sleep(secs=1.0):\n time.sleep(secs)", "def sleep(seconds):\n # After load and initializing ...
[ "0.8502472", "0.8376577", "0.8376577", "0.82660264", "0.8140304", "0.8069366", "0.80487895", "0.79732996", "0.7962595", "0.79321253", "0.76721597", "0.7637975", "0.754893", "0.7540977", "0.7521357", "0.74845695", "0.73986846", "0.7351855", "0.7318155", "0.73004866", "0.7288",...
0.8764882
0
Return and caches the user Profile from user access_token. First check for cached values.
def get_user_profile(access_token): message_log("Retrieving user profile for token %s" % access_token) user_profile = profiles_cache.get(access_token) if user_profile is not None: message_log("Using cached user profile for token %s" % access_token) else: message_log("Fetching user profil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_profile():\n access_token = _request_ctx_stack.top.current_user_token\n message_log(\"Got access token for user profile\")\n user_profile = get_user_profile(access_token)\n user_profile['access_token'] = access_token\n return json.dumps(user_profile)", "def get_profile(self):\n #fo...
[ "0.7440556", "0.71161795", "0.6707107", "0.6651845", "0.6530954", "0.6494981", "0.6418518", "0.63340926", "0.63255906", "0.6293674", "0.62868804", "0.6278049", "0.62655", "0.62645096", "0.6206123", "0.616639", "0.61637497", "0.61480135", "0.6135273", "0.6097209", "0.60939986"...
0.81954074
0
Retrieve the plugin roles from the xml
def get_plugin_roles(plugin_name): # Default plugin_roles = set() # Load xml from current folder # Points to the real file, not the symlink xml_dir = os.path.join(request.environ.get('DOCUMENT_ROOT', ''), 'plugins') tree = etree.parse(os.path.join(xml_dir, 'plugins.xml')) try: plugin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRoles(self):", "def get_roles(role):", "def get_roles():\r\n global _roles\r\n return _roles", "def get_roles():\n return config.get_cfg_storage(ID_ROLE)", "def _get_roles(self):\n return api.tuskar.OvercloudRole.list(self.request)", "def getRoles(context):\n\n pmemb = getToolBy...
[ "0.6966537", "0.6793309", "0.6674095", "0.6502217", "0.6481215", "0.6469064", "0.6342753", "0.63002867", "0.6285978", "0.62323856", "0.62002987", "0.6087664", "0.60736644", "0.6018698", "0.60125977", "0.59586716", "0.59323156", "0.5931869", "0.5923394", "0.5898992", "0.589535...
0.7862379
0
This function is called to check if a username / password combination is valid. A login is performed and the access_token is set in the app context and will be available for other methods by accessing the request context. The user role is also retrieved and stored in the roles cache ready for use in the authorization f...
def check_authentication(username, password): # Login db_authentication = authentication.Database(settings.client_domain) try: response = db_authentication.login(settings.client_id, username, password, 'Username-Pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_login(self, username, password):\n user = User(self).get(username)\n return user and user['Password'] == password", "def validate_authentication(self, username, password):\n return self.user_table[username]['pwd'] == password", "def check_auth(username, password):\n ADMIN_U...
[ "0.67409086", "0.6655861", "0.6559669", "0.65318555", "0.6508661", "0.64991987", "0.64968425", "0.6433657", "0.6390481", "0.63563335", "0.63420784", "0.63267136", "0.63267136", "0.631242", "0.62823075", "0.6269272", "0.6258", "0.6235275", "0.6229616", "0.6217591", "0.6186558"...
0.66999096
1
The download is authorized if the plugin roles set is empty (the plugin does not require any particular role to be downloaded) or if the plugin roles and the user roles intersection is not empty.
def authorize(user_roles, plugin_roles): if not plugin_roles: return True message_log("Comparing user roles %s with plugin roles %s" % (user_roles, plugin_roles)) return user_roles.intersection(plugin_roles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorized(self) -> bool:\n\n return not FileHelper(\n os.path.join(\n outputs.CURRENT_DIRECTORY, outputs.EXAMPLE_ADMINISTRATION_FILENAME\n )\n ).exists()", "def is_restricted_download(self):\n return self.has_label(RESTRICTEDDOWNLOAD_LABEL)", "def auth...
[ "0.5492684", "0.54513997", "0.54113793", "0.5396619", "0.53463405", "0.533768", "0.52938616", "0.5280581", "0.5280133", "0.52351266", "0.5215075", "0.5211185", "0.51855904", "0.51806676", "0.5167397", "0.51437646", "0.5085261", "0.50487953", "0.50487953", "0.5045231", "0.5011...
0.680317
0
Return the user roles in JSON format.
def user_roles(): access_token = _request_ctx_stack.top.current_user_token message_log("Got access token for user roles") user_roles = get_user_roles(access_token) return json.dumps(list(user_roles))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRoles():\n return jsonify(listRoles(ROLES_DIR))", "def roles(self):\n params = {\n \"f\" : \"json\"\n }\n uURL = self._url + \"/roles\"\n return self._con.get(path=uURL, params=params)", "def get_user_roles(self):\n url = 'userroles'\n result = self.ge...
[ "0.8376477", "0.7869818", "0.7863149", "0.7666762", "0.74592465", "0.7302259", "0.72905093", "0.7265741", "0.71933776", "0.7151129", "0.714399", "0.71210444", "0.7090939", "0.7073081", "0.70551044", "0.703948", "0.7032626", "0.699", "0.69525087", "0.6938412", "0.68985885", ...
0.8194219
1
Downloads a secured plugin. Also passes the access token back into a custom 'XAccessToken' header. The caller can reuse the token for future calls.
def securedPlugins(plugin_name): message_log("Downloading plugin {0} with token {1}".format(plugin_name, _request_ctx_stack.top.current_user_token)) plugins_dir = os.path.join(request.environ.get('DOCUMENT_ROOT', ''), 'plugins', 'packages-auth') plugin_path = os.path.join(plugins_dir, plugin_name) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(plugin_id, output_path, logger, client, tenant_name):\n utils.explicit_tenant_name_message(tenant_name, logger)\n logger.info('Downloading plugin %s...', plugin_id)\n plugin_name = output_path if output_path else plugin_id\n progress_handler = utils.generate_progress_handler(plugin_name, '...
[ "0.5187532", "0.5127477", "0.5119093", "0.50928885", "0.50072855", "0.49460602", "0.49158204", "0.48167273", "0.47854775", "0.47368887", "0.47068292", "0.4681055", "0.46640605", "0.46578255", "0.4614114", "0.4613172", "0.45899892", "0.45800686", "0.45667946", "0.45659912", "0...
0.7213856
0
send email to shibboleth users. user_id is the email for shibboleth.
def send_message(user_id, name, user_info, subject, body): send_mail(subject, body, settings.SERVER_EMAIL, ["%s <%s>" % (name, user_id)], fail_silently=False, html_message=body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_confirmation_email(user_pk):\n pass", "def send_email_users():\n\n # Get users emails\n users_emails = User.objects.exclude(\n Q(email='') |\n Q(email=None)\n ).values_list(\n 'email',\n flat=True\n )\n\n # Send email to each user\n # for email_user in us...
[ "0.6717047", "0.65953475", "0.6468871", "0.6448726", "0.64413947", "0.63874406", "0.63819265", "0.6368621", "0.6335638", "0.6302821", "0.6239454", "0.6213114", "0.61722964", "0.61229146", "0.6092309", "0.6074807", "0.6070659", "0.6066997", "0.60252005", "0.5996377", "0.598007...
0.6805462
0
Given a constraint list from the voters definition for some election, those constraints are checked against user attributes. In the first nonmatching attribute, returns False
def check_constraint(constraint, user): try: for key, value in constraint.items(): # some user attributes may be multivalued user_attrs = re.split('[,;]',user.info['attributes'][key]) ctr_list = re.split('[,;]',constraint[key]) has_attr = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all_constraints(csp) :\n\n for constraint in csp.get_all_constraints():\n assigned1 = csp.get_assigned_value(constraint.var1)\n assigned2 = csp.get_assigned_value(constraint.var2)\n check = constraint.check(assigned1,assigned2)\n if check==False and assigned1!=None and assi...
[ "0.6193323", "0.6135258", "0.59965307", "0.5878665", "0.5854281", "0.5844424", "0.5812803", "0.5736325", "0.5731531", "0.5647383", "0.56154877", "0.56116", "0.5606046", "0.553111", "0.5449286", "0.5389956", "0.53444535", "0.5323912", "0.5321401", "0.53190255", "0.53076094", ...
0.7063749
0
generate the proper basic data structure to express a constraint based on the category string
def generate_constraint(category_id, user): constraints = {} for category in category_id: constraints[category] = category_id[category].replace('\n','').lower() if settings.USE_ELECTION_MANAGER_ATTRIBUTES: for em_attribute in settings.ELECTION_MANAGER_ATTRIBUTES: try: constraints[em_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_categorical_constraint():\n categories = [\"Blue\", \"Red\", \"Yellow\"]\n prop = \"Property Color\"\n c = CategoricalConstraint(name=prop, accepted_categories=categories)\n\n mapped_c = c.to_dict()\n\n assert mapped_c[\"type\"] is \"categorical\"\n assert mapped_c[\"name\"] is prop\n ...
[ "0.690399", "0.598338", "0.5973134", "0.5777969", "0.5738707", "0.5682282", "0.56641686", "0.56396365", "0.5591416", "0.5588267", "0.55390483", "0.5409475", "0.5404108", "0.5370259", "0.5361147", "0.53332245", "0.53097683", "0.53048915", "0.52868646", "0.52772963", "0.5275933...
0.6930428
0
Finds all shortest paths between start_node and end_node
def all_shortest_paths(self, start_node, end_node): s=self.min_dist(start_node,end_node) return self.all_paths(start_node,end_node,s,[])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortestpaths(self, start, end, edgeweight=\"t_0\"):\n graph = self.graph\n shortest_nodepaths = list(\n nx.all_shortest_paths(\n graph, start, end, weight=edgeweight, method=\"dijkstra\"\n )\n )\n shortest_paths = []\n for path in shortes...
[ "0.7854832", "0.77828336", "0.7742501", "0.7713831", "0.7611114", "0.7593414", "0.758975", "0.7447652", "0.73915845", "0.73579013", "0.72388", "0.7235805", "0.7181964", "0.7157918", "0.7148192", "0.713274", "0.70914733", "0.7089154", "0.708437", "0.70443654", "0.70414835", ...
0.85039884
0
Finds all paths from node to destination with length = dist
def all_paths(self, node, destination, dist, path): d=self.dict() p=[] for i in range(len(path)): p.append(path[i]) p.insert(len(p),node) if len(p)-1==dist: if node==destination: return p else: return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_paths(graph, src, dst):\n paths = _find_all_paths(graph, src, dst)\n if not paths:\n return None\n minimum_length = min([len(path) for path in paths])\n return deque([path for path in paths if len(path) == minimum_length])", "def _get_paths(G, nodes, edges, target, weight, availab...
[ "0.6554855", "0.63100636", "0.6301514", "0.62030786", "0.6192581", "0.6187006", "0.617459", "0.6160929", "0.6154963", "0.61355996", "0.61198795", "0.6118932", "0.60987574", "0.6067896", "0.60516834", "0.60497206", "0.60162824", "0.5968875", "0.595288", "0.59114134", "0.591052...
0.7268916
0
Find betweenness centrality of the given node
def betweenness_centrality(self, node): l=[] b=0 for i in vertices: if i!=node: l.append(i) comb=list(itertools.combinations(l,2)) for c in comb: count=0 l=self.all_shortest_paths(c[0],c[1]) if l==None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeness_centrality(self):\n try:\n self.logger.info('正在计算网络的接近中心性 ...')\n return self.order_dict(nx.closeness_centrality(self.G), index=1)\n except Exception as e:\n self.logger.error(\"计算失败,原因:{0}\".format(e))", "def betweennessCentrality(graph, numberOfPoint...
[ "0.6731679", "0.664696", "0.6594976", "0.65795493", "0.6390879", "0.6290148", "0.6140907", "0.6111624", "0.6061342", "0.58576936", "0.58433217", "0.5810096", "0.57981706", "0.5768684", "0.57686496", "0.5761281", "0.5729037", "0.5721417", "0.5668246", "0.5581769", "0.5575762",...
0.79953027
0
Find top k nodes based on highest equal betweenness centrality.
def top_k_betweenness_centrality(self): d={} l=[] for v in vertices: a=self.betweenness_centrality(v) d[v]=a l.append(a) m=max(l) l1=[] for key in d: if d[key]==m: l1.append(key) return l1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_k(self, k = 1):\n\t if self.shapley_rank == {}:\n\t \treturn []\n\n\t n = self.nodes\n\t topknodes = []\n\t i = 0\n\t count = 0\n\t while count < k and not i == n:\n\t if self.shapley_rank[i][0] not in topknodes and not self.is_adj(self.shapley_rank[i][0], topknodes):\n\t ...
[ "0.7470577", "0.7075398", "0.6915667", "0.68522984", "0.66710705", "0.6652198", "0.66013926", "0.6578792", "0.652937", "0.6514417", "0.63803995", "0.6361274", "0.627352", "0.6222322", "0.62100506", "0.6187963", "0.6174817", "0.61614656", "0.61213434", "0.6109317", "0.6104808"...
0.7590104
0
parses the headers portion of the watson response and creates the header dataframe.
def _make_headers_df(headers_response): headers_df = util.make_dataframe(headers_response) headers_df = headers_df[ ["text", "column_index_begin", "column_index_end", "row_index_begin", "row_index_end", "cell_id", "text_normalized"]] return headers_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_headers(self):\n headers = {}\n headers.update(self.data_sources)\n headers.update(self.seasons)\n headers.update(self.region)\n headers.update(self.subregions)\n return headers", "def parse_header(self):", "def _headers(self, headers_dict):\n return ...
[ "0.6544926", "0.64718425", "0.64173955", "0.63263226", "0.63126564", "0.62557834", "0.62125415", "0.6201331", "0.6193568", "0.6167492", "0.61668706", "0.6148178", "0.61409366", "0.61314446", "0.6091171", "0.60419977", "0.6024797", "0.6007244", "0.59995425", "0.5989826", "0.59...
0.7908282
0
parses the body_cells portion of the watson response and creates the body_cells dataframe.
def _make_body_cells_df(body_cells_response): body_cells_df = util.make_dataframe(body_cells_response) if not "attributes.type" in body_cells_df.columns.to_list(): body_cells_df["attributes.type"] = None body_cells_df["attributes.text"] = None body_cells_df = body_cells_df[ ["text", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_tables(resp):\n if 'Blocks' not in resp.keys():\n return(None)\n tables = list(filter(lambda x: x['BlockType'] == 'TABLE', resp['Blocks']))\n blockmap = {}\n for b in resp['Blocks']:\n blockmap[b['Id']] = b\n\n t_unwrap = []\n for t in tables:\n \n # cells = list(...
[ "0.5798731", "0.5491687", "0.5265412", "0.5101885", "0.5049071", "0.49971876", "0.49842176", "0.49661112", "0.49265352", "0.49154913", "0.4894929", "0.48772675", "0.4870166", "0.48552194", "0.4850251", "0.48500475", "0.48094976", "0.48060754", "0.48047194", "0.4803918", "0.47...
0.8178657
0
Horizontal explode is the default way of 'exploding' the dataframe. It taes a dataframe, and a column that needs to be exploded. All list type elements in that column will be seperated into new columns of name ``{ original_column_name}_{n}``, where n is the position of the elment in the list. So the first element in a ...
def _horiz_explode(df_in, column, drop_original=True): # expands list of columns df = df_in.copy() # expand df.tags into its own dataframe tags = df[column].apply(pd.Series) tags = tags.rename(columns=lambda x: column + '_' + str(x)) df = pd.concat([df[:], tags[:]], axis=1) if drop_original...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_table_from_exploded_df(exploded_df: pd.DataFrame, row_heading_cols, column_heading_cols, dfs_dict=None,\n value_col: str = \"text\", concat_with: str = \" | \",\n convert_numeric_items=False, sort_headers=True) -> pd.DataFrame:\n for heading...
[ "0.6421381", "0.6350983", "0.6319281", "0.62903965", "0.62449867", "0.6166431", "0.590036", "0.577843", "0.5772426", "0.55767304", "0.5563734", "0.5346001", "0.527557", "0.51928127", "0.51681393", "0.516256", "0.50745654", "0.50520194", "0.50387055", "0.50219715", "0.49252802...
0.7355301
0
strips all empty elements from a list, returns the stripped list
def _strip_list(list): return [x for x in list if x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_blanks_list(src):\n return [el for el in src if el]", "def soar_trimlist(org_list):\n if not isinstance(org_list, list):\n return org_list\n return [element.strip() for element in org_list]", "def striplist(l):\n return([x.strip() for x in l])", "def remove_empty_string(str_list...
[ "0.8065592", "0.8061761", "0.7973895", "0.7920449", "0.78574693", "0.7671852", "0.76564544", "0.760797", "0.7474997", "0.7282649", "0.7045742", "0.70345825", "0.70338935", "0.6912659", "0.6849621", "0.6799333", "0.6771862", "0.67686707", "0.674938", "0.671748", "0.6711312", ...
0.8454965
0
"shreds" the given field of the dataframe, by concatennating all elements of the given list of strings This is as compared with the "horizontal explode method, which separates out each element into its own column does not change the name of the column, simply replaces each list with the concatted form of itself. In som...
def _explode_by_concat(df_in, column, agg_by: str = " "): def agg_horiz_headers(series): series[column] = agg_by.join(series[column]) return series df = df_in.copy() df = df.apply(agg_horiz_headers, axis=1) return df, [column]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _horiz_explode(df_in, column, drop_original=True):\n # expands list of columns\n df = df_in.copy()\n # expand df.tags into its own dataframe\n tags = df[column].apply(pd.Series)\n tags = tags.rename(columns=lambda x: column + '_' + str(x))\n df = pd.concat([df[:], tags[:]], axis=1)\n\n if ...
[ "0.63477445", "0.605292", "0.5742023", "0.57314366", "0.5717295", "0.5593263", "0.5548773", "0.5538201", "0.5500847", "0.53651154", "0.5362481", "0.5262826", "0.5243102", "0.5238861", "0.52212936", "0.51514935", "0.51514035", "0.51499826", "0.5145877", "0.5112816", "0.5049938...
0.6570911
0
intakes the exploded format of the dataframe, and uses it to infer which set of rows or columns are supposed to be numeric, then returns them as a list
def _infer_numeric_rows_cols(exploded_df, row_names, col_names): list_of_numeric_labels = ["Number", "Percentage"] numeric_cells = _generate_is_numeric_table(exploded_df, row_names, col_names) cols = [] rows = [] axis = None # if rows are unnamed they very likely are not numeric if row_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numerical(df):\r\n numerical_var=df.select_dtypes(include =['float64','int64']).columns.tolist()\r\n return numerical_var", "def identify_numeric_columns(dataset):\n return identify_columns_by_type(dataset, include=['int64', 'float64'])", "def get_numeric(X):\n return X.dtypes[X.dtypes.apply(la...
[ "0.6659247", "0.6280714", "0.61748713", "0.61208445", "0.6091047", "0.6069483", "0.60515535", "0.6008911", "0.59956354", "0.5990312", "0.59839404", "0.59686834", "0.59648836", "0.59453905", "0.5894163", "0.58753645", "0.5762964", "0.57625735", "0.5758204", "0.5758204", "0.563...
0.6790725
0
converts a single value to a numeric type as specified, and removes all nonnumeric characters If this is not possible, a warning is printed to the commandline and pd.NA is returned instead
def _convert_val_to_numeric(val, cast_type=float, regex_exp='[^0-9.-()]'): multiplier = 1 try: stripped = regex.sub(regex_exp, '', val) if len(stripped) >= 2 and stripped[0] == '(' and stripped[-1] == ')': multiplier = multiplier*-1 ans = cast_type(stripped[1:-1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cast_non_numeric_false():\n assert _currency_column_to_numeric(\"10 dollars\", {\"foo\": 42}) == \"10\"", "def test_cast_non_numeric_true():\n assert _currency_column_to_numeric(\"foo\", {\"foo\": 42}) == 42", "def test_default_cleaning_style_with_remove(currency_df):\n result = currency_df.c...
[ "0.7305151", "0.70472896", "0.6820766", "0.6692302", "0.66839683", "0.66236705", "0.6567332", "0.65236825", "0.6496353", "0.64548796", "0.63894415", "0.63442403", "0.6344204", "0.63358986", "0.6287873", "0.6228311", "0.62124103", "0.6186431", "0.6186361", "0.6186049", "0.6183...
0.7125523
1
converts all elements in the table that are tagged as numeric type to a numeric type
def _convert_labelled_numeric_items(table, exploded_df, row_header_cols, col_header_cols, decimal_pt='.', cast_type=float): def convert_val(val): return _convert_val_to_numeric(val, cast_type, f'[^0-9{decimal_pt}()-]') numeric_cells = _generate_is_numeric_table(expl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toNumeric(self):\n for column in list(self.data.columns):\n if not is_numeric_dtype(self.data[column]):\n values = list(sorted(self.data[column].unique()))\n indices = [index for index, value in enumerate(values)]\n self.data[column] = self.data[co...
[ "0.7188174", "0.6577561", "0.6490828", "0.641615", "0.64039105", "0.63815355", "0.6351335", "0.6337752", "0.6304294", "0.6163578", "0.60552305", "0.6042045", "0.603761", "0.6017023", "0.5981565", "0.5981565", "0.59476376", "0.59443474", "0.5911525", "0.590085", "0.58686185", ...
0.66172993
1
converts inputted columns or rows to numeric format. if none are given, it converts all elements to numeric types converts to type specified, if not, defaults to ``float`` type
def convert_cols_to_numeric(df_in: pd.DataFrame, columns=None, rows=None, decimal_pt='.', cast_type=float) -> pd.DataFrame: # converts inputted columns or rows to numeric format. # if none are given, it converts all elements to numeric types # converts to type given if column...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coerce_numeric_values(df, annot_types):\n if \"numeric\" in annot_types:\n numeric_columns = df.xs(\n \"numeric\", axis=1, level=1, drop_level=False\n ).columns.tolist()\n try:\n # Round numeric columns to 3 decimal places\n d...
[ "0.7145166", "0.6631862", "0.6479469", "0.64378875", "0.6309624", "0.62674874", "0.6160461", "0.60469705", "0.59784716", "0.59750754", "0.59500647", "0.5877708", "0.5767587", "0.57109207", "0.5704599", "0.5690172", "0.5685387", "0.5673215", "0.5638932", "0.561998", "0.5577652...
0.67009395
1
recursive function that orders a subset of headers of a multiindex table
def _order_multiindex(headers, exploded_col, spot, header_df): uniques = headers[spot].unique() uniques_sorted = header_df[header_df["text"].isin(uniques)].sort_values("column_index_begin")[ "text"].drop_duplicates().to_list() ans = [] for unique in uniques_sorted: if spot < (len(explode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_multi_index_tuples(header: list, sub_header: list) -> list:\r\n\r\n tuples = []\r\n\r\n for head in header:\r\n for sub_head in sub_header:\r\n tuples.append((head, sub_head))\r\n\r\n return tuples", "def index(self, H):\n if H.is_subgroup(self):\n return se...
[ "0.5774958", "0.5705933", "0.56051326", "0.54181755", "0.53355867", "0.5320534", "0.53090197", "0.5307081", "0.5289903", "0.526076", "0.52558523", "0.5199625", "0.5154011", "0.5105876", "0.5105161", "0.50922054", "0.50898063", "0.5085494", "0.5078051", "0.5066806", "0.5059446...
0.67473185
0
Parse a response from Watson Tables Understanding as a decoded JSON string. e.g. dictionary containing requested features and convert into a dict of Pandas DataFrames.
def parse_response(response: Dict[str, Any], select_table=None) -> Dict[str, pd.DataFrame]: return_dict = {} tables = response.get("tables", []) # if a tuple is used, of the form (feild, n) the nth table that meets the criterion is chosen if type(select_table) == tuple: select_no = select_table...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_api_response(api_response):\n\n df = pd.DataFrame(api_response)\n category_list = []\n\n for i in range(len(df)):\n cat_i = [cat[\"alias\"] for cat in df[\"categories\"][i]]\n category_list.append(\",\".join(cat_i))\n\n latitude = [coord.get(\"latitude\") for coord in df[\"coord...
[ "0.5945337", "0.5874362", "0.58650416", "0.58546305", "0.5820804", "0.58131266", "0.58131266", "0.5806143", "0.57362485", "0.57192147", "0.56440735", "0.56430405", "0.5636267", "0.554187", "0.5535443", "0.545207", "0.54516447", "0.5446419", "0.5430919", "0.5404498", "0.539716...
0.60912657
0
takes in the exploded dataframe, and converts it into the reconstructed table
def make_table_from_exploded_df(exploded_df: pd.DataFrame, row_heading_cols, column_heading_cols, dfs_dict=None, value_col: str = "text", concat_with: str = " | ", convert_numeric_items=False, sort_headers=True) -> pd.DataFrame: for heading_col in (row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_and_transpose(df):\n print(\"Cleaning and Transposing\")\n df = df.apply(pd.Series)\n df = df[sorted(df.columns)]\n df = df.T\n df.index.name = 'date'\n return df", "def transform(self, dataframe: DataFrame) -> DataFrame:", "def preprocess(table):\n # drop the column Zeitraum\n ...
[ "0.6119667", "0.60982627", "0.59610397", "0.5863467", "0.58585936", "0.57596016", "0.5754254", "0.56856316", "0.5648695", "0.557059", "0.5516384", "0.5479012", "0.54710364", "0.5462227", "0.54591703", "0.5456326", "0.54396015", "0.543446", "0.543446", "0.5418543", "0.54131997...
0.7253153
0
get the machine version
def get_machine_version(): return get_file_content("/home/pi/.machineconfig/latest_version")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version():\n cmd = \"{} -v\".format(_detect_os())\n out = __salt__[\"cmd.run\"](cmd).splitlines()\n ret = out[0].split(\": \")\n return ret[1]", "def build_version(self):\n return self.nodes[0].get('infos').get('system_info').get('system_version')", "def get_version():\n click.echo(ge...
[ "0.7637156", "0.7552766", "0.744265", "0.7430235", "0.7430235", "0.7387702", "0.73200005", "0.72636473", "0.7241635", "0.7223415", "0.71900326", "0.71792513", "0.7178303", "0.71767116", "0.7173325", "0.717196", "0.71656877", "0.7154363", "0.71426785", "0.7136277", "0.71252996...
0.8403236
0
Set the fade speed of the blinkm
def setFadeSpeed(self,speed): speed = clamp(speed, 1, 255) self._sendi2c('f', [speed])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulb_blink_call():\n times = blinkSlider.get()\n bulb_blink(times)", "def blink(self, duration: int=1, intensity: int=0xff):\n # Turn LED on\n self.intensity(max(0, min(intensity, 0xff)))\n # Turn LED off (after a delay)\n upyt.sched.loop.call_later_ms(duration, self.off)", ...
[ "0.67477113", "0.6514456", "0.6489791", "0.6464756", "0.6428093", "0.64263976", "0.63932806", "0.62828904", "0.6265285", "0.626061", "0.6260321", "0.6252305", "0.6209966", "0.6203128", "0.6196301", "0.61405975", "0.6136149", "0.6090874", "0.6088509", "0.6079926", "0.6075173",...
0.8217907
0
Scales u and v to avoid overlap of the arrows. u and v are added to x and y to get the endpoints of the arrows so a smaller scale value will result in less overlap of arrows.
def scale_uv(self): self.u = [i * self.scale * self.scaleratio for i in self.u] self.v = [i * self.scale for i in self.v]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_velocity(self):\n #reflext x values at x edges\n self.u[1,:,0] = -self.u[1,:,1]\n self.u[1,:,-1] = -self.u[1,:,-2]\n #mirror x values at y edges \n self.u[1,0,:] = self.u[1,1,:]\n self.u[1,-1,:] = self.u[1,-2,:]\n #mirror y values at x edges\n self.u[0,:,0] = se...
[ "0.6301325", "0.6254612", "0.615725", "0.5987826", "0.59649575", "0.5868431", "0.5861552", "0.57598317", "0.5703257", "0.5688469", "0.5584248", "0.55834216", "0.5559691", "0.5550347", "0.5530731", "0.5523477", "0.5523477", "0.55144435", "0.5505203", "0.54890937", "0.5484172",...
0.6671872
0
Creates x and y startpoint and endpoint pairs After finding the endpoint of each barb this zips startpoint and
def get_barbs(self): self.end_x = [i + j for i, j in zip(self.x, self.u)] self.end_y = [i + j for i, j in zip(self.y, self.v)] empty = [None] * len(self.x) barb_x = utils.flatten(zip(self.x, self.end_x, empty)) barb_y = utils.flatten(zip(self.y, self.end_y, empty)) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startEndPoints(mazz):\n for i in range (len(mazz)):\n for j in range (len(mazz[i])):\n if mazz[i][j] == 6:\n startx = i\n starty = j\n elif mazz[i][j] == 7:\n endx = i\n endy = j\n return startx, starty, endx, endy",...
[ "0.5946883", "0.591362", "0.59115624", "0.58385754", "0.56531876", "0.56351924", "0.56291044", "0.5599623", "0.5591872", "0.5585816", "0.5578405", "0.5563884", "0.5562818", "0.5545422", "0.5539894", "0.5527167", "0.5524608", "0.55151665", "0.5503742", "0.55005866", "0.547269"...
0.6801235
0
Creates lists of x and y values to plot the arrows Gets length of each barb then calculates the length of each side of the arrow. Gets angle of barb and applies angle to each side of the arrowhead. Next uses arrow_scale to scale the length of arrowhead and creates x and y values for arrowhead point1 and point2. Finally...
def get_quiver_arrows(self): dif_x = [i - j for i, j in zip(self.end_x, self.x)] dif_y = [i - j for i, j in zip(self.end_y, self.y)] # Get barb lengths(default arrow length = 30% barb length) barb_len = [None] * len(self.x) for index in range(len(barb_len)): barb_len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arrows(points_from, points_to, color='k',\n width=None, width_ratio=0.002,\n label=None, label_kw={}, margin_ratio=None, **kw):\n # convert and valid check of the points\n points_from = asarray(points_from, float)\n points_to = asarray(points_to, float)\n num_points = len(points_from)...
[ "0.66298264", "0.6256334", "0.6222115", "0.6049434", "0.5974349", "0.58842266", "0.587861", "0.5831685", "0.5795105", "0.5752259", "0.56958914", "0.56357795", "0.55921084", "0.55675083", "0.5546669", "0.5539751", "0.5538288", "0.55347633", "0.552012", "0.54747397", "0.5442497...
0.7660053
0
Returns the first free CRTC available for output_id. a CRTC ID
def next_free_crtc(self, output_id): min_id = -1 min_outputs = 2048 for crtc_id, crtc in list(r.crtcs.items()): if len(crtc.outputs) < min_outputs and output_id in crtc.possible_outputs: min_id = crtc_id min_outputs = len(crtc.outputs) return m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_output_id():\n _check_init()\n return _pypm.GetDefaultOutputDeviceID()", "def get_by_id(c_id):\n return cr.get_by_id(c_id)", "def get(self):\n if self.resource_id:\n with CachedCKAN(**self.ckan_kwargs) as ckan:\n return ckan.get_resource(resource_id=sel...
[ "0.5281294", "0.51563025", "0.48507607", "0.4746005", "0.47317165", "0.4731032", "0.47285795", "0.47145066", "0.4708157", "0.4676208", "0.46723714", "0.4666105", "0.46489042", "0.46299738", "0.4619724", "0.46141112", "0.46039113", "0.45821494", "0.45803055", "0.45430624", "0....
0.70492524
0
Builds a dictionary of display modes indexed on modes id. mode_names a string of node_names as returned by X resources modes a list of modes object as returned by Xlib a dict of display mode data indexed on mode id
def _build_modes_dict(self, mode_names, modes): last_index = 0 mode_datas = dict() for mode in modes: mode_data = dict(mode._data) mode_data["name"] = mode_names[ last_index : last_index + mode_data["name_length"] ] mode_datas[mode_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getmode(self, mode):\r\n modes = {}\r\n # core modes\r\n for m, (basemode, basetype, bands) in _MODEINFO.items():\r\n modes[m] = ModeDescriptor(m, bands, basemode, basetype)\r\n # extra experimental modes\r\n modes[\"RGBa\"] = ModeDescriptor(\"RGBa\",\r\n ...
[ "0.59451175", "0.5672359", "0.5645758", "0.547862", "0.5466664", "0.5391568", "0.53880507", "0.53855914", "0.53618526", "0.53419614", "0.53419614", "0.53265876", "0.5210299", "0.5209279", "0.51396143", "0.5097255", "0.50479245", "0.50077444", "0.49958408", "0.49788085", "0.49...
0.7800012
0
Returns the Output id returned by XRandR corresponding to the name passed as parameter (i.e. HDMI1 > 70). None if name is not found. name the name of an Output (i.e. HDMI1) the corresponding Output Id or None
def output_name_to_id(self, name): for i, o in list(r.outputs.items()): if o.name == name: return i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_by_name(self, name):\n for var in self.outputs:\n if var.get_object().name == name:\n return var\n logger.exception(\"Output variable with name {0} not found\".format(name))\n return None", "def get_output(self, name='0'):\n if name not in self...
[ "0.6404381", "0.6074136", "0.5755655", "0.55088246", "0.54827976", "0.5436496", "0.5321037", "0.52709675", "0.52356446", "0.52281034", "0.522416", "0.5202207", "0.5196968", "0.5188583", "0.516387", "0.51536095", "0.51527673", "0.5123046", "0.5120289", "0.511877", "0.5118547",...
0.7477175
0
Set the output_id to its maximum resolution at width offset width. Returns the width of the configured Output. output_id the id of the Output to be set width offset for Output placement the width of the configured Output
def set(self, output_id, width): crtc_id = self.next_free_crtc(output_id) mode_id = self.outputs[output_id].modes[0] print( ( "%5s +%4d %s crtc %d" % ( self.outputs[output_id].name, width, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_width(self):\n\t\treturn self.output_shape_param('W')", "def output_size(self) -> int:\n return self.win_length", "def _refresh_width(self):\n self._width = curses.tigetnum('cols')\n self._writer = formatter.DumbWriter(self._output, maxcol=self._width)", "def max_width...
[ "0.6339591", "0.5710951", "0.5509768", "0.5438864", "0.53479344", "0.5302696", "0.5261168", "0.52592736", "0.52592736", "0.52592736", "0.5256315", "0.52468586", "0.52062047", "0.52062047", "0.52062047", "0.52062047", "0.52062047", "0.52062047", "0.52062047", "0.52062047", "0....
0.6676604
0
Set framebuffer size. width height width_mm height_mm
def set_screen_size(self, width, height, width_mm, height_mm): # FIXME: setting framebuffer size doesn't work for some reason # self.window.xrandr_set_screen_size(width, height, 310+550, 310) # so I am going to use this dirty hack for the time being import subprocess subprocess....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_size(self, window, width, height):\n viewport = glfw.get_framebuffer_size(window)\n GL.glViewport(0, 0, *viewport)\n self.camera.viewport = viewport", "def set_size(self, width, height):\n cairo.cairo_xcb_surface_set_size(self._pointer, width, height)\n self._check_statu...
[ "0.6553793", "0.6539129", "0.63703126", "0.6191327", "0.6128324", "0.6107602", "0.6070593", "0.6036053", "0.602963", "0.5997033", "0.5989269", "0.5962676", "0.59418684", "0.5920167", "0.5915554", "0.5900957", "0.5900572", "0.58845824", "0.5869945", "0.5851543", "0.58399564", ...
0.7134249
0
Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an field is provided, permissions for this specific field a...
def has_field_perm(self, perm, obj=None, field=None): # Inactive users have no permissions. if not self.is_active: return False # Superusers have all permissions. if self.is_superuser: return True # Otherwise we need to check the backends. return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasPermission(self, permission, extra_params):\n\n with DBSession(self.__config_db) as session:\n perm, params = ThriftAuthHandler.__create_permission_args(\n permission, extra_params, session)\n\n return require_permission(perm, params,\n ...
[ "0.7212156", "0.7073221", "0.70552754", "0.7010417", "0.6933426", "0.6933426", "0.67541254", "0.6719015", "0.670037", "0.6690324", "0.6667062", "0.6652313", "0.6620965", "0.6571123", "0.65192753", "0.6488", "0.64403254", "0.63780075", "0.6359744", "0.6359744", "0.6339575", ...
0.7750434
0
Convert the file to a JPG then compress the file.
def convert_to_jpg_then_compress(self): self._compressed_file_name = 'c_' + self.file_name self._compressed_save_path = self.full_path.replace(self.file_name, self._compressed_file_name).replace('.png', '.jpg') image = Image.open(self.full_path) image.save(self._compressed_save_path) image = Image.open(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress_image(filename,k):", "def create_compressed_file(self):\n\t\tself._compressed_file_name = 'c_' + self.file_name\n\t\tself._compressed_save_path = self.full_path.replace(self.file_name, self._compressed_file_name)\n\t\tself._is_png = 'png' in self.file_extension\n\t\tself._is_jpg = 'jpg' in self.file...
[ "0.67685163", "0.64589554", "0.64372444", "0.6420995", "0.6286078", "0.6105159", "0.608277", "0.6082288", "0.6013439", "0.5992658", "0.59677696", "0.5955307", "0.5893351", "0.58837473", "0.583579", "0.5826658", "0.5825211", "0.58061516", "0.58058536", "0.5800167", "0.5748661"...
0.8278318
0
Creates the compressed version of the file.
def create_compressed_file(self): self._compressed_file_name = 'c_' + self.file_name self._compressed_save_path = self.full_path.replace(self.file_name, self._compressed_file_name) self._is_png = 'png' in self.file_extension self._is_jpg = 'jpg' in self.file_extension image = Image.open(self.full_path) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress_file(compression, pretty, src, dst):\n str_tail = \"sed 1d\"\n str_cleanup = \";exit\"\n if pretty:\n str_tail = \"tail -n+2\"\n str_cleanup = \";rm ~;exit\"\n if \"lzma\" == compression:\n command = [\"xz\", \"--format=lzma\", \"--lzma1=preset=9e,lc=1,lp=0,pb=0\", \"--stdout\"]\n head...
[ "0.70565844", "0.69513535", "0.6758357", "0.6714145", "0.6706649", "0.66616297", "0.66278297", "0.6608782", "0.6579896", "0.65435976", "0.6455298", "0.6455298", "0.63117456", "0.6298744", "0.6276549", "0.6250949", "0.6248516", "0.6228358", "0.62010807", "0.61343914", "0.61265...
0.80868804
0
Checks with custom alphabet and sign
def test_check_digits_with_custom_alphabet_and_sign(self, number, base, expected): alphabet = ("Z", "!", "T", "#", "F", "%", "S", "&", "E", "(", "0") converted = positional.encode(number, base, alphabet=alphabet, sign_literal="@") self.assertEqual(converted, expected) self.assertEqual( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isalpha(self) -> bool:\n pass", "def character(x):\n if (x==\"a\"or x==\"A\"or x==\"e\"or x==\"E\"or x==\"i\"or x==\"I\"or x==\"o\"or x==\"O\"or x==\"u\"or x==\"U\"):\n return('True')\n else:\n return('False')", "def test_allowed_chars(self):\n hash_val = self.reverse_hash.get...
[ "0.6705942", "0.6626428", "0.652665", "0.6497593", "0.6479341", "0.6404859", "0.63492316", "0.6319629", "0.6294826", "0.62943554", "0.6285358", "0.62573344", "0.62205726", "0.61951894", "0.6184939", "0.61648923", "0.6164153", "0.6146274", "0.6139533", "0.6116625", "0.60871506...
0.69936955
0
Places a new set of houseobjects on a given area.
def random_placement(area): area.create_houses(True) for house in area.houses: place_house(area, house)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_house(area, house):\n\n while_count = 0\n valid = False\n while not valid:\n\n # Get random bottom_left coordinates\n x = int(random.random() * (area.width - house.width + 1))\n y = int(random.random() * (area.height - house.height + 1))\n\n house.set_coordinates([x,y...
[ "0.7144768", "0.5928933", "0.58487195", "0.5841257", "0.57033783", "0.5671876", "0.5654151", "0.55491996", "0.5513568", "0.5504818", "0.5392677", "0.5353437", "0.5297141", "0.5268266", "0.5244738", "0.5221357", "0.5161734", "0.51603305", "0.5155849", "0.51439846", "0.5104186"...
0.7659748
0
Places a house It picks a random x and y coordinate and then checks if there is room for the new house. If it does not succeed, try new coordinates.
def place_house(area, house): while_count = 0 valid = False while not valid: # Get random bottom_left coordinates x = int(random.random() * (area.width - house.width + 1)) y = int(random.random() * (area.height - house.height + 1)) house.set_coordinates([x,y], house.horizo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_placement(area):\n\n area.create_houses(True)\n\n for house in area.houses:\n place_house(area, house)", "def genHome(grid, house):\n house.random_x(grid)\n house.random_y(grid)\n return generic.placeHouse(grid, house)", "def place_entrance(self):\r\n x = random.randint(...
[ "0.7471535", "0.6946651", "0.6412562", "0.6334225", "0.6274068", "0.6206916", "0.6163112", "0.6117228", "0.61032504", "0.60812205", "0.6050695", "0.60362405", "0.602264", "0.6003828", "0.59683675", "0.59456927", "0.5939977", "0.5930898", "0.5912097", "0.5882063", "0.58650124"...
0.7963765
0
Returns a list of tuples containing the (responder, response_time_in_seconds)
def get_response_times(self, thread=None): thread = thread or self.thread if len(thread) < 2: return [dict(fr=thread[0].to, response_time=None), ] else: return self.get_response_times(thread[:-1]) + \ [dict(fr=thread[-2].fr, res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timings(self):\r\n return self._timings", "def responsetime(conn):\n c = conn.cursor()\n results = c.execute(\"\"\"\n select finished.time, event.time, finished.time - event.time as responsetime\n from event\n left join (select time, task_id from event where type_id=\"\"\" + taskid(\"run_ta...
[ "0.59907144", "0.5882056", "0.58809644", "0.5880849", "0.5782201", "0.5782201", "0.5782201", "0.5778935", "0.570444", "0.5694036", "0.56700677", "0.5645393", "0.56398916", "0.5598384", "0.553771", "0.55298376", "0.55293834", "0.5515237", "0.55025536", "0.5500111", "0.54803115...
0.7361413
0
Read in files and use them as templates Provided externally to Email class to avoid large amounts of disk use If attach is passed, it should be an Email object
def read_in_templates(path, email_object=None): import os templates = {} for fle in os.listdir(path): with open(os.path.join(path, fle)) as _f: raw = "\n".join(_f.readlines()) templates[fle] = raw if email_object: email_object.use_templates(templates) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load():\n root = Path(__file__).parent\n for path in root.iterdir():\n if path.is_dir() and not path.name.startswith(\"_\"):\n subject = (path / \"subject.txt\").read_text()\n txt = (path / \"body.txt\").read_text()\n html = path / \"body.html\"\n if htm...
[ "0.65180254", "0.612502", "0.5860532", "0.5847069", "0.5801087", "0.5754388", "0.57114744", "0.56529117", "0.5648572", "0.56280184", "0.5495834", "0.5487416", "0.5478056", "0.54510534", "0.5434052", "0.5421473", "0.5414794", "0.5404989", "0.54023105", "0.5390067", "0.5385397"...
0.70348406
0
Sets up fields, which are things that can be used to format the template And, for special keys, sets the object itself to those values
def set_up_fields(self, fields): self.fields = { 'name': self.name, 'email': self.email } for key in fields.keys(): # special keys first, not to be used in the template if key.upper() == 'CC': self.is_cc = fields[key] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initFields(self):\n pass", "def set_generic_fields(self):\n self.constant_fields[\"admver\"] = 9.1\n self.constant_fields[\"datatype\"] = 'raw'\n self.constant_fields[\"dfo\"] = '//'\n self.constant_fields[\"enterdate\"] = time.strftime(\"%m/%d/%Y\")", "def format_data(s...
[ "0.6276471", "0.6262481", "0.62487084", "0.61724174", "0.61355776", "0.612533", "0.6116964", "0.6061318", "0.6052848", "0.6019446", "0.60192496", "0.5968393", "0.59091383", "0.5907335", "0.5895679", "0.58448225", "0.5830777", "0.5826051", "0.58234024", "0.5820012", "0.5811823...
0.71966773
0
Returns text of the templates available with the required languages Languages are set in add_language
def get_template(self): return self.sep.join([self.htmls[html] for html in self.lang]).format(**self.fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_templates(self):\n\n one_of_languages = '|'.join(l if l != 'c++' else r'c\\+\\+' for l in Languages.all)\n pattern = r'^::[ \\t\\r\\f\\v]*(' + one_of_languages + r')[ \\t\\r\\f\\v]*$'\n parts = re.split(pattern, self.templates_data, flags=re.MULTILINE)\n parts = parts[1:]\n ...
[ "0.7084616", "0.687689", "0.6746576", "0.6519441", "0.63185304", "0.62263787", "0.6074268", "0.6066684", "0.605049", "0.60367423", "0.5986037", "0.5985524", "0.5978127", "0.5963816", "0.59621495", "0.59400225", "0.5910411", "0.58951885", "0.589328", "0.5881213", "0.58774203",...
0.72805595
0
Who the email should be sent from
def define_sender(self, email="", name=""): if not email: return if not name: name = False self.from_who = _email.formataddr( (name, email) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self):\n key, alt = ('Sender', 'From') if not self.resent else \\\n ('Resent-Sender', 'Resent-From')\n value = self.get(key) or self.get(alt)\n _, addr = getaddresses([value])[0]\n return addr", "def whoami( self, mess, args):\n return mess.getFrom(...
[ "0.69983035", "0.6708111", "0.6697914", "0.6695961", "0.6694186", "0.66915125", "0.66870934", "0.66870934", "0.6641661", "0.65978396", "0.6566793", "0.6566793", "0.6566793", "0.6529045", "0.6517324", "0.6490078", "0.6490078", "0.6490078", "0.6490078", "0.64894295", "0.6489429...
0.72044593
0
Plots a playerid to a coordinate (in a tuple)
def plot(coor, playerid): if not hasattr(coor, '__iter__'): raise PlotException('The coordinate given is not an iterable.') if playerid is str: raise PlotException('The coordinate cannot be a string.') if type(playerid) is not str: raise PlotException('The player given is not a str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_coordinates(self) -> None:\n\n print('Y coordinate: ', self.player.row_position + 1)\n print('X coordinate: ', self.player.column_position + 1)", "def display_player_points():\r\n pass", "def scatter_plot_players(dict_of_players):\n seasons = [x[2:4] for x in dict_of_players...
[ "0.6477452", "0.62463814", "0.61421037", "0.58986235", "0.5865129", "0.5848438", "0.58316076", "0.5798321", "0.57198304", "0.56820464", "0.56705046", "0.560794", "0.55633855", "0.55453587", "0.5529514", "0.5506802", "0.5502056", "0.5497945", "0.545438", "0.5426078", "0.541566...
0.74296165
0
Prints a pretty version of the board
def pretty_print_board(): space_list = [' ', ' ', ' '] print_out = ' %s | %s | %s ' for char in board: print print_out % (space_list[0], space_list[1], space_list[2]) print print_out % (char[0], char[1], char[2]) print print_out % (space_list[0], space_list[1], space_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_board(self):\n print('Board:')\n print('\\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in self.board]))", "def pretty_print_board(board):\n board_rows = str(board).split('\\n')\n annotated = [str(8 - i) + \"\\t\" + x for i, x in enumerate(board_rows)]\n ...
[ "0.84095937", "0.83918816", "0.8245782", "0.82422996", "0.82323736", "0.8215113", "0.8162734", "0.8151316", "0.8150022", "0.8130835", "0.8112488", "0.8071105", "0.80561346", "0.804829", "0.8048186", "0.8045684", "0.80240655", "0.7992281", "0.79674995", "0.7966347", "0.7949747...
0.86141
0
Determines if a player won with a row
def win_row(playerid): if board[0][0] is playerid and board[0][1] is playerid and board[0][2] is playerid: return (True, "Row 1") if board[1][0] is playerid and board[1][1] is playerid and board[1][2] is playerid: return (True, "Row 2") if board[2][0] is playerid and board[2][1] is playeri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row_win(board, player):\n for row in board:\n if check_row(row, player):\n return True\n return False", "def col_win(board, player):\n for row in board.T:\n if check_row(row, player):\n return True\n return False", "def who_won(in_a_row, board_size, cur_playe...
[ "0.83189607", "0.7985594", "0.79045516", "0.78763646", "0.7863677", "0.77931696", "0.77766377", "0.7735508", "0.7633692", "0.75263256", "0.74989605", "0.7492958", "0.74697167", "0.7355253", "0.7343955", "0.72912085", "0.7253767", "0.723026", "0.72269255", "0.72235256", "0.721...
0.8227636
1
Determines if a player won with a column
def win_column(playerid): if board[0][0] is playerid and board[1][0] is playerid and board[2][0] is playerid: return (True, "Column 1") if board[0][1] is playerid and board[1][1] is playerid and board[2][1] is playerid: return (True, "Column 2") if board[0][2] is playerid and board[1][2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def col_win(board, player):\n for row in board.T:\n if check_row(row, player):\n return True\n return False", "def has_won(board, player):\r\n return False", "def has_won(board, player):\n return False", "def _check_won(field, col, delta_row):\n player = field[col][-1]\n c...
[ "0.77471805", "0.74463964", "0.7400077", "0.73837036", "0.7246299", "0.71902883", "0.71169466", "0.7052406", "0.7025867", "0.6867555", "0.6840361", "0.6821269", "0.682054", "0.6809554", "0.67971253", "0.6759612", "0.67421645", "0.67353773", "0.6691993", "0.6682995", "0.666356...
0.81317043
0
Determines if a player won with a diagonal
def win_diagonal(playerid): if board[0][0] is playerid and board[1][1] is playerid and board[2][2] is playerid: return (True, "Diagonal Left-up to Right-down") if board[0][2] is playerid and board[1][1] is playerid and board[2][0] is playerid: return (True, "Diagonal Right-up to Left-down") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal_wise_checking(player_):\n if board[0] == board[4] == player_:\n return 8\n elif board[4] == board[8] == player_:\n return 0\n elif board[2] == board[4] == player_:\n return 6\n elif board[4] == board[6] == player_:\n return 2\n else:\n return -1", "d...
[ "0.7823278", "0.76364714", "0.76018786", "0.7564239", "0.7509191", "0.7484246", "0.7422074", "0.736363", "0.73342633", "0.72659194", "0.7188879", "0.7101761", "0.708244", "0.7077482", "0.7068792", "0.7021743", "0.69726366", "0.6963936", "0.6962105", "0.6949203", "0.69404227",...
0.83060133
0
Precompute the features of the image by passing it through the vgg network and storing the computed layers.
def _precompute_image_features(img, layers, shape, save_dir): # type: (np.ndarray, Union[Tuple[str], List[str]], Union[Tuple[int], List[int]]) -> Dict[str, np.ndarray] features_dict = {} g = tf.Graph() # Choose to use cpu here because we only need to compute this once and using cpu would provide us more...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pretrained_layers(self):\n # Current state of base\n state_dict = self.state_dict()\n param_names = list(state_dict.keys())\n\n # Pretrained VGG base\n pretrained_state_dict = torchvision.models.vgg16(pretrained=True).state_dict()\n pretrained_param_names = list(p...
[ "0.66062474", "0.6350273", "0.63438046", "0.6333514", "0.6314429", "0.62802124", "0.6255271", "0.6249431", "0.62211055", "0.62177217", "0.6194107", "0.6168756", "0.6125945", "0.60973185", "0.60792696", "0.60363847", "0.60162824", "0.6012033", "0.6008614", "0.6005457", "0.6004...
0.72162515
0
Function for reading files filtered by subject, activity and mode
def read_files_filtered(subjects='all', activities='all', modes='all'): if subjects == 'all' and activities == 'all' and modes == 'all': return read_all_files() paths = get_recording_paths(subjects, activities, modes) return read_by_paths(paths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_clean_files(subjects='all', activities='all', model='all'):", "def getFiles(folderToProcess,filter):\n\n print(f\"Parsing {folderToProcess} for {filter} files\")\n\n if debug:\n for path in Path(folderToProcess).rglob(filter):\n print(f\"Found {path}\")\n\n all_files = [str(x)...
[ "0.69848543", "0.54883546", "0.54516315", "0.5418353", "0.5382338", "0.52918607", "0.5210965", "0.51933175", "0.5145049", "0.51396954", "0.51324344", "0.50466853", "0.5042937", "0.5042548", "0.50394475", "0.4947618", "0.49476132", "0.49307683", "0.4929578", "0.49254784", "0.4...
0.8165002
0
Are we running inside of the Nuke environment
def is_nuke(): try: import _nuke return True except ImportError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_runtime(self):\n\n return self.is_valid_platform() and self['ENVIRONMENT']", "def in_travis():\n return os.getenv(IN_TRAVIS_ENV) == 'true'", "def _in_travis(): # pragma: no cover\n return 'TRAVIS' in os.environ", "def running_under_virtualenv():\n return _running_under_venv() or _runn...
[ "0.6818015", "0.67812735", "0.66901594", "0.66534734", "0.65633863", "0.64935154", "0.64828295", "0.6478526", "0.6441256", "0.6402491", "0.63695174", "0.63553613", "0.63170344", "0.6310847", "0.6277519", "0.62353075", "0.6234855", "0.6231657", "0.6225297", "0.6225297", "0.621...
0.7006382
0
Are we running inside of the Gaffer environment
def is_gaffer(): try: import Gaffer return True except ImportError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running_locally():\n local = False\n if \"POLYAXON_NO_OP\" in os.environ:\n local = True\n return local", "def in_dataflow():\n if os.environ.get(\"HOME\") == \"/home/dataflow\":\n return True\n return False", "def in_runtime(self):\n\n return self.is_valid_platform()...
[ "0.69329476", "0.66380095", "0.6631477", "0.66221917", "0.6552447", "0.6489684", "0.6471967", "0.64436424", "0.6437507", "0.64190584", "0.64128906", "0.638684", "0.6378813", "0.6357585", "0.63335323", "0.6262988", "0.6255177", "0.6238661", "0.62310183", "0.6141811", "0.611946...
0.6930377
1
Test storage & retrival of GC entries in datastore
def test_gc_datastore(self): yg_gc = parsegc.generate_yg_gc_entry( "100.25", "100.25", "ParNew", "3", "2", "8", "0.12345", "8192", "5120", "16384", "3.12345", "1.5", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n objects = self.populate()\n for obj in objects:\n found = models.storage.get(type(obj), obj.id)\n self.assertIs(found, obj)\n for obj in objects:\n obj.delete()\n found = models.storage.get(type(obj), obj.id)\n self.a...
[ "0.62164956", "0.6025395", "0.6009474", "0.59689325", "0.5935794", "0.59326327", "0.5859177", "0.585346", "0.5831749", "0.5831245", "0.5819252", "0.5784528", "0.5784438", "0.57532656", "0.5742503", "0.57021046", "0.5701019", "0.56603944", "0.56532687", "0.5643895", "0.5590506...
0.7667878
0
We don't need swagger for tests, so might as well mock it
def _mock_swagger(cls): swagger_patcher = patch( 'manager_rest.rest.swagger.add_swagger_resource' ) cls._patchers.append(swagger_patcher)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_swagger(self):\n response = self.client.get(\"/api/v1/swagger\", query_string=dict(validate_schema=True))\n assert_that(response.status_code, is_(equal_to(200)))\n swagger = loads(response.get_data().decode(\"utf-8\"))\n # we have the swagger docs endpoint too, which is impleme...
[ "0.7336948", "0.6923838", "0.678964", "0.67113996", "0.6660139", "0.6651703", "0.66049826", "0.65836406", "0.646437", "0.6439443", "0.627302", "0.61702514", "0.61073226", "0.6094403", "0.60654604", "0.60420567", "0.60267264", "0.60136944", "0.60093683", "0.6007948", "0.597922...
0.7319172
1
Mock RabbitMQ related modules AMQP manager and workflow executor that use pika, because we don't have RabbitMQ in the unittests
def _mock_amqp_modules(cls): amqp_patches = [ patch('manager_rest.amqp_manager.RabbitMQClient'), patch('manager_rest.workflow_executor._execute_task', mock_execute_task), ] cls._patchers.extend(amqp_patches)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_setup():\n global credentials, connection, channel\n credentials = pika.PlainCredentials('guest', 'guest') # AUTH via Default guest user on RabbitMQ\n connection = pika.BlockingConnection(pika.ConnectionParameters(\"127.0.0.1\", 5672, '/', credentials)) # Using rabbit-mq container name to acce...
[ "0.64339656", "0.6224183", "0.6012848", "0.5942217", "0.5922251", "0.5896052", "0.589499", "0.5774781", "0.5766373", "0.5745331", "0.5712566", "0.5698385", "0.5680562", "0.5592014", "0.5567321", "0.55452615", "0.5500748", "0.54923385", "0.54795855", "0.5476272", "0.5459228", ...
0.7729408
0
Mock the _get_encryption_key_patcher function for all unittests
def _mock_get_encryption_key(cls): get_encryption_key_patcher = patch( 'cloudify.cryptography_utils._get_encryption_key', MagicMock(return_value=config.instance.security_encryption_key) ) cls._patchers.append(get_encryption_key_patcher)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_kms_re_encrypt_call(self):\n b64_secret = base64.b64encode(self.secret)\n ef_utils.kms_re_encrypt(self.mock_kms, self.service, self.env, b64_secret)\n self.mock_kms.re_encrypt_called_once_with(CiphertextBlob=b64_secret)", "def test_kms_encrypt_call(self):\n ef_utils.kms_encrypt(self.mock_kms...
[ "0.7175305", "0.71508867", "0.6681385", "0.6536506", "0.652063", "0.6463966", "0.6443366", "0.6435578", "0.6412135", "0.6371587", "0.63686365", "0.6337019", "0.63276094", "0.62486047", "0.62125623", "0.62123615", "0.61760014", "0.61661863", "0.6159143", "0.6145358", "0.613674...
0.9006511
0
Create config, and reset Flask app
def _create_config_and_reset_app(cls): cls.server_configuration = cls.create_configuration() utils.copy_resources(cls.server_configuration.file_server_root) server.reset_app(cls.server_configuration) cls._set_hash_mechanism_to_plaintext()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(config: dict) -> Flask:\n for key, value in config.items():\n app.config[key] = value\n db.init_app(app)\n ma.init_app(app)\n app.app_context().push()\n return app", "def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # I...
[ "0.75590825", "0.7508713", "0.748772", "0.72944295", "0.72625035", "0.72500557", "0.72128105", "0.7173611", "0.7169499", "0.7145428", "0.71268964", "0.71006304", "0.7073018", "0.7031195", "0.7028012", "0.7014083", "0.69877124", "0.6976852", "0.69703704", "0.696927", "0.694595...
0.7899444
0
Set up Flask app context, and handle DB related tasks
def _handle_flask_app_and_db(cls): cls._set_flask_app_context() cls.app = cls._get_app(server.app)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_app(app):\n app.teardown_appcontext(close_db)\n init_db()", "def init_app(app):\n app.teardown_appcontext(close_db)\n app.cli.add_command(init_db_command)", "def init_app(app):\n app.teardown_appcontext(close_db)\n app.cli.add_command(init_db_command)", "def init_app(app):\n app...
[ "0.7853245", "0.7584911", "0.7584911", "0.7584911", "0.7456693", "0.7456693", "0.7443681", "0.73877484", "0.73577726", "0.7292733", "0.7260691", "0.72222364", "0.71895194", "0.7162824", "0.71350414", "0.7131234", "0.7127256", "0.71075463", "0.7101007", "0.7083093", "0.7074253...
0.82375836
0
Calculates the standard deviation for a list of numbers.
def standard_deviation(list): num_items = len(list) mean = sum(list) / num_items differences = [x - mean for x in list] sq_differences = [d ** 2 for d in differences] ssd = sum(sq_differences) variance = ssd / num_items sd = sqrt(variance) return sd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StandardDeviation(numlist):\n\tv = Variance(numlist)\n\t#print v\n\treturn math.sqrt(v)", "def stddev(self, num_list):\n try:\n mean = self.average(num_list)\n\n minus_mean = []\n\n for number in num_list:\n try:\n minus_mean.append((n...
[ "0.8343992", "0.8174752", "0.81742907", "0.81430984", "0.80957067", "0.80957067", "0.8038053", "0.7987376", "0.7937656", "0.78013116", "0.77812856", "0.7755645", "0.77337843", "0.76542485", "0.7626096", "0.7618358", "0.7566693", "0.75570273", "0.7502997", "0.7431263", "0.7387...
0.82818234
1
DataFrame with fixed values as defined in fixers and not_equal option
def fixed(df: pd.DataFrame, fixers: dict, not_equal=False) -> pd.DataFrame: selector = None for k, v in fixers.items(): if selector is None: if not_equal: selector = (df[k] != v) else: selector = (df[k] == v) else: if not_equal:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_fix():\n df = force_test_data()\n return df", "def fix_data(self, df):\n return df.dropna(axis='columns', how='all').fillna(0.0)", "def df_fix(self, df, units='freqs'):\r\n\r\n # Import display settings.\r\n disp_stgs = vars(self.d_stgs)\r\n\r\n if units == 'freqs':\...
[ "0.61070645", "0.6055508", "0.5967976", "0.5843578", "0.5763484", "0.5757719", "0.5757607", "0.5622603", "0.55553955", "0.55050665", "0.5500112", "0.5499162", "0.54925114", "0.54836506", "0.5472696", "0.54319566", "0.5431826", "0.54155105", "0.5401075", "0.53885806", "0.53850...
0.73126876
0
List files with given prefix and suffix
def files(path: str, prefix: str = None, suffix: str = None): for file in os.listdir(path): if os.path.isfile(os.path.join(path, file)): if (prefix is None or file.startswith(prefix)) and (suffix is None or file.endswith(suffix)): yield file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_prefix(prefixes, dirname, Lshow=None, Ldir=None):\n matched_files=[]\n for pref in prefixes:\n print(f\"prefix: {pref} in {whereami()} of module {__name__}\")\n for fname in os.listdir(dirname):\n # re.match finds only prefix\n if re.match(pref, fname):\n ...
[ "0.7093185", "0.694431", "0.68654144", "0.68147314", "0.6777375", "0.67114264", "0.66726196", "0.65506333", "0.6482676", "0.64686674", "0.6468468", "0.6460398", "0.64520705", "0.6441219", "0.6384878", "0.6307066", "0.62810194", "0.6270825", "0.6204898", "0.6202487", "0.619629...
0.7547778
0
Return Agent config loader.
def loader() -> ConfigLoader: return ConfigLoader.from_configuration_type(PackageType.AGENT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self) -> AgentConfig:\n agent_loader = self.loader()\n path = Path(DEFAULT_AEA_CONFIG_FILE)\n with path.open(mode=\"r\", encoding=\"utf-8\") as fp:\n agent_config = agent_loader.load(fp)\n return agent_config", "def load_config(self) -> AgentConfig:\n ...
[ "0.7789186", "0.76750416", "0.7203399", "0.66333944", "0.6520389", "0.64594156", "0.64592004", "0.6402473", "0.63390857", "0.62994236", "0.627919", "0.61811906", "0.6135862", "0.6096656", "0.60769004", "0.60437053", "0.60209733", "0.60027635", "0.59712595", "0.59507966", "0.5...
0.8579351
1
Load AgentConfig from current directory.
def load_config(self) -> AgentConfig: agent_loader = self.loader() path = Path(DEFAULT_AEA_CONFIG_FILE) with path.open(mode="r", encoding="utf-8") as fp: agent_config = agent_loader.load(fp) return agent_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self) -> AgentConfig:\n with cd(self._get_cwd()):\n agent_loader = self.loader()\n path = Path(DEFAULT_AEA_CONFIG_FILE)\n with path.open(mode=\"r\", encoding=\"utf-8\") as fp:\n agent_config = agent_loader.load(fp)\n return agent_con...
[ "0.7938165", "0.75347126", "0.63730085", "0.6327753", "0.6305391", "0.61932546", "0.617233", "0.61495316", "0.6142741", "0.6117466", "0.6109345", "0.60807043", "0.6073481", "0.60175836", "0.6016547", "0.6015295", "0.6003587", "0.60022396", "0.5962636", "0.59564507", "0.595645...
0.7598646
1
Dump AgentConfig to current directory.
def dump_config(self, agent_config: AgentConfig) -> None: agent_loader = self.loader() path = Path(DEFAULT_AEA_CONFIG_FILE) with path.open(mode="w", encoding="utf-8") as fp: agent_loader.dump(agent_config, fp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_cfg(dump_path, cfg):\n cfg_file = os.path.join(dump_path)\n with open(cfg_file, \"w\") as f:\n cfg.dump(stream=f)", "def save_cfg(self, output_dir):\n output_path = os.path.join(output_dir, 'level_config.cfg')\n shutil.copy(self.cfg_path, output_path)", "def test_dump_config...
[ "0.6151234", "0.60773027", "0.5995359", "0.5991647", "0.59771234", "0.5944956", "0.58589894", "0.5853796", "0.58345014", "0.5833078", "0.5808817", "0.57946444", "0.5746484", "0.57455885", "0.5729673", "0.5698917", "0.56971693", "0.5668471", "0.56666535", "0.56566256", "0.5612...
0.7920179
0
Add and remove oef connection.
def with_oef_installed(self): result = self.runner.invoke( cli, [ "-v", "DEBUG", "add", "--local", "connection", str(oef.connection.PUBLIC_ID), ], standalone_mode=False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_connection(self, connection):\n self.connections[connection.id] = connection", "def addConnection(tagA, tagB): #@NoSelf", "def remove_connection(self, cnx=None):\n self._connections_openned.remove(cnx)", "def add_connection(self, connection):\n self.connections.append(connection...
[ "0.5738175", "0.57243925", "0.57082504", "0.5659774", "0.5512216", "0.5509328", "0.5506893", "0.5362747", "0.5357334", "0.53536284", "0.53306025", "0.52831197", "0.5280138", "0.5270142", "0.52701026", "0.5242261", "0.5217767", "0.5211424", "0.52112573", "0.51867807", "0.51847...
0.57735175
0
Test dependency removed after upgrade. Done with mocking _add_item_deps to avoid dependencies installation. Also checks dependency configuration removed with component
def test_upgrade_and_dependency_removed(self): assert self.DEPENDENCY_PUBLIC_ID in self.load_config().protocols # add empty component config to aea-config.py agent_config = self.load_config() component_id = ComponentId(self.DEPENDENCY_TYPE, self.DEPENDENCY_PUBLIC_ID) agent_confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_and_dependency_not_removed_caused_required_by_another_item(self):\n assert self.DEPENDENCY_PUBLIC_ID in self.load_config().protocols\n # do not add dependencies for the package\n\n with self.with_oef_installed(), self.with_config_update(), patch(\n \"aea.cli.add._ad...
[ "0.81135434", "0.7362617", "0.6766462", "0.6544789", "0.6531516", "0.6438319", "0.6319041", "0.62185085", "0.6188907", "0.6132456", "0.6041189", "0.6006803", "0.5998753", "0.5991123", "0.59702504", "0.5968387", "0.5958896", "0.5913445", "0.5889102", "0.5883631", "0.5875791", ...
0.8429663
0
Test dependency is not removed after upgrade cause required by another item.
def test_upgrade_and_dependency_not_removed_caused_required_by_another_item(self): assert self.DEPENDENCY_PUBLIC_ID in self.load_config().protocols # do not add dependencies for the package with self.with_oef_installed(), self.with_config_update(), patch( "aea.cli.add._add_item_deps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_and_dependency_removed(self):\n assert self.DEPENDENCY_PUBLIC_ID in self.load_config().protocols\n\n # add empty component config to aea-config.py\n agent_config = self.load_config()\n component_id = ComponentId(self.DEPENDENCY_TYPE, self.DEPENDENCY_PUBLIC_ID)\n ...
[ "0.73587066", "0.70623755", "0.6924959", "0.6702369", "0.6659108", "0.6502818", "0.63948333", "0.63574445", "0.63364923", "0.63122445", "0.6305679", "0.62712497", "0.6254786", "0.6245533", "0.62379134", "0.62112606", "0.6205118", "0.6191424", "0.6189909", "0.6169795", "0.6134...
0.79161876
0
Test upgrade shared dependencies.
def test_upgrade_shared_dependencies(self): result = self.run_cli_command("-s", "upgrade", cwd=self._get_cwd()) assert result.exit_code == 0 agent_config: AgentConfig = cast( AgentConfig, load_item_config(PackageType.AGENT.value, Path(self.current_agent_context)), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_vendor_update_references_to_upgraded_packages(\n self,\n ): # pylint: disable=unused-argument\n self.assert_dependency_updated(\n ComponentType.CONNECTION,\n \"my_connection\",\n \"protocols\",\n {DefaultMessage.protocol_id},\n )\n ...
[ "0.73382586", "0.7293695", "0.7190012", "0.7150176", "0.70477426", "0.6946601", "0.6922761", "0.6902385", "0.67145294", "0.6549927", "0.648727", "0.64786726", "0.64778936", "0.64440256", "0.64372975", "0.64312977", "0.64312977", "0.6426931", "0.636959", "0.63609445", "0.63578...
0.7697041
0
Test do not upgrade non vendor package.
def test_upgrade_non_vendor(self): with pytest.raises( ClickException, match=r"The .* with id '.*' already has version .*. Nothing to upgrade.", ): self.runner.invoke( cli, [ "upgrade", *self.LOCA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_with_auto_upgrade_latest_engine_enabled():", "def test_reinstall_packages():\n\tassert packaging.install_packages(pkgs) == None", "def test_upgrade_without_fromrepo(self):\n pkg_cmd = MagicMock(return_value={\"retcode\": 0})\n\n with patch.dict(pkgng.__salt__, {\"cmd.run_all\": p...
[ "0.7427488", "0.73842704", "0.7354087", "0.707579", "0.70582646", "0.69683087", "0.69113016", "0.6833848", "0.6806153", "0.679244", "0.67788756", "0.67279434", "0.670627", "0.66816664", "0.6659474", "0.66453236", "0.6632922", "0.6630645", "0.6629528", "0.6612126", "0.6609736"...
0.7783982
0
Test can not upgrade not registered component.
def test_upgrade_to_non_registered(self): with pytest.raises( ClickException, match=r".* with id .* is not registered. Please use the `add` command. Aborting...", ): self.runner.invoke( cli, [ "-v", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_non_vendor(self):\n with pytest.raises(\n ClickException,\n match=r\"The .* with id '.*' already has version .*. Nothing to upgrade.\",\n ):\n self.runner.invoke(\n cli,\n [\n \"upgrade\",\n ...
[ "0.75732744", "0.724644", "0.7215793", "0.7132323", "0.69514716", "0.6843944", "0.67169875", "0.66903317", "0.6642845", "0.6626017", "0.6607427", "0.65851265", "0.65829057", "0.6560401", "0.65252763", "0.65048265", "0.64978427", "0.64870054", "0.6470185", "0.6460638", "0.6454...
0.77531296
0
Test real full upgrade.
def test_do_upgrade(self): with self.with_config_update(): result = self.runner.invoke( cli, [ "upgrade", *self.LOCAL, self.ITEM_TYPE, f"{self.ITEM_PUBLIC_ID.author}/{self.ITEM_PUBLIC_ID.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_with_auto_upgrade_latest_engine_enabled():", "def test_wait_for_upgrade(self):\n self.run_test_suites(self.wait_for_upgrade_test_suite_list)", "def test_upgrade_plan_all_fine(setup, skuba):\n\n setup_kubernetes_version(skuba)\n out = skuba.cluster_upgrade_plan()\n\n assert out....
[ "0.83933073", "0.7308629", "0.7290605", "0.72794247", "0.71594167", "0.70284414", "0.69807744", "0.6956428", "0.69499004", "0.6891482", "0.68815255", "0.6868052", "0.67566407", "0.6722042", "0.6702972", "0.6699253", "0.6688377", "0.66672164", "0.6611809", "0.6589397", "0.6579...
0.77515984
1
Test no package in registry.
def test_package_can_not_be_found_in_registry(self): with self.with_config_update(): with patch( "aea.cli.registry.utils.get_package_meta", side_effects=Exception("expected!"), ), patch( "aea.cli.registry.utils.find_item_locally", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_component_default_package_installed_UNKNOWN(self):\n self.assertEqual(None, self.u.is_component_defaultpackage_installed('a'))", "def test_is_component_default_package_installed_MISSING(self):\n self._ucr({\n 'repository/online/component/b/defaultpackage': 'b',\n }...
[ "0.72358173", "0.6919422", "0.6914876", "0.68076855", "0.6569837", "0.65655696", "0.6559018", "0.6554562", "0.65437", "0.6535291", "0.6465791", "0.6465791", "0.6465791", "0.6401717", "0.6397564", "0.6393766", "0.6386692", "0.63834286", "0.6364652", "0.6342027", "0.63388544", ...
0.71365845
1
Test the agent configuration is updated.
def test_agent_config_updated(self): loader = ConfigLoader.from_configuration_type(PackageType.AGENT) with Path(self._get_cwd(), DEFAULT_AEA_CONFIG_FILE).open() as fp: agent_config = loader.load(fp) assert DefaultMessage.protocol_id in agent_config.protocols assert ERROR_SKIL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_change():\n clean_tables()\n config = set_configuration()\n assert config['age']['value'] == \"72\"\n assert config['retainUnsent']['value'] == \"False\" \n\n config = update_configuration(age=0, retain_unsent=True) \n assert config['age']['value'] == \"0\" \n assert config['re...
[ "0.7209072", "0.6992483", "0.6961175", "0.66688454", "0.6619531", "0.6618874", "0.65753937", "0.65387523", "0.6521512", "0.6515647", "0.64843065", "0.6470692", "0.6441869", "0.6433934", "0.64215523", "0.6352646", "0.63388705", "0.6322415", "0.63143575", "0.6309911", "0.629871...
0.7789157
0
Test that dependencies in nonvendor packages are updated correctly after upgrade.
def test_non_vendor_update_references_to_upgraded_packages( self, ): # pylint: disable=unused-argument self.assert_dependency_updated( ComponentType.CONNECTION, "my_connection", "protocols", {DefaultMessage.protocol_id}, ) self.assert_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_and_dependency_not_removed_caused_required_by_another_item(self):\n assert self.DEPENDENCY_PUBLIC_ID in self.load_config().protocols\n # do not add dependencies for the package\n\n with self.with_oef_installed(), self.with_config_update(), patch(\n \"aea.cli.add._ad...
[ "0.7485039", "0.7445749", "0.7389565", "0.7320196", "0.70845586", "0.7076064", "0.70106494", "0.6955463", "0.6925927", "0.6906778", "0.6884128", "0.6854553", "0.68540126", "0.68211585", "0.6787183", "0.67439", "0.6664481", "0.66410315", "0.66395974", "0.663351", "0.6626211", ...
0.8349532
0
Test default routing has been updated correctly.
def test_default_routing_updated_correctly(self): result = self.run_cli_command( "--skip-consistency-check", "config", "get", "agent.default_routing", cwd=self._get_cwd(), ) assert ( result.stdout == f'{{"{Defaul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_routing_updated(self):\n assert self.agent_config.default_routing == {\n self.new_protocol_id: self.new_connection_id\n }", "def test_patch_namespaced_route_status(self):\n pass", "def test_patch_namespaced_route(self):\n pass", "def test_api(self):\n ...
[ "0.81897014", "0.7263149", "0.7203789", "0.7200019", "0.7080318", "0.6919853", "0.68657523", "0.6806963", "0.67227316", "0.66406924", "0.64625436", "0.63000375", "0.62891644", "0.6271479", "0.6264239", "0.6247724", "0.6210134", "0.6190821", "0.6173336", "0.61360687", "0.61273...
0.7639861
1
Test nothing to upgrade.
def test_nothing_to_upgrade(self, mock_click_echo): agent_config = self.load_agent_config(self.agent_name) result = self.run_cli_command("upgrade", cwd=self._get_cwd()) assert result.exit_code == 0 mock_click_echo.assert_any_call("Starting project upgrade...") mock_click_echo.ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_with_auto_upgrade_latest_engine_enabled():", "def test_nothing_to_upgrade(self, mock_click_echo):\n result = self.run_cli_command(\"upgrade\", cwd=self._get_cwd())\n assert result.exit_code == 0\n mock_click_echo.assert_any_call(\"Starting project upgrade...\")\n mock...
[ "0.8118252", "0.778251", "0.7574209", "0.7530331", "0.7352203", "0.7311413", "0.7267051", "0.7262919", "0.7221152", "0.7216041", "0.71628124", "0.70960796", "0.7064248", "0.69781184", "0.69738615", "0.6943728", "0.6942627", "0.6900356", "0.6858848", "0.68585694", "0.685193", ...
0.7805737
1
Update aea version to all items and fingerprint them.
def _update_aea_version(cls, agent_config: AgentConfig): for item in agent_config.package_dependencies: type_ = item.component_type.to_plural() dotted_path = f"vendor.{item.author}.{type_}.{item.name}.aea_version" path = os.path.join("vendor", item.author, type_, item.name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateVersions(self):\r\n f = open('../versions.pckl', 'wb')\r\n pickle.dump(self.versions, f)\r\n f.close()", "def updateDictFile(self):\n if self.dictFile.vdata.get('version',0): return\n #--Update to version 1\n for name in self.data.keys():\n installer...
[ "0.59572446", "0.5847187", "0.582219", "0.5574933", "0.5574933", "0.5518731", "0.5496537", "0.53983974", "0.539353", "0.53508", "0.5343443", "0.5307425", "0.5307425", "0.5293178", "0.5278932", "0.5278932", "0.52512443", "0.5240729", "0.52283216", "0.52189577", "0.5214814", ...
0.73335904
0
Test nothing to upgrade, and additionally, that 'aea_version' is correct.
def test_nothing_to_upgrade(self, mock_click_echo): result = self.run_cli_command("upgrade", cwd=self._get_cwd()) assert result.exit_code == 0 mock_click_echo.assert_any_call("Starting project upgrade...") mock_click_echo.assert_any_call( f"Updating AEA version specifier from...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_with_auto_upgrade_latest_engine_enabled():", "def test_version(self):\n pass", "def test_version_missing(self):\r\n self.assertIsNone(self._version_test(self.no_version))", "def test_get_version(self):\n pass", "def test_upgrade(self):\n with cd(self.latest_agen...
[ "0.7488589", "0.71843773", "0.6869489", "0.68066096", "0.67994815", "0.6794901", "0.6636289", "0.65934694", "0.65915775", "0.6563526", "0.64820576", "0.64787495", "0.646726", "0.64638144", "0.6436771", "0.64313346", "0.64274293", "0.6410678", "0.6390549", "0.63589203", "0.634...
0.7698277
0
Mock 'get_latest_version_available_in_registry' when called with generic_seller public key.
def mock_get_latest_version_available_in_registry(cls, *args, **kwargs): if ( args[1] == str(cls.GENERIC_SELLER.package_type) and args[2] == cls.GENERIC_SELLER.public_id.to_latest() ): # return current version return cls.GENERIC_SELLER return cls.u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mock(self):\n return mock.patch(\n \"aea.cli.upgrade.get_latest_version_available_in_registry\",\n side_effect=self.mock_get_latest_version_available_in_registry,\n )", "def mock_upgrade_package(\n mock_get_installed_version, mock_get_latest_version, monkeypatch\n)...
[ "0.7309545", "0.58763295", "0.5864447", "0.58395016", "0.58056015", "0.5698485", "0.56743044", "0.564939", "0.5587511", "0.5538209", "0.5528231", "0.5513699", "0.55113155", "0.5465772", "0.54465187", "0.54401696", "0.5427664", "0.54229385", "0.54144603", "0.5407348", "0.53688...
0.7941086
0
Get the mock of 'get_latest_version_available_in_registry'.
def _get_mock(self): return mock.patch( "aea.cli.upgrade.get_latest_version_available_in_registry", side_effect=self.mock_get_latest_version_available_in_registry, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_get_latest_version_available_in_registry(cls, *args, **kwargs):\n if (\n args[1] == str(cls.GENERIC_SELLER.package_type)\n and args[2] == cls.GENERIC_SELLER.public_id.to_latest()\n ):\n # return current version\n return cls.GENERIC_SELLER\n ...
[ "0.80680627", "0.64312685", "0.64097947", "0.63471204", "0.6214762", "0.6141788", "0.60316896", "0.59222525", "0.591951", "0.5905374", "0.58792794", "0.5837276", "0.58365786", "0.57319987", "0.5717", "0.57125854", "0.57079506", "0.5681459", "0.5666343", "0.5609874", "0.560379...
0.87356293
0
la seule fonction de notre classe, on teste si la case du perso et celle vers laquelle il tente d'aller ne sont pas des murs, puis change le joueur.y/x et casex/y on change aussi le statut possession de perso de l'ancienne et nouvelle case. Finalement on change la direction dans laquelle regarde le perso
def deplacer(self,direction): if direction == "haut": if self.y>=200: #Eviter que le joueur sorte de la grille if grille[self.casey-1][self.casex-1][2][0]==1 and grille[self.casey-2][self.casex-1][2][1]==1: # on teste si le déplacement est autorisé : sur la case du joueur et la case ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mvts(self, plateau):\n if self.type == \"p\": #Pion\n if self.color == \"w\":\n diags = [[self.x-1, self.y+1],[self.x+1, self.y+1]] #Mouvements possibles de diagonales\n faces = [[self.x, self.y+1]] #Mouvements possibles de face\n if not self.m...
[ "0.6400048", "0.6253523", "0.6203404", "0.6178181", "0.6174946", "0.60422826", "0.6025236", "0.6005264", "0.5950732", "0.593587", "0.5915964", "0.5906928", "0.5903836", "0.5874109", "0.586919", "0.58674926", "0.5835641", "0.5811595", "0.5799158", "0.57982135", "0.577244", "...
0.77259666
0
Do the star matching, loading observations from fits files.
def runFromFits(self, clobber=False): if 'starfileBase' not in self.starConfig: raise ValueError("Required starfileBase not in starConfig") observationFile = self.starConfig['starfileBase']+'_observations.fits' if (not os.path.isfile(observationFile)): raise IOError("C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_files(self):\n # Open starinfo file and define structured array\n starinfo_file = self.starinfo_file\n nstar = sum(1 for line in open(starinfo_file))\n infoname = ['obj', 'std', 'caldir', 'altname']\n infofmt = ['|S25', '|S25', '|S25', '|S25']\n starinfo = np...
[ "0.63388085", "0.5687976", "0.56131953", "0.5592598", "0.5577932", "0.5480487", "0.5423742", "0.54044247", "0.535855", "0.53382635", "0.53362477", "0.53110117", "0.5310845", "0.53058916", "0.52857876", "0.527715", "0.52761745", "0.52589387", "0.5256315", "0.52556294", "0.5225...
0.5917167
1
Make reference stars, loading observations from fits.
def makeReferenceStarsFromFits(self, observationFile): import fitsio fits = fitsio.FITS(observationFile) fitsWhere = None for filterName in self.filterNames: for referenceBand in self.starConfig['referenceBands']: if (self.starConfig['filterToBand'][filterNa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runFromFits(self, clobber=False):\n\n if 'starfileBase' not in self.starConfig:\n raise ValueError(\"Required starfileBase not in starConfig\")\n\n observationFile = self.starConfig['starfileBase']+'_observations.fits'\n\n if (not os.path.isfile(observationFile)):\n r...
[ "0.6182688", "0.5614079", "0.560672", "0.5508656", "0.54994977", "0.53825426", "0.5372702", "0.5323354", "0.5322856", "0.5235639", "0.5222571", "0.52114373", "0.5190064", "0.5171109", "0.5164983", "0.5162137", "0.51019156", "0.50926983", "0.50903815", "0.5088045", "0.5077373"...
0.614225
1
Make reference stars, from preloaded arrays
def makeReferenceStars(self, raArray, decArray, filterNameArray, bandSelected=False, brightStarRA=None, brightStarDec=None, brightStarRadius=None): # can we use the better smatch code? try: import smatch hasSmatch = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromArrays(cls, lon, lat, depth, origin, reference=''):\n pass", "def _reconstruct(self, num_samples=None):", "def makeReferenceStarsFromFits(self, observationFile):\n\n import fitsio\n\n fits = fitsio.FITS(observationFile)\n fitsWhere = None\n for filterName in self.filt...
[ "0.56700546", "0.5354913", "0.5328065", "0.52406746", "0.520642", "0.52062327", "0.5189317", "0.517837", "0.51436144", "0.5140962", "0.5140962", "0.5127426", "0.5103638", "0.5083687", "0.50693774", "0.50671124", "0.4994818", "0.49896437", "0.49796975", "0.49519607", "0.494921...
0.5628936
1
Make matched stars, from preloaded arrays. Requires self.objCat was generated from makeReferenceStars().
def makeMatchedStars(self, raArray, decArray, filterNameArray): if (self.objCat is None): raise ValueError("Must run makeReferenceStars first") # can we use the better smatch code? try: import smatch hasSmatch = True except ImportError: h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeReferenceStars(self, raArray, decArray, filterNameArray,\n bandSelected=False,\n brightStarRA=None, brightStarDec=None, brightStarRadius=None):\n\n # can we use the better smatch code?\n try:\n import smatch\n hasSmatch...
[ "0.60351145", "0.5685632", "0.546123", "0.52357095", "0.5187138", "0.5030543", "0.5010908", "0.5010364", "0.49473846", "0.49055758", "0.4875793", "0.48720032", "0.48382196", "0.48379466", "0.47752053", "0.47742695", "0.47712192", "0.4750553", "0.47053054", "0.46963975", "0.46...
0.66479224
0
Invokes vim on 'filename'. If 'filename' cannot be found, then the user will be asked if they want to create and edit it.
def call_vim(files, filename): call(["vim", filename]) # This needs to be able to recursively search the sub-tree. # if filename in files: # call(["vim", filename]) # else: # if ask_yes_no(input("File not found. Do you want to make it? [Y/n]: ")): # call(["touch", filename]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(filename, log):\n cmd = shlex.split(util.editor_command())\n cmd.append(filename)\n log.debug('invoking editor command: {!r}', cmd)\n try:\n subprocess.call(cmd)\n except OSError as exc:\n raise ui.UserError('could not run editor command {!r}: {}'.format(\n cmd[0], ...
[ "0.7178173", "0.699162", "0.69802445", "0.697654", "0.6288128", "0.6169402", "0.6119304", "0.59246784", "0.5866183", "0.5720411", "0.57178193", "0.569094", "0.55070573", "0.53896147", "0.535432", "0.53375745", "0.53329104", "0.5318311", "0.52834195", "0.52833545", "0.52690345...
0.7668946
0
Splits contents into a list of chunkgraphs, then returns whichever one starts with the query string.
def find_query(contents, query): for chunk in re.compile("\n\s*\n").split(contents): if chunk.startswith(query): return chunk return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_chunk(chunk: List) -> List[List]:\n encoded = urlencode({'queries': json.dumps(chunk)})\n if len(encoded) > URL_MAX_LENGTH:\n # Split chunk in half to avoid HTTP 414 error.\n mid = len(chunk) // 2\n left, right = chunk[:mid], chunk[mid:]\n # Recurse in case either half i...
[ "0.54413694", "0.504142", "0.50210166", "0.5001716", "0.4932502", "0.48620328", "0.48263308", "0.48154554", "0.4720556", "0.47133932", "0.47098678", "0.47072792", "0.4701924", "0.47018117", "0.4687214", "0.46782568", "0.46581483", "0.46293473", "0.4620499", "0.46165976", "0.4...
0.58616006
0
Create an up layer merging from across and down.
def UpTier(conv_size): def create_tier(down_inputs, across_inputs): up_layer = UpSampling2D(size=(2, 2))(down_inputs) up_conv_layer = Conv2D(conv_size, 2, **conv2d_args)(up_layer) merge_layer = concatenate([across_inputs, up_conv_layer], axis=3) final_layer = Conv2D(conv_size, 3, **c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_on_top(\n low_layer: np.array,\n high_layer: np.array,\n width: int,\n height: int,\n with_shadow: bool = False,\n) -> np.array:\n merged_layer = np.copy(low_layer)\n\n for row in range(height):\n for col in range(width):\n if high_layer[row, col] != 0:\n ...
[ "0.6006087", "0.5796177", "0.5700677", "0.5669941", "0.5553703", "0.54763246", "0.54499584", "0.5401903", "0.53444487", "0.5275303", "0.52343863", "0.51989996", "0.5179562", "0.51538247", "0.51495594", "0.5137149", "0.5114667", "0.51077306", "0.507607", "0.50574857", "0.50564...
0.58183885
1
Return int(s), float(s) or s if unparsable. Also returns s if s starts with 0 unless it is "0" or starts with "0." (and therefore can't be treated like a number)
def try_parse_number(s): if s.startswith("0") and len(s) != 1 and not s.startswith("0."): return s # Try parsing a nmeric try: return int(s) except ValueError: # Try float or return s try: return float(s) except: return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2num(s):\n if s.is_constant() and (s.is_float() or s.is_integer()):\n return True, s.compute_value()\n elif s.functor == \".\":\n values = term2list(s)\n numvalues = []\n for value in values:\n if isinstance(value, int) or isinstance(value, float):\n ...
[ "0.74815905", "0.7299863", "0.7111118", "0.7093674", "0.70607793", "0.7010791", "0.696104", "0.6956661", "0.6915342", "0.688626", "0.6861667", "0.68444234", "0.6841532", "0.6832864", "0.6798507", "0.67788756", "0.67172396", "0.66896385", "0.6683508", "0.6664536", "0.6659144",...
0.784655
0
Request to drop the 'pixresolution' table.
def drop_pixresolution(self): try: with self.connect_db: request = """DROP TABLE IF EXISTS pixresolution""" self.connect_db.execute(request) self.connect_db.commit() except Exception: super_logger.error('Error drop_pixresolution', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(self):\n c = self.cursor()\n for table in ['experiment','fact']:\n c.execute(\"drop table if exists {}\".format(table))\n self.commit()", "def clean(self):\n cursor = self.cnx.cursor()\n cursor.execute(\"DROP TABLE IF EXISTS FileNameFilter_scores\")\n ...
[ "0.5950611", "0.5775712", "0.5767471", "0.568143", "0.5622443", "0.56171983", "0.5606275", "0.55575925", "0.55477786", "0.5544393", "0.55332094", "0.5500657", "0.54984605", "0.54748696", "0.5469321", "0.5455257", "0.54504997", "0.54496384", "0.5448268", "0.5432212", "0.542740...
0.902552
0
Request to drop the 'iphone' table.
def drop_iphone(self): try: with self.connect_db: request = """DROP TABLE IF EXISTS iphone""" self.connect_db.execute(request) self.connect_db.commit() except Exception: super_logger.error('Error drop_iphone', exc_info=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_drop(self, table):\n\n stmt = 'DROP TABLE %s' % table\n\n curs = self.cursor()\n try:\n curs.execute(stmt)\n except sqlite3.OperationalError:\n pass\n finally:\n curs.close()", "def drop_table_if_exists(self, table): \n result...
[ "0.68466336", "0.67746574", "0.6711485", "0.6674761", "0.66522896", "0.6639538", "0.6618974", "0.659434", "0.6580337", "0.6568335", "0.65665966", "0.6554788", "0.6544416", "0.65135497", "0.65043604", "0.6418039", "0.63892645", "0.63843477", "0.6384087", "0.6375715", "0.631657...
0.8404928
0
Request to drop the 'user' table.
def drop_user(self): try: with self.connect_db: request = """DROP TABLE IF EXISTS user""" self.connect_db.execute(request) self.connect_db.commit() except Exception: super_logger.error('Error drop_user', exc_info=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_user_table(self,connection):\n sql=\"\"\"DROP TABLE IF EXISTS users CASCADE\"\"\"\n cursor = connection.cursor()\n cursor.execute(sql)", "def drop_tables(self):\n con = self.connect()\n cursor = con.cursor()\n cursor.execute(\"\"\"DROP TABLE IF EXISTS users CA...
[ "0.774572", "0.7507122", "0.7218817", "0.71750665", "0.7159698", "0.71408045", "0.7046719", "0.6905389", "0.68976927", "0.6788407", "0.6779718", "0.67258704", "0.6719753", "0.67018086", "0.6688449", "0.66728294", "0.6656121", "0.6644471", "0.6644471", "0.6644471", "0.6644471"...
0.85150146
0
Split list using a regex.
def list_by_re_pattern(list_to_be_splited, pattern): return [(i, val) for i, val in enumerate(list_to_be_splited) if match(pattern, val)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_input_list(str_list):\r\n\r\n new_list = re.split(r'[\\n\\r\\s,]', str_list)\r\n new_list = [s.strip() for s in new_list]\r\n new_list = [s for s in new_list if s != '']\r\n\r\n return new_list", "def _regex_split(pattern, string):\n splits = list((m.start(), m.end()) for m in re.findit...
[ "0.68350315", "0.6757449", "0.63662285", "0.6267726", "0.62359667", "0.6215278", "0.61809784", "0.61306906", "0.6074248", "0.6048792", "0.60384667", "0.6031578", "0.59642184", "0.5931439", "0.5929772", "0.5880159", "0.5869812", "0.5859514", "0.58379793", "0.58108455", "0.5802...
0.7037024
0