query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
convert a rfc3339 date representation into a Python datetime
def rfc3339_to_datetime(data): try: ts = time.strptime(data, '%Y-%m-%d') return date(*ts[:3]) except ValueError as error: pass try: dt, _, tz = data.partition('Z') if tz: tz = offset(tz) else: tz = offset('00:00') ts = time.str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rfc3339str_to_datetime(rfc3339_str):\n\n ret = None\n for fmt in rfc3339_date_input_fmts:\n try:\n ret = datetime.datetime.strptime(rfc3339_str, fmt)\n # Force this since the formats we support are all utc formats, to support non-utc\n if ret.tzinfo is None:\n ...
[ "0.77277243", "0.7557866", "0.6939527", "0.68279094", "0.6747444", "0.6724481", "0.6667682", "0.6641921", "0.66370517", "0.65986127", "0.6573383", "0.6560308", "0.65338504", "0.6486673", "0.646336", "0.6452801", "0.6445426", "0.6442138", "0.6438197", "0.6423296", "0.6411111",...
0.81067127
0
The function when POST action occurs in the Profile edit page. The POST data is sent by Ajax. The Ajax script is in main.js.
def profile_edit_post(request): if request.user.is_authenticated and request.method == 'POST': u = request.user rq = read_request_data(request) ji = judge_instance(u, rq, request) save_data_to_db(rq, ji, request) response = load_data_from_db(rq, ji) return HttpRespons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_ajax(self):\r\n pass", "def edit_profile(request, userId):\n try:\n try:\n user = User.objects.get(pk=userId)\n profile = Profile.objects.get(user_id=userId)\n user.first_name = request.data['first_name'] if 'first_name' in request.data else user.first...
[ "0.64560044", "0.62283105", "0.61597276", "0.6152454", "0.6027695", "0.6007733", "0.5926738", "0.5895855", "0.5893347", "0.5859112", "0.585527", "0.5765868", "0.57532847", "0.57269907", "0.5719247", "0.57186335", "0.57110727", "0.5680641", "0.5676178", "0.5657126", "0.5627813...
0.71993047
0
The View function for the organization page.
def organization(request, id): org = get_object_or_404(Organization, pk=id) context = { 'org': org, 'cover': modify_image_url(str(org.cover), 'cover'), 'logo': modify_image_url(str(org.logo), 'logo'), 'mission': "", 'values': "", 'members': "", } context[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org_view(org_id):\n org_detail = None\n try:\n org_detail = Organisation.query.filter_by(id=org_id).first()\n\n except IndexError:\n pass\n\n if org_detail is not None:\n return render_template('organisations/org_view.html', org_detail=org_detail, org=org_detail)\n\n\n elif ...
[ "0.69180477", "0.6562782", "0.6347636", "0.6236421", "0.61702347", "0.61681354", "0.6154304", "0.61482716", "0.6101052", "0.59865576", "0.58782595", "0.5795372", "0.5794597", "0.577704", "0.5755357", "0.5727754", "0.5677531", "0.5673188", "0.56458205", "0.56372476", "0.562334...
0.7201585
0
Add the form to the context.
def get_context_with_form(self): self.context['form'] = { 'profile': ProfileEditForm(), 'avatar': AvatarForm(), 'cover': CoverForm(), 'introduction': IntroductionForm(), 'statement': StatementForm(), 'experience': ExperienceForm(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form(self, form):\n\n self._form = form", "def form(self, form):\n\n self._form = form", "def get_context_data(self):\n return {\"form\": self.get_form()}", "def register_form(self):\n f = Form()\n self.forms = f\n return f", "def form(self):\n if getatt...
[ "0.7144628", "0.7144628", "0.6993413", "0.688578", "0.681279", "0.6785873", "0.6544541", "0.64791316", "0.6425021", "0.6402661", "0.63913417", "0.63824195", "0.633752", "0.6306994", "0.6285876", "0.6278406", "0.62484014", "0.6244671", "0.6233216", "0.62002236", "0.6193718", ...
0.74072003
0
Modify image url each types and return it.
def modify_image_url(image_url, type=''): parsed_uri = urlparse(image_url) if parsed_uri.scheme == 'https' or parsed_uri.scheme == 'http': pass elif image_url == '': image_url = '/media/default_' + type + '.jpg' else: image_url = '/media/' + image_url return image_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def url_for(**options):\n\n url_parts = get_url_parts(**options)\n image_hash = hashlib.md5(b(options[\"image_url\"])).hexdigest()\n url_parts.append(image_hash)\n\n return \"/\".join(url_parts)", "def get_thumbnail_url():", "def get_url_image(self, obj):\n return s...
[ "0.7146244", "0.6298754", "0.6159808", "0.6114807", "0.6114807", "0.6114807", "0.60653496", "0.6041088", "0.6010959", "0.6006904", "0.59923077", "0.5985666", "0.5966213", "0.592543", "0.5918504", "0.59183526", "0.5910592", "0.58902115", "0.5883194", "0.5861966", "0.5857781", ...
0.77044326
0
Pull max_length of text column in DB and calculate the number of characters that can be entered to textarea. And add calculated data to the context.
def calculate_char_in_textarea(context): context['max_length'] = {} context['remaining_length'] = {} introduction_max_length = Introduction._meta.get_field('introduction').max_length context['max_length']['introduction'] = introduction_max_length if context['introduction']: context['remaini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_user_description_text_length(row):\n row[\"user_description_text_length\"] = len(row['user_description'])\n return row[\"user_description_text_length\"]", "def set_max_sentence_length(self):\n new_max = int(self.set_max_sentence.get())\n cur_min = self.min_sentence_length\n\n ...
[ "0.6396993", "0.6259367", "0.6027601", "0.59684163", "0.5717755", "0.5667692", "0.564673", "0.56400645", "0.5621926", "0.5595736", "0.5549537", "0.5544679", "0.5539502", "0.5515646", "0.5499823", "0.5490022", "0.54774857", "0.5465199", "0.5458489", "0.5439081", "0.5363234", ...
0.798289
0
Read the request.POST and the request.FILES data. The function is called in the profile_edit_post function.
def read_request_data(request): print(request.POST) print(request.FILES) rq = { 'change_privacy_level': request.POST.get('change-privacy-level', False), 'target_instance_name': request.POST.get('target-instance-name', False), 'edit_target_instance_id': request.POST.get('uuid', False)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, request, *args, **kwargs):\n user_prof = UserProfile.objects.get(user=request.user)\n form = AboutFunderForm(request.POST, request.FILES)\n if form.is_valid():\n name = form.cleaned_data['name']\n content = form.cleaned_data.get('content')\n fund...
[ "0.6435877", "0.6140716", "0.60834515", "0.60343087", "0.6024056", "0.5950326", "0.5948689", "0.5940282", "0.5928336", "0.58589065", "0.58264875", "0.58215076", "0.5799543", "0.5796606", "0.576883", "0.5722754", "0.5717224", "0.56721866", "0.564817", "0.5510797", "0.550546", ...
0.7192528
0
printing capital 'P' using while loop
def while_P(): i=0 while i<7: j=0 while j<4: if j==0 or i in(0,3) and j%3!=0 or j==3 and i in(1,2): print("*",end=" ") else: print(" ",end=" ") j+=1 print() i+=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_phrase(self):\r\n for letter in self.phrase:\r\n if letter == ' ':\r\n print(letter, end=' ')\r\n else:\r\n print(letter.show(), end=' ')\r\n print('\\n')", "def operation(level):\r\n blank = 0\r\n while blank < len(input_list[leve...
[ "0.60286325", "0.58887637", "0.5877251", "0.5765733", "0.5721193", "0.56865925", "0.5669595", "0.56365657", "0.5609904", "0.55644715", "0.5557263", "0.5557263", "0.5557263", "0.5554934", "0.5519928", "0.5482042", "0.5440737", "0.54331636", "0.54306805", "0.54181135", "0.53854...
0.6100206
0
Returns the normalized name for the task.
def TaskNormalizedName(cls, task): abs_path = FileUtils.GetAbsPathForFile(task) if abs_path: return abs_path return task
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_name(self) -> str:\n return self._task_name", "def task_name(self):\n pass", "def getTaskName(self):\n return self._taskName", "def TaskDisplayName(cls, task):\n if not task: return None\n return '//' + cls.TaskRelativeName(task)", "def TaskBaseName(cls, task):\n if n...
[ "0.8382673", "0.79891896", "0.79698485", "0.79065853", "0.77549475", "0.73818046", "0.708065", "0.708065", "0.7041858", "0.7030377", "0.6922824", "0.6897264", "0.68918365", "0.68649757", "0.682683", "0.6758295", "0.67563534", "0.6754193", "0.6749823", "0.6647676", "0.66235113...
0.85451823
0
Returns the relative name for the task w.r.t the src dir.
def TaskRelativeName(cls, task): if not task: return None return os.path.relpath(cls.TaskNormalizedName(task), PipelineConfig.Instance().pipeline_base_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TaskNormalizedName(cls, task):\n abs_path = FileUtils.GetAbsPathForFile(task)\n if abs_path: return abs_path\n return task", "def src_name(self) -> str:\n return self._src_name", "def TaskBaseName(cls, task):\n if not task: return None\n return os.path.basename(task)", "def task_nam...
[ "0.70790714", "0.70685434", "0.70276946", "0.68989986", "0.6897503", "0.6831635", "0.67773825", "0.6771261", "0.67468935", "0.67403793", "0.66436476", "0.65638936", "0.6533882", "0.6504925", "0.6454892", "0.645265", "0.6442094", "0.63864714", "0.632192", "0.6313081", "0.63065...
0.8300594
0
Returns the display name for the task.
def TaskDisplayName(cls, task): if not task: return None return '//' + cls.TaskRelativeName(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_name(self) -> str:\n return self._task_name", "def task_name(self):\n pass", "def getTaskName(self):\n return self._taskName", "def display_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"display_name\")", "def display_name(self) -> pulumi.Output[str]:\n ...
[ "0.82471687", "0.81944007", "0.78453606", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0....
0.8725436
0
Returns the base name for the task.
def TaskBaseName(cls, task): if not task: return None return os.path.basename(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_name(self):\n pass", "def task_name(self) -> str:\n return self._task_name", "def base_name(self):\n return self._project.path", "def TaskRelativeName(cls, task):\n if not task: return None\n return os.path.relpath(cls.TaskNormalizedName(task),\n ...
[ "0.80576354", "0.7993184", "0.76752627", "0.7604692", "0.75275767", "0.7465695", "0.74218655", "0.741003", "0.7403453", "0.7358316", "0.7225236", "0.7169889", "0.7147637", "0.71266806", "0.6995057", "0.6930375", "0.6924231", "0.6897062", "0.6875494", "0.68721527", "0.6861195"...
0.8556416
0
Returns the dir name for the task.
def TaskDirName(cls, task): if not task: return None return os.path.dirname(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_name(self):\n return self._dir", "def GetTaskOutputRelativeDir(cls, task):\n task = os.path.dirname(cls.TaskRelativeName(task))\n if not task: return ''\n\n parts = task.split(os.sep)\n res_parts = []\n for part in parts:\n priority_name = part.split('_', 1)\n res_parts +=...
[ "0.7382956", "0.71118563", "0.7021062", "0.70205456", "0.7001556", "0.69878685", "0.69065046", "0.69002163", "0.6749548", "0.6700269", "0.66729057", "0.6617986", "0.66096455", "0.6530177", "0.6515121", "0.63931465", "0.6349999", "0.63473034", "0.63405544", "0.63321805", "0.63...
0.8452019
0
Returns the display name for a list of tasks.
def TasksDisplayNames(cls, tasks): return [cls.TaskDisplayName(task) for task in tasks]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TaskDisplayName(cls, task):\n if not task: return None\n return '//' + cls.TaskRelativeName(task)", "def task_name(self):\n pass", "def task_name(self) -> str:\n return self._task_name", "def show_tasks(self, tasks=None, date_format=None):\n\n\t\tif not tasks:\n\t\t\ttasks = self.task...
[ "0.7450009", "0.7172618", "0.69796497", "0.6694739", "0.66327953", "0.6623551", "0.6532465", "0.6459202", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6363873", "0.6363873", "0.6363873", ...
0.8679665
0
Returns the output directory for the task. This removes all priority info from the task. This path is intended for use as input to CreateAllSubDirsForPath() which can generate the relevant output dirs for the path.
def GetTaskOutputRelativeDir(cls, task): task = os.path.dirname(cls.TaskRelativeName(task)) if not task: return '' parts = task.split(os.sep) res_parts = [] for part in parts: priority_name = part.split('_', 1) res_parts += [priority_name[1]] return os.sep.join(res_parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetOutDirForTask(cls, task):\n rel_path = cls.GetTaskOutputRelativeDir(task)\n subdirs = PipelineConfig.Instance().GetAllSubDirsForPath(rel_path)\n return subdirs.get('PIPELINE_OUT_DIR', '')", "def output_directory(self):\n if self._output_directory is None:\n cache_filename = self...
[ "0.76105917", "0.69024384", "0.6888713", "0.6840183", "0.6792421", "0.67734486", "0.6719438", "0.6704272", "0.6657806", "0.6648596", "0.65524286", "0.6510063", "0.6486327", "0.6458716", "0.64314944", "0.6418034", "0.6389241", "0.63731694", "0.63688755", "0.63460684", "0.63168...
0.76557827
0
Returns the out dir base for the pipeline.
def GetOutSubDir(cls): return PipelineConfig.Instance().pipeline_subdirs().get('PIPELINE_OUT_DIR', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_dir(self) -> str:\n return self._out_dir", "def get_base_dir(self):\n return self._config_dict['output']['@baseDirectory']", "def outputdir():\n return __OUTPUT_DIR__", "def output_path():\n folder = path.join(path.curdir, \"stages\")\n folder = path.abspath(folder)\n return...
[ "0.7739622", "0.7588257", "0.7478215", "0.73121095", "0.7309159", "0.72506773", "0.72222686", "0.71670294", "0.70638156", "0.70635444", "0.6981685", "0.69800514", "0.6948506", "0.6907481", "0.6896779", "0.68842655", "0.6840776", "0.6840294", "0.68123174", "0.67847246", "0.677...
0.80701506
0
Returns the out dir for the task.
def GetOutDirForTask(cls, task): rel_path = cls.GetTaskOutputRelativeDir(task) subdirs = PipelineConfig.Instance().GetAllSubDirsForPath(rel_path) return subdirs.get('PIPELINE_OUT_DIR', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_dir(self) -> str:\n return self._out_dir", "def GetTaskOutputRelativeDir(cls, task):\n task = os.path.dirname(cls.TaskRelativeName(task))\n if not task: return ''\n\n parts = task.split(os.sep)\n res_parts = []\n for part in parts:\n priority_name = part.split('_', 1)\n re...
[ "0.8124036", "0.7807332", "0.7749472", "0.77024525", "0.75807124", "0.75534135", "0.7461827", "0.74134356", "0.73026556", "0.7255008", "0.7196208", "0.7184133", "0.71576756", "0.71497446", "0.71199167", "0.708671", "0.7082931", "0.697324", "0.6912908", "0.690384", "0.68974566...
0.83940774
0
Returns the publish dated dir for the task.
def GetPublishDirForTask(cls, task): if not PipelineConfig.Instance().pipeline_publish_dir(): return '' out_dir = cls.GetOutDirForTask(task) if not out_dir: return '' return out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPublishCurrentDirForTask(cls, task):\n if not PipelineConfig.Instance().pipeline_publish_dir(): return ''\n\n out_dir = cls.GetOutDirForTask(task)\n if not out_dir: return ''\n out_dir = out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir())\n return os.path.joi...
[ "0.7302616", "0.6539091", "0.6442193", "0.6307431", "0.626553", "0.62530804", "0.6200344", "0.61683017", "0.60647184", "0.6061066", "0.60597706", "0.60472125", "0.6033625", "0.6007393", "0.5978313", "0.5960628", "0.5911679", "0.5867535", "0.58419484", "0.58406895", "0.5836643...
0.7450393
0
Returns the current publish dir for the task.
def GetPublishCurrentDirForTask(cls, task): if not PipelineConfig.Instance().pipeline_publish_dir(): return '' out_dir = cls.GetOutDirForTask(task) if not out_dir: return '' out_dir = out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir()) return os.path.join(os.path.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPublishDirForTask(cls, task):\n if not PipelineConfig.Instance().pipeline_publish_dir(): return ''\n\n out_dir = cls.GetOutDirForTask(task)\n if not out_dir: return ''\n return out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir())", "def get_dir(self):\n ...
[ "0.8311917", "0.66121066", "0.6603187", "0.6539092", "0.65207803", "0.6476241", "0.6405742", "0.639465", "0.6389074", "0.6347666", "0.6347057", "0.6316912", "0.62855846", "0.6264913", "0.6236826", "0.6235748", "0.6203303", "0.6187073", "0.61870384", "0.61644363", "0.61621976"...
0.87881327
0
Returns the log file for the task.
def GetLogFileForTask(cls, task): rel_path = cls.TaskRelativeName(task) if not rel_path or not PipelineConfig.Instance().pipeline_log_dir(): return None # Flatten the path. rel_path = rel_path.replace(os.sep, '.') return os.path.join(PipelineConfig.Instance().pipeline_log_dir(), rel_path + '.log')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_file(self):\n self.log_file = os.path.join(\n self.directory,\n \"ts\",\n self.ts.reaction_label,\n \"conformers\",\n \"{}_{}_{}.log\".format(self.ts.reaction_label, self.ts.direction, self.ts.index))\n return self.log_file", "def g...
[ "0.7858659", "0.76647484", "0.76480573", "0.75937", "0.74517137", "0.7376751", "0.7348423", "0.7322756", "0.73191816", "0.7068097", "0.7066757", "0.70392674", "0.6990611", "0.69762087", "0.694384", "0.6891112", "0.68894416", "0.6869049", "0.6851791", "0.6836735", "0.6825012",...
0.84021187
0
Returns the email id for zeus.
def ZeusEmailId(cls, mail_domain): return ('zeus+%s+noreply@%s.%s' % (PipelineConfig.Instance().pipeline_id(), socket.gethostname(), mail_domain))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n return self.email", "def get_id(self):\n return self.email", "def get_id(self):\n return escape(self.email)", "def get_email_template_id(self):\n return self.email_template_id", "def generate_email_address(self):\n return \"%s.%s@%s\" % (uuid.uuid4(), ...
[ "0.7823534", "0.7823534", "0.76104593", "0.66705906", "0.6644535", "0.6607022", "0.6607022", "0.6607022", "0.6598872", "0.65259534", "0.65159255", "0.6464402", "0.6455131", "0.64423794", "0.6381351", "0.63786924", "0.63620985", "0.6347863", "0.6347863", "0.6347863", "0.634786...
0.7983458
0
Compute the cosine distance between a "model" M from an author's set of documents and a featureset F extracted from D (the document to anonymize.) Note that m and f must be of equal length for this computation to be meaningful.
def cosine_distance(m, f): return (1 - ((m * f).sum() / (norm(m) * norm(f))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(self, source_doc, input_doc):\n vectorizer = self.vectorizer or TfidfVectorizer(tokenizer=PlagiarismDetector.tokenize_and_stem, stop_words='english')\n tfidf = vectorizer.fit_transform([source_doc, input_doc])\n return ((tfidf * tfidf.T).A)[0, 1]", "def cossim(corpus):\...
[ "0.6630762", "0.61939925", "0.6147209", "0.60718644", "0.6021758", "0.59584635", "0.5938526", "0.5901172", "0.58796334", "0.58659804", "0.5859782", "0.58310515", "0.581814", "0.5765349", "0.57595015", "0.57588243", "0.5756044", "0.57552505", "0.5741638", "0.5714364", "0.57093...
0.72795385
0
read the dataset json file. Gets only the utterance and the first label for that utterance
def read_json(self): utterances, labels = [], [] for log in self.log_json: for turn in log['turns']: utterance = turn['output']['transcript'] label = turn['output']['dialog-acts'][0]['act'] utterances.append(utterance) labels.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset():\n data = request.get_json()\n return jsonify(result=Tree.files(data['label']))", "def load_dataset(data_json):\n with open(data_json, 'r') as file:\n data = [json.loads(l) for l in file]\n \n ecgs = []; labels = []\n \n for entry in tqdm.tqdm(data):\n ecgs.ap...
[ "0.63026005", "0.6185721", "0.613367", "0.61276716", "0.6103785", "0.60992557", "0.60845", "0.605887", "0.60186905", "0.5916006", "0.5856801", "0.5816078", "0.5790435", "0.57400084", "0.56922793", "0.5689473", "0.5661292", "0.5655901", "0.5613307", "0.5607707", "0.56064785", ...
0.6511941
0
update the Hamiltonian matrix by new kvector and timeinterval it
def updateH(self,k_vec,it): self.k_vec = k_vec self.it = it self.H_kc = fl.H_k(k_vec, self.it, self.delta)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Hamiltonian_setup(N,V,interval):\n (a,b) = interval\n H = np.zeros((N-1,N-1))\n h= (b-a)/N\n for i in range(N-1):\n for j in range(N-1):\n if i==j:\n x=((i+1)*h) + a\n Vi=V(x)\n H[i,j] = Vi + 2/(h**2)\n if i==j+1 or i==j-1:\n...
[ "0.6314911", "0.59838396", "0.59380555", "0.58630985", "0.58421797", "0.5684106", "0.56371933", "0.5370095", "0.5368967", "0.53191304", "0.53141874", "0.5274858", "0.5238412", "0.52382356", "0.52371114", "0.520182", "0.5200775", "0.5192901", "0.5190681", "0.5169864", "0.51665...
0.6105699
1
To calculate the Chern number of the Hamiltonian (or the Floquet Hamiltonian) over its Brillouin zone (BZ).
def chernNum(self, kx_Bz=np.array([0,4*np.pi/3]), ky_Bz=np.array([0,2*np.pi/np.sqrt(3)]), N_res=30): x_eps = 0.3 # shift from Dirac point x_res = 20 kx_int = 0 + x_eps # -np.pi kx_fin = 4*np.pi/3 + x_eps Dx = (kx_fin - kx_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chibar(z):\n return chi(z)", "def king(r, n0, rc, b):\n return n0 * (1. + (r/rc)**2)**b", "def Z(n):\n count5 = 0\n i = 1\n while 1:\n a = pow(5, i)\n if a > n:\n return count5\n else:\n count5 += n/a\n i += 1", "def schmidt_number(self...
[ "0.6322738", "0.5849933", "0.58299345", "0.58136356", "0.5776217", "0.575044", "0.5717144", "0.5632605", "0.56096643", "0.5605452", "0.5583257", "0.5583257", "0.5566679", "0.5551885", "0.5551387", "0.5535313", "0.5525047", "0.551542", "0.55070794", "0.55008334", "0.5497203", ...
0.68269795
0
Runs Pyinstaller producing a binary for every platform arch.
def dist(self): for arch, python in self.python: # Build the binary build_path = os.path.join("dist", f"safety-{arch}") self.run(f"{python} -m PyInstaller safety.spec" f" --distpath {build_path}") # There seems to be no way to tell pyinstall...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n parser = argparse.ArgumentParser(prog='Build', description='Python script for building apps for Pyinstaller')\n # Flag arguments\n parser.add_argument('--version', action='version', version='%(prog)s 1.0.0')\n parser.add_argument('--clean', '-c', action='store_true', default=False, help...
[ "0.6310259", "0.5789505", "0.5693444", "0.5510755", "0.55103916", "0.5497933", "0.5497933", "0.54874897", "0.54428", "0.54246897", "0.5419463", "0.5417989", "0.5384044", "0.53545874", "0.5292452", "0.5261924", "0.52568054", "0.5245243", "0.52441704", "0.51907384", "0.517166",...
0.6888925
0
Runs tests for every available arch on the current platform.
def test(self): for arch, python in self.python: self.run(f"{python} -m pytest")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_platform():\n build()\n sh(\"%s psutil\\\\tests\\\\test_windows.py\" % PYTHON)", "def test_system_platform():\n accepted_values = ['windows', 'linux']\n output = sh.system_platform()\n assert output in accepted_values", "def test_all_envs(func):\n register_tests(func, [func.__name__ ...
[ "0.638114", "0.63241595", "0.62285227", "0.614223", "0.5939137", "0.585725", "0.5821105", "0.57821816", "0.5781692", "0.5748923", "0.56621426", "0.5645789", "0.56325114", "0.5582712", "0.55822486", "0.5556149", "0.554905", "0.5544548", "0.5525121", "0.5525121", "0.5525121", ...
0.7169691
0
Check if all elements present in the descending diagonal starting from position (i, j) in the matrix are all the same or not.
def checkDiag(mat, i, j): res = mat[i][j] i += 1 j += 1 while i < col and j < row: if mat[i][j] != res: return False i += 1 j += 1 return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkMatrix(i,j):\n # print(i,j)\n counter = Counter([grid[di][dj] for di in range(i,i+3) for dj in range(j,j+3)])\n for k in range(1,10):\n if counter[k] != 1:\n return False\n\n rows_sum = [sum(grid[k][j:j+3]) for k in range(i,i+3)...
[ "0.7221507", "0.72052103", "0.70935583", "0.7079611", "0.6919874", "0.6859481", "0.6859481", "0.6692153", "0.66862524", "0.6574057", "0.65542644", "0.6525075", "0.64994526", "0.64286137", "0.6414612", "0.6412978", "0.6392789", "0.63825876", "0.63576436", "0.6351419", "0.63253...
0.7580794
0
Check whether the matrix is Toeplitz using our routine.
def isToeplitz(mat): for j in range(row): if not checkDiag(mat, 0, j): return False for i in range(1, col): if not checkDiag(mat, i, 0): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_invertible(matrix: np.ndarray) -> bool:\n return matrix.shape[0] == matrix.shape[1] and np.linalg.det(matrix) != 0", "def check_matrix(self, matrix):\n for i in range(self.size):\n if (matrix[0][i] + matrix[-1][i] == i % 2 or matrix[0][i] + matrix[-1][i] == (i + 1) % 2) and (\n ...
[ "0.62021834", "0.6143656", "0.6061478", "0.58724177", "0.5847098", "0.5835416", "0.579894", "0.57757217", "0.5651579", "0.564704", "0.56339616", "0.5586131", "0.5580269", "0.55736345", "0.55596083", "0.5545253", "0.5520429", "0.5501175", "0.5497774", "0.5475992", "0.546678", ...
0.8034812
0
Try to locate the most frontfacing instance of the specified number in the given image.
def locate_number( pipeline: Pipeline, num: int, img: ImageBGR, ) -> Optional[Tuple[int, int]]: box = locate_front_facing_text(pipeline, str(num), img) if box is None: return None (cx, cy) = center_of_box(box) return (round(cx), round(cy))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_face(self, image):\n\t\ttry:\n\t\t\treturn max(self.get_faces(image),\n\t\t\t key = (lambda f: f[1]))\n\t\texcept ValueError:\n\t\t\treturn None", "def locate_face(image, minNeighbors=5, scaleFactor=1.05):\n rects = cc_face.detectMultiScale(image, scaleFactor=scaleFactor, minNeighbors=m...
[ "0.6109257", "0.5968454", "0.55990577", "0.5586432", "0.5545742", "0.5542052", "0.5507893", "0.54844373", "0.54029626", "0.53532827", "0.5300011", "0.52998513", "0.52698857", "0.52682185", "0.5256586", "0.5255363", "0.51983386", "0.5198194", "0.5178408", "0.51701695", "0.5156...
0.6024551
1
Try to locate the most frontfacing instance of the specified text in the given image.
def locate_front_facing_text( pipeline: Pipeline, text: str, img: ImageBGR, ) -> Optional[ndarray]: boxes = locate_all_text(pipeline, text, img) return None if not boxes else max(boxes, key=width_of_box)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(image):\n keypoint, description = describe(image)\n # load keypoints, descriptions from mongodb\n\n bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)\n\n best_match_size = float(\"inf\")\n best_match_index = -1\n match_index = 0\n best_matches = 0\n\n for desc in descriptions:\n matches = b...
[ "0.6584374", "0.5994109", "0.5930117", "0.5808667", "0.5791923", "0.5733024", "0.57220936", "0.56743777", "0.5612249", "0.559422", "0.5520388", "0.5518373", "0.55104786", "0.5501395", "0.5458008", "0.5457504", "0.5452925", "0.5452155", "0.54426736", "0.5430474", "0.5422574", ...
0.7968446
0
Locate all instances of the specified text in the given image.
def locate_all_text(pipeline: Pipeline, text: str, img: ImageBGR) -> List[ndarray]: predictions = recognize(pipeline, img) return [box for (txt, box) in predictions if txt == text]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image_search(image_name, saved_image, text):\n with Image(filename=image_name) as img:\n with img.clone() as cloned:\n cloned.format = 'png'\n with Drawing() as draw:\n draw.font_family = 'Liberation Mono'\n draw.font_...
[ "0.7133031", "0.6248851", "0.62018156", "0.6122685", "0.5983066", "0.59805745", "0.5944735", "0.5919284", "0.5852322", "0.5812584", "0.5805259", "0.57655126", "0.57553184", "0.57473385", "0.5714805", "0.56760997", "0.566809", "0.5653277", "0.5649725", "0.5605669", "0.5579515"...
0.73533505
0
Compute the width of a bounding box.
def width_of_box(box: ndarray) -> float: (w, _) = dimensions_of_box(box) return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWidth(self):\n return _libsbml.BoundingBox_getWidth(self)", "def width(self) -> int:\r\n return self.rect_uv.w", "def _get_pad_width(self, bbox):\r\n if isinstance(bbox, shapely.geometry.polygon.Polygon):\r\n bbox = bbox.bounds\r\n elif isinstance(bbox, tuple):\r\n...
[ "0.78384995", "0.7405333", "0.72103524", "0.71854645", "0.71309066", "0.698792", "0.69232786", "0.69125646", "0.68847704", "0.68847704", "0.681629", "0.6795641", "0.67908436", "0.67605865", "0.6724223", "0.67201644", "0.6717353", "0.66922086", "0.6662561", "0.6651283", "0.663...
0.7852812
0
Return the email address in the user's git config.
def get_my_email(): return check_output(['git', 'config', '--get', 'user.email']).strip().decode('utf-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")", "def account_email(self) -> str:\n return pulumi.get(self, \"account_email\")", "def email(self) -> str:\n return pulumi.get(self, \"email\")", "def email(self) -> str:\n return pulumi.get(self...
[ "0.7280318", "0.7232141", "0.7188435", "0.7188435", "0.7188435", "0.71637696", "0.71572125", "0.7076948", "0.7076948", "0.7076948", "0.7076948", "0.7075867", "0.7023382", "0.70050824", "0.6937374", "0.68804014", "0.6870833", "0.68378097", "0.68269426", "0.6818887", "0.6805280...
0.86037236
0
Germline TSV sheet without header
def tsv_sheet_germline_no_header(): f = io.StringIO( textwrap.dedent( """ patientName\tfatherName\tmotherName\tsex\tisAffected\tlibraryType\tfolderName\thpoTerms 12_345\t12_346\t12_347\tM\tY\tWGS\t12_345\tHP:0009946,HP:0009899 12_348\t12_346\t12_347\tM\tN\tWGS\t12_348\t. 12_346\t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tsv_sheet_cancer_no_header():\n f = io.StringIO(\n textwrap.dedent(\n \"\"\"\n patientName\\tsampleName\\tisTumor\\tlibraryType\\tfolderName\\tncbiTaxon\\tmycnCn\\tinssStage\\tshimada4Class\\tlohChr1p\\tpatientStatus\\ttimeToEventDays\\ttimeToDeathDays\\ttestSampleNice\\tngsLibraryNice\...
[ "0.6542757", "0.5973285", "0.58995175", "0.586946", "0.56117624", "0.5556044", "0.5453089", "0.54130244", "0.5376477", "0.53673553", "0.53632265", "0.52624077", "0.52572477", "0.52544403", "0.52472043", "0.52365565", "0.5235203", "0.5222204", "0.52163196", "0.51827556", "0.51...
0.6975893
0
Germline TSV sheet with seqPlatform name
def tsv_sheet_germline_platform_name(): f = io.StringIO( textwrap.dedent( """ patientName\tfatherName\tmotherName\tsex\tisAffected\tlibraryType\tfolderName\thpoTerms\tseqPlatform 12_347\t.\t.\tF\tN\tWGS\t12_347\t.\tIllumina 12_347\t.\t.\tF\tN\tWGS\t12_347\t.\tPacBio """.lstrip() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tsv_sheet_germline_no_header():\n f = io.StringIO(\n textwrap.dedent(\n \"\"\"\n patientName\\tfatherName\\tmotherName\\tsex\\tisAffected\\tlibraryType\\tfolderName\\thpoTerms\n 12_345\\t12_346\\t12_347\\tM\\tY\\tWGS\\t12_345\\tHP:0009946,HP:0009899\n 12_348\\t12_346\\t12_347\\tM\...
[ "0.5723765", "0.54112744", "0.5368876", "0.5364168", "0.5343656", "0.5305883", "0.52360225", "0.5199959", "0.51087195", "0.50739825", "0.4979598", "0.49793586", "0.49732012", "0.49713272", "0.49574873", "0.49445036", "0.49361375", "0.49321032", "0.49083406", "0.4893043", "0.4...
0.71251005
0
`comment_list` must be an iterable containing Comment instances.
def wrap_comments(comment_list, cls=None): if not cls: cls = CommentDetails return [cls(d) for d in CachedCall.multicall([cmt.details for cmt in comment_list])]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comment_list(parser, token):\n return CommentListNode.handle_token(parser, token)", "def get_all_comments(self, idList: Union[List, str]) -> None:\n\n #loads pickle list if it is one\n if type(idList) == str and \".pickle\" in idList:\n print(\"pickle load\")\n with...
[ "0.6494126", "0.6294482", "0.60200804", "0.59759414", "0.5885373", "0.58529603", "0.5835406", "0.581138", "0.5802858", "0.5801029", "0.5784154", "0.5736132", "0.57356554", "0.5729952", "0.5724823", "0.57243335", "0.5698182", "0.56944305", "0.56499034", "0.56499034", "0.564990...
0.73803866
0
Strip and redirect requests with certain trailing characters left by bad URL parsers.
def redirect_trailing(view): IGNORE_CHARS = ",./" def wrapped(request, *args, **kwargs): if request.META['PATH_INFO'][-1] in IGNORE_CHARS: return HttpResponseRedirect(request.META['PATH_INFO'].rstrip(IGNORE_CHARS)) return view(request, *args, **kwargs) return wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drop_trailing_questionmark():\n assert normalize_url(\"http://example.com/?\") == \"http://example.com/\"\n assert normalize_url(\"http://example.com?\") == \"http://example.com/\"\n assert normalize_url(\"http://example.com/a?\") == \"http://example.com/a\"\n assert normalize_url(\"http://exa...
[ "0.6716417", "0.65329564", "0.6438808", "0.6175929", "0.6159155", "0.61399084", "0.60827553", "0.6058008", "0.60463554", "0.6016129", "0.6008326", "0.59506243", "0.59365505", "0.59365505", "0.59365505", "0.59365505", "0.59365505", "0.59365505", "0.59365505", "0.58958346", "0....
0.6691305
1
`force_show` if True will return as many top reply IDs as we have.
def top_reply_ids(self, force_show=False): num_top = min(self.num_replies / Config['posts_per_top_reply'], Config['maximum_top_replies']) min_top_replies = Config['minimum_top_replies'] top_reply_ids = [] # Avoid even hitting redis if we know we aren't going to use the data. if f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_from_top_ten(title,users,max = 3):\n \"\"\" ten prolific users \"\"\"\n \"\"\" max : number of user with related followers \"\"\"\n getAllUsers(users,all_users,users_set,proceeded_users,max,user_cpt,title)\n for data in users_set:\n print(data.id)", "def show_recommendation_pool(s...
[ "0.5378942", "0.532292", "0.52742416", "0.5210229", "0.514267", "0.5120347", "0.51002747", "0.5028869", "0.50170374", "0.49864686", "0.49803752", "0.49629715", "0.49612206", "0.49332845", "0.4932724", "0.4930099", "0.49299458", "0.49253184", "0.49134997", "0.48672706", "0.485...
0.77080315
0
Returns replies with text, sorted by id
def get_text_reply_ids(self): if not self._linked_comment: return [] replies = Comment.objects.filter(replied_comment=self._linked_comment) return [ids[0] for ids in replies.exclude(reply_text='').order_by('id').values_list('id')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_replies(self, mid):\n pass", "def cmd_comment_replies(client, args):\n comment_replies = client.get_comment_replies(args.comment_id)\n data = format_comment_tree(comment_replies)\n generate_output({'comment_replies': data}, args.output_file)", "def replies(self):\n keys =...
[ "0.61649644", "0.6155298", "0.597946", "0.58901846", "0.5586778", "0.55457026", "0.55379367", "0.5525999", "0.5513527", "0.55060965", "0.5498998", "0.54371476", "0.5423341", "0.53732705", "0.53540397", "0.53385663", "0.53333944", "0.5317818", "0.53098434", "0.52878696", "0.52...
0.6619243
0
Do some preparation before running jobs
def _tidyBeforeRun (self): self._buildProps () self._buildInput () self._buildProcVars () self._buildJobs ()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare(self):", "def prepare(self):\n if self.opts['verbose']:\n print(\"Preparing dataset (one-time operation)...\")\n # Create paths files and load them back in\n self._build_ID_sets()\n self._create_ID_files()\n self._load_ID_files()\n if self.opts['ve...
[ "0.7044057", "0.68709004", "0.68693995", "0.68585104", "0.68585104", "0.68585104", "0.6740922", "0.6718343", "0.6686946", "0.666077", "0.666077", "0.666077", "0.666077", "0.666077", "0.6644439", "0.6626265", "0.6626265", "0.65906596", "0.65197337", "0.6379625", "0.6327932", ...
0.71023333
0
Get my name include `aggr`, `id`, `tag`
def _name (self, incAggr = True): aggrName = "@%s" % self.aggr if self.aggr and incAggr else "" tag = ".%s" % self.tag if self.tag != "notag" else "" return "%s%s%s" % (self.id, tag, aggrName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name():", "def get_name() -> str:", "def get_name(self):", "def get_name(self):", "def get_name_tag(obj):\n if 'Name' in obj.tags:\n return obj.tags['Name']\n else:\n return \"\"", "def get_name_tag(obj):\n if 'Name' in obj.tags:\n return obj.tags['Na...
[ "0.6776478", "0.6571145", "0.64042926", "0.64042926", "0.6375301", "0.6357653", "0.63202906", "0.6207927", "0.6207927", "0.6207927", "0.6207927", "0.6207927", "0.6207927", "0.62068367", "0.61977625", "0.61679345", "0.6132641", "0.6104459", "0.60582983", "0.6038414", "0.603841...
0.73647666
0
also add proc.props, mostly scalar values
def _buildProcVars (self): alias = {val:key for key, val in proc.ALIAS.iteritems()} for prop in sorted(self.props.keys()): val = self.props[prop] if not prop in ['id', 'tag', 'tmpdir', 'forks', 'cache', 'workdir', 'echo', 'runner', 'errorhow', 'errorntry', 'defaultSh', 'exportdir', 'exporthow', 'export...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_proc_attr_order(self):\n jobad = classad.ClassAd()\n for attr, val in [(x, condor_meter.PROC_ATTRS.index(x)) for x in reversed(condor_meter.PROC_ATTRS)]:\n jobad[attr] = val\n self.assertEqual(condor_meter.get_num_procs(jobad), val)", "def props(self):\r\n retu...
[ "0.5752733", "0.56328917", "0.56328917", "0.56328917", "0.5615482", "0.5577076", "0.5544038", "0.54323864", "0.5425881", "0.54114395", "0.53192484", "0.52942336", "0.52895135", "0.5284507", "0.52701503", "0.52666897", "0.5265208", "0.52173996", "0.52003396", "0.5196597", "0.5...
0.63126945
0
Tell whether the jobs are cached
def _isCached (self): self.props['ncjobids'] = range(self.length) if self.cache == False: self.log ('Not cached, because proc.cache is False', 'debug') return False if self.cache == True: for depend in self.depends: if depend.cached: continue self.log ('Not cached, my dependent "%s" is not cac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cached(self):\n return False", "def getCacheable(self):\n return False", "def mark_if_cached(self, args):\n pass", "def is_cached(name, typ=\"pkl\"):\n return os.path.exists(cache_name(name, typ))", "def enable_caching_acts_data() -> bool:\n return True", "def cached(s...
[ "0.760183", "0.7193296", "0.7158146", "0.7049321", "0.6945171", "0.69392574", "0.67610794", "0.67602086", "0.6705713", "0.66986024", "0.66811", "0.6526449", "0.6522423", "0.6519703", "0.65172327", "0.65119636", "0.64544183", "0.6348132", "0.633575", "0.6330356", "0.6327569", ...
0.7973835
0
Submit and run the jobs
def _runJobs (self): # submit jobs def sworker (q): """ The worker to run jobs """ while True: (run, i) = q.get() sleep (i) if run.isRunning(): self.log ("Job #%s is already running, skip submitting." % run.job.index, 'info') else: run.submit() run.wait() run.finish() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.submit()\n self.start()", "def submit(self):\n self.keep_data = False\n ManagedJob.submit(self)", "def submit(self, **kwargs):\n pwd = curdir\n wd = dirname(self.logFile)\n chdir(wd)\n d = OrderedDict()\n #d['universe'] = 'van...
[ "0.7423292", "0.7267833", "0.71237546", "0.69903475", "0.6716146", "0.67021185", "0.6673676", "0.6648856", "0.66117823", "0.6582873", "0.6563722", "0.65595084", "0.6535261", "0.65330726", "0.6530133", "0.6523355", "0.6512174", "0.65109503", "0.65062904", "0.6478821", "0.64662...
0.74873537
0
Checks if the digits in a UPC is consistent with checksum
def checksum (upc): # check type of input # raise TypeError if not string # xxxxxxxxxxx x # check length of string # raise ValueError if not 12 # convert string to array # generate checksum using the first 11 digits provided # check against the the twelfth digit # result of fir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum(upc):\n\n # check type of input\n if type(upc) != str:\n # raise TypeError if not string\n raise TypeError(\"Input must be a string\")\n # check length of string\n elif len(upc) != 12:\n # raise ValueError if not 12\n raise ValueError(\"Invalid UPC length\")\n ...
[ "0.76931924", "0.7153059", "0.6873011", "0.6843878", "0.6791563", "0.67721796", "0.67342436", "0.6706044", "0.66468424", "0.6590527", "0.65206844", "0.651262", "0.64882284", "0.64793825", "0.6446997", "0.643259", "0.64238644", "0.6422077", "0.6409033", "0.63966155", "0.639355...
0.7522875
1
Reset the current_instance counter.
def reset_current_instance(self): self.current_instance = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_counter(self) -> None:", "def reset (self):\n self.counter = 0", "def reset(self):\n self.counter = 0", "def reset(cls):\n cls.__instance = None", "def reset_count(self):\n self.count = 0", "def reset_counter(self):\n if hasattr(self._id_generator, \"reset_cou...
[ "0.75970316", "0.7579666", "0.7566452", "0.73800683", "0.7352367", "0.73349226", "0.722008", "0.7206008", "0.7027615", "0.69778574", "0.69737387", "0.6953763", "0.69374794", "0.6844482", "0.6788848", "0.678196", "0.6729615", "0.6675882", "0.66605294", "0.6637174", "0.6578837"...
0.8937279
0
Get the last instance added.
def get_last_instance(self): return self.instance_contexts[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_my_last_event(self):\r\n return self._handler.get_my_last_event()", "def at_last(self):\n return self._collection.at_last()", "def last(self):\n return self.last and self.last.value or None", "def last(self):\n return self.deque[-1]", "def getLastWorker(self):\n r...
[ "0.68711853", "0.6810386", "0.6726944", "0.66564316", "0.66301244", "0.6626313", "0.66114026", "0.65852886", "0.65747017", "0.6562729", "0.6555281", "0.655031", "0.6537491", "0.65363795", "0.6502471", "0.6441597", "0.6427053", "0.6420172", "0.640018", "0.6364432", "0.63504106...
0.7894895
0
Get the current instance, then increment the current_instance value.
def get_next_instance(self): self.current_instance += 1 return self.instance_contexts[self.current_instance - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_current_instance(self):\r\n self.current_instance = 0", "def inc(self):\n with self.mutex:\n self.value += 1\n return self.value", "def updateCounter(self):\n self.counter = self.counter + 1\n self.syncDataStructure[\"+\"][str(self.instanceID)] = self...
[ "0.690823", "0.68347883", "0.6701055", "0.66770405", "0.66295475", "0.64652735", "0.6456468", "0.64496535", "0.6416826", "0.6364535", "0.63558865", "0.625179", "0.6242719", "0.62325436", "0.6130614", "0.61168027", "0.6098057", "0.608348", "0.60704607", "0.60397077", "0.603596...
0.8085299
0
Register a new macro in the macros dict.
def register_macro(self, name: str): self.macros.setdefault(name, Macro())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_macro_context(self, name: str, context: dict = None):\r\n if context is None:\r\n context = dict()\r\n self.macros[name].add_instance(dict())", "def _expand_macros(tokdict,macrodict):\r\n def macro_value(m):\r\n return '(?:%s)' % macrodict[m.groupdict()['macro']]\r\n ...
[ "0.667128", "0.6386615", "0.6171267", "0.5982367", "0.59769773", "0.58068347", "0.57270074", "0.5714279", "0.5649475", "0.56381917", "0.5628102", "0.5482599", "0.5440994", "0.5368773", "0.5367753", "0.5353264", "0.53425723", "0.5309798", "0.5293307", "0.52802014", "0.52768517...
0.8195985
0
Add a new instance/context to a Macro object
def add_macro_context(self, name: str, context: dict = None): if context is None: context = dict() self.macros[name].add_instance(dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_instance(self, context):\r\n self.instance_contexts.append(context)\r\n self.total_count += 1", "def add(self, context):\n self._contexts.add(context)", "def __init__(self, macro_name, macro_content):\n self._macro_name = process_for_latex(macro_name)\n self._macro_co...
[ "0.64550906", "0.5815178", "0.581206", "0.57343155", "0.56727946", "0.565651", "0.56156", "0.5564796", "0.5564684", "0.5454445", "0.536506", "0.5324165", "0.53177595", "0.5314927", "0.5123087", "0.5122237", "0.508866", "0.50394654", "0.5033408", "0.5000955", "0.49768367", "...
0.8081105
0
Switch the current context.
def switch_context(self, context): self.context_stack.append(self.current_context) self.current_context = context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch(self, context):\n return", "def _set_context(self, ctx):\n try:\n current_engine_name = self.parent.engine.name \n if sgtk.platform.current_engine(): \n sgtk.platform.current_engine().destroy()\n sgtk.platform.start_engine(curren...
[ "0.7744432", "0.7199943", "0.71186477", "0.69892776", "0.68974406", "0.68526095", "0.68338317", "0.68338317", "0.678041", "0.6674753", "0.66629636", "0.66492593", "0.6548222", "0.6524813", "0.6431893", "0.61897355", "0.6144941", "0.6088508", "0.60671574", "0.60372967", "0.594...
0.8493895
0
Restore the previous context.
def restore_context(self): self.current_context = self.context_stack.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context_reset(self):\n self._context_state = None\n logging.info('Resetting the context')", "def restore_context(self, filepath):\n\n raise NotImplementedError()", "def reset(self, *_):\n with self._context.lock:\n super().reset()\n self.__context_init()", "def r...
[ "0.7633371", "0.71010125", "0.7044028", "0.6811748", "0.6767361", "0.6687625", "0.66691613", "0.6668881", "0.65513235", "0.6521201", "0.6511832", "0.6501799", "0.65001637", "0.6458619", "0.6444411", "0.6437519", "0.64000064", "0.6383079", "0.6379866", "0.63735694", "0.6261989...
0.8610675
0
The macro function decorator.
def macro(self, func): self.register_macro(func.__name__) def wrapper(*args, **kwargs): old = func.__globals__.copy() for key in self.current_context.keys(): del func.__globals__[key] if not self.loaded: self.add_macro_contex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_macro(extension):\n def macro(body, args, kwargs, is_block, environ):\n if extension.is_void and body:\n return wrap(MarkupErrorElement(\n _(u'Macro “%s” was passed a body but does not '\n u'support it.') % extension.name))\n # ensure the body is...
[ "0.6746005", "0.65535325", "0.65420234", "0.6394286", "0.630091", "0.62976325", "0.6149211", "0.6125098", "0.6049065", "0.5981956", "0.5956665", "0.5904848", "0.5892715", "0.5882666", "0.58784175", "0.5797652", "0.5781429", "0.5764209", "0.5754016", "0.57075137", "0.5688477",...
0.6873393
0
Called exactly once for the first DBAPI connection.
def first_connect(self, dbapi_connection, connection_record):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._connection = get_db_connection()", "def connect(self, dbapi_connection, connection_record):", "def _db_connection(self):\n pass", "def init(self):\n self.conn = None\n\n return True", "def __init__(self):\n\t\tself.obtainDatabaseConnection()", "def ...
[ "0.67195183", "0.6715476", "0.656256", "0.6527683", "0.65126604", "0.6497691", "0.64863473", "0.6459973", "0.64582694", "0.6446564", "0.6421492", "0.64208746", "0.64178276", "0.6338431", "0.63314486", "0.63314486", "0.63314486", "0.63299924", "0.6309114", "0.62960386", "0.627...
0.82037026
0
Creates an HTML file with given template and content.
def create_html(text, template, output): # TODO uncomment this for orginal DMP format (right now difficult with differing section sizes) #templateLoader = jinja2.FileSystemLoader(searchpath="../templates/new") templateLoader = jinja2.FileSystemLoader(searchpath="../templates") templateEnv = jinja2.Envi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provide_html_template():\n get_content = str(input(\"Paste the content you want to see displayed in the browser here. \\n\"))\n get_name = input(\"I am going to create an html file with your content. What do you want to call your file? \\n\")\n \n new_html_file = open(str(get_name) + '.html', 'w')\...
[ "0.76947534", "0.70680845", "0.6908305", "0.68400776", "0.68179643", "0.6798371", "0.6737883", "0.67168546", "0.6636704", "0.655709", "0.65269643", "0.646904", "0.6464826", "0.64504373", "0.6447081", "0.64354914", "0.6418375", "0.6408326", "0.640207", "0.63944256", "0.6386369...
0.7549857
1
Converts a given HTML file into a PDF.
def create_pdf(html, options): # TODO: we will change this path, or use an other library for converting PDF! # TODO: otherwise just say that wkhtmltopdf needs to be pre-installed (and how) and added to windows path path_wkthmltopdf = "C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe" config = pdfkit.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html2pdf(html_filename, output_filename=None, **options):\n\n if not output_filename:\n output_filename = newTempfile(suffix='.pdf')\n\n if not pdfreactor_available:\n raise RuntimeError(\"The external 'pdfreactor' converter isn't available\")\n\n cmd = '%s \"pdfreactor\" \"%s\" \"%s\"' ...
[ "0.7248246", "0.7169749", "0.71362674", "0.6948476", "0.6708248", "0.6610215", "0.658075", "0.6533911", "0.6426139", "0.642575", "0.63720566", "0.63564223", "0.61420655", "0.6088606", "0.60696626", "0.6064924", "0.6037568", "0.6029076", "0.6007931", "0.5998022", "0.59935737",...
0.756505
0
Return list of groups (id) for requested projects flag groups declared as projects owner
def get_project_groups_id(self, names): assert isinstance(names, list) # Getting access rules for all projects hosted # is done by one request specifiying multiple # project names inside the query string. To act safer # bulk limits the amount of projects requested in one shot ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_groups(self, obj):\n groupsForCompany = get_groups_with_perms(obj)\n return [x.id for x in groupsForCompany]", "def get_groups(id_project):\n data = sql.list_groups(id_project)\n names = [(d['id'], d['name']) for d in data]\n return names", "def list_projects(ctx):\n pprint(ct...
[ "0.66103697", "0.6584689", "0.6564444", "0.6420417", "0.6404506", "0.63974404", "0.6299866", "0.627742", "0.62102056", "0.6117552", "0.61089313", "0.60776865", "0.60669416", "0.60601676", "0.60473305", "0.6034015", "0.6022365", "0.59869814", "0.5985959", "0.5977469", "0.59712...
0.66556174
0
Update a gerrit account. Only 'full_name' and 'email' can be updated.
def update_account(self, id=None, username=None, **kwargs): if not (bool(id) != bool(username)): raise TypeError('account id OR username needed') if 'full_name' in kwargs.keys(): try: self.g.put('accounts/%s/name' % id or username, data=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_update(request):\r\n params = request.params\r\n json_body = request.json_body\r\n user_acct = request.user\r\n\r\n if 'name' in params and params['name'] is not None:\r\n name = params.get('name')\r\n user_acct.name = name\r\n\r\n if 'name' in json_body and json_body['name...
[ "0.7108805", "0.6938995", "0.6783032", "0.65848964", "0.6567411", "0.6345919", "0.63428134", "0.63318664", "0.6312359", "0.6220183", "0.6206186", "0.6164123", "0.60568076", "0.60517806", "0.60360813", "0.60136294", "0.60079366", "0.59596103", "0.5938938", "0.5931337", "0.5928...
0.74522334
0
Add a group as a member of targetgroup
def add_group_group_member(self, targetgroup, groupname): try: targetgroup = self.quote(targetgroup) groupname = self.quote(groupname) self.g.put('groups/%s/groups/%s' % (targetgroup, groupname), headers={...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_add():\r\n try:\r\n target_id = request.post_vars[\"target\"]\r\n group_id = request.post_vars[\"group\"]\r\n except KeyError:\r\n pass\r\n\r\n result = gl.add_to_targetgroup(target_id, group_id)\r\n\r\n if result:\r\n return response.json({'success': 'true'})\r\n...
[ "0.7717108", "0.7391383", "0.71136713", "0.7108314", "0.7095311", "0.7065485", "0.701168", "0.7006552", "0.70005846", "0.6773371", "0.67148256", "0.66208655", "0.65720075", "0.6564292", "0.6531716", "0.65001243", "0.63495827", "0.6329787", "0.62838423", "0.6272301", "0.626889...
0.7701457
1
Query the system for package information of a specified RPM Query the package information only for the installed package and work from cached data to avoid side effects to the host. Return a list of lines from the response STDOUT
def get_package_info(package_name): info_command_template = "yum info installed --cacheonly {}" info_command = info_command_template.format(package_name) # subprocess wants a list of arguments, not a single string try: package_info = subprocess.check_output(info_command.split(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages(module, repo_mgr, list_type, package):\n rc_code, out, err = module.run_command(\"/usr/bin/%s -q list %s %s\"\n % (repo_mgr, list_type, package), environ_update=ENV_LOCALE)\n if rc_code is 0:\n return out.splitlines()\n else:\n if rc...
[ "0.6890891", "0.6458352", "0.6417518", "0.6267885", "0.61134464", "0.6095884", "0.60921556", "0.60532266", "0.6008601", "0.59963685", "0.59829915", "0.594374", "0.59393394", "0.5866107", "0.5844895", "0.58440983", "0.56793255", "0.5670345", "0.5658176", "0.5651326", "0.563908...
0.66073734
1
The source repo name is stored with the package. The "From repo" line indicates where the package came from. Return the repo name or None if not found
def get_package_repo_name(package_info): # should check that there is EXACTLY one line repo_lines = \ [line for line in package_info if line.startswith("From repo ")] # "From repo : <repo name>" # Get the value and remove white space. if len(repo_lines) > 0: repo_name = repo_lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_repo_name(vcs):\n return 'source'", "def repo_of_package(self, package_name: str) -> str:\n if package_name not in self.all_packages_dict:\n return Colors.BOLD(Colors.LIGHT_MAGENTA(\"local/\") + package_name)\n package = self.all_packages_dict[package_name]\n if pack...
[ "0.7836136", "0.7142839", "0.6934166", "0.6934166", "0.6934166", "0.66367394", "0.6576414", "0.6525963", "0.64376867", "0.6327674", "0.6325919", "0.631426", "0.6271193", "0.62525576", "0.62364066", "0.6220603", "0.6095599", "0.6084242", "0.6082746", "0.6072888", "0.6054819", ...
0.78646374
0
Get the repo name for an OSP package That name should indicate the major version of OSP from a table. Return the version matching the repo name or None if not found
def get_version_from_repo_name(package_repo_name): version_string = yum_repos[package_repo_name] \ if package_repo_name in yum_repos.keys() \ else None return version_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_repo_name(package_info):\n\n # should check that there is EXACTLY one line\n repo_lines = \\\n [line for line in package_info if line.startswith(\"From repo \")]\n\n # \"From repo : <repo name>\"\n # Get the value and remove white space.\n if len(repo_lines) > 0:\n r...
[ "0.69046545", "0.66761976", "0.64646137", "0.6194541", "0.61512", "0.61512", "0.61512", "0.61041784", "0.6055042", "0.6055042", "0.60245675", "0.6001156", "0.59974265", "0.59744567", "0.59740454", "0.5970664", "0.59664947", "0.5939434", "0.5933307", "0.5932706", "0.591309", ...
0.7307918
0
Takes an input and converts it into a float number
def main(): try: x = input("Type in a number to be converted to a float: ") floatnum = float(x) print(floatnum) except(ValueError): print("Could not convert the string to a float")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_float(self, prompt=\"> \"):\n\t\twhile True:\n\t\t\tans = raw_input(prompt)\n\t\t\ttry: \t\n\t\t\t\tans = float(ans)\n\t\t\t\treturn ans\n\t\t\texcept ValueError:\n\t\t\t\tif ans == \"quit\": quit()\n\t\t\t\telse: print \"Please enter a number using decimal notation.\"", "def char_float(inp_char):\n try...
[ "0.7609443", "0.75654024", "0.7514502", "0.74880666", "0.73692375", "0.73636425", "0.7316602", "0.72737426", "0.7193005", "0.7177591", "0.71387315", "0.70654273", "0.7059681", "0.70422375", "0.7035431", "0.7034577", "0.7033259", "0.7026536", "0.69930553", "0.6986892", "0.6977...
0.80235124
0
Given an input value in the interval [input_interval_start, input_interval_end], return an output value scaled to fall within the output interval [output_interval_start, output_interval_end].
def remap_interval(val, input_interval_start, input_interval_end, output_interval_start, output_interval_end): inputrange = float(input_interval_end) - float(input_interval_start) #finds length or original interval outputrange = float(output_interval_end) - float(output_interval_start) #finds length of t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remap_interval(val, input_interval_start, input_interval_end, output_interval_start, output_interval_end):\n convert = float (val - input_interval_start) / float ( input_interval_end - input_interval_start)\n output1 = output_interval_start + convert* (output_interval_end - output_interval_start)\n re...
[ "0.79932183", "0.7901168", "0.7887289", "0.7876046", "0.7751076", "0.7288981", "0.7237463", "0.7120831", "0.7019347", "0.6851704", "0.68007386", "0.66910595", "0.6677727", "0.6569077", "0.6418457", "0.62758476", "0.625303", "0.6198374", "0.6172267", "0.616496", "0.616496", ...
0.8289255
0
Runs num_iters steps of SC steepest descent on the dictionary elements The a comment on axis ordering and the padding necessary to deal with boundary affects, see the docstrings in analysis_transforms/convolutional
def run(images_padded, dictionary, codes, kernel_stride, padding_dims, stepsize=0.001, num_iters=1, normalize_dictionary=True): reconstruction_mask = create_mask(images_padded, padding_dims) codes_temp_transposed = codes.transpose(dim0=1, dim1=0) # TODO: Figure out if I can remove the double-transpose in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_conv_code_unroll_batch_kern(d, unroll_bsize=1, unroll_ksize=1):\r\n assert unroll_bsize > 0 and unroll_ksize > 0\r\n if \"unroll_bsize\" in d or \"unroll_ksize\" in d or \"unroll_iter\" in d or \"unroll_biter\" in d or \"unroll_kiter\" in d:\r\n raise Exception(\"We can't use this dictionnary ...
[ "0.561682", "0.5455139", "0.54320246", "0.5400106", "0.53414565", "0.53230274", "0.52961946", "0.52878106", "0.52821034", "0.5278173", "0.52781266", "0.52665293", "0.52234095", "0.5221753", "0.5208205", "0.52052426", "0.5204347", "0.5190821", "0.5174756", "0.5170999", "0.5153...
0.6045369
0
Perform multiple consecutive attacks
def multiattack(self, sentence, attacks_with_severity): for i,(attack, severity) in enumerate(attacks_with_severity): if attack=="rand": attack = random.choice(self.methods) while attack=="intrude" and i!=len(attacks_with_severity)-1: attack = rand...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def attacking_logic(self):\n if len(self.units(UnitTypeId.ZERGLING)) >= 6:\n for zergling in self.units(UnitTypeId.ZERGLING):\n self.do(zergling.attack(self.enemy_start_locations[0]))", "def attack(self, robot):\n pass", "def attack(self):\n\n if not self.at...
[ "0.5993577", "0.5946337", "0.576245", "0.5705413", "0.56642854", "0.5558414", "0.55434275", "0.5485012", "0.54479545", "0.53891695", "0.537023", "0.53190684", "0.5313921", "0.53021246", "0.5299953", "0.5299419", "0.5256593", "0.5190473", "0.5189436", "0.51798266", "0.51435095...
0.6846764
0
Create path to a unique temp dir from given base temp dir.
def _make_unique_temp_dir(base_temp_dir): return os.path.join(base_temp_dir, uuid.uuid4().hex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_base_temp_dir(cls):\n if cls._thread_local.state.temp_dirs:\n base_temp_dir = os.path.join(cls._thread_local.state.temp_dirs[-1],\n cls._TEMP_SUBDIR)\n else:\n raise ValueError(\n 'A tf.Transform function that required a temp dir was called but ...
[ "0.7639535", "0.75858647", "0.75725234", "0.7204607", "0.7200416", "0.71961796", "0.7147817", "0.71170455", "0.7116208", "0.71064216", "0.7062529", "0.6970509", "0.695506", "0.6905613", "0.689262", "0.68787223", "0.68727803", "0.681926", "0.6812259", "0.68059057", "0.6804259"...
0.885131
0
Returns a list of lists, containing analyzers by level. We need to run analyzers in order so that when running the TF graph to get the inputs of an analyzer, we only rely on analyzers that have already been computed. This is acheived by running analyzers in order of their `level` where the level of an analyzer is defin...
def _analyzers_by_level(self, outputs): memoized_column_levels = {} analyzers_by_level = collections.defaultdict(list) def column_level(column): """Adds all analyzers above this column to analyzers_by_level. Visits all parents of this column or statistic in the `Column`/`Statistic` graph,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_analyzers(cls):\n for analyzer_name, analyzer_class in iter(cls._class_registry.items()):\n yield analyzer_name, analyzer_class", "def list_analyzers(args: argparse.Namespace):\n first = True\n queue = [tuple(c) + (\"lookout.\",) for c in pkgutil.iter_modules(lookout.__path__)]\n ...
[ "0.5864481", "0.53452533", "0.50972193", "0.5097106", "0.506351", "0.49360263", "0.49226353", "0.4915473", "0.48669732", "0.48573586", "0.475987", "0.47398412", "0.46899807", "0.46852565", "0.46842974", "0.4634878", "0.46315", "0.46094146", "0.4595435", "0.45916668", "0.45753...
0.7261228
0
Replaces a wit b and b with a in my_str
def inverse_replacer(my_str:str, a:str, b:str) -> str: my_str = list(my_str) for i in range(len(my_str)): if my_str[i] == a: my_str[i] = b elif my_str[i] == b: my_str[i] = a return(''.join(my_str[::-1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_substitutions_in_word(self):\n m = strutils.MultiReplace({r'cat': 'kedi', r'purple': 'mor', })\n self.assertEqual(m.sub('Thecatispurple'), 'Thekediismor')", "def myreplace(old, new, s):\n\n s = s.split()\n s = \" \".join(s)\n\n return new.join(s.split(old))", "def test_simple_su...
[ "0.6426957", "0.6371966", "0.62510085", "0.6172532", "0.605283", "0.60364926", "0.5999566", "0.591037", "0.5850798", "0.58500206", "0.58080274", "0.5771347", "0.57628804", "0.56756216", "0.56451476", "0.56305456", "0.56139046", "0.5609791", "0.5602158", "0.55999005", "0.55693...
0.7641272
0
Return an array of n linearspaced values from min to max.
def rangeLin(min, max, n): return np.arange( min, max, (max-min)/n )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linspace(start, stop, n, istart=True, istop=True):\r\n n = n-1\r\n arr = [start + ((stop-start)/n) * i for i in range(n+1)]\r\n return arr", "def create_array(n, bound):\n array = [np.random.randint(0, bound) for x in range(n)]\n return array", "def x_uniform1(xlim, n):\n return linspace...
[ "0.71289086", "0.7006669", "0.66802406", "0.65675193", "0.6554845", "0.6424489", "0.63840723", "0.6360398", "0.63580406", "0.6333735", "0.6289109", "0.6270997", "0.6265102", "0.6229819", "0.6141139", "0.6074155", "0.6066987", "0.6065085", "0.60578597", "0.6039758", "0.6018827...
0.7715625
0
Return X matrix Xij = [ exp(k_jt_i); Iw^(1/2) ] from arrays k and t.
def Xmatrix(k,t,w, standardizeData=True): K, N = len(k), len(t) X = np.zeros( (N+K,K) ) for i in range(N): for j in range(K): X[i,j] = np.exp(-1.0*k[j]*t[i]) for i in range(K): X[i+len(t),i] = w**0.5 Xmean = (X[0:N,:]).mean(axis=0) if standardizeData: for j in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Xsubmatrix(k,t, standardizeData=True):\n\n K, N = len(k), len(t)\n X = np.zeros( (N,K) )\n for i in range(N):\n for j in range(K):\n X[i,j] = np.exp(-1.0*k[j]*t[i])\n\n Xmean = X.mean(axis=0)\n if standardizeData:\n for j in range(K):\n X[:,j] = X[:,j] - Xmean[j]\n\n r...
[ "0.654792", "0.62343216", "0.59998757", "0.59954584", "0.58997905", "0.5833076", "0.58315307", "0.5817481", "0.57968336", "0.57816815", "0.5695442", "0.56352943", "0.5633382", "0.55761397", "0.55315673", "0.5512695", "0.55079854", "0.5452388", "0.545135", "0.542148", "0.53979...
0.6576722
0
Return X matrix Xij = [ exp(k_jt_i)] from arrays k and t.
def Xsubmatrix(k,t, standardizeData=True): K, N = len(k), len(t) X = np.zeros( (N,K) ) for i in range(N): for j in range(K): X[i,j] = np.exp(-1.0*k[j]*t[i]) Xmean = X.mean(axis=0) if standardizeData: for j in range(K): X[:,j] = X[:,j] - Xmean[j] return X, Xmean
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Xmatrix(k,t,w, standardizeData=True):\n \n K, N = len(k), len(t)\n X = np.zeros( (N+K,K) )\n for i in range(N):\n for j in range(K):\n X[i,j] = np.exp(-1.0*k[j]*t[i])\n for i in range(K):\n X[i+len(t),i] = w**0.5\n\n Xmean = (X[0:N,:]).mean(axis=0) \n if standardizeData:\...
[ "0.64807385", "0.62325656", "0.6106175", "0.6067337", "0.5988209", "0.59643847", "0.58780324", "0.586434", "0.58161384", "0.5789269", "0.5753004", "0.57186216", "0.5696763", "0.56853116", "0.56414497", "0.5595421", "0.5574128", "0.55618346", "0.5512092", "0.5468021", "0.54500...
0.66882664
0
nTimes = 727 same number as W55F dataset taus = [1.0e6, 1.0e4, 5.0e3] timescales for a test data curve amps = [0.3, 0.3, 0.4] ampltudes of each relaxation sigma = 0.05 add artifical noise to the data
def testData(nTimes = 1000, taus = [1.0e-6, 1.0e-4, 5.0e-3], amps = [0.3, 0.3, 0.4], sigma = 0.05, linear=False): if linear: Times = rangeLin(1.0e-7, 1.0e-3, nTimes) # in seconds else: Times = rangeLog(1.0e-9, 1.0, nTimes) # in seconds Data = np.zeros( Times.shape ) for i in range(len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_plt_mag_time():\n\n ta = WATA()\n wata_data = define_testdata()\n ta.source = ColumnDataSource(data=wata_data)\n ta.add_time_column()\n ta.setup_date_range()\n\n # create the arrays per filter and readout pattern\n nrsrapid_f140x, nrsrapid_f110w, nrsrapid_clear = [], [], []\n nrsra...
[ "0.6373813", "0.6351109", "0.6140943", "0.613694", "0.6108043", "0.6039261", "0.60305786", "0.596345", "0.59240603", "0.58829147", "0.5873695", "0.5839105", "0.58336765", "0.58019346", "0.5791312", "0.57601404", "0.57052803", "0.5704976", "0.569301", "0.5687342", "0.5664945",...
0.6944508
0
nTimes = 727 same number as W55F dataset beta = the stretching exponenent (should be between 0 and 1) sigma = 0.05 add artifical noise to the data
def testStretchedExpData(nTimes = 1000, beta = 0.5, sigma = 0.05, linear=False): if linear: Times = rangeLin(1.0e-3, 1.0e+3, nTimes) # in seconds else: Times = rangeLog(1.0e-3, 1.0e+3, nTimes) # in seconds Data = np.exp(-1.*(Times**beta)) Data += sigma*np.random.randn( len(Data) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise_generator(n, mean, std, fractindex):\n if fractindex not in VALID_FRACT:\n raise ValueError(\"results: status must be one of %r.\" % VALID_FRACT)\n \n stdev = std\n \n b = 2*fractindex-1\n print('beta: ', b)\n \n bdis = np.zeros(n)\n\n bdis[0] = 1\n for i in range(1,n...
[ "0.64249635", "0.6127469", "0.59821934", "0.5905486", "0.5902299", "0.5896128", "0.5882188", "0.5829961", "0.58168125", "0.5813827", "0.5785464", "0.57696134", "0.5728573", "0.5718349", "0.57028085", "0.56930923", "0.56703866", "0.5651287", "0.5642848", "0.5610342", "0.559990...
0.623264
1
Apply a passthrough filter to a cloud
def apply_passthrough_filter(cloud, axis, axis_min, axis_max): # Create a PassThrough filter object. passthrough = cloud.make_passthrough_filter() # Assign axis and range to the passthrough filter object. filter_axis = axis passthrough.set_filter_field_name(filter_axis) #axis_min = 0.6 #axi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_filter(self, image):\n pass", "def filter(self, *args, **kwargs):", "def apply(self, *args):\n return _ida_hexrays.udc_filter_t_apply(self, *args)", "def apply_filters(self, new_filters):\n\t\tself.filters = new_filters", "def apply(self, *args):\n return _ida_hexrays.microco...
[ "0.6539141", "0.60534006", "0.6045387", "0.593166", "0.5931561", "0.5887304", "0.58217114", "0.581077", "0.5772639", "0.57151353", "0.5696424", "0.5690819", "0.56490076", "0.563207", "0.5628303", "0.56268173", "0.561666", "0.5591821", "0.5530589", "0.5467814", "0.5466966", ...
0.74443835
0
Segments a cloud using a sac model
def ransac(cloud, sacmodel): # Create the segmentation object seg = cloud.make_segmenter() # Set the model you wish to fit seg.set_model_type(sacmodel) seg.set_method_type(pcl.SAC_RANSAC) # Max distance for a point to be considered fitting the model # Experiment with different values for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment(points, model=pclpy.pcl.sample_consensus.SACMODEL_LINE, method=pclpy.pcl.sample_consensus.SAC_RANSAC, miter=1000, distance=0.5, rlim=[0,0.5]):\n pointcloud = pclpy.pcl.PointCloud.PointXYZ(points)\n segmenter = pclpy.pcl.segmentation.SACSegmentation.PointXYZ()\n\n segmenter.setInputCloud(pointc...
[ "0.5972947", "0.57596177", "0.5705211", "0.55908954", "0.5576257", "0.55459577", "0.55090237", "0.54882836", "0.54302746", "0.53734714", "0.52986604", "0.528243", "0.5271106", "0.52643365", "0.5247393", "0.5247393", "0.5171636", "0.51356274", "0.51081306", "0.50940233", "0.50...
0.6150639
0
Make a terminal loader/spinner animation using the imports above. Takes seconds argument = time for the spinner to run. Does not return anything, only prints to stdout.
def spinner(seconds): timeout = time() for state in cycle(SPINNER_STATES): if time() - timeout > seconds: break else: print(state, end= '\r', flush= True) sleep(STATE_TRANSITION_TIME)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loading(delay):\r\n\r\n for i in range(3):\r\n\r\n print \".\",\r\n sys.stdout.flush()\r\n time.sleep(delay)\r\n\r\n print(\"\")", "def animate():\n for c in itertools.cycle(['|', '/', '-', '\\\\']):\n if done:\n break\n sys.stdout.wr...
[ "0.66631764", "0.65671074", "0.6313429", "0.62911284", "0.57967776", "0.57249594", "0.5722175", "0.5686955", "0.5641586", "0.56180584", "0.5608205", "0.5562148", "0.55549806", "0.5531149", "0.5498166", "0.5469922", "0.54436475", "0.54220825", "0.54170036", "0.5410249", "0.540...
0.68003017
0
Removes punctuation & excess whitespace, sets to lowercase, and stems tweets. Returns a list of stemmed tokens.
def tokenize(tweet): tweet = " ".join(re.split("[^a-zA-Z]*", tweet.lower())).strip() tokens = [stemmer.stem(t) for t in tweet.split()] return tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stem_tokens(tokens, stemmer):\n stemmed = []\n # going through tokens stem where needed\n for token in tokens:\n stemmed.append(stemmer.stem(token))\n return stemmed", "def tokenizeAndStem(phrase, ignore = []):\n # Final list of stems\n stems = []\n # Loop through tokenized items\...
[ "0.7678134", "0.7551364", "0.75347817", "0.7524167", "0.750994", "0.750994", "0.750994", "0.750994", "0.750994", "0.7473676", "0.7467269", "0.7444527", "0.74240965", "0.7400697", "0.7393167", "0.7378211", "0.7346575", "0.7345031", "0.73118025", "0.7284678", "0.72558844", "0...
0.8219763
1
Tally the statistics in the given HDF5
def tally_stats(hdf5_file): Stat = namedtuple('Stat', ['cr_count', 'img_count', 'total_exptime']) with h5py.File(hdf5_file,mode='r') as f: instr = list(f.keys())[0] print(instr) grp = f['/{}/sizes'.format(instr)] num_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize_hdf5(hdf5_file):\n # characterize the h5file in a mostly content-agnostic way\n summary = {\n 'sums': {},\n 'shapes': {}\n }\n\n def characterize_object(obj_name, obj_data):\n \"\"\"retain some properties of each dataset in an hdf5 file\"\"\"\n if isinstance(ob...
[ "0.65691614", "0.65687823", "0.647717", "0.61742824", "0.6162718", "0.5820011", "0.58141285", "0.5803666", "0.5748079", "0.57440376", "0.5700492", "0.5689688", "0.5675805", "0.5675805", "0.56419486", "0.56329083", "0.55740833", "0.55623597", "0.55504835", "0.5539534", "0.5532...
0.8037474
0
Queries a given endpoint on the Eskom loadshedding API with the specified payload
async def async_query_api(self, endpoint, payload=None): async with RetryClient() as client: # The Eskom API occasionally drops incoming connections, implement reies async with client.get( url=self.base_url + endpoint, headers=self.headers, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_call_api(url, payload, headers):\n return requests.request(\"GET\", url, headers=headers, data=payload)", "def _query(self, url, payload=None, action='GET'):\r\n full_url = self._base + url\r\n\r\n headers = {\r\n 'Content-Type': 'application/json'\r\n }\r\n\r\n ...
[ "0.6770775", "0.6607444", "0.6537534", "0.6452347", "0.6452142", "0.6295583", "0.61789805", "0.6112436", "0.6107325", "0.60884076", "0.59610105", "0.59126604", "0.5908381", "0.587297", "0.586031", "0.58270234", "0.5821195", "0.5821195", "0.5802803", "0.57767856", "0.57263523"...
0.7321024
0
Fetches the current loadshedding stage from the Eskom API
async def async_get_stage(self, attempts=50): # Query the API until a sensible (> 0) value is received, or the number of attempts is exceeded for attempt in range(attempts): res = await self.async_query_api("/GetStatus") # Return the current loadshedding stage by subtracting 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stage():\n try:\n filename = os.path.join(get_var('SITE'), \".stage\")\n f = open(filename, \"r\")\n stage = f.readline().strip()\n f.close()\n logger.debug(\"get stage: %s\" % (stage))\n return stage\n except:\n return reset_stage()", "def get_stage...
[ "0.5896602", "0.55642724", "0.54953194", "0.54792047", "0.5462125", "0.54313517", "0.53262895", "0.53185606", "0.5314176", "0.5314081", "0.5314081", "0.5295862", "0.5229258", "0.5218341", "0.52007157", "0.5197444", "0.5197444", "0.5197444", "0.5137261", "0.512215", "0.5114277...
0.71549255
0
Check whether each file listed in the changes file is present. ```changes_file``` The changes file to parse for the orig.tar (note the dsc file referenced must exist)
def test_files_present(self, changes_file): for filename in changes_file.get_files(): log.debug('Looking whether %s was actually uploaded' % filename) if os.path.isfile(os.path.join(pylons.config['debexpo.upload.incoming'], filename)): log.debug('%s is present' % filename...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_native_package(self, changes_file):\n\n for file in changes_file['Files']:\n if file['name'].endswith('.diff.gz'):\n return False\n if file['name'].endswith(('.debian.tar.gz','.debian.tar.bz2','.debian.tar.xz')):\n return False\n return True"...
[ "0.6562452", "0.61490893", "0.5917509", "0.5785546", "0.5767901", "0.5733005", "0.5689596", "0.5616368", "0.5590855", "0.55259246", "0.54963535", "0.5468433", "0.5468134", "0.5463716", "0.5461302", "0.54606396", "0.5443999", "0.5441099", "0.542676", "0.53501844", "0.5344584",...
0.7056379
0
Check each file's md5sum and make sure the md5sum in the changes file is the same as the actual file's md5sum. ```changes_file``` The changes file to parse for the orig.tar (note the dsc file referenced must exist)
def test_md5sum(self, changes_file): for file in changes_file['Files']: log.debug('Checking md5sum of %s' % file['name']) filename = os.path.join(pylons.config['debexpo.upload.incoming'], file['name']) if not os.path.isfile(filename): raise OSError("Missing fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_sum(file_path, md5_sum):\n file_md5_sum = generate_sum(file_path)\n return (file_md5_sum == md5_sum)", "def svn_fs_file_md5_checksum(*args):\r\n return _fs.svn_fs_file_md5_checksum(*args)", "def test_source_package_checksum_changes(self):\n response = self.client.head(\n f'/...
[ "0.61215234", "0.6010805", "0.59985346", "0.59703654", "0.59538466", "0.5940276", "0.59365785", "0.5863028", "0.58563745", "0.5855248", "0.581167", "0.5796914", "0.5796634", "0.57454133", "0.57304496", "0.5703791", "0.5699861", "0.56995535", "0.5671011", "0.5628634", "0.56136...
0.8076951
0
Guess based on the changes file and files being uploaded, whether a package is considered native of not ```changes_file``` The changes file to parse for the orig.tar (note the dsc file referenced must exist)
def is_native_package(self, changes_file): for file in changes_file['Files']: if file['name'].endswith('.diff.gz'): return False if file['name'].endswith(('.debian.tar.gz','.debian.tar.bz2','.debian.tar.xz')): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_orig_tarball(self, changes_file):\n\n orig_name = None\n if not changes_file.get_dsc() or open(changes_file.get_dsc()) == None:\n return (orig_name, constants.ORIG_TARBALL_LOCATION_NOT_FOUND)\n\n dscfile = open(changes_file.get_dsc())\n dsc = deb822.Dsc(dscfile)\n ...
[ "0.7022202", "0.5861582", "0.5830605", "0.57546717", "0.5683719", "0.5522598", "0.55078954", "0.5425292", "0.5394608", "0.53885627", "0.537539", "0.5327455", "0.5298978", "0.52786845", "0.524849", "0.51662666", "0.5139674", "0.51386774", "0.5101697", "0.508725", "0.507584", ...
0.7332381
0
Look to see whether there is an orig tarball present, if the dsc refers to one. This method returns a triple (filename, file_found, location_hint), returning the (expected) name of the original tarball, and whether it was found in the local repository ```changes_file``` The changes file to parse for the orig.tar (note ...
def find_orig_tarball(self, changes_file): orig_name = None if not changes_file.get_dsc() or open(changes_file.get_dsc()) == None: return (orig_name, constants.ORIG_TARBALL_LOCATION_NOT_FOUND) dscfile = open(changes_file.get_dsc()) dsc = deb822.Dsc(dscfile) for file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_applicable(result: Result, original_file_dict, file_diff_dict):\n\n if len(result.affected_code) == 0:\n return 'The result is not associated with any source code.'\n\n filenames = set(src.renamed_file(file_diff_dict)\n for src in result.affected_code)\n ...
[ "0.5856133", "0.5586155", "0.5303869", "0.52426755", "0.5206382", "0.5184854", "0.5141354", "0.5130958", "0.509906", "0.506888", "0.5050227", "0.50488764", "0.49886075", "0.49809384", "0.49780205", "0.49768654", "0.49239424", "0.4915758", "0.48938805", "0.48809808", "0.487459...
0.806148
0
Returns all unique paths for files associated with the supplied package version ```packageversion``` The package version to be scanned ```absolute_path``` if set to True, returns the absolute path instead of a path relative to the repository root
def find_files_for_packageversion(self, packageversion, absolute_path=False): package_files = [] for attr in ('binary_packages', 'source_packages'): if hasattr(packageversion, attr): for bp in getattr(packageversion, attr): for files in bp.package_files: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_files_for_package(self, package, absolute_path=False):\n package_files = []\n for p in package.package_versions:\n package_files.extend(self.find_files_for_packageversion(p, absolute_path))\n return package_files", "def full_find(self, file, version):\n matches = [...
[ "0.6776081", "0.57738966", "0.57006", "0.5643437", "0.5551925", "0.5528448", "0.54549044", "0.5375594", "0.53727055", "0.5351883", "0.5307413", "0.5246328", "0.5221049", "0.51959926", "0.5160953", "0.51521415", "0.5149688", "0.51018757", "0.51011", "0.5095191", "0.5087868", ...
0.7598108
0
Returns all unique paths for files associated with the supplied packages ```package``` The package to be scanned ```absolute_path``` if set to True, returns the absolute path instead of a path relative to the repository root
def find_files_for_package(self, package, absolute_path=False): package_files = [] for p in package.package_versions: package_files.extend(self.find_files_for_packageversion(p, absolute_path)) return package_files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_files_for_packageversion(self, packageversion, absolute_path=False):\n package_files = []\n for attr in ('binary_packages', 'source_packages'):\n if hasattr(packageversion, attr):\n for bp in getattr(packageversion, attr):\n for files in bp.packag...
[ "0.65744954", "0.6538738", "0.6327214", "0.60860723", "0.6070535", "0.5906358", "0.5833705", "0.5832187", "0.58272886", "0.58078057", "0.5749993", "0.57397157", "0.57397157", "0.57397157", "0.5738294", "0.56959873", "0.565308", "0.563047", "0.56227636", "0.56075794", "0.55792...
0.7131917
0
Removes all files associated with the package version supplied ```packageversion``` PackageVersion object whose files are supposed to be removed
def delete_files_for_packageversion(self, packageversion): files = self.find_files_for_packageversion(packageversion, absolute_path=True) if not files: return path = os.path.dirname(files[0]) for file in files: if os.path.exists(file): log.debu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_files_for_package(self, package):\n files = self.find_files_for_package(package, absolute_path=True)\n if not files:\n return\n path = os.path.dirname(files[0])\n for file in files:\n if os.path.exists(file):\n log.debug(\"Removing fil...
[ "0.7006803", "0.6729492", "0.66909456", "0.62634903", "0.62541205", "0.6170387", "0.61650103", "0.6109658", "0.6072664", "0.6071761", "0.6042147", "0.600773", "0.60031897", "0.5883982", "0.58733577", "0.5864497", "0.58045745", "0.57851744", "0.57476383", "0.57243997", "0.5702...
0.8144159
0
Removes all files associated with the package supplied ```package``` package object whose files are supposed to be removed
def delete_files_for_package(self, package): files = self.find_files_for_package(package, absolute_path=True) if not files: return path = os.path.dirname(files[0]) for file in files: if os.path.exists(file): log.debug("Removing file '%s'" % (fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_packages(self, packages):", "def clean(self) -> None:\n # remove all *.py and *.pyi files in the folder\n for wc in [\"*.py\", \"*.pyi\", \"modules.json\"]:\n for f in (self.package_path).rglob(wc):\n f.unlink()", "def remove_module_files(self, base_dir):\n ...
[ "0.7546989", "0.73516136", "0.71049297", "0.70153433", "0.7001211", "0.6886907", "0.68704784", "0.6867759", "0.6712021", "0.66684604", "0.6525831", "0.6513985", "0.64653736", "0.6430455", "0.641628", "0.63933665", "0.6354628", "0.63250524", "0.63172334", "0.6308882", "0.62891...
0.7580052
0
Sets the personal available time slot in calendar
def set_available_time_slot(): if request.content_type != 'application/json': error = json.dumps({'error': 'Invalid Content Type'}) return make_response(error, 400, InterviewCalendarApi.HEADERS) data = request.json # For Temporary purpose, stored in flat file database with open(InterviewCal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_time_available(self, new_value):\n\n self.available_at = new_value\n self.save()", "def time_slot(self):\n pass", "def timeslot(self, timeslot: List[TimeslotTimeslot]):\n\n self._timeslot = timeslot", "def choose_time_slot():\n req = request.json\n firebase_uid = req...
[ "0.6769007", "0.6269106", "0.6212529", "0.61314505", "0.6038733", "0.6016706", "0.59351456", "0.5850808", "0.580659", "0.5770316", "0.5760114", "0.57599235", "0.5728663", "0.5717891", "0.57096136", "0.5688027", "0.5682681", "0.56790507", "0.5677591", "0.56367344", "0.56291395...
0.78393424
0
Parse a date string and convert to a naive ``datetime`` object in UTC
def parse(date_string: str): # parse the date string date = dateutil.parser.parse(date_string) # convert to UTC if containing time-zone information # then drop the timezone information to prevent unsupported errors if date.tzinfo: date = date.astimezone(dateutil.tz.UTC).replace(tzinfo=None) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_date(s):\n return parse(s).astimezone(pytz.utc)", "def parse_datetime(datestr):\r\n try:\r\n return dateutil.parser.parse(datestr).replace(tzinfo=utc)\r\n except ValueError:\r\n raise DashboardError(_(\"Unable to parse date: \") + datestr)", "def parse_datetime(date_string):\n...
[ "0.7907918", "0.7845481", "0.76971775", "0.7675037", "0.7473908", "0.7440517", "0.735506", "0.7350854", "0.72948474", "0.72435045", "0.7241617", "0.72313863", "0.7218996", "0.7172882", "0.71403486", "0.71389437", "0.71222574", "0.71187925", "0.71035874", "0.70936656", "0.7073...
0.8085187
1
Split a date string into units and epoch
def split_date_string(date_string: str): try: units,_,epoch = date_string.split(None, 2) except ValueError: raise ValueError(f'Invalid format: {date_string}') else: return (units.lower(), parse(epoch))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_date_string(date_string: str):\n # try parsing the original date string as a date\n try:\n epoch = parse(date_string)\n except ValueError:\n pass\n else:\n # return the epoch (as list)\n return (datetime_to_list(epoch), 0.0)\n # split the date string into units ...
[ "0.725681", "0.72525626", "0.6715245", "0.64701724", "0.6382786", "0.619452", "0.61797726", "0.6074394", "0.6071968", "0.60437346", "0.601686", "0.6001186", "0.59548134", "0.5884169", "0.5833305", "0.58276343", "0.5821117", "0.581139", "0.5810008", "0.5795588", "0.57780796", ...
0.7802953
1
Convert a ``datetime`` object into a list
def datetime_to_list(date): return [date.year, date.month, date.day, date.hour, date.minute, date.second]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_datetime_objs(list_of_dates):\n datetime_list = []\n for date in list_of_dates:\n date_obj = datetime.datetime.strptime(date, '%d.%m.%Y')\n datetime_list.append(date_obj)\n return datetime_list", "def deconstruct_datetime(self, date: datetime) -> List[int]:\n year, month...
[ "0.72293544", "0.7085231", "0.70122313", "0.64888054", "0.6427361", "0.6376207", "0.62667364", "0.6259938", "0.62293786", "0.61688745", "0.6106284", "0.6053032", "0.6039443", "0.6039443", "0.6039443", "0.6039443", "0.602236", "0.60170233", "0.601256", "0.5993775", "0.59911925...
0.8505954
1
Convert a ``numpy`` ``datetime`` array to seconds since ``epoch``
def convert_datetime( date: float | np.ndarray, epoch: str | tuple | list | np.datetime64 = _unix_epoch ): # convert epoch to datetime variables if isinstance(epoch, (tuple, list)): epoch = np.datetime64(datetime.datetime(*epoch)) elif isinstance(epoch, str): epoch = np.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_to_epoch_seconds(t) -> float:\n return t.astype(int) / 1e9", "def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)", "def seconds_since_epoch(date_time, epoch=None):\n return microseconds_since_epoch(date_time) / 10.0**6", "def epoch_seconds(date):\n td = date - epoch\n retu...
[ "0.7119384", "0.70471823", "0.67733616", "0.6677283", "0.6677283", "0.66770333", "0.65791225", "0.6510859", "0.64249825", "0.62467736", "0.62348825", "0.62348825", "0.61904925", "0.6188793", "0.6172504", "0.5990658", "0.5972928", "0.5956192", "0.59386444", "0.59345615", "0.59...
0.72007585
1
Convert delta time from seconds since ``epoch1`` to time since ``epoch2``
def convert_delta_time( delta_time: np.ndarray, epoch1: str | tuple | list | np.datetime64 | None = None, epoch2: str | tuple | list | np.datetime64 | None = None, scale: float = 1.0 ): # convert epochs to datetime variables if isinstance(epoch1, (tuple, list)): epoch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2time(time):\n\tvalue = datetime.datetime.fromtimestamp(time)\n\tNormal = value.strftime('%Y-%m-%d %H:%M:%S')\n\tprint(normal)\n\treturn normal", "def pcr_delta_time_ms(pcr_t1, pcr_t2, offset = 0):\n return float(pcr_t2-pcr_t1)/90000.0 + offset", "def to_deltatime(self,\n epoch: str | tu...
[ "0.65060514", "0.6424808", "0.6152584", "0.60279953", "0.59376085", "0.5886172", "0.5869834", "0.58575207", "0.5820404", "0.58052814", "0.5757795", "0.57485944", "0.56638455", "0.56527215", "0.56485754", "0.56349045", "0.56349045", "0.5627923", "0.5625807", "0.5594252", "0.55...
0.7332065
1
Counts the number of leap seconds between a given GPS time and UTC
def count_leap_seconds( GPS_Time: np.ndarray | float, truncate: bool = True ): # get the valid leap seconds leaps = get_leap_seconds(truncate=truncate) # number of leap seconds prior to GPS_Time n_leaps = np.zeros_like(GPS_Time,dtype=np.float64) for i,leap in enumerate(leaps): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utctoweekseconds(utc, leapseconds=18):\n datetimeformat = \"%Y-%m-%d %H:%M:%S\"\n epoch = datetime.datetime.strptime(\"1980-01-06 00:00:00\", datetimeformat)\n tdiff = utc - epoch + datetime.timedelta(seconds=leapseconds)\n gpsweek = tdiff.days // 7\n gpsdays = tdiff.days - 7 * gpsweek\n gpss...
[ "0.652139", "0.58384943", "0.57290035", "0.56942356", "0.56746274", "0.5595739", "0.55098593", "0.5501737", "0.53909945", "0.5376595", "0.5324631", "0.5324156", "0.5290026", "0.5261761", "0.5184121", "0.5171609", "0.51585203", "0.5151989", "0.51178706", "0.5116599", "0.505507...
0.7145605
1
Gets a list of GPS times for when leap seconds occurred
def get_leap_seconds(truncate: bool = True): leap_secs = icesat2_toolkit.utilities.get_data_path(['data','leap-seconds.list']) # find line with file expiration as delta time with leap_secs.open(mode='r', encoding='utf8') as fid: secs, = [re.findall(r'\d+',i).pop() for i in fid.read().splitlines() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leap_seconds(truncate: bool = True):\n leap_secs = pyTMD.utilities.get_data_path(['data','leap-seconds.list'])\n # find line with file expiration as delta time\n with leap_secs.open(mode='r', encoding='utf8') as fid:\n secs, = [re.findall(r'\\d+',i).pop() for i in fid.read().splitlines()\n ...
[ "0.6662289", "0.63633394", "0.6226151", "0.6171691", "0.61506224", "0.61460394", "0.6143277", "0.6093351", "0.5990384", "0.5958879", "0.5958879", "0.5958879", "0.5945612", "0.5896451", "0.5885215", "0.588292", "0.58812433", "0.5852047", "0.581152", "0.57902336", "0.5767987", ...
0.676572
0
generate label vectors from collected images
def get_label_vectors(): print("Retrieving label vectors...") label_dict = {} # instantiate dict for labels:vectors categories = sorted([c for c in os.listdir('images/') if c[0] != '.']) # ignore hidden files x = np.zeros(len(categories)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_labels(pics):\r\n return []", "def extract_labels(filename, num_images, starting_id, context_factor):\n gt_imgs = []\n for i in range(starting_id, num_images+starting_id):\n imageid = \"satImage_%.3d\" % i\n image_filename = filename + imageid + \".png\"\n if os.path.is...
[ "0.7303702", "0.7006394", "0.68937486", "0.6873022", "0.68646514", "0.6803414", "0.6724581", "0.6620808", "0.66204023", "0.6591786", "0.6567913", "0.65644395", "0.65557486", "0.6555063", "0.6541309", "0.6527798", "0.65208435", "0.65085703", "0.6501463", "0.6480988", "0.646566...
0.78073823
0
load image data from collected categories
def load_image_data(): print("Loading image data...") label_dict = get_label_vectors() categories = [c for c in os.listdir('images/') if c[0] != '.'] # ignore labels = [] # instantiate list for image labels data = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_image_data(arg_dict):\n cat_df = pd.read_csv(arg_dict['category_file'],\n skiprows=1,\n sep='\\s+')\n bbox_df = pd.read_csv(arg_dict['bbox_file'],\n skiprows=1,\n sep='\\s+')\n img_dir = arg_dict['im...
[ "0.73744714", "0.70992035", "0.6866402", "0.6855467", "0.67352", "0.67105335", "0.6656234", "0.66058004", "0.65050745", "0.65049785", "0.6448114", "0.6420186", "0.6376639", "0.63688254", "0.6314507", "0.63099957", "0.6244066", "0.6235248", "0.62325114", "0.6227874", "0.621148...
0.75711864
0