query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Resize an image to a square image (width = height = side)
def resize_image(image, side): cv2.imshow("Original", image) small = cv2.resize(image, (side,side), interpolation = cv2.INTER_AREA) return small
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square(img):\n\n # image after making height equal to width\n squared_image = img\n\n # Get image height and width\n h = img.shape[0]\n w = img.shape[1]\n\n # In case height superior than width\n if h > w:\n diff = h-w\n if diff % 2 == 0:\n x1 = np.zeros(shape=(h, ...
[ "0.7255887", "0.70602775", "0.7035608", "0.70195657", "0.6944379", "0.6938678", "0.68413717", "0.67514956", "0.6735933", "0.6733177", "0.67089653", "0.6696039", "0.6657528", "0.65651417", "0.6562902", "0.65581095", "0.6549727", "0.65445", "0.6524752", "0.651283", "0.65066546"...
0.74849427
0
Create and return a new object. See help(type) for accurate signature.
def __new__(*args, **kwargs): # real signature unknown pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_object():\n return object()", "def create(cls, _):\n return cls", "def __newobj__(cls, *args):\n return cls.__new__(cls, *args)", "def create(cls):\n pass\n return cls()", "def __new__(cls):\n return object.__new__(cls)", "def __new__(cls):\n return objec...
[ "0.75214255", "0.7425395", "0.72271156", "0.72245073", "0.70972306", "0.70972306", "0.7059875", "0.70065236", "0.6914606", "0.6869051", "0.6815517", "0.6813204", "0.6802906", "0.6692112", "0.6628181", "0.6586047", "0.6570168", "0.6557733", "0.65474325", "0.65446", "0.6540515"...
0.0
-1
Metode inisialisasi ini menutupi metode inisiasi di class Manusia.
def __init__(self,nama,NIM,kota,us): self.nama = nama self.NIM = NIM self.kotaTinggal = kota self.uangsaku = us
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moi(self):\n\n pass", "def mezclar_bolsa(self):", "def addMetaMolecule (self,metaMolecule):\r\n self.metaMolecule = metaMolecule", "def __init__(self, sistema, nombre):\r\n productos = sistema.productos\r\n\r\n self.nombre = nombre\r\n # TODO modificar con datos reales\...
[ "0.64187473", "0.58613336", "0.5816301", "0.5751989", "0.56940377", "0.5667595", "0.55650306", "0.54975575", "0.546282", "0.5429405", "0.54250157", "0.54116684", "0.53965193", "0.538739", "0.5383455", "0.5338215", "0.53378356", "0.53274345", "0.53178775", "0.52964056", "0.525...
0.56243914
6
Variant is the number of houses that has to be placed, resolution changes the size of the map and loops is the amount of rounds the algorithm shoud look for a better solution
def startGeneration(variant, resolution, loops): # Check for valid resolution if resolution % 2 != 0: print ("Resolution should be an even integer.") return # Set high score: if variant == 20: high_score = 11365950 if variant == 40: high_score = 17858670 if varia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_points_ascending_hillclimber(house, all_houses, waters, total_value_map):\n total_value_map_NEW = total_value_map\n\n # check in welke range het huis geplaats kan worden, niet kijkend naar water of andere \n rangex = MAXIMUM_WIDTH - house.width\n rangey = MAXIMUM_HEIGHT - house.length\n\n ...
[ "0.6033722", "0.588629", "0.58354026", "0.57623374", "0.5724886", "0.56725067", "0.5625394", "0.5621047", "0.56147605", "0.56", "0.55322355", "0.55315334", "0.5521285", "0.5412654", "0.5357182", "0.53541523", "0.53317034", "0.5319103", "0.52973694", "0.52739733", "0.5271306",...
0.6851993
0
Input is a grid and an instance of the house class. It calls placeHouse function using random coordinates.
def genHome(grid, house): house.random_x(grid) house.random_y(grid) return generic.placeHouse(grid, 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.6998493", "0.6979279", "0.6193127", "0.6015307", "0.59624696", "0.59511083", "0.5789173", "0.57785887", "0.5760649", "0.57373405", "0.5723482", "0.56952333", "0.56909704", "0.5664013", "0.5663497", "0.5659337", "0.56584257", "0.56440085", "0.5634831", "0.5631952", "0.56127...
0.75639224
0
Takes as input a grid and outputs a list containing
def genWater(grid, resolution): grid_surface = len(grid) * len(grid[0]) # Amount of surface for the water. allowed_surface = round(0.2 * grid_surface) # Collection of the created surfaces water_surfaces = [] # Min size of one water piece. min_single_size = 4 * resolution run = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gridToList(self, grid):\n gridList =[]\n for i in range(grid.width):\n for j in range(grid.height):\n if grid[i][j] == True:\n # print \"grid[i][j]\", grid[i][j]\n gridList.append((i,j))\n return gridList", "def gridToList(grid):\n gridLis...
[ "0.78495634", "0.7654676", "0.75424135", "0.74616915", "0.7264568", "0.71735483", "0.71463656", "0.70927745", "0.7089206", "0.7063631", "0.70555377", "0.7003385", "0.69817066", "0.69702137", "0.6962073", "0.69454646", "0.685495", "0.685351", "0.6762203", "0.67029566", "0.6670...
0.0
-1
Postprocess a detectionrecord in order to easily use it for training a predictor with accept_prob_predictor.py
def create_training_record(data_path: str, path_to_gt: str, ratio: float): with open(data_path) as file: data = json.load(file) base = os.path.join(os.path.dirname(data_path), datetime.now().strftime('%Y_%m_%d_%H%M%S')) train_filename = '{}_{}'.format(base, 'train.tfrecords') test_filename = '{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process_predictions(self, labels, scene):\n pass", "def postprocess(self, prediction_dict, **params):\r\n pass", "def process_record(self, record):\n raise NotImplementedError('Process record needs to be customized')", "def parse_record(raw_record, is_training, dtype):\n\n te...
[ "0.63738376", "0.6303579", "0.62267673", "0.61075026", "0.5884455", "0.5833256", "0.5785694", "0.57593364", "0.56785333", "0.56757754", "0.56540614", "0.56361574", "0.56000036", "0.5582407", "0.5556888", "0.55348086", "0.5525903", "0.55128163", "0.5471748", "0.5465673", "0.54...
0.0
-1
Lambda function handler for XTRACTA integration
def handler(event, context=None): LOGGER.info(event) result = {'status':'400', 'messages':'Error'} bucket = event["Records"][0]["s3"]["bucket"]["name"] key = unquote_plus(event["Records"][0]["s3"]["object"]["key"].encode("utf8")) obj = S3.get_object(Bucket=bucket, Key=key) document_file = (key, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(Event, Context):\n if 'StateMachineArn' in Event.keys():\n step_function_arn = Event['StateMachineArn']\n r = step_function_client.start_execution(\n stateMachineArn=step_function_arn,\n input=json.dumps({\"last_updated\": \"\"}))\n\n else:\n step...
[ "0.64417785", "0.64038795", "0.64038795", "0.62402904", "0.62250394", "0.6197988", "0.61637074", "0.600204", "0.5985922", "0.5981598", "0.59712094", "0.5932418", "0.58815515", "0.58661216", "0.5865635", "0.58452535", "0.58080435", "0.58060145", "0.57816565", "0.5763179", "0.5...
0.5237749
89
Mapping master_document_id to xtracta workflow id
def get_workflow_id(master_document_id): workflow_id = WORKFLOW_MAPPING.get(master_document_id) return workflow_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_workflows_id_get(self):\n pass", "def workflow_id(self):\n if self._workflow_id is None and self.workflow_loaded():\n workflow, _ = self.get_workflow()\n self._workflow_id = workflow.id\n\n return self._workflow_id", "def test_workflows_id_patch(self):\n ...
[ "0.59178025", "0.58331275", "0.5775823", "0.57322353", "0.56916577", "0.55855453", "0.55352056", "0.5527326", "0.55247635", "0.54731137", "0.54303414", "0.53976077", "0.52327216", "0.52293485", "0.5224544", "0.51767606", "0.51365936", "0.51099974", "0.51084536", "0.51076734", ...
0.7897448
0
Update the status of the document in the smart_document table
def insert_document(xtracta_document_id, lendi_document_id, workflow_id, status): #Connection to the database result = {'status':'400', 'message':'Error to connect to db', 'document_id':''} try: conn = dbconnector.connect(**DATABASES['lendi_ai']) except dbconnector.Error: LOGGER.exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_document(self):\n pass", "def _update_status(self):\n self._db_update({'status': self.status})", "def update(self, doc):\n if app.config.get(\"READ_ONLY_MODE\", False) and app.config.get(\"SCRIPTS_READ_ONLY_MODE\", False):\n app.logger.warn(\"System is in READ-ONLY mo...
[ "0.7181111", "0.66297424", "0.6217687", "0.61775184", "0.60986674", "0.6046923", "0.59986037", "0.5936424", "0.59112144", "0.589143", "0.58787686", "0.586315", "0.58525366", "0.574423", "0.574423", "0.5706667", "0.5706382", "0.5691729", "0.5691521", "0.56845576", "0.5677966",...
0.0
-1
Get document from XTRACTA based on document_id
def get_document_from_xtracta(document_id): response = None response = requests.post(XTRACTA['url']+"documents", data={"submit":"Submit",\ "api_key":XTRACTA['key'],\ "document_id":document_id}) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_document(self, docid):\n raise NotImplementedError", "def get_document_by_id(document_id):\n return Documents.query.filter_by(id=document_id).first()", "def retrieve(document_id: str) -> Fulltext:\n return current_session().retrieve(document_id)", "def document(self, document_id):\r\...
[ "0.7611445", "0.7408272", "0.7046423", "0.68967134", "0.6668736", "0.6636387", "0.66137767", "0.6546737", "0.65452653", "0.6492808", "0.6488995", "0.6436565", "0.6424351", "0.64181244", "0.63924766", "0.63828534", "0.63728637", "0.635899", "0.632777", "0.6318808", "0.6296382"...
0.82048696
0
Upload document to XTRACTA based on document_id
def upload_document_to_xtracta(workflow, document_file): response = None file = {"userfile":document_file} response = requests.post(XTRACTA['url']+"documents"+"/"+"upload",\ files=file, data={"submit":"Submit", "api_key":XTRACTA['key'],\ "workflow_id"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_doc():\n file = request.files[\"file\"]\n meta_data = {\"name\": request.form[\"name\"].lower()}\n file_id = save_file(meta_data, file)\n print('file-id: ' + file_id)\n index_after_uploading(file_id)\n return jsonify({\"file_id\": file_id})", "def get_document_from_xtracta(document_...
[ "0.6871023", "0.6805021", "0.6690708", "0.6596134", "0.65866995", "0.6406619", "0.6367324", "0.63114834", "0.6254257", "0.61851346", "0.61786866", "0.6057179", "0.6016124", "0.5928141", "0.59106", "0.5906524", "0.58953094", "0.5895309", "0.58747303", "0.58572143", "0.5839104"...
0.7220496
0
Return a day as a table cell.
def formatday(self, day, weekday, events): events_from_day = events.filter(day__day=day) events_html = "<ul>" for event in events_from_day: events_html += event.get_absolute_url() + "<br>" events_html += "</ul>" if day == 0: return '<td class="noday">&nbs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatday(self, day, weekday):\r\n if day == 0:\r\n return '<td class=\"noday\">&nbsp;</td>' # day outside month\r\n else:\r\n if len(self.worktimes.filter(day=weekday+1))==0:\r\n return '''\r\n <td class=\"%s\">\r\n <...
[ "0.67893255", "0.64169925", "0.6343143", "0.6303392", "0.62195915", "0.59166765", "0.590449", "0.5881711", "0.57823145", "0.5748522", "0.5743581", "0.56981665", "0.5686068", "0.5662388", "0.5661434", "0.5656333", "0.56043684", "0.56010914", "0.56006336", "0.55943596", "0.5575...
0.66491044
1
Return a complete week as a table row.
def formatweek(self, theweek, events): s = ''.join(self.formatday(d, wd, events) for (d, wd) in theweek) return '<tr>%s</tr>' % s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatWeekHeader(self):\n s = ''.join(self.formatWeekDay(i) for i in self.iterweekdays())\n return '<tr>%s</tr>' % s", "def formatweek(self, theweek, schedules):\n s = ''.join(self.formatday(d, wd, schedules) for (d, wd) in theweek)\n return '<tr>%s</tr>' % s", "def formatweekhe...
[ "0.7189514", "0.69993424", "0.6893345", "0.6708384", "0.63470304", "0.628649", "0.6121799", "0.6001106", "0.59045076", "0.5854563", "0.5730193", "0.5729441", "0.566795", "0.5629985", "0.559184", "0.55640805", "0.5560718", "0.55485463", "0.5532377", "0.5520608", "0.5500528", ...
0.71608937
1
Return a formatted month as a table.
def formatmonth(self, theyear, themonth, withyear=True): events = Event.objects.filter(day__month=themonth) v = [] a = v.append a('<table border="0" cellpadding="0" cellspacing="0" class="month">') a('\n') a(self.formatmonthname(theyear, themonth, withyear=withyear)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatMonth(self, theyear, themonth, withyear=True):\n html = ('<table class=\"month\">\\n%s\\n%s\\n'\n % (self.formatMonthName(theyear, themonth,\n withyear=withyear), self.formatWeekHeader()))\n weeks = self.monthdatescalendar(theyear, themonth)\n fo...
[ "0.7134699", "0.7002023", "0.65425044", "0.64765465", "0.63949794", "0.61361825", "0.6074644", "0.6062721", "0.6062721", "0.5965839", "0.5939903", "0.5879206", "0.5876679", "0.58666515", "0.5848568", "0.5828335", "0.5827049", "0.5825652", "0.58041704", "0.57771266", "0.574493...
0.7155175
0
Function to randomly select TOTAL_TEST_FILES from the POS_DIR_PATH and NEG_DIR_PATH
def get_test_train_files_split() -> str: pos_files_list = [os.path.join(POS_DIR_PATH, file_name) for file_name in os.listdir(POS_DIR_PATH)] neg_files_list = [os.path.join(NEG_DIR_PATH, file_name) for file_name in os.listdir(NEG_DIR_PATH)] test_files_list = [] random_files_index = random.sample(range(le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_random_elements(\n basedir: str, n_dirs: int, n_files: int, onfail: str = \"raise\"\n) -> Tuple[List[Path], List[Path]]:\n alldirs = []\n allfiles = []\n for root, dirs, files in os.walk(str(basedir)):\n for d in dirs:\n alldirs.append(Path(root) / d)\n for file in f...
[ "0.60715747", "0.5966422", "0.5932681", "0.5914077", "0.58858365", "0.5881185", "0.5820345", "0.5797507", "0.5773249", "0.57173306", "0.57066214", "0.57044", "0.5703326", "0.56919885", "0.5687747", "0.5682543", "0.56691974", "0.56612897", "0.56592804", "0.565059", "0.5649891"...
0.7139843
0
This function strips all characters in the list and removes any strings that begin with a ';'
def clean_lexicon_list_words(l: list) -> list: clean_l = map(str.strip, l) #Remove trailing '\n' chars clean_l = [s for s in clean_l if not s.startswith(';')] #Remove initial explanation text return clean_l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_special_characters(string_list):", "def clean(source_name):\n with open(source_name, 'r') as f:\n text = f.read()\n text_list = re.split('; |, |\\n| |\\!|\\?', text)\n if '' in text_list:\n text_list = list(filter(lambda x: x != \" \" and x != \"\", text_list))\n return text_...
[ "0.6740119", "0.65770775", "0.6347542", "0.63399696", "0.6244524", "0.601168", "0.59749085", "0.5968724", "0.5948834", "0.58929855", "0.58916974", "0.5852751", "0.583452", "0.58319706", "0.58059204", "0.5775026", "0.572425", "0.56963515", "0.5658292", "0.560861", "0.5607881",...
0.600932
6
Function to tokenize a sentence (break up into words) based on the TOKENIZER regex
def tokenize(text: str) -> list: TOKENIZER = re.compile(f'([!"#$%&\'()*+,-./:;<=>?@[\\]^_`|~“”¨«»®´·º½¾¿¡§£₤‘’\n\t])') return TOKENIZER.sub(r' \1 ', text).split()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(sentence):\n return nltk.word_tokenize(sentence)", "def tokenize(sentence):\n ret = []\n #for token in re.split('\\W+', sentence):\n for token in sentence.split(' '):\n token = token.strip()\n if not len(token):\n continue\n if token[-1] == '.' or token[-1...
[ "0.78913397", "0.7821764", "0.77582806", "0.7687089", "0.7668706", "0.76109326", "0.75864846", "0.7557652", "0.7526917", "0.7497942", "0.7435132", "0.73910666", "0.73733234", "0.7371356", "0.7359411", "0.7332259", "0.7331818", "0.7313859", "0.7303731", "0.72848535", "0.727875...
0.0
-1
Returns whether a string is a number or not
def is_digit_regex(s: str) -> bool: if re.match("^\d+?\.\d+?$", s) is None: return s.isdigit() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.8744992", "0.872017", "0.86263174", "0.861253", "0.8594354", "0.8553676", "0.8550075", "0.8513001", "0.8513001", "0.8513001", "0.84561634", "0.8438337", "0.8430808", "0.8331034", "0.83163124", "0.8291856", "0.82304853", "0.82140267", "0.8140006", "0.8120189", "0.81172305",...
0.7522996
48
Function to count how many tokens are in the positive and negative lexicon word list passed in
def get_pos_neg_word_count(tokens: list, pos_lex_words: set, neg_lex_words: set) -> tuple: positive_words = 0 negative_words = 0 for token in tokens: if token and len(token) > 1 and\ (token not in string.punctuation) and\ not is_digit_regex(token):\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lexicon_features(tokens, feats):\n# feats['neg_words'] = 0;\n# feats['pos_words'] = 0;\n# tokens = list([token.lower() for token in tokens])\n# feats['neg_words'] , feats['pos_words'] = np.count_nonzero(np.in1d(tokens, list(neg_words))), np.count_nonzero(np.in1d(tokens, list(pos_words)))\n n...
[ "0.7245609", "0.69737387", "0.6767516", "0.66683203", "0.65738237", "0.6470758", "0.63966507", "0.63769865", "0.6356329", "0.6353296", "0.6329496", "0.6297136", "0.6279287", "0.62308764", "0.6209839", "0.6166272", "0.61583793", "0.6126984", "0.6107725", "0.6107423", "0.610390...
0.8004957
0
This is the main function for building a Sentiment lexiconbased classifier.
def analyze_sentiment(test_files_list: list, classification_dict: dict): # Lexicon words used for sentiment analysis pos_lex_words = get_lexicon_words(POS_LEXICON_DIR_PATH) neg_lex_words = get_lexicon_words(NEG_LEXICON_DIR_PATH) classification_scores = [] true_labels = [] for file in test_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # process CLI arguments\n argparser = argparse.ArgumentParser(description=\"\"\"Script for classifying\ntweets according to their sentiment polarity\"\"\")\n\n subparsers = argparser.add_subparsers(help=\"type of operation to perform\", dest = \"mode\")\n # training options\n tr_parser...
[ "0.6939597", "0.6833205", "0.6580828", "0.657428", "0.63617766", "0.63403374", "0.6297269", "0.62610763", "0.61896724", "0.6151147", "0.6145866", "0.61110127", "0.6017235", "0.60049057", "0.6000399", "0.59801614", "0.59330106", "0.5911189", "0.58998835", "0.5891524", "0.58866...
0.60297054
12
Decorator for wrapping functions that enter a system context. This should decorate every method a user might call. This will allow us to add differentiation between what is a user error and what is a system failure. Furthermore, we will clean the exception trace so as to make more sense to the userallowing them to know...
def system_entry_point(wrapped, instance, args, kwargs): try: _CONTEXT_STACK.append(_SYSTEM_CONTEXT) if _is_base_context(): try: return wrapped(*args, **kwargs) except FlyteScopedException as ex: _reraise(ex.type, ex.value, ex.traceback) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_exceptions(callable):\r\n def wrapper(self, *args, **kwargs):\r\n try:\r\n return callable(self, *args, **kwargs)\r\n except EnvironmentError:\r\n # ENOENT (no such file or directory) gets raised on open().\r\n # ESRCH (no such process) can get raised on r...
[ "0.62283856", "0.6204277", "0.6075031", "0.60119647", "0.6009196", "0.5977504", "0.5926194", "0.5922835", "0.5898166", "0.58828527", "0.5882718", "0.5881702", "0.5851216", "0.5849375", "0.58470154", "0.5820462", "0.58026505", "0.57045597", "0.56874484", "0.56868964", "0.56848...
0.66706175
0
Decorator for wrapping functions that enter into a user context. This will help us differentiate usercreated failures even when it is reentrant into system code.
def user_entry_point(wrapped, instance, args, kwargs): try: _CONTEXT_STACK.append(_USER_CONTEXT) if _is_base_context(): try: return wrapped(*args, **kwargs) except FlyteScopedException as ex: _reraise(ex.type, ex.value, ex.traceback) el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_context(f):\n\n def wrapper(*args, **kwargs):\n if not is_admin_context(args[0]) and not is_user_context(args[0]):\n raise exception.NotAuthorized()\n return f(*args, **kwargs)\n return wrapper", "def require_context(f):\n\n def wrapper(*args, **kwargs):\n if ...
[ "0.69888574", "0.69888574", "0.68860686", "0.68860686", "0.6463882", "0.6316225", "0.62956756", "0.6238051", "0.6233132", "0.61962813", "0.6181068", "0.6174694", "0.61637056", "0.61579674", "0.61337996", "0.61075824", "0.60950094", "0.60907435", "0.6056834", "0.6050342", "0.6...
0.6583386
4
Identify the input file to work with.
def get_arguments(): parser = argparse.ArgumentParser(description=""" Yield a sorted frequency count of similar/dissimilar InChi DW/OpenBabel. """) parser.add_argument( "file", help="DataWarrior's list file exported after running the macro.") args = parser.parse_args() data = args....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_input_file(self):\n pass", "def identify_file(self, file):", "def imagefile(self):\n return self.__inputfilename", "def input_file(self):\n if not self.input_file_generated():\n return None\n if self.input_static is False:\n return self._input_gener...
[ "0.73736244", "0.7030968", "0.6811661", "0.6710594", "0.664603", "0.66197366", "0.6463795", "0.6455836", "0.64458615", "0.6415382", "0.6317847", "0.62802714", "0.6263071", "0.6253498", "0.6240869", "0.62197393", "0.62092394", "0.6194203", "0.61824256", "0.61271274", "0.611811...
0.0
-1
Analysis of DW's listing file.
def scrutiny(raw_data=""): # Per molecule in DW's listing file, extract count of stereo centres, # cistrans double bonds, and assigned diff_inchi label. survey = [] with open(raw_data, mode="r") as source: for line in source: line = str(line).strip() data = line.split("\t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listfile(self):\n print(\"Opened file(s):\")\n for f in self.fmap:\n print('\\t%s'%(self.files.index(self.fmap[f])),end=':')\n print(f)\n print(\"active file(s):\")\n for i in range(len(self.handle)):\n print('\\t%s'%(self.handle[i]),end=':')\n ...
[ "0.5974511", "0.5859134", "0.5744215", "0.56534886", "0.5642017", "0.5604874", "0.55843204", "0.5560721", "0.5558318", "0.55484635", "0.553514", "0.5526004", "0.54719096", "0.5466519", "0.54644436", "0.54643655", "0.5452854", "0.5415639", "0.54097414", "0.54084694", "0.540358...
0.5723729
3
computes the distance of a given cell to the enemy position
def dist(dm, sm, neighbors): # Initialize list of possible distances distances = [] # loop over all neighbors of the cell for neighbor in neighbors: # If the neighbor is valid if dm[neighbor[0], neighbor[1]] != -1: # add neighbor distance + 1 to possible distances ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(unit, tile):\n return abs(tile['x'] - unit['x']) + abs(tile['y'] - unit['y'])", "def distance_to_location(self, row, col):\n return float(sqrt(pow(self._row - row, 2) + pow(self._col - col, 2)))", "def measure_distance(cell1, cell2):\n\n\tx1, y1 = cell1.location\n\tx2, y2 = cell2.location\n\...
[ "0.67895997", "0.6736873", "0.6661446", "0.6541716", "0.6479071", "0.64211947", "0.64211947", "0.63727576", "0.6362925", "0.6362459", "0.6351663", "0.6339557", "0.63383836", "0.6333318", "0.6301942", "0.62578773", "0.625512", "0.6253803", "0.62491465", "0.62274194", "0.622731...
0.0
-1
0, None, or (mu,sigma). None implies default mu,sigma.
def _validate_init_control(self, v): if v is None or v == 0: return v if len(v) == 2: return tuple([float(x) for x in v])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mu=1.0, sigma=1.0):\n self.mu = float(mu)\n self.sigma = float(sigma)", "def __init__(self, mu=None, sigma=1.):\n self.mu = mu\n self.sigmasqr = sigma**2", "def __init__(self, sigma=0.0001):\n self.sigma = sigma", "def get_sigma_psf(self):\n pass",...
[ "0.6586204", "0.6285884", "0.595974", "0.58598095", "0.58143145", "0.56923026", "0.5619846", "0.55469763", "0.5503677", "0.5475531", "0.5474628", "0.54724455", "0.5445041", "0.53961504", "0.5366206", "0.5353181", "0.53448004", "0.53446406", "0.53393626", "0.53305584", "0.5304...
0.47927254
66
Return a tuple of two ints from 1 or 2 intish things.
def _tuple_from_one_or_two_ints(self, v): try: a, b = [int(x) for x in v] except TypeError: a, b = int(v), int(v) return (a,b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_tuple(v: Union[int, Tuple[int, int]]) ->Tuple[int, int]:\n if torch.jit.isinstance(v, int):\n return v, v\n else:\n return v", "def _to_tuple(values: Union[int, Iterable[int]]) -> Tuple[int, ...]:\n try:\n return tuple(values)\n except TypeError:\n return (values,)"...
[ "0.7521668", "0.71872586", "0.67897296", "0.66056657", "0.6550124", "0.6381458", "0.63615984", "0.63500184", "0.63150114", "0.6306386", "0.6288212", "0.6223996", "0.6137928", "0.61346763", "0.6120724", "0.61114156", "0.6105132", "0.60968715", "0.6076315", "0.6074093", "0.6072...
0.81066763
0
Returns dictionary of placeholders that must be fed. Only valid after network() has been run.
def placeholders(self): rv = dict() for stage in self.stages: for name, ph_var in stage.placeholders: rv[name] = ph_var return rv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def placeholders(self):\n x = [i.placeholder for i in self._input_desc]\n return x[0] if len(x) == 1 else x", "def _validate_placeholders(self):\n if self.implementation.container is None:\n return\n\n valid_inputs = {} if self.inputs is None else self.inputs\n valid...
[ "0.6215448", "0.6073801", "0.592821", "0.5835194", "0.5761858", "0.5752826", "0.5747895", "0.56185067", "0.55785143", "0.557546", "0.5575306", "0.5567209", "0.5552609", "0.5547895", "0.5461414", "0.54389316", "0.5426337", "0.5407213", "0.5380769", "0.5353769", "0.5327057", ...
0.6491004
0
Checks if this notification should be sent or not
def check_ratelimit(db, notification_object, override=False): notification_priority = notification_object['priority_level'] to_username = notification_object['to_username'] if notification_priority == Priority.ALWAYS: logger.debug('PRIORITY ALWAYS Checking') return db.get_priority_count(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_notification(self) -> bool:\n return pulumi.get(self, \"send_notification\")", "def non_compliant_notification(self) -> bool:\n return pulumi.get(self, \"non_compliant_notification\")", "def non_compliant_notification(self) -> bool:\n return pulumi.get(self, \"non_compliant_notifi...
[ "0.7569572", "0.72110873", "0.72110873", "0.71615547", "0.7113662", "0.6953311", "0.6791438", "0.67768735", "0.65806925", "0.6497984", "0.6497984", "0.6497984", "0.6437435", "0.6412014", "0.6401645", "0.6398709", "0.63752735", "0.63381314", "0.6334512", "0.6313075", "0.628304...
0.0
-1
Handle /admin BOTNAME help.
def admin(frame): # pylint: disable=too-many-branches ctx, msg, modconf = frame.ctx, frame.msg, frame.value action, _, modname = frame.text.partition(' ') hidden = set(modconf.get('hidden', '').split()) if action == 'hide': if modname in hidden: msg.add('<code>%s</code> is alread...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _admin(self, ctx: commands.Context):\n await ctx.send_help()", "async def admin(self, ctx: MyContext):\n if ctx.subcommand_passed is None:\n await ctx.send_help(\"wormhole admin\")", "def help():\n print(UI.HELP)", "def help(update, context):\n update.message.reply_te...
[ "0.7525917", "0.7148767", "0.70828104", "0.70285386", "0.6917419", "0.69143015", "0.6775951", "0.67704237", "0.6763744", "0.6756615", "0.67479354", "0.67300075", "0.6721372", "0.6706166", "0.6705432", "0.6699269", "0.6699269", "0.6697536", "0.66724056", "0.66545403", "0.66353...
0.0
-1
Sopel setup method, called when module is started. This method resets all the variables used.
def setup(bot): global report global opened update_report("", "", "") set_state(CLOSED) print("Variable reset.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n self.ae = None", "def _setup(self) -> None:\n\t\treturn", "def setup(self):\n\t\tpass", "def setup( self ):", "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self):\n pass", "def _setup(self):\n ...
[ "0.74840987", "0.7481788", "0.7383563", "0.73656553", "0.7306061", "0.7306061", "0.7306061", "0.7306061", "0.7306061", "0.7300803", "0.7300803", "0.7280059", "0.7280059", "0.7280059", "0.7280059", "0.7280059", "0.7280059", "0.7280059", "0.7280059", "0.7280059", "0.7280059", ...
0.0
-1
Sopel shutdown method. Routed to setup() and thus resets all variables.
def shutdown(bot): setup(bot)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self):\n ...", "def shutdown(self):", "def shutdown(self):\n\n pass", "def shutdown(self) -> None:", "def shutdown(self) -> None:", "def shutdown(self):\n pass", "def shutdown(self):\n pass", "def shutdown(self):\n pass", "def clean_shutdown(self):\n\...
[ "0.77859575", "0.7727538", "0.7642009", "0.76403725", "0.76403725", "0.7598953", "0.7598953", "0.7598953", "0.7571384", "0.7523606", "0.75221574", "0.75134194", "0.7339365", "0.73235834", "0.7279762", "0.7197343", "0.71973217", "0.71973217", "0.7114111", "0.7098933", "0.70349...
0.74960816
12
Set given report as new report.
def update_report(new_report, reporttime, event_count): global report report[0] = new_report report[1] = reporttime report[2] = event_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report(self, report):\n\n self._report = report", "def _setReport(self, pReport):\n bytessent = self._dev.ctrl_transfer(bmRequestType = 0x21, # Set_Report Request\n bRequest = 0x09, # SET_REPORT\n wValue = 0x200, # report...
[ "0.8052028", "0.696197", "0.6782948", "0.67493016", "0.6552944", "0.64693487", "0.64693487", "0.64693487", "0.6305297", "0.6152705", "0.60862154", "0.6068365", "0.6068365", "0.6068365", "0.6029484", "0.60247356", "0.5828357", "0.58279073", "0.5821796", "0.5787036", "0.5654249...
0.59644437
16
Timed power status check routine. Called by Sopel on 10 second interval.
def monitor(bot): timestamp = datetime.now() # If the monitor status file exists, clubroom is open. if os.path.exists(STATUSFILE): if not get_state(): print(timestamp.strftime("[%d %b, %H:%M]") + " -- Open!") set_state(OPEN) # Randomly choose and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_power_limited(self):\n status = self.get_status_response()\n return ((status[1] & 0x10) == 0x10)\n #end is_power_limited()", "def power_status(self):\n raise NotImplementedError(\"ERROR: Unimplemented function.\")", "def lightleep(time_ms: int = None) -> None:", "def period...
[ "0.6624471", "0.6351741", "0.6328002", "0.6154194", "0.60556597", "0.59936625", "0.5932305", "0.5918719", "0.5918278", "0.59155035", "0.5906591", "0.58775216", "0.5814206", "0.5807348", "0.5790096", "0.5765544", "0.5765172", "0.5748555", "0.57038033", "0.56699675", "0.5635446...
0.0
-1
Topic process(bot, trigger, from_topic, topic_reset) Process only topics of given channel. Split current topic using "|" as separator. We assume that first part of the split topic is reserved for current status. Thus whatever is contained in this part is replaced with current status. If no "|" separators exist, replace...
def parse_topic(bot, trigger, from_topic, topic_reset):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_topic_change(bot, trigger):\n\tif len(trigger.args) == 1:\n\t\treturn # Empty TOPIC gets the current topic.\n\tchannel = trigger.args[0]\n\tlog(bot, channel, '*** {} changes topic to \"{}\"', trigger.nick, trigger.args[1]);", "def reset_topic(bot, trigger):\n global report\n\n if get_state():\n ...
[ "0.55901504", "0.5492897", "0.52117544", "0.5190746", "0.51528454", "0.5146953", "0.5138362", "0.507733", "0.50478727", "0.5047027", "0.5019809", "0.50074124", "0.49721324", "0.4848447", "0.4844749", "0.47917017", "0.4729333", "0.4674787", "0.46009457", "0.45672083", "0.45628...
0.72231275
0
report_handler(bot, new_report) Process new report into topic.
def report_handler(bot, new_report): event_count = report[2] # Count events and take report & time if event_count == 0: event_count = new_report.count("|") else: event_count += new_report.count("|") timestamp = datetime.now() reporttime = timestamp.strftime("[%H:%M]") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_report_tg(bot, trigger):\n new_report = trigger.group(0).split(\"eporting: \")[1]\n\n # Check preliminaries and then call report handler\n if trigger.sender == CHANNEL:\n if get_state():\n if new_report is None:\n # Silly...\n bot.reply(\"Informatio...
[ "0.64067423", "0.6079078", "0.59823257", "0.5917744", "0.58443093", "0.58145285", "0.58028007", "0.5755404", "0.5718759", "0.56281924", "0.56260574", "0.55986154", "0.5579969", "0.5579851", "0.55763656", "0.55205", "0.5470385", "0.5465731", "0.54592896", "0.54445344", "0.5433...
0.8357721
0
reset_topic(bot, trigger) Used to clear changes made to the topic by the bot. Also clears current report.
def reset_topic(bot, trigger): global report if get_state(): if is_reported(): for channel in bot.channels: bot.msg(channel, "Clearing my changes from topic") print("TOPIC RESET") parse_topic(bot, trigger, 0, 1) else: bot....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_report_from_topic(bot, trigger):\n if trigger.sender == CHANNEL:\n if get_state():\n bot.write(('TOPIC',), CHANNEL)\n parse_topic(bot, trigger, 1, 0)\n else:\n bot.reply(\"Sensors indicate that you must be mistaken.\")\n else:\n bot.reply(\"You h...
[ "0.6828663", "0.66188425", "0.6498818", "0.61289966", "0.5740045", "0.5717969", "0.5678631", "0.5288347", "0.5264879", "0.5252115", "0.5218302", "0.51682925", "0.51637286", "0.51555514", "0.51157296", "0.5100585", "0.50775653", "0.5051933", "0.50357884", "0.5031498", "0.50274...
0.90120465
0
take_report(bot, trigger) Preliminary sanity checks on new report after which the report is passed to handler.
def take_report(bot, trigger): # Check preliminaries and then call report handler if trigger.sender == CHANNEL: if get_state(): if trigger.group(2) is None: # Oh boy... bot.reply("Information content zero..") else: # Take report and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_report_tg(bot, trigger):\n new_report = trigger.group(0).split(\"eporting: \")[1]\n\n # Check preliminaries and then call report handler\n if trigger.sender == CHANNEL:\n if get_state():\n if new_report is None:\n # Silly...\n bot.reply(\"Informatio...
[ "0.77184224", "0.6597283", "0.6471456", "0.6050006", "0.5949276", "0.585307", "0.5423698", "0.5341602", "0.53049964", "0.5297914", "0.52932143", "0.529256", "0.5291882", "0.52771765", "0.5246162", "0.5241872", "0.5194986", "0.5186295", "0.5183256", "0.512548", "0.51198107", ...
0.7793067
0
take_report_tg(bot, trigger) Take report from telegram users.
def take_report_tg(bot, trigger): new_report = trigger.group(0).split("eporting: ")[1] # Check preliminaries and then call report handler if trigger.sender == CHANNEL: if get_state(): if new_report is None: # Silly... bot.reply("Information content zero.....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_report(bot, trigger):\n # Check preliminaries and then call report handler\n if trigger.sender == CHANNEL:\n if get_state():\n if trigger.group(2) is None:\n # Oh boy...\n bot.reply(\"Information content zero..\")\n else:\n # ...
[ "0.6437883", "0.6085747", "0.58172345", "0.5489603", "0.51390964", "0.5100913", "0.49046394", "0.48993888", "0.48883653", "0.48822558", "0.48745948", "0.48617592", "0.4833422", "0.48287883", "0.47916818", "0.47651523", "0.47533637", "0.47409648", "0.4722519", "0.47202516", "0...
0.686354
0
tale_report_from_topic(bot, trigger) Process a report request from topic.
def take_report_from_topic(bot, trigger): if trigger.sender == CHANNEL: if get_state(): bot.write(('TOPIC',), CHANNEL) parse_topic(bot, trigger, 1, 0) else: bot.reply("Sensors indicate that you must be mistaken.") else: bot.reply("You have to do this f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_topic(bot, trigger, from_topic, topic_reset):", "def take_report_tg(bot, trigger):\n new_report = trigger.group(0).split(\"eporting: \")[1]\n\n # Check preliminaries and then call report handler\n if trigger.sender == CHANNEL:\n if get_state():\n if new_report is None:\n ...
[ "0.64785373", "0.63892686", "0.58351517", "0.5721067", "0.57095695", "0.51564574", "0.48008454", "0.47865102", "0.47159374", "0.46900564", "0.4626033", "0.4594493", "0.45877644", "0.45565897", "0.45409906", "0.4495742", "0.44656736", "0.44615316", "0.4446827", "0.44167086", "...
0.7355818
0
status(bot, trigger) Status command, report current status to channel.
def status(bot, trigger): if get_state(): if is_reported(): bot.say("Last report was: " + report[0] + " at " + report[1]) else: response = random.randint(0, len(UNKNOWN_COMMENTS) - 1) bot.say(UNKNOWN_COMMENTS[response]) else: bot.say("Nothing is curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def status(self, context):\n await self.send_message(context, await self.status_msg_packed(context))", "async def status(self, ctx, *, status=None):\n # [p]set status <status>\n\n statuses = {\n \"online\": discord.Status.online,\n \"idle\": discor...
[ "0.7298816", "0.72063637", "0.71302694", "0.7092791", "0.69058675", "0.6794377", "0.6703658", "0.66455245", "0.6634766", "0.65599847", "0.65438527", "0.65194947", "0.6451947", "0.6447418", "0.6415836", "0.63635343", "0.6325386", "0.631007", "0.62898755", "0.62850565", "0.6260...
0.66672766
7
play(sound) Play given sound from defined SOUNDDIR. If not specified, does nothing
def play(sound): if SOUNDDIR != "": call(["aplay", SOUNDDIR + sound])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_sound(self, sound):\n try:\n if self.se_volume != 0:\n self.sound_lib[sound].play()\n except:\n print \"Couldn't play the sound '\", sound, \"'!\"", "def play_sound(self, sound) -> None:\n pass", "def playSound(self,sound):\n sound.play(...
[ "0.82288665", "0.81507856", "0.8060567", "0.79823667", "0.761578", "0.7580619", "0.7477844", "0.722535", "0.72210425", "0.72055215", "0.7147864", "0.7132323", "0.7117206", "0.70374626", "0.70054907", "0.70038426", "0.6989375", "0.69840586", "0.6981598", "0.69734263", "0.69456...
0.89302546
0
alert_signal(signum, stack) Function to be called when signal is received from doorbell
def alert_signal(signum, stack): if get_state(): play(DOORBELL_SND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler(signum, frame):\n m.signal()", "def handler(signum, frame):\n logging.warning(\"Got a {} signal. Doing nothing\".format(signum))", "def alarmhandler(signum, frame):\n signum = signum\n frame = frame\n raise AlarmException", "def signal_handler(self, signum):\n raise Exception(...
[ "0.69552094", "0.6942623", "0.6794785", "0.6709137", "0.66343784", "0.6615214", "0.6613414", "0.6583996", "0.6574192", "0.64988756", "0.64925855", "0.64427394", "0.6378109", "0.6301674", "0.62608254", "0.62308687", "0.61666477", "0.6140567", "0.61354727", "0.61339843", "0.613...
0.8009605
0
register a listener for eventClass type events The caller of EventManager.register must store the Connection which is returned in a list attribute in order for the listener to be automatically removed from the EventManager when that caller is deleted.
def register(self, eventClass, listener): LOGGER.debug("register %s" % eventClass.__name__) key = eventClass.__name__ if (hasattr(listener, '__self__') and hasattr(listener, '__func__')): # Wrap the callable if it is an instance method. listener = Even...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_listener ( cls, listener, class_name = '' ):\n MetaHasTraits._listeners.setdefault( class_name, [] ).append( listener )", "def register(self, event_type, callback,\n args=None, kwargs=None, details_filter=None,\n weak=False):\n if not six.callable(callback):\...
[ "0.63691604", "0.62791574", "0.60326046", "0.6025486", "0.6019247", "0.5945441", "0.59279853", "0.5871596", "0.5848477", "0.58279526", "0.5817841", "0.57959986", "0.57937294", "0.57539785", "0.57426494", "0.57278997", "0.56773615", "0.56583154", "0.5653645", "0.5632728", "0.5...
0.76873153
0
Test the ability to split the dim_N_header fields
def test_split_dim_header(): hdr_in = Hdr_Ext.from_header_ext( {'SpectrometerFrequency': [100.0, ], 'ResonantNucleus': ['1H', ], 'dim_5': 'DIM_DYN', 'dim_5_info': 'averages', 'dim_5_header': {'p1': [1, 2, 3, 4], 'p2': [0.1, 0.2, 0.3, 0.4]}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_split():\n nmrs = NIFTI_MRS(test_data_split)\n\n # Error testing\n # Wrong dim tag\n with pytest.raises(ValueError) as exc_info:\n nmrs_tools.split(nmrs, 'DIM_EDIT', 1)\n\n assert exc_info.type is ValueError\n assert exc_info.value.args[0] == \"DIM_EDIT not found as dimension tag....
[ "0.70561", "0.6739945", "0.6581336", "0.6157314", "0.6076363", "0.6067349", "0.6037094", "0.6031764", "0.6013476", "0.5951711", "0.58882964", "0.58772826", "0.5867258", "0.5857906", "0.58556885", "0.5738381", "0.5737253", "0.5734351", "0.57198685", "0.5713524", "0.57126564", ...
0.7777845
0
Test the ability to merge the dim_N_header fields
def test_merge_dim_header(): hdr_in_1 = Hdr_Ext.from_header_ext( {'SpectrometerFrequency': [100.0, ], 'ResonantNucleus': ['1H', ], 'dim_5': 'DIM_DYN', 'dim_5_info': 'averages', 'dim_5_header': {'p1': [1, 2, 3, 4], 'p2': [0.1, 0.2, 0.3, 0.4]}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_split_dim_header():\n hdr_in = Hdr_Ext.from_header_ext(\n {'SpectrometerFrequency': [100.0, ],\n 'ResonantNucleus': ['1H', ],\n 'dim_5': 'DIM_DYN',\n 'dim_5_info': 'averages',\n 'dim_5_header': {'p1': [1, 2, 3, 4],\n 'p2': [0.1, 0.2, 0.3, ...
[ "0.7518095", "0.63130283", "0.6131983", "0.60388684", "0.5994544", "0.59517586", "0.5851797", "0.58242273", "0.5728598", "0.5727216", "0.5703473", "0.568503", "0.56473434", "0.56400406", "0.5592178", "0.55870146", "0.5554662", "0.55400366", "0.55224055", "0.55090165", "0.5445...
0.78858435
0
Test the split functionality
def test_split(): nmrs = NIFTI_MRS(test_data_split) # Error testing # Wrong dim tag with pytest.raises(ValueError) as exc_info: nmrs_tools.split(nmrs, 'DIM_EDIT', 1) assert exc_info.type is ValueError assert exc_info.value.args[0] == "DIM_EDIT not found as dimension tag."\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self, splits, catchall=False):\r\n raise NotImplementedError()", "def test_split_feature(tree):\r\n print(\"test_split_feature()...\", end = \"\")\r\n assert (tree.process_split_feature() == True)\r\n print(\"Passed!\")", "def split_test_data():\n outputvis = ROOT_DIR + 'test_imaging/t...
[ "0.742798", "0.7305101", "0.70832115", "0.707626", "0.70721024", "0.7069411", "0.7030964", "0.69847304", "0.69262993", "0.6904356", "0.68954915", "0.68914276", "0.6865217", "0.68626124", "0.67914706", "0.6772114", "0.66572714", "0.66341937", "0.6629383", "0.6619216", "0.66073...
0.68653274
12
Test the merge functionality
def test_merge(): nmrs_1 = NIFTI_MRS(test_data_merge_1) nmrs_2 = NIFTI_MRS(test_data_merge_2) nmrs_bad_shape, _ = nmrs_tools.split(nmrs_2, 'DIM_COIL', 1) nmrs_no_tag = NIFTI_MRS(test_data_other) # Error testing # Wrong dim tag with pytest.raises(ValueError) as exc_info: nmrs_tools....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_merge_one():\n run_merge([2], [1], [1, 2])", "def test_merge_two_two():\n run_merge([1, 3], [2, 4], [1, 2, 3, 4])", "def test_merge(self):\n A = [1,4,6,7,8,2,3,4,5,7]\n p = 0\n q = 5\n r = 10\n A_merged = mst.merge(A, p, q, r)\n expected = [1, 2, 3, 4, 4...
[ "0.8044764", "0.7812677", "0.78110933", "0.7665403", "0.7606062", "0.7502166", "0.7367402", "0.73196834", "0.7256863", "0.7129972", "0.70882225", "0.7040338", "0.6974265", "0.6914942", "0.68824106", "0.67943406", "0.6699933", "0.66242814", "0.65895224", "0.6526845", "0.652486...
0.66210616
18
Construct a new movement announcement.
def __init__(self, movement: Movement, message: str, user: User): self.movement = movement self.message = message self.poster = user self.created_time = datetime.now() self.updated_time = None self.removed_time = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, pos):\n self.pos = pos", "def make_movetext(self, input, start, end, elements):\n mt = Movetext()\n for e in elements:\n if type(e.wcomment) == str:\n wcomment = e.wcomment\n else:\n wcomment = \"\"\n\n mcomment = \"...
[ "0.5662564", "0.5571824", "0.541672", "0.5415097", "0.53581494", "0.5340892", "0.5337541", "0.5314158", "0.52858454", "0.52231646", "0.52023035", "0.51937115", "0.5163608", "0.51530135", "0.51489055", "0.5131338", "0.51310277", "0.51046455", "0.50937015", "0.5085939", "0.5084...
0.6208744
0
Convert an announcement to json.
def to_json(self) -> dict: json_dict = { "id": self.id, "movement_id": self.movement_id, "poster": self.poster.to_json(), "message": self.message, "created_time": str(self.created_time.astimezone()) } if self.updated_time: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json(self):\n if self.valid:\n return {\n 'articleID': self._id,\n 'ticker_symbol': self.ticker,\n 'published_date': self.pub_date,\n 'author_name': self.author,\n 'title': self.title,\n 'text': self.tex...
[ "0.6051779", "0.6012607", "0.5895918", "0.5875261", "0.57886094", "0.5782429", "0.57796854", "0.5778346", "0.5774402", "0.57713", "0.57579416", "0.57488304", "0.57150453", "0.5713005", "0.5689563", "0.56489825", "0.5632943", "0.56286925", "0.56113124", "0.55800426", "0.557394...
0.6206867
0
Update the message of the announcement.
def update_message(self, message: str): self.message = message self.updated_time = datetime.now()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, msg):\n pass", "def update(self, message):\n return self.request().update(message)", "def update(self, msg):\n self.msgVar.set(msg)", "def update(self, msg):\r\n self.msgVar.set(msg)", "def update(self, msg):\r\n self.msgVar.set(msg)", "async def update...
[ "0.7527086", "0.7319726", "0.718939", "0.7075682", "0.7075682", "0.70619524", "0.68893784", "0.6799449", "0.64309204", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", "0.6297348", ...
0.7587067
0
Calculate the five number summary on a list of items Five number summary includes maximum, minimum, median, 25th percentile and 75th percentile
def five_num_summary(items): for num in items: s_list = sorted(items) n_max = np.max(s_list) n_med = np.median(s_list) n_q1 = np.percentile(s_list, 25) n_min = np.min(s_list) n_q3 = np.percentile(s_list, 75) D = { "max":n_max, "median":n_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def five_num_summary(items):\n sort_items = sorted(items)\n # assign minimum and maximum values of the list\n minimum = sort_items[0]\n maximum = sort_items[-1]\n # Calculating & Unpacking percentiles using Numpy\n x, y, z = np.percentile(items, [25, 50, 75])\n q1 = round(x, 2)\n med = roun...
[ "0.8869819", "0.86697614", "0.8409164", "0.80669975", "0.7534344", "0.63560724", "0.63442206", "0.6261507", "0.6257918", "0.6229704", "0.6098437", "0.6097574", "0.6046899", "0.603023", "0.60117185", "0.59580094", "0.5915846", "0.58917576", "0.58604455", "0.58404005", "0.58020...
0.8565285
2
Override to perform any special decoding before filter is applied
def _pre_filter_decode(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decoder(self):\n pass", "def decode(self, encoded):", "def _dinamic_decode(self):\n raise NotImplementedError", "def decode(self): # pragma: no cover\n pass", "def preprocess_raw(self):\n pass", "def decode(data): #@NoSelf", "def decode(self):\n if self._decoded:...
[ "0.6965735", "0.67332125", "0.6660794", "0.65154576", "0.64826334", "0.6411799", "0.6307839", "0.6212253", "0.6098016", "0.6077169", "0.6055751", "0.60075444", "0.5955589", "0.5955589", "0.592723", "0.58944446", "0.5846141", "0.5846141", "0.5846141", "0.5763023", "0.5763023",...
0.8819532
0
Override this to process an ethernet frame
def _decode_frame(self): self._processed.eth_frame.log(level=logging_helper.INFO) # Parse IP packets, protocol=0x8 if hex(self._processed.eth_frame.protocol) == u'0x8': self._processed.ip_frame = IPFrame(self._processed.eth_frame.payload) self._processed.ip_frame.log(le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, packet):\n pass", "def process(self, pkt):\n pass", "def main():\n connection = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.htons(0x03))\n\n # Start the main loop.\n while True:\n # 65536 is the biggest buffer size that can be used.\n raw_data, a...
[ "0.66927326", "0.6625298", "0.6436988", "0.63724154", "0.6301187", "0.6277163", "0.62646335", "0.61792684", "0.6045093", "0.59651387", "0.5932023", "0.5890164", "0.58770925", "0.5821221", "0.5798806", "0.57481873", "0.5731673", "0.56896305", "0.5667021", "0.5624094", "0.56182...
0.65261894
2
Extract JPEG or RGBD depth image
def get_image(data): global g_depth # https://stackoverflow.com/questions/12569452/how-to-identify-numpy-types-in-python if isinstance(data, np.ndarray): # https://www.learnopencv.com/applycolormap-for-pseudocoloring-in-opencv-c-python/ if g_danger_binary_image: img = np.array(de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depr_depth_images(self):\n if not hasattr(self, '_depr_depth_images'):\n depth_images = self._archive['gaps_depth']\n self._depr_depth_images = depth_images.reshape([1, 20, 224, 224, 1])\n return self._depr_depth_images", "def extract_depth(self, alpha_exr, outpath, vis=False):\n logge...
[ "0.69902235", "0.6593917", "0.6568915", "0.6446434", "0.6433199", "0.6269796", "0.6252449", "0.6142505", "0.61175454", "0.60880554", "0.6075832", "0.60743326", "0.60027", "0.59795", "0.59522736", "0.5938955", "0.5923436", "0.588116", "0.58666724", "0.58393604", "0.58351415", ...
0.61116344
9
Return parsed commandline arguments.
def ParseArgs(args): parser = commandline.ArgumentParser() parser.add_argument('--test_results_root', type='path', help='Directory to store test results') parser.add_argument('--board', type=str, help='Board (wolf, beaglebone...)') parser.add_argument('image_dir', type='path', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_command_line_arguments() -> Namespace:\n\n parser = build_parser()\n arguments = parser.parse_args()\n\n return arguments", "def get_args():\n\n parser = get_argument_parser()\n args = parser.parse_args()\n\n return args", "def parse_arguments():\n arguments_parser = argparse.A...
[ "0.81010777", "0.7717105", "0.7666663", "0.76563144", "0.76208925", "0.76039207", "0.7585389", "0.7575028", "0.75655633", "0.75487566", "0.7541852", "0.75212586", "0.7512818", "0.75039715", "0.7503804", "0.74753106", "0.74748445", "0.74710023", "0.74678373", "0.74264115", "0....
0.0
-1
Return the path to the image file.
def FindImage(image_path): if os.path.isdir(image_path): # Assume base image. image_file = os.path.join(image_path, constants.BASE_IMAGE_NAME + '.bin') if not os.path.exists(image_file): raise ValueError('Cannot find base image %s' % image_file) elif os.path.isfile(image_path): image_file = i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imagePath(self):\n return self.path", "def get_pathname(self):\n return self.image_data.path", "def imagefile(self):\n return os.path.join(self.__folder, self.__name + '.jpg')", "def get_image_path(self) -> Optional[str]:\n if not self.image or not self.image.file_path:\n ...
[ "0.8316106", "0.8163531", "0.81182754", "0.7961282", "0.7760827", "0.769565", "0.76003695", "0.75976634", "0.7590159", "0.75808513", "0.7478475", "0.74614805", "0.7457801", "0.7451773", "0.7395841", "0.7384844", "0.7317921", "0.72773635", "0.7273996", "0.72732276", "0.7266428...
0.0
-1
Provides access to Angular's routing
def partial_helper(request, template_name): model = { 'user': request.user, 'authenticated': request.user.is_authenticated(), } return render_to_response(template_name, model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includeme(config):\n config.add_route('home', '/')\n config.add_route('detail', '/detail/{id:\\d+}')\n config.add_route('update', '/edit/{id:\\d+}')\n config.add_route('create', '/create')", "def getRoutes(self):\n pass", "def route(self):\n pass", "def add_routes(self):\n ...
[ "0.5707436", "0.5671702", "0.5641519", "0.56232744", "0.5525336", "0.547132", "0.5450406", "0.5345552", "0.5325578", "0.5300767", "0.5280052", "0.5259213", "0.5239241", "0.52320844", "0.51885235", "0.5174117", "0.5161088", "0.5149184", "0.5123362", "0.5121724", "0.5104657", ...
0.0
-1
RESTFUL call to obtain information about the currentlylogged in user, also provides information about how much of their email is currently imported.
def current_user(request): client_id = os.environ['GOOGLE_CLIENT_ID'] scope = 'https://mail.google.com/ profile' url = '' if os.environ['ENV'] == 'dev': url = TEST_OAUTH_CALLBACK else: url = "https://accounts.google.com/o/oauth2/auth?scope=%s&" \ "redirect_uri=%s&respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_info():\n if session and session.get(\"email\") and session.get(\"display_name\"):\n email = session.get(\"email\")\n display_name = session.get(\"display_name\")\n data = dict(email=email, displayName=display_name)\n app.logger.debug(\"Success in getting log information...
[ "0.7246899", "0.703527", "0.6966072", "0.6944442", "0.6933036", "0.6920569", "0.68972135", "0.6836678", "0.681147", "0.6780369", "0.67173135", "0.6663877", "0.6654884", "0.6628925", "0.661826", "0.66109914", "0.6597784", "0.65934384", "0.6540971", "0.652987", "0.6522337", "...
0.7403401
0
The user is requesting logout
def logout_view(request): logout(request) return HttpResponseRedirect('/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout(self, request):\n pass", "def logout():", "def logout(self):", "def logout(self):\n pass", "def logout_user():\n pass", "def logout(self):\n with self.client.post(\"/logout\", catch_response=True) as response:\n for r_hist in response.history:\n ...
[ "0.8393892", "0.83755165", "0.83551514", "0.8221824", "0.81836987", "0.800444", "0.78994584", "0.7708406", "0.769705", "0.7664477", "0.76110435", "0.7607977", "0.7589549", "0.75653845", "0.753407", "0.74868315", "0.74758345", "0.74583805", "0.74515826", "0.74489564", "0.74195...
0.0
-1
This is going to use our google credentials to go fetch all our mail!
def fetch_my_mail(request): q = Queue(connection=conn) if not request.user.email: return HttpResponse("User must have email defined.") logger.info("Queuing job in EmailAnalyzer") email_analyzer = EmailAnalyzer(request.user) q.enqueue(email_analyzer.process) return HttpResponse("Job queue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go():\n # Authenticate\n print('****************** Authenticate ******************')\n\n creds = None\n\n if os.path.exists('token.pickle'):\n with open('token.pickle', 'rb') as token:\n print('****************** Load Token ******************')\n\n creds = pickle.load(t...
[ "0.71546847", "0.6786783", "0.6720513", "0.67185223", "0.6704925", "0.6697211", "0.6626488", "0.6616033", "0.6596816", "0.6578102", "0.65628296", "0.6374269", "0.63587695", "0.6330741", "0.6248675", "0.61917347", "0.6146658", "0.6101265", "0.60968244", "0.60867155", "0.608671...
0.5358727
97
Primary landing page for the user to decide what they want to study.
def study(request): if request.method == 'POST': # If the form has been submitted... form = WordChooserForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass word = Word.objects.get(word__exact=form.cleaned_data['new_word']) new_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def landing_page():\n fn_title = satisfaction_survey.title\n fn_instructions = satisfaction_survey.instructions\n\n return render_template(\n 'home.html',\n survey_title=fn_title,\n survey_instructions=fn_instructions\n )", "def defaultlanding(...
[ "0.7610892", "0.7189656", "0.7000428", "0.6988881", "0.697749", "0.69087017", "0.6896512", "0.6817518", "0.6808122", "0.6750754", "0.67416763", "0.6718484", "0.6681808", "0.6660671", "0.6659592", "0.6602545", "0.660017", "0.6596845", "0.6586822", "0.65812325", "0.6580478", ...
0.0
-1
Choosing a new word is fun! Show them off
def gallery(request): return render(request, 'gallery.html', { 'page_name': 'gallery', 'controller_name': 'galleryCtrl', 'controller_script': 'galleryCtrl.js', })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_word():\n pass", "def select_word(options):\n options = list(set(options)) # Remove duplicate words\n selection = []\n if len(options) > 10:\n for n in range(10):\n word = random.choice(options)\n while word in selection:\n word = random.choice(o...
[ "0.78138", "0.6864264", "0.6582934", "0.653198", "0.6489433", "0.6457542", "0.64520353", "0.6432947", "0.6393102", "0.6381714", "0.63501793", "0.62203336", "0.6202429", "0.619583", "0.61644393", "0.616034", "0.61555785", "0.61531705", "0.6142968", "0.61414456", "0.6138071", ...
0.0
-1
the user wants to look a word up
def definition(request, word_to_lookup): return render(request, 'definition.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_word():\n\n search_user= raw_input(\"\\nEnter word(s) to search: \")\n return search_user.lower()", "def choose_word():\n pass", "def search(self, word):", "def getWord(wordType):\n if (wordType == ADJECTIVE) or (wordType == ADJECTIVE):\n newWord = input('Enter an ' + wordType.lo...
[ "0.76338303", "0.753258", "0.7465922", "0.7125073", "0.7029487", "0.688749", "0.68561953", "0.6818938", "0.67749757", "0.66614735", "0.65723056", "0.6549455", "0.65382695", "0.6483208", "0.64805716", "0.64751226", "0.6463204", "0.6461119", "0.64591956", "0.6456814", "0.642223...
0.60132724
56
the user wants to remove a word from their studylist
def remove(request, word_to_remove): word_object = Word.objects.get(word__exact=word_to_remove) word_to_learn = WordsToLearn.objects.filter( user__id=request.user.id, word=word_object) word_to_learn.delete() return HttpResponseRedirect('/study')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(q_words):\n filtered_words = [\"how\",\"what\"]\n for word in q_words:\n if word in filtered_words:\n q_words.remove(word)", "def removeWord(self,category,word):\n\t\ttry:\n\t\t\tlist = self.dictData[category]\n\t\t\tlist.pop(list.index(word))\n\t\t\tself.__save()\n\t\texcept K...
[ "0.67881536", "0.64333194", "0.6248782", "0.6224686", "0.6219968", "0.6188909", "0.61815625", "0.6160331", "0.612381", "0.61169577", "0.6115707", "0.60878754", "0.60639286", "0.6062924", "0.60580707", "0.6013443", "0.59992397", "0.5995951", "0.59686553", "0.59641165", "0.5935...
0.7295103
0
Chinese remainder theorem If a % x = 0 and b % x = 0, appareantly we have (pa + qb) % x == 0 If x > 1, making it impossible pa + qb = 1.
def isGoodArray(self, nums: List[int]) -> bool: return functools.reduce(math.gcd, nums)==1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chinese_remainder_theorem(bs, ms):\n\n m = product(ms)\n sol_sum = 0\n\n for i in range(len(ms)):\n mi, bi = ms[i], bs[i]\n ci = m // mi\n # partial equation: ci*xi = bi mod mi\n _, alpha, _ = extended_euclid(ci, mi)\n xi = alpha * bi\n sol_sum += xi * ci\n\n ...
[ "0.7122794", "0.7108307", "0.7097448", "0.69529", "0.693875", "0.6925881", "0.6915731", "0.6911623", "0.6874013", "0.68541473", "0.6827359", "0.68166393", "0.68137616", "0.681321", "0.6803438", "0.67818314", "0.67675936", "0.676378", "0.676378", "0.676378", "0.6761953", "0....
0.0
-1
Name must be capitalized
def test_name_must_be_capitalized(self): form = self.make_validator_form(name='PATRICK alves') # O cleaned_data é um dicionário que armazena todos os valores do # formulários já validados self.assertEqual('Patrick Alves', form.cleaned_data['name'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_name_must_be_capitalized(self):\n form = self.make_validated_form(name='HENRIQUE bastos')\n self.assertEqual('Henrique Bastos', form.cleaned_data['name'])", "def test_name_must_be_capitalized(self):\r\n form = self.make_validated_form(name='DieGo MaraNhao')\r\n self. assertEq...
[ "0.8193219", "0.8164763", "0.8003153", "0.76962405", "0.745632", "0.7340215", "0.7321985", "0.71422136", "0.7129266", "0.708505", "0.7029354", "0.7024253", "0.69393677", "0.69393677", "0.69393677", "0.6887481", "0.6868966", "0.68688947", "0.6863508", "0.6856835", "0.6838902",...
0.8274609
0
Email and phone are optional, but one must be informed
def test_must_inform_email_or_phone(self): form = self.make_validator_form(phone='', email='') # Identifica erro no formulário e não em um campo. self.assertListEqual(['__all__'], list(form.errors))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_must_inform_email_or_phone(self):\n form = self.make_validated_form(email='',phone='')\n self.assertListEqual(['__all__'], list(form.errors))", "def test_must_inform_email_or_phone(self):\r\n form = self.make_validated_form(email='', phone='')\r\n self.assertListEqual(['__all...
[ "0.75361687", "0.7490287", "0.7065026", "0.6368576", "0.6270754", "0.6209141", "0.619869", "0.6197438", "0.6183619", "0.6181492", "0.6180816", "0.6178619", "0.61082476", "0.60776365", "0.60598195", "0.6025348", "0.6018382", "0.60004056", "0.59906375", "0.59758604", "0.595008"...
0.73785985
2
Test retrieving a Sonar test report.
def test_test_report(self): self.__test_report.unittests = unittest.mock.Mock(return_value=11) self.__test_report.failing_unittests = unittest.mock.Mock(return_value=2) self.assertEqual(2, self.__test_report.failed_tests('sonar_id')) self.assertEqual(9, self.__test_report.passed_tests('s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_report(self):\n report = self.analytics.suites[testReportSuite].report\n queue = []\n queue.append(report)\n response = omniture.sync(queue)\n self.assertIsInstance(response, list)", "def test_basic_usage(self):\n self._test_reports_helper({}, [\"report.tx...
[ "0.7074292", "0.66301477", "0.65632385", "0.6551492", "0.6524615", "0.65036476", "0.6462773", "0.63588864", "0.6300303", "0.62780917", "0.6243578", "0.6237225", "0.62051684", "0.6197856", "0.61297584", "0.609604", "0.6089572", "0.607959", "0.60769016", "0.6037692", "0.6007790...
0.6595998
2
Test that the default is returned when no Sonar ids are provided.
def test_missing_url(self): self.__test_report.unittests = unittest.mock.Mock(return_value=11) self.__test_report.failing_unittests = unittest.mock.Mock(return_value=2) self.assertEqual(-1, self.__test_report.failed_tests()) self.assertEqual(-1, self.__test_report.passed_tests()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_return_default(self):\n ars = self.ar[2009][11]['general']\n self.assertTrue(ars.get('invalid_row') is None)", "def test_get_return_default_provided(self):\n ars = self.ar[2009][11]['general']\n self.assertEqual(ars.get('invalid_row', 'ZZZZZZ'), 'ZZZZZZ')", "def test_de...
[ "0.5472899", "0.5462023", "0.53718823", "0.5333191", "0.52959406", "0.5295588", "0.52764815", "0.5273415", "0.5261988", "0.5248053", "0.5201767", "0.5189855", "0.51841277", "0.516158", "0.51566416", "0.5152506", "0.50999445", "0.5089033", "0.50751144", "0.50593686", "0.505853...
0.0
-1
Test that the urls point to the HTML versions of the reports.
def test_urls(self): self.__test_report.dashboard_url = unittest.mock.Mock(return_value='http://sonar/sonar_id') self.assertEqual(['http://sonar/sonar_id'], self.__test_report.metric_source_urls('sonar_id'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def test_urls(self):\n # Points to the XML at the moment because the UFT HTML report isn't stored at a predictable location.\n self.assertEqual(['http://server/uft/uft.xml'],\n self.__uft.metric_source_urls('http://server/uft/uft....
[ "0.69071126", "0.67659813", "0.6749532", "0.67086995", "0.65968335", "0.6571794", "0.6519359", "0.64984214", "0.6426068", "0.6379072", "0.6367425", "0.62772745", "0.62507516", "0.62409735", "0.6210853", "0.61961204", "0.61910313", "0.61895597", "0.6185282", "0.61637324", "0.6...
0.6184863
19
Test if this node is the network node.
def is_network_node(): return config.NODE_IP == config.NETWORK_NODE_IP
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_network_type(self, name):\n nt = self.config[\"networks\"].get(name)\n return bool(nt)", "def has_node(self, name):\n return self.source_net.has_node(name)", "def __contains__ (self, item):\n if isinstance(item, Node):\n item = item.id\n return item in self.network", "...
[ "0.7338448", "0.68739766", "0.6680434", "0.6630339", "0.6630339", "0.66011393", "0.6267848", "0.62573254", "0.62540036", "0.61622053", "0.61584145", "0.6156845", "0.61213005", "0.6108773", "0.60500073", "0.6039537", "0.60387963", "0.60387963", "0.60387963", "0.5994629", "0.59...
0.831017
0
Returns day and time in various formats
def format_daytime(options, dayformat='/', timeformat=':'): time_now = datetime.now() if options == 'daytime': dayformat = '-' timeformat = '-' day = '{}{}{}{}{}'.format(time_now.year, dayformat, time_now.month, dayformat, time_now....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time(self):\r\n\t\tactual_time = '{}, {} de {} del {} ({}:{} {} (UTC))'\r\n\t\tda_taim = actual_time.format(self.wday, self.day, self.mon,\r\n\t\t\t\t\t\t\t\t\t self.year, self.hour, self.min,\r\n\t\t\t\t\t\t\t\t\t self.day_or_night)\r\n\t\treturn da_taim", "def getdate():\n return strftime(\"%A %B %d...
[ "0.69575495", "0.6924019", "0.68723494", "0.67796105", "0.6696663", "0.66922486", "0.66743", "0.6674197", "0.6671306", "0.6645618", "0.6619655", "0.6574433", "0.65522647", "0.65311974", "0.6525805", "0.65112585", "0.6496104", "0.64922416", "0.64845353", "0.64829296", "0.64773...
0.69112945
2
Returns time difference from starting time
def time_diff(start_time, end_time=None, choice='millis'): if end_time is None: end_time = datetime.now() timediff = (end_time - start_time) if choice == 'millis': return timediff.seconds * 1000 + int(timediff.microseconds) / 1000 elif choice == 'micros': return timediff.seconds ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_time(start_time):\r\n return round(time() - start_time, 2)", "def get_time_diff(start_time, end_time):\n time_diff = end_time - start_time\n return timedelta(seconds=int(round(time_diff)))", "def get_time_delta(start):\n\tend = datetime.now()\n\tduration = ((end-start).microseconds)/1000...
[ "0.8108136", "0.75064516", "0.74752355", "0.74312955", "0.7354597", "0.73346627", "0.7060144", "0.7047898", "0.70433176", "0.7029544", "0.6975039", "0.6962269", "0.69382143", "0.69247186", "0.6920252", "0.68807906", "0.686269", "0.6860179", "0.68554264", "0.6852525", "0.68067...
0.66099024
37
Limit a given string to a specified length
def lim_str_len(string, length, end='...'): if len(string) <= length: return string else: return '{}{}'.format(string[:length - len(end)], end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_max_length(self, string):\n newstring = string\n length = len(newstring)\n max_length = 63\n if length > max_length:\n newstring = newstring[0:max_length]\n\n return newstring", "def test__limit_string_length(string, max_length):\n return limit_string_l...
[ "0.7902587", "0.7835895", "0.75604343", "0.7514349", "0.74940544", "0.74157304", "0.7361507", "0.73120594", "0.72713256", "0.7262752", "0.71534055", "0.7017553", "0.6987489", "0.6956871", "0.69386333", "0.6928784", "0.6910822", "0.69106156", "0.6901981", "0.6878013", "0.68769...
0.80943525
0
Returns a list of lists with unique Python IDs for each outer list, populated with desired variable or callable object would have been easier with numpy arrays but i'm in too deep now
def deepcopy_lists(outer, inner, populate=None): hold = [] for i in range(outer): if callable(populate): hold.append([]) for n in range(inner): hold[i].append(populate()) elif not callable(populate): hold.append(deepcopy([populate] * inner)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIDs():", "def _instantiated_ids(self):\n return self._identity_map.keys()", "def X(self)->list:", "def batches2IDs(batches):\n l = [ np.array( [ char2id(x) for x in characters(b) ] ) for b in batches ]\n return l", "def id_lst(self):\n id_set = set()\n for key in self.forw...
[ "0.6496731", "0.5829538", "0.5450664", "0.54489905", "0.54398626", "0.54376125", "0.5433291", "0.5432504", "0.5429854", "0.5415309", "0.54095143", "0.5401998", "0.5375357", "0.5341702", "0.53371173", "0.53257203", "0.5310846", "0.529755", "0.5259929", "0.5253542", "0.5244152"...
0.0
-1
flattens the given dictionary into a list
def dict_flatten(*args): hold = [] for a in args: hold.append([i for s in a.values() for i in s]) return hold
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_list(dictionary):\n zippers = []\n for key, value in dictionary.items():\n zippers.append(zip(repeat(key), value))\n output = []\n for zipper in zip(*zippers):\n output.append(dict(zipper))\n return output", "def to_flatlist(d: dict) -> List[dict]:\n def value_to_list(...
[ "0.7167921", "0.714838", "0.7111231", "0.7021266", "0.69783247", "0.6942656", "0.691712", "0.6793542", "0.66931677", "0.66931677", "0.66883093", "0.66645074", "0.6641108", "0.6633235", "0.65910095", "0.6580594", "0.65238255", "0.6514312", "0.645683", "0.63778377", "0.6346849"...
0.70600843
3
Given a number and arduino register Return all corresponding arduino pins
def check_binary(num, register): dicts = {'binary': 'pin_num'} if register == 'D': dicts = {1: 0, 2: 1, 4: 2, 8: 3, 16: 4, 32: 5, 64: 6, 128: 7} elif register == 'B': dicts = {1: 8, 2: 9, 4: 10, 8: 11, 16: 12, 32: 13} store = [] for i in dicts: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_all_registers(self):\n return self.REGISTERS", "def read_register(self, device_id, address):\n register_array = self.read(device_id, address, 1) \n return register_array[0] << 24 | register_array[1] << 16 | register_array[2] << 8 | register_array[3]", "def get_byte():\n GPIO.setup(data_pin...
[ "0.60851634", "0.576264", "0.56494975", "0.5606323", "0.55677825", "0.5541105", "0.5487929", "0.5467551", "0.5465366", "0.5464848", "0.5383344", "0.53690445", "0.5268947", "0.52120453", "0.52038735", "0.52020365", "0.5194894", "0.51665664", "0.51609755", "0.515856", "0.515851...
0.48692006
69
Return as a list of field choices.
def as_choices(): return ( # Live is currently disabled as a choice # pending implementation ("live", "Use working directory"), ("latest", "Use latest snapshot"), ("pinned", "Pinned to snapshot"), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_choices_for_model_field(cls):\n return [c[0:2] for c in cls.attr_choices]", "def get_choices(self):\n raise NotImplementedError()", "def get_choices(self):\n raise NotImplementedError()", "def choices(self, typename, value_field='description'):\n rows = self.type(typename)...
[ "0.80070734", "0.7434968", "0.7434968", "0.7353117", "0.7302724", "0.72494674", "0.71962416", "0.7108783", "0.69741213", "0.69617325", "0.6852431", "0.6775638", "0.6750487", "0.6722035", "0.6578648", "0.6571623", "0.6537159", "0.6513538", "0.64543384", "0.64526904", "0.645085...
0.0
-1
Generate a unique, and very difficult to guess, project key.
def generate_project_key(): return shortuuid.ShortUUID().random(length=32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_key():\n return str(uuid.uuid4())", "def gen_api_key():\r\n m = hashlib.sha256()\r\n m.update(get_random_word(12))\r\n return unicode(m.hexdigest()[:12])", "def generate_key():\n return get_token_generator().generate_token()", "def generate_key(self):\n retu...
[ "0.79155785", "0.7775702", "0.7626928", "0.750305", "0.7375972", "0.71838915", "0.7182287", "0.7178739", "0.7053424", "0.7009634", "0.6993134", "0.6992274", "0.69627655", "0.69268835", "0.6890797", "0.6881805", "0.6874118", "0.6863728", "0.6855253", "0.6817818", "0.67374754",...
0.91272426
0
Get the metadata to include in the head of the project's pages.
def get_meta(self) -> Meta: return Meta( object_type="article", title=self.title or self.name, description=self.description, image=self.image_file.url if self.image_file else None, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_meta():\n meta = {\n 'pages': _get_pages()\n }\n return meta", "def meta(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'meta')\r\n\r\n return http.Request('GET', url), parsers.parse_json", "def GetMetadata(self):\n return self.dict['meta']", "def site_metadata():\n\n s...
[ "0.70803446", "0.67621255", "0.6539717", "0.6451946", "0.6438139", "0.6271023", "0.61966383", "0.6136623", "0.61073774", "0.61045307", "0.60791564", "0.6078248", "0.60408026", "0.5991486", "0.59834343", "0.59690696", "0.59375095", "0.5934691", "0.5929024", "0.59227186", "0.58...
0.5362866
94
Update the image file for the project from the path of a file within it.
def set_image_from_file(self, file): if isinstance(file, str): try: file = self.files.filter(current=True, path=file)[0] except IndexError: return content = file.get_content() format = file.get_format() ext = format.default_extensi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_image(self):\n modified_since = (\n dict(modified__gt=self.image_updated) if self.image_updated else {}\n )\n if self.image_path and self.image_path != \"__uploaded__\":\n # Does the file need updating?\n images = self.files.filter(\n ...
[ "0.73526776", "0.68269295", "0.65086704", "0.6380084", "0.62259567", "0.62116706", "0.6197291", "0.6185773", "0.61753637", "0.6168252", "0.61249834", "0.6082021", "0.60370713", "0.601191", "0.5937832", "0.5923513", "0.59205914", "0.5910893", "0.590042", "0.58223635", "0.57893...
0.65182406
2
Update the image for the project.
def update_image(self): modified_since = ( dict(modified__gt=self.image_updated) if self.image_updated else {} ) if self.image_path and self.image_path != "__uploaded__": # Does the file need updating? images = self.files.filter( current=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_image(self, image):\n raise NotImplementedError()", "def update_image(self):\n self.image = Image.fromarray(self.img)", "def update_image_all_projects(self):\n projects = Project.objects.all(temporary=False)\n for project in projects:\n project.update_image()",...
[ "0.7685141", "0.73662555", "0.7222374", "0.69448644", "0.6820686", "0.6818791", "0.677097", "0.6753897", "0.6717046", "0.6702262", "0.66908646", "0.6661354", "0.66291267", "0.65811455", "0.6577313", "0.655217", "0.64976764", "0.64719224", "0.6462158", "0.6462158", "0.6392289"...
0.7719839
0
Update the image of all projects.
def update_image_all_projects(self): projects = Project.objects.all(temporary=False) for project in projects: project.update_image()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_project_data(project_name):\n project_path = context.__PROJECTS_PATH__+ '/' + project_name\n f = open(project_path+'/.project', 'r')\n project_data = json.load(f)\n f.close()\n\n image_count = len(os.listdir(project_path)) - 2\n\n if image_count > 0:\n\n img = Image.open('{}/{}....
[ "0.6972187", "0.6777449", "0.6594918", "0.6342221", "0.6153103", "0.6097519", "0.6076489", "0.6054905", "0.59777665", "0.59237146", "0.5920237", "0.59075", "0.59057623", "0.5903648", "0.5901088", "0.58525425", "0.5830686", "0.5823933", "0.5811466", "0.5807372", "0.5804207", ...
0.90420735
0
Get the scheduled deletion time of a temporary project.
def scheduled_deletion_time(self) -> Optional[datetime.datetime]: if not self.temporary: return None delta = Project.TEMPORARY_PROJECT_LIFESPANS.get( self.account.name, Project.TEMPORARY_PROJECT_LIFESPANS.get("default") ) return self.created + delta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduled_deletion_warning(self) -> Optional[datetime.datetime]:\n time = self.scheduled_deletion_time\n return time - Project.TEMPORARY_PROJECT_WARNING if time else None", "def delete_time(self) -> str:\n return pulumi.get(self, \"delete_time\")", "def delete_time(self) -> str:\n ...
[ "0.6921164", "0.6562803", "0.6562803", "0.6188812", "0.58171326", "0.5730795", "0.5701719", "0.5518333", "0.55177927", "0.5512329", "0.54670966", "0.5458026", "0.54461396", "0.5335375", "0.53240615", "0.5315584", "0.5306388", "0.5295981", "0.5270675", "0.5270596", "0.5227072"...
0.81216675
0
Get the scheduled time for a warning of deletion email to be send to project owner.
def scheduled_deletion_warning(self) -> Optional[datetime.datetime]: time = self.scheduled_deletion_time return time - Project.TEMPORARY_PROJECT_WARNING if time else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduled_deletion_time(self) -> Optional[datetime.datetime]:\n if not self.temporary:\n return None\n\n delta = Project.TEMPORARY_PROJECT_LIFESPANS.get(\n self.account.name, Project.TEMPORARY_PROJECT_LIFESPANS.get(\"default\")\n )\n return self.created + delta...
[ "0.6964856", "0.6478921", "0.6478921", "0.63262975", "0.61052036", "0.5725044", "0.5711345", "0.5687409", "0.5663868", "0.5653854", "0.5606957", "0.56067246", "0.55298257", "0.5479845", "0.5387236", "0.5387061", "0.537733", "0.5360682", "0.5312974", "0.5282476", "0.5270324", ...
0.80382836
0
Get the main file for the project. The main file can be designated by the user (using the `main` field as the path). If no file matches that path (e.g. because it was removed), or if `main` was never set, then this defaults to the most recently modified file with path `main.` or `README.` if those are present.
def get_main(self): if self.main: try: # Using `filter()` and indexing to get the first item is more robust that # using `get()`. There should only be one item with path that is current # but this avoids a `MultipleObjectsReturned` in cases when there ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMain(self):\n\n if self.__projects:\n return self.__projects[0]\n else:\n return None", "def get_main_source(self):\n\t\tpath, loader = self.main\n\t\tif path is not None:\n\t\t\treturn loader.get_source(path)", "def defaultFile(self):\n filename = _odb.getCurr...
[ "0.6912671", "0.63616216", "0.6164986", "0.6089585", "0.6066663", "0.59985036", "0.5891858", "0.58236873", "0.55907995", "0.5402024", "0.5329899", "0.5312935", "0.5272182", "0.5242959", "0.5234238", "0.5114161", "0.5106685", "0.50861514", "0.50775504", "0.50709206", "0.507092...
0.7425918
0
Get the theme for the project.
def get_theme(self) -> str: return self.theme or self.account.theme
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_theme():\n # Return None if theming is disabled\n if not is_comprehensive_theming_enabled():\n return None\n\n site_theme = get_current_site_theme()\n if not site_theme:\n return None\n try:\n return Theme(\n name=site_theme.theme_dir_name,\n ...
[ "0.77218676", "0.756868", "0.7343077", "0.711062", "0.70631874", "0.70348823", "0.68387085", "0.66256326", "0.65988183", "0.654876", "0.6471758", "0.6386882", "0.63486433", "0.63153225", "0.62846875", "0.6231964", "0.62230563", "0.6190626", "0.61657983", "0.61640877", "0.6141...
0.8288318
0
Get the URL that the content for this project is served on. This is the URL, on the account subdomain, that content for the project is served from.
def content_url(self, snapshot=None, path=None, live=False) -> str: params: Dict = {} if settings.CONFIGURATION.endswith("Dev"): # In development, it's very useful to be able to preview # content, so we return a local URL url = ( reverse("ui-accounts-c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBaseUrl(self):\n return self.url", "def get_url(self):\n return staticfiles_storage.url(self._name)", "def url(self):\n url = self.url\n return url", "def get_url(self):\n return self.url", "def get_url(self):\n return self.url", "def website_url(self):\n ...
[ "0.7204285", "0.7087473", "0.7075978", "0.7044254", "0.7044254", "0.7044229", "0.70275116", "0.70192707", "0.7014525", "0.7001934", "0.6995414", "0.6995414", "0.6978689", "0.69648707", "0.6941174", "0.6920266", "0.6920266", "0.69162595", "0.6902565", "0.6902565", "0.6902565",...
0.0
-1
Get the location of one of the project's files relative to the root of the storage volume.
def file_location(self, file: str) -> str: return os.path.join(str(self.id), file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location(self):\n\n p = os.path.abspath(__file__)\n pathSP = os.path.split(p)\n return pathSP", "def path(self):\n path = os.path.join(self.base_dir, self.store().replace(' ', '_'), self.package_name())\n return os.path.abspath(path)", "def get_absolute_pathname(self):\n ...
[ "0.666451", "0.66000694", "0.658896", "0.6555157", "0.65166426", "0.647148", "0.6465352", "0.6453355", "0.6424935", "0.6400169", "0.63222474", "0.628216", "0.62486446", "0.6230657", "0.6214746", "0.62136924", "0.6198161", "0.6198161", "0.6198161", "0.6198161", "0.6173934", ...
0.58607525
79
Handle an event notification. Records the event and evaluates each project trigger.
def event(self, data: dict, source=None): ProjectEvent.objects.create(project=self, data=data, source=source) # TODO: Evaluate each project trigger # #for trigger in self.triggers.all(): # trigger.evaluate(event=event, context=dict(event=event, source=source))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_event(event):\n\n\tglobal update_local_events\n\trecord_trigger = True\n\n\tlogger.info(\"Event is potentially suitable for observation!\")\n\tif MAIL_NOTIFICATIONS_ON:\n\t\tlogger.info(\"Mailing event notification...\")\n\t\ttry:\n\t\t\tsend_mail_notification(event)\n\t\texcept Exception as ex:\n\t\t\...
[ "0.6982703", "0.62325114", "0.612688", "0.57484126", "0.5741762", "0.5703489", "0.570331", "0.5697788", "0.5667945", "0.5661009", "0.56453514", "0.5602698", "0.5601577", "0.5578952", "0.55578", "0.5533698", "0.5530482", "0.55246097", "0.54608643", "0.5457123", "0.5456523", ...
0.6456528
1
Clean the project's working directory. Removes all files from the working directory. In the future, this may be smarter and only remove those files that are orphaned (i.e. not registered as part of the pipeline). This is not called `clean()` because that clashes with `Model.clean()` which gets called, for example, afte...
def cleanup(self, user: User) -> Job: return Job.objects.create( project=self, creator=user, method=JobMethod.clean.name, description=f"Clean project '{self.name}'", **Job.create_callback(self, "cleanup_callback"), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(self):\n original_dir = os.getcwd()\n os.chdir(self.output)\n\n # Clear out directory\n file_list = os.listdir(self.output)\n\n for afile in file_list:\n if not afile.endswith('.gitignore'):\n path = os.path.join(self.output, afile)\n ...
[ "0.77081805", "0.7406477", "0.738206", "0.7333592", "0.73319924", "0.72822344", "0.71573967", "0.71142447", "0.70437706", "0.7025727", "0.6991537", "0.6988398", "0.6974335", "0.6947045", "0.69163674", "0.6906578", "0.6902911", "0.6888679", "0.6883839", "0.68827343", "0.687981...
0.0
-1
Set all project files as noncurrent. This will remove derived files (e.g. converted from another format) and files from a source.
def cleanup_callback(self, job: Job): from projects.models.files import File File.objects.filter(project=self, current=True).update(current=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset():\n local('cd {{ project_name }} && \\\n rm -rf static && rm -rf gzip && rm -rf build')", "def clean_files(self):\n self.filenames.clear()", "def scrub():\n\n\tlocal(\"rm -fr dist build\")\n\tlocal(\"find . -name \\\"*.pyc\\\" -exec rm '{}' ';'\")", "def reset(self):\n def ...
[ "0.6168245", "0.61669266", "0.61512905", "0.60710835", "0.598589", "0.5936993", "0.5888643", "0.5817007", "0.57047087", "0.5697226", "0.56633544", "0.5590449", "0.5585752", "0.557597", "0.55295295", "0.5517425", "0.5500379", "0.5498486", "0.54823655", "0.54674506", "0.5465025...
0.5233539
46
Pull all the project's sources into its working directory. Groups sources by `order` (with `null` order first i.e. can be overridden). If there are more than one source in each group creates a `parallel` job having children jobs that `pull`s each source. Groups are then placed in a series job (if there is more than one...
def pull(self, user: User) -> Job: # Do not create individual pull jobs here because series job children # are run in order of their ids; so we need to sort into groups first. groups: Dict[int, List] = {} for source in self.sources.all(): order = source.order or 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull(args):\n do_all_projects(args + [\"pull\"])", "def pull(targets, *keys):", "def push_sources():\n ensure_src_dir()\n push_rev = getattr(env, 'push_rev', None)\n if push_rev is None:\n push_rev = datetime.datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n local(\"git tag -a {0} -m \\\...
[ "0.5802862", "0.5222017", "0.5175938", "0.51217717", "0.50083756", "0.49580196", "0.48946944", "0.48938698", "0.4885122", "0.48726898", "0.48700982", "0.48692283", "0.48593602", "0.48042524", "0.47969273", "0.47789612", "0.47780585", "0.47709864", "0.4749284", "0.47399348", "...
0.61282736
0
Reflow the dependencies between the project's files by rerunning jobs. For all `current` files that have `upstreams` creates a new job that reexecutes the original job. Because jobs can have `secrets` and callbacks to the original project, rather than creating a copy of the original job we go through the `File` method ...
def reflow(self, user: User) -> Optional[Job]: subjobs = [] for file in self.files.filter( current=True, upstreams__isnull=False, # Currently limited to convert jobs but in future there # may be other jobs that create a derived file # e.g. runn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _precache_reference_files(self, input_file):\n from .. import datamodels\n gc.collect()\n if self._is_association_file(input_file):\n return\n try:\n with datamodels.open(input_file) as model:\n pass\n except (ValueError, TypeError, IOErro...
[ "0.5435536", "0.52989703", "0.5218885", "0.51945597", "0.51398677", "0.50693643", "0.506141", "0.5025757", "0.50252265", "0.50123876", "0.49895275", "0.49730432", "0.496613", "0.49546805", "0.49308264", "0.49184242", "0.4908504", "0.49012965", "0.48830163", "0.4880889", "0.48...
0.6498693
0
Pin the project's container image. Does not change the project's `container_image` field, but rather, returns a pinned version of it. The callback should use that value.
def pin(self, user: User, **callback) -> Job: return Job.objects.create( project=self, creator=user, method=JobMethod.pin.name, params=dict(container_image=self.container_image,), description=f"Pin container image for project '{self.name}'", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_container():\n return exec_fn(_update_container)", "def _put_container_on_host(self, container_name):\n with hide(\"output\", \"warnings\", \"running\"):\n # first see if container is already present on host\n host_result = self._execute_root(\n \"docker ...
[ "0.4892535", "0.47694457", "0.4650474", "0.46101207", "0.46038973", "0.45849597", "0.4556329", "0.45442688", "0.45416212", "0.44963834", "0.4495275", "0.4492923", "0.44748017", "0.44405603", "0.44272813", "0.4418504", "0.44036055", "0.44023618", "0.43763033", "0.43761548", "0...
0.7015722
0
Archive the project's working directory. Creates a copy of the project's working directory on the `snapshots` storage.
def archive(self, user: User, snapshot: str, path: str, **callback) -> Job: # Get the upload policy policy = snapshots_storage().generate_post_policy(path) url = policy.get("url") if policy else None secrets = policy.get("fields") if policy else None return Job.objects.create( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gitCreateArchive(self):\n self.vcs.gitCreateArchive(self.project.getProjectPath())", "def archive(project, filename, pack_envs=False):\n return archiver._archive_project(project, filename, pack_envs)", "def archive_backup(self):\n\n # Archiving the Training script\n shutil.copyfil...
[ "0.6987642", "0.633524", "0.61700743", "0.6033355", "0.5977099", "0.5971754", "0.5949469", "0.59469014", "0.5850925", "0.57817495", "0.57318884", "0.5714925", "0.56832516", "0.56823653", "0.56435615", "0.55906874", "0.5583479", "0.5560037", "0.5557835", "0.5524871", "0.550306...
0.5949958
6
Create a session job for the project.
def session(self, request: HttpRequest) -> Job: job = Job.objects.create( project=self, creator=request.user if request.user.is_authenticated else None, method=JobMethod.session.name, params=dict(container_image=self.container_image), description=f"Ses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_job(self, context=None):\n return self._client.call_method(\n 'UserAndJobState.create_job',\n [], self._service_ver, context)", "def createJob(self, joboptions, previousId=None):\n root = self.manifest.getRootResource()\n assert self.manifest.tosca\n j...
[ "0.631419", "0.61037755", "0.60672235", "0.59948283", "0.5993035", "0.59315264", "0.5915751", "0.59131706", "0.59121525", "0.59017074", "0.5868312", "0.5839195", "0.57926786", "0.5777216", "0.5776275", "0.5771428", "0.5747704", "0.57435995", "0.57095104", "0.5693203", "0.5688...
0.8064805
0
Make the project create an owner. Makes sure each project has at least one owner.
def make_project_creator_an_owner( sender, instance: Project, created: bool, *args, **kwargs ): if sender is Project and created and instance.creator: ProjectAgent.objects.create( project=instance, user=instance.creator, role=ProjectRole.OWNER.name )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_owner(self):\n url = reverse(\n 'projectroles:api_role_create',\n kwargs={'project': self.project.sodar_uuid},\n )\n post_data = {\n 'role': PROJECT_ROLE_OWNER,\n 'user': str(self.assign_user.sodar_uuid),\n }\n response ...
[ "0.6795974", "0.67435247", "0.6457388", "0.6397213", "0.6334437", "0.61915594", "0.6109523", "0.6071861", "0.6055635", "0.59651107", "0.59185636", "0.59049666", "0.5854356", "0.5853638", "0.5830807", "0.5797529", "0.5782358", "0.57266897", "0.5696159", "0.56787217", "0.565595...
0.7869675
0