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
Send new AI to API, if successful redirects to second step using AIID as a parameter, if not raises a error message and redirect back to the form.
def form_valid(self, form): ai = form.save( token=self.request.session.get('token', False), aiid=self.kwargs.get('aiid', '') ) # Check if save was successful if ai['status']['code'] in [200, 201]: level = messages.SUCCESS redirect_url = H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, request, aiid, *args, **kwargs):\n form = ProxyDeleteAIForm(request.POST)\n\n if form.is_valid():\n status = form.save(\n token=self.request.session.get('token', False)\n )\n\n message = status['status']['info']\n\n if status['...
[ "0.6452779", "0.58047915", "0.569181", "0.5559519", "0.54769045", "0.5445984", "0.5445984", "0.5406151", "0.539119", "0.53807807", "0.5364313", "0.5248679", "0.5191619", "0.5175927", "0.51676065", "0.515381", "0.5137936", "0.512654", "0.512654", "0.5108686", "0.5107228", "0...
0.61742723
1
Update context adding import form
def get_context_data(self, **kwargs): context = super(AIUpdateView, self).get_context_data(**kwargs) context['import_form'] = ImportAIForm return context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_import(request):\n if request.POST:\n form = ImportForm(request.POST, request.FILES)\n if form.is_valid():\n import_log = form.save(commit=False)\n import_log.user = request.user\n import_log.import_setting, created = ImportSetting.objects.get_or_create(\...
[ "0.63400924", "0.623988", "0.6154117", "0.6044799", "0.59432536", "0.5888689", "0.5764352", "0.5607566", "0.5594028", "0.5583956", "0.5555526", "0.5553158", "0.5519774", "0.54938567", "0.5472408", "0.54716283", "0.54216444", "0.5420786", "0.5371603", "0.53676915", "0.5362823"...
0.770857
0
Update context with Intents list and Entities formsets
def get_context_data(self, **kwargs): context = super(IntentsEditView, self).get_context_data(**kwargs) # Get entities entities = get_entities_list( self.request.session.get('token', False), self.kwargs['aiid'] ).get('entities') # Custom entities goes f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_context(self, intent):\n for tag in intent['__tags__']:\n if 'entities' not in tag:\n continue\n context_entity = tag['entities'][0]\n if self.context_greedy:\n self.context_manager.inject_context(context_entity)\n elif con...
[ "0.64402807", "0.59722364", "0.58286756", "0.57897985", "0.57000446", "0.558151", "0.54241735", "0.5410868", "0.53879887", "0.5372495", "0.53593415", "0.53282356", "0.52834654", "0.5213211", "0.5189935", "0.51806664", "0.51599526", "0.5128227", "0.5111983", "0.5096767", "0.50...
0.72993433
0
If the form or entities_formset is invalid, render the invalid form.
def form_invalid(self, form, formsets): return self.render_to_response( self.get_context_data(form=form, formsets=formsets) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_invalid(self, form, formset):\n return self.render_to_response(self.get_context_data(\n form=form,\n application_candidate_form=formset,\n ))", "def formset_invalid(self, formset):\n self.messages.error(self.formset_invalid_message, fail_silently=True)\n ...
[ "0.8187543", "0.8042635", "0.77656263", "0.7555058", "0.7555058", "0.7552338", "0.7424616", "0.7424616", "0.7336103", "0.7336103", "0.7284399", "0.7073939", "0.7073939", "0.7051852", "0.7051852", "0.70463663", "0.70463663", "0.7013037", "0.6904915", "0.69039446", "0.69039446"...
0.8193801
0
Custom post for handling both Intent form and Entities entities_formset
def post(self, request, *args, **kwargs): # Get entities entities = get_entities_list( self.request.session.get('token', False), self.kwargs.get('aiid') ).get('entities') intents = [intent['intent_name'] for intent in get_intent_list( self.request.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, request, *args, **kwargs):\n self.object = OTML.objects.get(pk=kwargs['pk'])\n form_class = self.get_form_class()\n form = self.get_form(form_class)\n factura_form = Factura_LineaFormSet(self.request.POST, instance=self.object)\n ot_linea_form = OT_LineaFormSet(sel...
[ "0.6533095", "0.6471974", "0.6367922", "0.6312173", "0.6201604", "0.6152906", "0.61499304", "0.61234903", "0.6102097", "0.6102097", "0.60370094", "0.59690565", "0.59533346", "0.59527385", "0.5950986", "0.5911498", "0.5868167", "0.58565867", "0.58458114", "0.5812719", "0.58000...
0.7440897
0
Find if a (left, right) pair is already in the list
def lookup(self, left, right): for val in self.find_left(left): if right == val: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connected_pair(self, first, second):\n cover = set()\n queue = {first}\n while queue:\n new = queue.pop()\n cover.add(new)\n for adjacent in new.parents() | new.children():\n if adjacent == second:\n return True\n ...
[ "0.6576417", "0.65201", "0.63596517", "0.6225679", "0.61727715", "0.616497", "0.6075149", "0.605671", "0.6036427", "0.6002299", "0.5984781", "0.5927618", "0.5884798", "0.5857877", "0.5854755", "0.5841416", "0.58384115", "0.5832545", "0.5817095", "0.5813472", "0.5800859", "0...
0.6572441
1
Find all ids in dictionary where
def find(where, ids): if not ids: return if not isinstance(ids, (set, list, tuple)): ids = [ids] for key in ids: if key in where: for i in where[key]: yield i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_has(self, ids_):\n with self._db_connection() as connection:\n existing = set(connection.datasets_intersection(ids_))\n\n return [x in existing for x in\n map((lambda x: UUID(x) if isinstance(x, str) else x), ids_)]", "def lookup(root: dict, query: str, exact: boo...
[ "0.64733976", "0.6235124", "0.6168044", "0.6145751", "0.6041423", "0.6036825", "0.6032566", "0.6011395", "0.5877843", "0.5841072", "0.5791253", "0.5772204", "0.57670826", "0.5765682", "0.5740387", "0.57323784", "0.5731032", "0.5707636", "0.5689576", "0.5682683", "0.56679195",...
0.70820117
0
Find left values given a list of ids
def find_left(self, ids): return self.find(self.forward, ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left(cls):\n student_count = func.count(Student.id).label('student_count')\n recent_years = [sy.id for sy in SchoolYear.recent()]\n stmt = Session.query(student_count, Student).\\\n join(GroupMembership).\\\n join(Group).group_by(Group.id).\\\...
[ "0.5556694", "0.5451275", "0.53974277", "0.539385", "0.5352896", "0.53429824", "0.5319958", "0.5286182", "0.5283537", "0.52616566", "0.52579606", "0.52537847", "0.5215402", "0.5207344", "0.52053964", "0.51904666", "0.513959", "0.51305455", "0.51034874", "0.5092443", "0.508472...
0.76158416
0
Set debug (left, right) debug values for the structure
def set_debug(self, left, label, right): # lowercase left and right keys if is_str(left): left = left.lower() if is_str(right): right = right.lower() # remove duplicates in the debug structure # - duplicates in the structure itself are # - handled ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug2(node):\n print \"%.01f %r %r\" % (node.value, node.left, node.right)", "def debug3(node):\n print \"%.01f obj: %r left: %r right: %r\" % (node.value, node.objects, node.left.objects, node.right.objects)", "def set_debug(self, debug):\n self.debug = debug", "def set_debug(flag):\n globa...
[ "0.6519096", "0.64873046", "0.6146102", "0.6134923", "0.6033736", "0.60063356", "0.5932444", "0.5922356", "0.5839485", "0.58369446", "0.5737077", "0.57249707", "0.56395936", "0.56260693", "0.55948776", "0.5592509", "0.55912805", "0.5590443", "0.55689436", "0.5563218", "0.5555...
0.6960936
0
Get debug information for a given key
def get_debug(self, key): # lowercase key if possible if is_str(key): key = key.lower() # return debug information if isinstance(key, list): return "type(list)" try: return self.debug[key] except KeyError: return "not-availa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(self, key):\n return self.execute_command(self.INFO_CMD, key)", "def _get_debug_info(self):\n info = {'problem_file' : self._problem.problem_fname,\n 'domain_file' : self.domain.domain_fname }\n return info", "def output_debug_info(self):", "def DebugInfo( self, r...
[ "0.6685764", "0.6418056", "0.62838596", "0.6151271", "0.60842377", "0.60793245", "0.6069409", "0.6054835", "0.6021656", "0.6012793", "0.5937385", "0.5891042", "0.58809453", "0.5790267", "0.5782056", "0.57558244", "0.57475233", "0.57136923", "0.56915104", "0.56915104", "0.5658...
0.8006641
0
Parse the input_types argument
def _parse_input_types(self, input_types): res_input_types = [] if isinstance(input_types, str): input_types = [input_types] if isinstance(input_types, list): for input_type in input_types: if isinstance(input_type, (tuple, list)): if n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processCmdLineArgs(expectedTypes, usage):\n\targs = []\n\tnumComLineArgs = len(sys.argv)\n\tnumExpected = len(expectedTypes)\n\tif (numComLineArgs - 1 == len(expectedTypes)):\n\t\ttry:\n\t\t\tfor i in range(0, numExpected):\n\t\t\t\tif (expectedTypes[i] == typeInt):\n\t\t\t\t\targs.append(int(sys.argv[i+1]))\n...
[ "0.6734562", "0.65455455", "0.64750177", "0.6398061", "0.6203305", "0.61409116", "0.61080426", "0.5990899", "0.59423697", "0.5907353", "0.5885094", "0.5882487", "0.5880165", "0.5880165", "0.5880165", "0.5880165", "0.5880165", "0.5880165", "0.5863835", "0.58209956", "0.5801638...
0.7746067
0
Core method for looking up all keys in batch (iterator)
def key_lookup_batch(self, batchiter): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterkeys(self):", "def iterkeys(self):", "def keys_iterator(keyspace, table_name):\n \n keys = keys_for_table(keyspace, table_name)\n row_keys = keys['row_keys']\n clustering_keys = keys['clustering_keys']\n columns = keys['columns']\n\n\n try:\n key_str = \", \".join(str(r) fo...
[ "0.6799188", "0.6799188", "0.66693836", "0.66003084", "0.6356289", "0.6348269", "0.62892145", "0.6260823", "0.62474495", "0.61969835", "0.6175907", "0.6152303", "0.61352926", "0.61339927", "0.61024356", "0.6090905", "0.6087564", "0.6081653", "0.60808057", "0.60695803", "0.606...
0.8407249
0
Performs a nested lookup of doc using a period (.) delimited list of fields. This is a nested dictionary lookup.
def _nested_lookup(doc, field): value = doc keys = field.split(".") try: for k in keys: value = value[k] except KeyError: return None return str(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nested_lookup(doc, field):\n value = doc\n keys = field.split(\".\")\n try:\n for k in keys:\n if isinstance(value, (list, tuple)):\n # assuming we have a list of dict with k as one of the keys\n stype = set([type(e) for e in value])\n if ...
[ "0.75303674", "0.67048454", "0.597931", "0.5579058", "0.5382589", "0.5359143", "0.53010267", "0.5243129", "0.5186618", "0.5170317", "0.513969", "0.51200736", "0.5110074", "0.5106273", "0.5095656", "0.5085443", "0.5070285", "0.5049831", "0.502323", "0.50220954", "0.5017787", ...
0.72725636
1
Property method for getting id_priority_list
def id_priority_list(self): return self._id_priority_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPriorityList(self):", "def id_priority_list(self, value):\n # pylint: disable=W0201\n self._id_priority_list = value\n self.input_types = self.sort_input_by_priority_list(self.input_types)\n self.output_types = self.sort_output_by_priority_list(self.output_types)", "def _expa...
[ "0.7644556", "0.688134", "0.6785198", "0.60939974", "0.6067523", "0.6058157", "0.6014391", "0.59487194", "0.59487194", "0.59487194", "0.59487194", "0.58815306", "0.5742788", "0.5649377", "0.5602599", "0.5579469", "0.5541318", "0.54741997", "0.5409578", "0.5395041", "0.5356747...
0.8687863
0
Property method for setting id_priority_list and sorting input_types and output_types.
def id_priority_list(self, value): # pylint: disable=W0201 self._id_priority_list = value self.input_types = self.sort_input_by_priority_list(self.input_types) self.output_types = self.sort_output_by_priority_list(self.output_types)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_input_by_priority_list(self, input_types):\n # construct temporary id_priority_list with extra elements at the end\n id_priority_list = self._expand_priority_order([x[0] for x in input_types])\n input_types = sorted(input_types, key=lambda e: self._priority_order(id_priority_list, e[0...
[ "0.66176265", "0.6247911", "0.5739114", "0.5637165", "0.5321232", "0.52363276", "0.51667124", "0.5155236", "0.51521564", "0.51285255", "0.5115065", "0.5067206", "0.5031187", "0.50004625", "0.49772328", "0.4972509", "0.49265048", "0.49146044", "0.48389423", "0.48298532", "0.48...
0.761858
0
Reorder the given input_types to follow a priority list. Inputs not in the priority list should remain in their given order at the end of the list.
def sort_input_by_priority_list(self, input_types): # construct temporary id_priority_list with extra elements at the end id_priority_list = self._expand_priority_order([x[0] for x in input_types]) input_types = sorted(input_types, key=lambda e: self._priority_order(id_priority_list, e[0])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_output_by_priority_list(self, output_types):\n # construct temporary id_priority_list with extra elements at the end\n id_priority_list = self._expand_priority_order(output_types)\n output_types = sorted(output_types, key=lambda e: self._priority_order(id_priority_list, e))\n r...
[ "0.69503695", "0.62454987", "0.58355814", "0.5789913", "0.5645273", "0.5573793", "0.5448301", "0.54323965", "0.5313263", "0.5280046", "0.5268915", "0.5265634", "0.516667", "0.5166572", "0.5140391", "0.5125893", "0.51215035", "0.5115389", "0.5100975", "0.50950694", "0.50814456...
0.84543127
0
Reorder the given output_types to follow a priority list. Outputs not in the priority list should remain in their given order at the end of the list.
def sort_output_by_priority_list(self, output_types): # construct temporary id_priority_list with extra elements at the end id_priority_list = self._expand_priority_order(output_types) output_types = sorted(output_types, key=lambda e: self._priority_order(id_priority_list, e)) return out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_input_by_priority_list(self, input_types):\n # construct temporary id_priority_list with extra elements at the end\n id_priority_list = self._expand_priority_order([x[0] for x in input_types])\n input_types = sorted(input_types, key=lambda e: self._priority_order(id_priority_list, e[0...
[ "0.6734957", "0.64006", "0.6323225", "0.57136774", "0.5675696", "0.5578375", "0.5552074", "0.53853726", "0.534626", "0.53175974", "0.5188115", "0.5148496", "0.51468277", "0.51179534", "0.5094872", "0.5086676", "0.5062091", "0.5058068", "0.5050483", "0.504642", "0.50458914", ...
0.84835756
0
Expand the self.id_priority_list to also include elements in id_list that are not in the priority list. These elements are added to the priority list in the order that they appear in the id_list.
def _expand_priority_order(self, id_list): res = self.id_priority_list.copy() for key in id_list: if key not in self.id_priority_list: res.append(key) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_priority_list(self, value):\n # pylint: disable=W0201\n self._id_priority_list = value\n self.input_types = self.sort_input_by_priority_list(self.input_types)\n self.output_types = self.sort_output_by_priority_list(self.output_types)", "def id_priority_list(self):\n retu...
[ "0.71369946", "0.69824", "0.5515933", "0.54111195", "0.53296894", "0.5233102", "0.5199696", "0.51683927", "0.5117485", "0.51143044", "0.5112797", "0.50699997", "0.5058548", "0.5044972", "0.5007948", "0.4988564", "0.4982154", "0.4970623", "0.49030146", "0.48733607", "0.4866473...
0.87039113
0
Determine the priority order of an input_type following a id_priority_list. This list, first defined in DataTransformMDB is used to reorder the input_types so that their order matches the id types listed in id_priority_list. If an id type is not in that list then the input_type will be placed at the end of the list in ...
def _priority_order(id_priority_list, elem): assert isinstance(id_priority_list, list) # match id types with id priority for index, id_elem in enumerate(id_priority_list): if elem == id_elem: return index # the id type is not in id_priority_list so it will be ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_input_by_priority_list(self, input_types):\n # construct temporary id_priority_list with extra elements at the end\n id_priority_list = self._expand_priority_order([x[0] for x in input_types])\n input_types = sorted(input_types, key=lambda e: self._priority_order(id_priority_list, e[0...
[ "0.816521", "0.69023293", "0.6618054", "0.5925151", "0.57943356", "0.56410825", "0.5560461", "0.5300788", "0.5198906", "0.51595956", "0.5132115", "0.5010449", "0.49331728", "0.49231339", "0.48865548", "0.4870619", "0.48295626", "0.48117563", "0.47670177", "0.4754261", "0.4752...
0.7018103
1
virtual method for edge lookup. Each edge class is responsible for its own lookup procedures given a keylookup_obj and an id_strct
def edge_lookup(self, keylookup_obj, id_strct, debug=False): # pylint: disable=E1102, R0201, W0613 yield NotImplemented("This method must be overridden by the base class.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_lookup(self, keylookup_obj, id_strct, debug=False):\n res_id_strct = IDStruct()\n for left, right in id_strct:\n res_id_strct.add(left, re.sub(self.from_regex, self.to_regex, right))\n return res_id_strct", "def lookup(self, key):", "def fk_lookup(self, table, identifie...
[ "0.71159935", "0.66000026", "0.5949186", "0.5861557", "0.58410096", "0.5836864", "0.5836864", "0.57133526", "0.56357485", "0.54741466", "0.5414244", "0.54034865", "0.53910136", "0.536861", "0.5355268", "0.5291193", "0.51061565", "0.5053239", "0.5051811", "0.50500286", "0.5030...
0.81663924
0
setter for the logger variable
def logger(self, value): self._state["logger"] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_logger(self, logger): \n self.logger = logger", "def set_logger(logger):\n global __log__\n __log__ = logger", "def logger(self, value):\n pass", "def set_logger(self, logger):\n self.logger = logger", "def set_logger(self, logger):\n self.logger = logger", "def ...
[ "0.8036135", "0.783002", "0.7788384", "0.7638455", "0.7638455", "0.7548268", "0.73705816", "0.73668814", "0.73042715", "0.70837986", "0.69338673", "0.6890346", "0.68829983", "0.6734972", "0.6728085", "0.6697023", "0.6672316", "0.66349334", "0.660322", "0.66028893", "0.6582191...
0.8120736
0
Performs a nested lookup of doc using a period (.) delimited list of fields. This is a nested dictionary lookup.
def nested_lookup(doc, field): value = doc keys = field.split(".") try: for k in keys: if isinstance(value, (list, tuple)): # assuming we have a list of dict with k as one of the keys stype = set([type(e) for e in value]) if not stype: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nested_lookup(doc, field):\n value = doc\n keys = field.split(\".\")\n try:\n for k in keys:\n value = value[k]\n except KeyError:\n return None\n\n return str(value)", "def _get_nested(nested_dict, field):\n print(nested_dict, f...
[ "0.7272222", "0.6705258", "0.5979054", "0.5582293", "0.5383502", "0.5358377", "0.53006864", "0.5245246", "0.51880264", "0.5171517", "0.51379454", "0.51200914", "0.51110876", "0.5107268", "0.50974923", "0.50858164", "0.50701064", "0.5049411", "0.50247693", "0.50216115", "0.501...
0.75318706
0
Return the tokens needed to authenticate the access to any API the service might provide. Tumblr uses a pair of OAuthToken consisting on a oauth_token and oauth_token_secret. instance must be a UserSocialAuth instance.
def tokens(cls, instance): token = super(TumblrOAuth, cls).tokens(instance) if token and 'access_token' in token: token = dict(tok.split('=') for tok in token['access_token'].split('&')) return token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_token(self):\n social_auth = self.social_auth.get()\n return social_auth.tokens", "def oauth():\n return {\"consumer_key\": \"Insert consumer key HERE\",\n \"consumer_secret\": \"Insert consumer secret HERE\",\n \"token_key\": \"Insert token key HERE\",\n ...
[ "0.69867873", "0.6805026", "0.65922654", "0.65922654", "0.64544785", "0.64544785", "0.6377879", "0.6377879", "0.63037527", "0.6288191", "0.6265137", "0.6235318", "0.61624914", "0.6103147", "0.6100232", "0.60589933", "0.60290647", "0.60158634", "0.59988356", "0.59846425", "0.5...
0.7418724
0
Get a list of item types and subtypes.
def getTypesList(): return Gw2Spidy._request('types')['results']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getItemsOfType(typeId):\n return Gw2Spidy._request('all-items', str(typeId))['results']", "def allItemsByType(self, itemType):\n if itemType.value not in self.__inventory__:\n return []\n return self.__inventory__[itemType.value]", "def getTypes():\n\n\t\tquery = \"\\\n\t\t\...
[ "0.7288953", "0.70042604", "0.6785657", "0.67089224", "0.668477", "0.6608126", "0.66065013", "0.65781295", "0.6552279", "0.64929223", "0.6410754", "0.6387931", "0.6304883", "0.62760276", "0.6249379", "0.6238528", "0.6220215", "0.621244", "0.62109184", "0.61828524", "0.6154982...
0.71305066
1
Get a list of crafting disciplines.
def getDisciplinesList(): return Gw2Spidy._request('disciplines')['results']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ui_list_disciplines(self):\n try:\n print(str(self.__discipline_controller))\n\n except RepositoryException as re:\n print(re)\n return", "def get_sorted_disciplines(self):\n results = self.__create_discipline_and_grade_dto()\n results.sort(self....
[ "0.58811045", "0.53777117", "0.5317237", "0.5307757", "0.53059524", "0.5251845", "0.5243822", "0.5156207", "0.5102134", "0.50424933", "0.49956003", "0.48776805", "0.48698422", "0.48670194", "0.4844907", "0.47472867", "0.47046387", "0.47004396", "0.46935552", "0.46586874", "0....
0.7510398
0
Get a list of item rarities.
def getRaritiesList(): return Gw2Spidy._request('rarities')['results']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reagent_item_list(self) -> DBRecList:\n raise NotImplementedError('not implemented')", "def get_items(self):\n return self.item_ids", "def get_rewards(self):\n for i in self.REWARDS:\n self.get_reward(i)", "def get_items(self):\n return self.item_list", "def g...
[ "0.6688184", "0.6087386", "0.600519", "0.5992151", "0.5901439", "0.58732486", "0.5817203", "0.5816738", "0.5803831", "0.5758321", "0.575494", "0.5733895", "0.57313645", "0.5712539", "0.57064134", "0.5695988", "0.5690285", "0.5687107", "0.56407666", "0.56407666", "0.56255424",...
0.7902325
0
Get a list of all items.
def getAllItemsList(): return Gw2Spidy._request('all-items', 'all')['results']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self):\n return self.__items", "def get_all_items(self):\n return self.api.state['items']", "def all(self):\n return self.client.request_with_method(Methods.LIST % self.name)['items']", "def get_all(self,empty=True):\n with self.lock:\n items = self.items\n ...
[ "0.84253937", "0.8359328", "0.83210117", "0.8225633", "0.8139733", "0.7850139", "0.7827745", "0.77930033", "0.7757399", "0.7721276", "0.7708981", "0.77050364", "0.7646707", "0.76162696", "0.7552615", "0.75029814", "0.7467474", "0.7379397", "0.73677814", "0.73654664", "0.73401...
0.8519237
0
Get a list of all items of a certain type.
def getItemsOfType(typeId): return Gw2Spidy._request('all-items', str(typeId))['results']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_items(model, type):\n if(type == \"office\"):\n return model.get_all_offices()\n elif(type == \"party\"):\n return model.get_all_parties()\n return []", "def allItemsByType(self, itemType):\n if itemType.value not in self.__inventory__:\n return []\n re...
[ "0.80559105", "0.773367", "0.7731726", "0.7117611", "0.69495213", "0.69487274", "0.69468254", "0.6821881", "0.67376673", "0.6731547", "0.6665573", "0.66264826", "0.65028715", "0.6501267", "0.6495409", "0.6478296", "0.6476366", "0.64720285", "0.6464242", "0.64612967", "0.64243...
0.8188449
0
Get the data of a particular item. High frequency of update.
def getItemData(itemId): return Gw2Spidy._request('item', str(itemId))['result']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n return self.get_data(stock=item)", "def __getitem__(self, item):\n return self.data[item]", "def __getitem__(self, item):\n return self.data[item]", "def __getitem__(self, item):\n return self.data[item]", "def __getitem__(self, item):\n ret...
[ "0.7624138", "0.67148376", "0.67148376", "0.67148376", "0.6686171", "0.6667251", "0.66509175", "0.664449", "0.66322106", "0.66322106", "0.66322106", "0.66269", "0.66187686", "0.66187686", "0.6433046", "0.6280939", "0.62171835", "0.6167471", "0.61247575", "0.6123215", "0.60869...
0.7078673
1
Get a list of all buy offers for a certain item.
def getItemBuyListings(itemId, allPages = False): return Gw2Spidy._paginatedRequest(allPages, 'listings', str(itemId), 'buy')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_offers_list():\n offers_list = Offers()\n offers_list.add_new_offer('Offer1', 'Baked Beans', 3, 1)\n offers_list.add_new_offer('Offer2', 'Sardines', 1, 0.25)\n return offers_list", "def getItemSellListings(itemId, allPages = False):\n return Gw2Spidy._paginatedRequest(allPages, 'listi...
[ "0.6291218", "0.6269345", "0.5786118", "0.5731212", "0.56983286", "0.55467474", "0.53833646", "0.53561646", "0.5353941", "0.5324464", "0.53242135", "0.53233147", "0.5259981", "0.52508676", "0.5250708", "0.52356476", "0.5206746", "0.5192987", "0.5184894", "0.5182347", "0.51543...
0.7018464
0
Get a list of all sell offers for a certain item.
def getItemSellListings(itemId, allPages = False): return Gw2Spidy._paginatedRequest(allPages, 'listings', str(itemId), 'sell')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_offers_list():\n offers_list = Offers()\n offers_list.add_new_offer('Offer1', 'Baked Beans', 3, 1)\n offers_list.add_new_offer('Offer2', 'Sardines', 1, 0.25)\n return offers_list", "def getItemBuyListings(itemId, allPages = False):\n return Gw2Spidy._paginatedRequest(allPages, 'listin...
[ "0.6361055", "0.6187623", "0.5951162", "0.57278025", "0.55515", "0.55454504", "0.55055815", "0.5461952", "0.5452169", "0.54247415", "0.5406549", "0.5379518", "0.53276795", "0.5319134", "0.5307508", "0.5266877", "0.52656245", "0.5250715", "0.5206154", "0.51983523", "0.5196505"...
0.7101226
0
Search items by name. Might be slow, not recommended.
def searchItems(name, allPages = False): return Gw2Spidy._paginatedRequest(allPages, 'item-search', name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_contains_name(items, name):\n ret = 0\n # Loops all items and saves the searched one\n for x in range(len(items)):\n if items[x]['name'] == name:\n ret = x\n return ret", "def get_items_by_name(request, name):\n try:\n items = Items.objects.filter(titulo__icontai...
[ "0.7681056", "0.72909695", "0.7104459", "0.7021031", "0.7012583", "0.68865407", "0.6833507", "0.683189", "0.68183327", "0.6785376", "0.6623667", "0.6623241", "0.65961444", "0.6541313", "0.65354973", "0.6485011", "0.64710367", "0.6432023", "0.64189875", "0.6405277", "0.6403933...
0.7768129
0
Get a list of all crafting recipes for a certain discipline.
def getRecipesOfDiscipline(disciplineId, allPages = False): return Gw2Spidy._paginatedRequest(allPages, 'recipes', str(disciplineId))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipes():\n # pylint: disable=redefined-outer-name\n recipes = list(mongo.db.recipes.find().sort('_id', -1))\n return render_template(\n \"recipes.html\", page_title=\"All Recipes\", recipes=recipes)", "def GetRecipes(self) -> List[Recipe]:\n return sorted(self._recipes.values(), key=lamb...
[ "0.6487927", "0.6397761", "0.63729787", "0.625598", "0.6198711", "0.61692214", "0.6060824", "0.5997523", "0.5990287", "0.5865964", "0.5768593", "0.57569087", "0.56551194", "0.56281215", "0.5564877", "0.55318457", "0.5526318", "0.55114657", "0.54900837", "0.54453087", "0.54224...
0.7067415
0
Get the data of a particular recipe.
def getRecipeData(recipeId): return Gw2Spidy._request('recipe', str(recipeId))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_recipe(self, _id):\n raise NotImplementedError()", "def recipe(self):\n return self.__recipe", "def find_recipe(self, recipe_id):\n return self.find_doc('recipe', 'name', self.get_unique_recipe_name(recipe_id))", "def get_recipe(cls, recipeid):\n\n recipe = Recipe.query.fi...
[ "0.69791776", "0.69119143", "0.6786093", "0.6780429", "0.67455363", "0.664302", "0.6418403", "0.6328417", "0.6243942", "0.62257487", "0.61019534", "0.6009829", "0.5987901", "0.5953582", "0.594203", "0.59389687", "0.5922322", "0.5867659", "0.5861185", "0.58285546", "0.58028126...
0.8197804
0
Handle paginated requests, downloading all pages if requested.
def _paginatedRequest(allPages, *args): data = [] currentPage = 0 while True: newData = Gw2Spidy._request(*(args + (str(currentPage),))) if not allPages: return newData['results'] data.extend(newData['results']) currentPage = curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginated_handling(self) -> global___Snippet.PaginatedResponseHandling:", "def _scrolling_request(self, path, method='GET', body=None, headers=None):\n assert 'pagination' in body\n paginated_view = body\n url = '{}{}'.format(self._url_base, path)\n headers = self._headers() if he...
[ "0.71103185", "0.68762827", "0.6717565", "0.6324157", "0.628341", "0.62628573", "0.62483454", "0.62377447", "0.62147516", "0.6174295", "0.6156397", "0.61429656", "0.607965", "0.6067194", "0.60252696", "0.60162514", "0.60162514", "0.601459", "0.6005498", "0.60041666", "0.59756...
0.70388454
1
Makes a request on the GW2Spidy API.
def _request(*args): url = 'http://www.gw2spidy.com/api/v0.9/json/' + '/'.join(args) r = urllib2.Request(url, headers=Gw2Spidy.headers) if 'Cookie' not in Gw2Spidy.headers: resp = urllib2.urlopen(r) if 'set-cookie' in resp.headers: Gw2Spidy.headers['Cookie'] = resp.headers['set-cookie'].split(';',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(self, *args, **kwargs):\n req = GoodreadsRequest(self, *args, **kwargs)\n return req.request()", "def make_request(self, url, action, data='', status_code='', parser=None):\n self._url = self.get_api_path(url)\n headers = {\n 'Content-Type': \"application/json\"...
[ "0.5983662", "0.5962979", "0.5946429", "0.5919456", "0.5910001", "0.58901393", "0.58893377", "0.5843586", "0.58304554", "0.5817279", "0.5790577", "0.57675844", "0.5760673", "0.5760673", "0.5726898", "0.5721647", "0.57126313", "0.5677342", "0.56640095", "0.5662453", "0.5656771...
0.6390168
0
Add a chunk containing 'data', returning a string that is framed and (optionally, default) compressed. This data should be concatenated to the tail end of an existing Snappy stream. In the absence of any internal buffering, no data is left in any internal buffers, and so unlike zlib.compress, this method returns everyt...
def add_chunk(self, data, compress=None): if not self._header_chunk_written: self._header_chunk_written = True out = [struct.pack("<L", _IDENTIFIER_CHUNK + (len(_STREAM_IDENTIFIER) << 8)), _STREAM_IDENTIFIER] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(self, data):\r\n return self.add_chunk(data)", "def encode(self, compress=0):\n raw = bytes(self._encode())\n return gzip.compress(raw, compress) if compress else raw", "def write(self, data: bytes, name: str, compress: bool = False):\n filepath = self.join(name)\n ...
[ "0.7183057", "0.5703993", "0.5684", "0.5451548", "0.5425758", "0.5423084", "0.5394311", "0.5372644", "0.5346283", "0.52141404", "0.5137426", "0.50930786", "0.50014967", "0.4921885", "0.49202016", "0.48890024", "0.48811412", "0.4867818", "0.4856803", "0.48213577", "0.47734666"...
0.7972731
0
All pending input is processed, and a string containing the remaining uncompressed output is returned. After calling flush(), the decompress() method cannot be called again; the only realistic action is to delete the object.
def flush(self): if self._buf != b"": raise UncompressError("chunk truncated") return b""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize(self):\r\n self.stream.finalize()", "def __handle_decompression(self, x):\n if self.__compress:\n return zlib.decompress(x)\n return x", "def __handle_compression(self, x):\n if self.__compress:\n return zlib.compress(x)\n return x", "def ...
[ "0.5917309", "0.57582253", "0.5671041", "0.56415474", "0.558007", "0.5569796", "0.5556639", "0.5556584", "0.5507771", "0.5477584", "0.5465025", "0.54514563", "0.54471743", "0.5434634", "0.54305434", "0.5428128", "0.5428128", "0.5428128", "0.5428128", "0.5415677", "0.5384314",...
0.64608544
0
Returns a copy of the decompression object. This can be used to save the state of the decompressor midway through the data stream in order to speed up random seeks into the stream at a future point.
def copy(self): copy = StreamDecompressor() copy._buf, copy._header_found = self._buf, self._header_found return copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompress(data):\n pickled = zlib.decompress(data)\n return pickle_util.load(pickled)", "def __handle_decompression(self, x):\n if self.__compress:\n return zlib.decompress(x)\n return x", "def decompress(self, s):\n return zlib.decompress(s, -zlib.MAX_WBITS)"...
[ "0.6925496", "0.63833547", "0.6075093", "0.59669656", "0.58811176", "0.5854266", "0.576971", "0.5765296", "0.57570505", "0.56792736", "0.5612739", "0.5599361", "0.5594443", "0.5581229", "0.5554577", "0.5547557", "0.5516419", "0.5491315", "0.5475955", "0.54711115", "0.5455313"...
0.7166197
0
Takes an incoming filelike object and an outgoing filelike object, reads data from src, compresses it, and writes it to dst. 'src' should support the read method, and 'dst' should support the write method. The default blocksize is good for almost every scenario.
def stream_compress(src, dst, blocksize=_STREAM_TO_STREAM_BLOCK_SIZE): compressor = StreamCompressor() while True: buf = src.read(blocksize) if not buf: break buf = compressor.add_chunk(buf) if buf: dst.write(buf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress_stream(src, dst):\n with gzip.GzipFile(fileobj=dst, mode='wb') as gz:\n for block in iterfile(src):\n gz.write(block)", "def stream_decompress(src, dst, blocksize=_STREAM_TO_STREAM_BLOCK_SIZE):\r\n decompressor = StreamDecompressor()\r\n while True:\r\n buf = src.re...
[ "0.66251296", "0.65518945", "0.6235194", "0.622015", "0.60013145", "0.5888635", "0.58747995", "0.58385336", "0.5654937", "0.5629403", "0.55607754", "0.5434642", "0.5383721", "0.5335917", "0.52975863", "0.5296024", "0.52819055", "0.5279969", "0.52602315", "0.52286553", "0.5218...
0.6918862
0
Takes an incoming filelike object and an outgoing filelike object, reads data from src, decompresses it, and writes it to dst. 'src' should support the read method, and 'dst' should support the write method. The default blocksize is good for almost every scenario.
def stream_decompress(src, dst, blocksize=_STREAM_TO_STREAM_BLOCK_SIZE): decompressor = StreamDecompressor() while True: buf = src.read(blocksize) if not buf: break buf = decompressor.decompress(buf) if buf: dst.write(buf) decompressor.flush() # makes sure the stream ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream_compress(src, dst, blocksize=_STREAM_TO_STREAM_BLOCK_SIZE):\r\n compressor = StreamCompressor()\r\n while True:\r\n buf = src.read(blocksize)\r\n if not buf: break\r\n buf = compressor.add_chunk(buf)\r\n if buf: dst.write(buf)", "def decompress_stream(src, dst):\n ...
[ "0.6593963", "0.6537316", "0.6226533", "0.59445155", "0.58220905", "0.5817378", "0.5810974", "0.55934566", "0.5584775", "0.55736387", "0.5443666", "0.53294194", "0.5318774", "0.5280879", "0.52218896", "0.5198386", "0.5159948", "0.514034", "0.5131315", "0.510541", "0.50612295"...
0.70542616
0
This method is what is run when invoking snappy via the commandline. Try python m snappy help
def cmdline_main(): import sys if (len(sys.argv) < 2 or len(sys.argv) > 4 or "--help" in sys.argv or "-h" in sys.argv or sys.argv[1] not in ("-c", "-d")): print("Usage: python -m snappy <-c/-d> [src [dst]]") print(" -c compress") print(" -d ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_help(self):\n run_nbgrader([\"quickstart\", \"--help-all\"])", "def help():", "def printHelp():\n print(\"amqWorkApiMass.py -n <msgcnt> -b <body> -m <headers> -s <path/to/bodyandheaders>\")", "def command_help(args):\n\tprint_usage()\n\treturn 0", "def help():\n \n pass", "de...
[ "0.6367044", "0.63433844", "0.63220483", "0.62899595", "0.6286061", "0.6280999", "0.62229306", "0.6146778", "0.6123531", "0.60720694", "0.6068584", "0.60610014", "0.60412145", "0.5964111", "0.59638095", "0.59473747", "0.5930729", "0.59158725", "0.5896823", "0.58824974", "0.58...
0.65329194
0
Full sorting of the order list. Uses the natural ordering of the orders, with the additional constraints of the before/after ordering.
def full_sort(orders: list or tuple) -> list: # We set up the topo sort to include the "before" and "after" objects # as another element in the sort. These are injected into the to-be # sorted list, and removed at the end. # Setup the topo sort. input_list = list(orders...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder( self ):\n self.sorted.sort(self.compareFunction)", "def make_custom_sort(orders):\n orders = [{k: -i for (i, k) in enumerate(reversed(order), 1)} for order in orders]\n def process(stuff):\n if isinstance(stuff, dict):\n l = [(k, process(v)) for (k, v) in stuff.items()...
[ "0.68136275", "0.6743404", "0.6533074", "0.64655787", "0.6330571", "0.61679476", "0.6143027", "0.6090904", "0.6036177", "0.6029507", "0.60155845", "0.6002121", "0.5999367", "0.5992446", "0.59697044", "0.5925685", "0.5925623", "0.59184736", "0.59155226", "0.5909884", "0.590939...
0.7619785
0
Returns the most appropriate SqlString instance, starting with the first platform value.
def get_for_platform( self, platforms: str or list or tuple) -> None or SqlString: if isinstance(platforms, str): platforms = [platforms] for plat in platforms: plat = plat.strip().lower() for sql in self.__sql_set: assert isinstan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sequencing_platform(self):\n platform = self.data[\"platform\"]\n if platform == \"miseq\":\n platform = \"MiSeq\"\n elif platform == \"hiseq4000\":\n platform == \"HiSeq4000\"\n elif platform == \"hiseq2000\":\n platform == \"HiSeq2000\"\n else:\n raise...
[ "0.551231", "0.5330433", "0.5330433", "0.5060567", "0.50455624", "0.4967626", "0.49599984", "0.49288383", "0.4928459", "0.48998073", "0.4886638", "0.48826876", "0.48699632", "0.48584884", "0.4857254", "0.48349535", "0.48274267", "0.48193818", "0.4810762", "0.48067117", "0.480...
0.75149673
0
This is the hello page on wildlife REST APIs usages ``GET``
def hello(): usage_msg = "<br/>\n".join(["Welcome to WildLife: The REST APIs for " "ZooKeeper!<br/>", hello.__doc__.replace("\n", "<br/>\n")]) return make_response(usage_msg, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n response = jsonify(\n {'message':'Hello, RESTful API development!'}\n )\n \n return response, 200", "def do_GET(self):\n self.log.debug('do_GET called')\n self.HeadGet('GET')", "def get(self, request, format=None):\n an_apiview = [\n 'Uses HTTP methods...
[ "0.73314464", "0.7088987", "0.7076638", "0.70648944", "0.6977301", "0.69665855", "0.69659585", "0.6957469", "0.6940304", "0.69305223", "0.6915593", "0.69006383", "0.68617684", "0.6807505", "0.6807064", "0.6805488", "0.67848176", "0.678479", "0.67621017", "0.67555964", "0.6731...
0.7539239
0
get the basic information of a specific cluster
def detail_cluster(cluster_name, znode): _cluster_info = dict() _cluster_info.update(app.clusters[cluster_name].__dict__) _cluster_info.pop("auth_data", None) _cluster_info["connection"] = app.managers[cluster_name]._client.state resp = Response(json.dumps(_cluster_info), status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_info(self) -> Dict[str, Any]:\n pass", "def show_cluster(name: str) -> Cluster:\n environment = EnvironmentProvider().environment\n return environment.clusters[name]", "def list_cluster_response():\n return {\n \"clusters\": [\n EXAMPLE_NAME\n ]\n }",...
[ "0.79686385", "0.72358394", "0.7226845", "0.71572334", "0.7115782", "0.7054738", "0.7015873", "0.7011808", "0.69873834", "0.69290453", "0.6919172", "0.69130856", "0.6883007", "0.68551433", "0.68085957", "0.6787342", "0.6737089", "0.672974", "0.67191106", "0.6704386", "0.67020...
0.75640976
1
create a znode in a specific cluster
def cluster_create_znode(cluster_name, znode, headers=None): _zclient = get_client(cluster_name, headers or request.headers) acl_config = wildutils.ACLConfig(headers or request.headers) data = request_data(request) real_path_list = list() for (_znode, _zdata) in data.items...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_cluster_network(self):\n pass", "def create_cluster():\n config = get_kube_config()\n command = CLUSTER_CREATE_COMMAND.replace('\\n','').format(cluster_name=config['cluster_name'],\n project_name=config['project_name'],\n ...
[ "0.69783026", "0.68469054", "0.67649543", "0.67396474", "0.66558343", "0.660216", "0.6541099", "0.6471974", "0.6470758", "0.6422064", "0.6386441", "0.6355805", "0.63444173", "0.6187112", "0.61868495", "0.6184347", "0.6170597", "0.61427826", "0.6121524", "0.6116833", "0.609464...
0.7713211
0
get the root children of a specific cluster
def cluster_list_children(cluster_name, znode, headers=None): return cluster_znode_children(cluster_name, "/", headers=headers or request.headers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_znode_children(cluster_name, znode, headers=None):\n\n _zclient = get_client(cluster_name,\n headers or request.headers)\n zchildren = _zclient.get_children(znode)\n return make_response(str(zchildren),\n 200)", "def get_child_znodes(cluster_n...
[ "0.70786995", "0.69932806", "0.6935309", "0.64266056", "0.6414852", "0.61486125", "0.6090426", "0.5980974", "0.59795284", "0.59795284", "0.5949663", "0.59165347", "0.5900144", "0.5882156", "0.5876566", "0.5871498", "0.58663744", "0.5842499", "0.58250684", "0.5816844", "0.5790...
0.7342523
0
get the znode data including the znodeStat, update the znode data and delete the znode
def cluster_znode(cluster_name, znode, headers=None): _zclient = get_client(cluster_name, headers or request.headers) if request.method == "GET": zdata = _zclient.get(znode) data = {"data": zdata[0], "znodeStat": wildutils.convert_zstat(zdata[1])} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_znode_data(cluster_name, znode, headers=None):\n\n zdata_resp = cluster_znode(cluster_name,\n znode,\n headers=headers)\n zdata = json.loads(zdata_resp.get_data())\n resp = Response(zdata[\"data\"],\n status=200,\n ...
[ "0.5373689", "0.5273742", "0.5075266", "0.50748503", "0.50466686", "0.503976", "0.4985969", "0.49762192", "0.497448", "0.4964389", "0.49052078", "0.49017364", "0.4865922", "0.48021978", "0.47926277", "0.4788437", "0.47876316", "0.4779386", "0.4768562", "0.47685406", "0.475960...
0.5672493
0
get or update the acls of a znode in a specific cluster
def cluster_znode_acls(cluster_name, znode, headers=None): _zclient = get_client(cluster_name, headers or request.headers) if request.method == "GET": acls = _zclient.get_acls(znode)[0] return make_response(str(acls), 200) if request.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_znode(cluster_name, znode, headers=None):\n\n _zclient = get_client(cluster_name,\n headers or request.headers)\n if request.method == \"GET\":\n zdata = _zclient.get(znode)\n data = {\"data\": zdata[0],\n \"znodeStat\": wildutils.convert_zsta...
[ "0.6120968", "0.5822818", "0.578362", "0.5718397", "0.56861407", "0.5677384", "0.56047076", "0.55888546", "0.55510396", "0.55241555", "0.54977036", "0.54975134", "0.54909545", "0.5450188", "0.5449753", "0.5439439", "0.53624964", "0.533381", "0.52977103", "0.5261461", "0.52344...
0.75809515
0
get only the data of a znode in a specific cluster
def cluster_znode_data(cluster_name, znode, headers=None): zdata_resp = cluster_znode(cluster_name, znode, headers=headers) zdata = json.loads(zdata_resp.get_data()) resp = Response(zdata["data"], status=200, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getClusterData(clusterName,data):\n clusters = rhevGet(\"/api/clusters\")\n doc = libxml2.parseDoc(clusters)\n ctxt = doc.xpathNewContext()\n res = ctxt.xpathEval(\"/clusters/cluster[name [position()=1]= '\"+ clusterName + \"']\")\n return res[0].prop(data)", "def detail_cluster(cluster_name, ...
[ "0.7018603", "0.6644268", "0.62937874", "0.6237388", "0.6226925", "0.6203947", "0.6152202", "0.61375844", "0.6101296", "0.60726506", "0.6056079", "0.6052364", "0.6040989", "0.6005195", "0.594744", "0.584992", "0.5816863", "0.5813703", "0.5793177", "0.57919335", "0.57774866", ...
0.7252783
0
get the children of a znode in a specific cluster
def cluster_znode_children(cluster_name, znode, headers=None): _zclient = get_client(cluster_name, headers or request.headers) zchildren = _zclient.get_children(znode) return make_response(str(zchildren), 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_list_children(cluster_name, znode, headers=None):\n\n return cluster_znode_children(cluster_name,\n \"/\",\n headers=headers or request.headers)", "def get_child_znodes(cluster_name, path):\n zoo_client = ZookeeperService.get_zoo...
[ "0.85263276", "0.7920109", "0.6669216", "0.6313875", "0.6300167", "0.62672305", "0.62672305", "0.60664016", "0.6062976", "0.60154545", "0.59611475", "0.59508294", "0.59277457", "0.5915434", "0.58864725", "0.58848935", "0.5879007", "0.58775723", "0.5863188", "0.58544725", "0.5...
0.8357048
1
Closes the monochromator connection.
def closeinstance(self): if self.status != "not connected": m = self.serial m.close() result = "out.monochrom: Closed monochromator connection." return result else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection(self):\n try:\n ljm.close(self.connection_handle)\n except LJMError:\n pass", "def close(self):\n self._connection.close()", "async def close_connection(self):\n\t\t...", "def close(self) -> None:\n self._connected = False", "def close(self...
[ "0.7043207", "0.693524", "0.6931194", "0.6917567", "0.6910911", "0.6903881", "0.6865405", "0.68192524", "0.6768987", "0.67682177", "0.6737875", "0.67302835", "0.6725004", "0.6717543", "0.6677244", "0.66752464", "0.6664463", "0.66567534", "0.6649557", "0.66485816", "0.6627092"...
0.7378704
0
Scans from start (nm) to end (nm) in steps of stepsize (nm). Sleeps for sleeptime seconds at each wavelength. Writes list of wavelengths to file filename
def scan(self, start, end, stepsize, sleeptime, filename='test.txt'): if self.status != "not connected": self.gowave(start) time.sleep(5) wave = start while wave <= end: time.sleep(sleeptime) self.gowave(wave + stepsize) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runWavelengthDependency():\n RunData([getFiles(mintime=(15, 39, 58), maxtime=(15, 47, 58), folder='data/30Jul/')[0],], out='I600nmwave',\n wavelength='l600')\n RunData([getFiles(mintime=(17, 48, 35), maxtime=(17, 56, 03), folder='data/30Jul/')[0],], out='I700nmwave',\n wavelength='l...
[ "0.5589533", "0.55571085", "0.55230576", "0.55046386", "0.54201984", "0.5405603", "0.53539646", "0.5322486", "0.53104", "0.5308084", "0.53049016", "0.5240727", "0.5205891", "0.52053046", "0.5200349", "0.5192761", "0.5159999", "0.5125217", "0.51243967", "0.5124382", "0.5120579...
0.6718007
0
Opens ('O') or closes ('C') the monochromator shutter.
def shutter(self, state): if self.status != "not connected": m = self.serial m.write("shutter " + str(state) + "\r\n") r = m.read(100) if state == 'O': st = "open" else: st = "closed" result = "out.monochrom:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cehs():\n\tcloseEHShutter()", "def w():\n system_command('w')", "def shclose():\n\tsh('c')", "def shopen():\n\tsh('o')", "def close_door(self):\n\t\tio.set_bit(OUTPUT.DOOR_OPEN, 0)\n\t\tself.should_drive()", "def close():\n print('\\n\\tClosing')", "def open_camera__LINUX(jarvis, s):\n jar...
[ "0.65041816", "0.60286087", "0.5954267", "0.5836128", "0.5690043", "0.56693774", "0.5581232", "0.5420525", "0.541885", "0.53909165", "0.53507257", "0.5329898", "0.5237518", "0.5205622", "0.51950467", "0.5194404", "0.51821256", "0.5178536", "0.5172109", "0.5133695", "0.5105799...
0.62222815
1
Return the authentication header.
def auth_header(self): return self._auth_header
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_authenticate_header(self):\n pass", "def get_auth_header(self):\n if not self.verify():\n return None\n\n auth_val = self.encode_auth_header_val()\n if not auth_val:\n return None\n\n return {'Authorization': auth_val.replace('\\n', '')}", "def g...
[ "0.8705761", "0.85099626", "0.8039289", "0.78624386", "0.76933163", "0.7599953", "0.7598708", "0.7435408", "0.73607713", "0.73407507", "0.72907925", "0.72599363", "0.724971", "0.7178261", "0.7177647", "0.7157621", "0.7145928", "0.71377546", "0.710297", "0.70987093", "0.708205...
0.8648501
1
Retrieve blink parameters from login response.
def setup_params(self, response): self.login_url = self.login_handler.login_url ((self.region_id, self.region),) = response["region"].items() self._host = "{}.{}".format(self.region_id, BLINK_URL) self._token = response["authtoken"]["authtoken"] self._auth_header = {"Host": self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_login_info(opener):\n request = urllib.request.Request(URL)\n response = opener.open(request)\n html = response.read().decode()\n # print(html)\n\n params_base64 = re.search(\"window.atob\\('(.+?)'\\)\", html).group(1)\n params = json.loads(base64.b64decode(params_base64).decode())\n #...
[ "0.5312792", "0.5285339", "0.5267658", "0.5242795", "0.52081645", "0.51706564", "0.5105567", "0.5092038", "0.5085125", "0.50273246", "0.49785724", "0.4961858", "0.49271914", "0.49206787", "0.49133083", "0.4912281", "0.49013796", "0.4874102", "0.4865722", "0.486494", "0.484823...
0.584881
0
Retrieve a camera list for each onboarded network.
def get_cameras(self): response = api.request_homescreen(self) try: all_cameras = {} for camera in response["cameras"]: camera_network = str(camera["network_id"]) camera_name = camera["name"] camera_id = camera["id"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camera_list(self, **kwargs):\n api = self._api_info['camera']\n payload = dict({\n '_sid': self._sid,\n 'api': api['name'],\n 'method': 'List',\n 'version': api['version'],\n }, **kwargs)\n response = self._get_json(api['url'], payload)\n\...
[ "0.7397992", "0.70530784", "0.70530784", "0.69696206", "0.6817692", "0.6732843", "0.66054785", "0.65961903", "0.63997304", "0.63936424", "0.63894826", "0.63704073", "0.6215702", "0.6108204", "0.6020552", "0.5921499", "0.59094447", "0.5864031", "0.5848088", "0.5824424", "0.578...
0.7129081
1
Merge all sync camera dicts into one.
def merge_cameras(self): combined = CaseInsensitiveDict({}) for sync in self.sync: combined = merge_dicts(combined, self.sync[sync].cameras) return combined
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _syncCameras(self, camera, ev):\n\t\tself.rendererOverlay.GetActiveCamera().ShallowCopy(camera)", "def extract_camera_sync(sync, chmap=None):\n assert(chmap)\n sr = _get_sync_fronts(sync, chmap['right_camera'])\n sl = _get_sync_fronts(sync, chmap['left_camera'])\n sb = _get_sync_fronts(sync, chma...
[ "0.6069103", "0.5779138", "0.5641571", "0.5609386", "0.5400561", "0.5294496", "0.52505445", "0.5204408", "0.5101879", "0.50810826", "0.5044568", "0.49977142", "0.49903548", "0.49672067", "0.49638373", "0.49623334", "0.49402735", "0.49237362", "0.49192142", "0.48834366", "0.48...
0.8078841
0
Generates tfop that assigns the stored noise to weights. Also used by tfeager.
def _tf_add_stored_noise_op(self): add_noise_ops = list() for var, noise in zip(self.model_variables, self.noise): add_noise_ops.append(tf1.assign_add(var, noise)) ret = tf.group(*tuple(add_noise_ops)) with tf1.control_dependencies([ret]): return tf.no_op()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_stored_noise(self, *, tf_sess=None):\n # Make sure we only add noise to currently noise-free weights.\n assert self.weights_are_currently_noisy is False\n\n # Add stored noise to the model's parameters.\n if self.framework == \"tf\":\n tf_sess.run(self.tf_add_stored_...
[ "0.66517526", "0.64524406", "0.6398275", "0.6244791", "0.62304187", "0.6197944", "0.6087129", "0.59881634", "0.59712887", "0.59519535", "0.5902107", "0.58702", "0.5796758", "0.5784609", "0.57591236", "0.574913", "0.57465935", "0.5709665", "0.56946677", "0.56784797", "0.563441...
0.6922497
0
Removes the current action noise from the model parameters.
def _remove_noise(self, *, tf_sess=None): # Make sure we only remove noise iff currently noisy. assert self.weights_are_currently_noisy is True # Removes the stored noise from the model's parameters. if self.framework == "tf": tf_sess.run(self.tf_remove_noise_op) eli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_noise(self):\n self.advantage_hidden_layer.reset_noise()\n self.advantage_layer.reset_noise()\n self.value_hidden_layer.reset_noise()\n self.value_layer.reset_noise()", "def _tf_remove_noise_op(self):\n remove_noise_ops = list()\n for var, noise in zip(self.mod...
[ "0.63060975", "0.6300119", "0.60341734", "0.6013809", "0.59907615", "0.59617525", "0.59610003", "0.59363043", "0.5923741", "0.58529073", "0.5825014", "0.5820904", "0.5767701", "0.5767701", "0.5761218", "0.5752928", "0.57315606", "0.5706779", "0.56984687", "0.56791276", "0.567...
0.66403574
0
Generates a tfop for removing noise from the model's weights. Also used by tfeager.
def _tf_remove_noise_op(self): remove_noise_ops = list() for var, noise in zip(self.model_variables, self.noise): remove_noise_ops.append(tf1.assign_add(var, -noise)) ret = tf.group(*tuple(remove_noise_ops)) with tf1.control_dependencies([ret]): return tf.no_op()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_noise(self, *, tf_sess=None):\n # Make sure we only remove noise iff currently noisy.\n assert self.weights_are_currently_noisy is True\n\n # Removes the stored noise from the model's parameters.\n if self.framework == \"tf\":\n tf_sess.run(self.tf_remove_noise_op...
[ "0.7204253", "0.62007445", "0.61138064", "0.60468775", "0.5993119", "0.5899586", "0.5858569", "0.5840985", "0.5831078", "0.5791867", "0.5761541", "0.57299596", "0.572592", "0.5720114", "0.57001287", "0.5678233", "0.56595904", "0.5657382", "0.5652612", "0.5641403", "0.5587703"...
0.77977866
0
Transform the call on the pointer in a request to evaluate the remote plan
def __call__(self, *args, **kwargs): result_ids = [sy.ID_PROVIDER.pop()] response = self.request_execute_plan(self.location, result_ids, *args) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_execute_plan(\n self,\n location: \"sy.workers.BaseWorker\",\n response_ids: List[Union[str, int]],\n *args,\n **kwargs,\n ) -> object:\n plan_name = f\"plan{self.id}\"\n # args, _, _ = hook_args.unwrap_args_from_function(\n # plan_name, ar...
[ "0.6183252", "0.55733895", "0.55733895", "0.5531869", "0.5504888", "0.5483553", "0.546563", "0.541369", "0.541369", "0.53839254", "0.53602034", "0.53582805", "0.5352802", "0.52783924", "0.5274764", "0.52733314", "0.5255356", "0.5248557", "0.52291393", "0.5228036", "0.52175164...
0.6617616
0
Requests plan execution. Send a request to execute the plan on the remote location.
def request_execute_plan( self, location: "sy.workers.BaseWorker", response_ids: List[Union[str, int]], *args, **kwargs, ) -> object: plan_name = f"plan{self.id}" # args, _, _ = hook_args.unwrap_args_from_function( # plan_name, args, {} # )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, *args, **kwargs):\n result_ids = [sy.ID_PROVIDER.pop()]\n\n response = self.request_execute_plan(self.location, result_ids, *args)\n\n return response", "def _execute(self, req: pb2.ExecutePlanRequest) -> None:\n logger.info(\"Execute\")\n\n def handle_respon...
[ "0.69741124", "0.6270479", "0.60047364", "0.59312046", "0.56973463", "0.56335443", "0.56177163", "0.55780303", "0.55531335", "0.5499659", "0.54774195", "0.5474973", "0.54545575", "0.54393226", "0.5414597", "0.5403089", "0.5403089", "0.5328957", "0.52663165", "0.5209576", "0.5...
0.7401817
0
This is an alias to fetch_plan, to behave like a pointer
def get(self, deregister_ptr: bool = True): copy = not deregister_ptr plan = self.owner.fetch_plan(self.id_at_location, self.location, copy=copy) return plan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plans():", "def plan(self):\n raise NotImplementedError('You must implement the plan() method '\n 'yourself!')", "def __init__(self, plan):\n self.plan = plan", "def build_plan(self):\n assert False, \"Not implemented.\"", "def seek_plan_2(state,tas...
[ "0.5999866", "0.5978136", "0.5851539", "0.5744593", "0.55793613", "0.55755836", "0.5571411", "0.55085737", "0.54559636", "0.5440046", "0.53984016", "0.53291583", "0.5217922", "0.5191589", "0.5168124", "0.51669455", "0.5139428", "0.5132694", "0.5132533", "0.5132533", "0.512217...
0.6184417
0
parse params config from json file
def parse_json(params_path): with open (params_path) as f: params = json.load(f) return params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_params_from_file(self, fn):\n f = file(fn, 'r')\n params = json.load(f)\n return params", "def load_params(param_file):\n with open(param_file, 'r') as pfile:\n eff_params = json.load(pfile)\n return eff_params", "def load_parameters(self):\n json_data = op...
[ "0.70962477", "0.70247406", "0.70062", "0.684115", "0.68335986", "0.6821451", "0.67697304", "0.6737991", "0.67056066", "0.66875875", "0.6671494", "0.6656328", "0.6596548", "0.6583646", "0.65472156", "0.65153694", "0.65152097", "0.6509099", "0.64808846", "0.6442926", "0.638807...
0.7354244
0
Parse HTML fragments from the given HTML fragment string.
def parse_fragments(html_string, safe_tags=None, safe_attrs=None): for f in html.fragments_fromstring(html_string): cf = clean_fragment(f, safe_tags=safe_tags, safe_attrs=safe_attrs) if cf is not None: yield cf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(html, encoding='utf-8'):\n if isinstance(html, unicode):\n return bs4.BeautifulSoup(html, 'html.parser')\n\n return bs4.BeautifulSoup(html, 'html.parser', from_encoding=encoding)", "def parse_html(html):\n parser = lxml.html.HTMLParser(encoding='utf8')\n return lxml.html.fromstring(h...
[ "0.56239295", "0.5550598", "0.50901145", "0.5075531", "0.50661176", "0.5007007", "0.4972859", "0.49443534", "0.49226478", "0.49127916", "0.49005935", "0.48786095", "0.4843172", "0.4841388", "0.48242086", "0.48240602", "0.48120746", "0.48109034", "0.480894", "0.48028117", "0.4...
0.74327075
0
Clean an HTML fragment subtree of unsafe tags and attrs.
def clean_fragment(subtree, safe_tags=None, safe_attrs=None): if isinstance(subtree, str): return E('p', subtree) if safe_tags is None: safe_tags = default_safe_tags if safe_attrs is None: safe_attrs = default_safe_attrs if subtree.tag not in safe_tags: if callable(subt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_html(input):\n p = HTMLParser(tree=treebuilders.getTreeBuilder(\"dom\"))\n dom_tree = p.parseFragment(input)\n walker = treewalkers.getTreeWalker(\"dom\")\n stream = walker(dom_tree)\n\n s = HTMLSerializer(omit_optional_tags=False)\n return \"\".join(s.serialize(stream))", "def saniti...
[ "0.69207746", "0.6851112", "0.6787994", "0.6762686", "0.6641109", "0.66095674", "0.6423998", "0.6379426", "0.63460016", "0.62701243", "0.62160534", "0.61747944", "0.6083591", "0.6076524", "0.60660493", "0.5972916", "0.59661376", "0.59508634", "0.5923158", "0.59106386", "0.588...
0.7691546
0
Builds API requests to construct Target VPN Gateways.
def CreateRequests(self, args): target_vpn_gateway_ref = self.TARGET_VPN_GATEWAY_ARG.ResolveAsResource( args, self.resources, scope_lister=compute_flags.GetDefaultScopeLister(self.compute_client, self.project)) network_ref = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_config(context):\n\n\n properties = context.properties\n project_id = properties.get('project', context.env['project'])\n\n network = context.properties.get('networkURL', generate_network_uri(\n project_id,\n context.properties.get('network','')\n ))\n target_vpn_gateway =...
[ "0.5457457", "0.5400112", "0.52314186", "0.52288437", "0.5151026", "0.5138157", "0.51055276", "0.510482", "0.5102499", "0.5087584", "0.5038377", "0.5031687", "0.4890897", "0.48808277", "0.48528752", "0.48292014", "0.4820826", "0.48128098", "0.4810738", "0.47896957", "0.478969...
0.6306386
0
Return the sum of the first n positive integer numbers.
def integer_sum(n): sum = 0 k = 0 # INVARIANT # The sum of far is equal to the sum of the first k integer numbers # VARIANT: n-k # while (k!=n): k += 1 sum += k return sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_nth( n ):\n if n > 0:\n return sum( range(n + 1) )\n else:\n return 0", "def sum_to_n(n):\n total = 0\n for i in range(1,n+1):\n total += i\n return total", "def sum_to(n):\n the_sum = 0\n for counter in range(n+1):\n the_sum = the_sum + counter\n ...
[ "0.8215", "0.76410437", "0.7622653", "0.76161855", "0.757394", "0.75360984", "0.75360984", "0.75297254", "0.74707264", "0.7282134", "0.7234292", "0.7179291", "0.710554", "0.70555204", "0.70266354", "0.6928122", "0.6913925", "0.6838018", "0.67928416", "0.675572", "0.67517275",...
0.8239469
0
This is a vendored and modified version of the Django create_sql method We do this so that we can monkey patch in the unique index statement onto the schema_editor while we create the statement for this index, and then revert it to normal. We should remove this as soon as Django natively supports UniqueConstraints with...
def create_sql(self, model, schema_editor, using='', **kwargs): include = [model._meta.get_field(field_name).column for field_name in self.include] condition = self._get_condition_sql(model, schema_editor) if self.expressions: index_expressions = [] for expression in self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_patch():\n assert BaseDatabaseSchemaEditor is not None\n\n def _create_unique_sql(self, *args, **kwargs):\n from django.db.backends.ddl_references import IndexName\n\n statement = orig_create_unique_sql(self, *args, **kwargs)\n\n if statement is not None:\n index_nam...
[ "0.70809084", "0.6315724", "0.59476066", "0.5805522", "0.5715756", "0.5651993", "0.5598853", "0.55119926", "0.5468462", "0.53348327", "0.53348327", "0.5326961", "0.5320753", "0.5297098", "0.52593166", "0.52473915", "0.5226516", "0.5196271", "0.51656127", "0.51099163", "0.5084...
0.76624185
0
Use this method when we want to recover a user.
def recover(self): self.deleted = False self.save() self.history.create(user_id=self.pk, action=user_history.RECOVERY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recover_password(self):\n self.user_in_db = User.users_db.get(self.email)\n if not self.user_in_db:\n # User does not exist\n return\n\n recovery_token = manage_tokens.encode({\n 'email': self.email,\n 'expires': time.time() + TWO_HOURS,\n ...
[ "0.7828689", "0.664469", "0.64906734", "0.6380119", "0.6194072", "0.6192591", "0.61285627", "0.6069517", "0.6016944", "0.5856853", "0.5822997", "0.58201", "0.5802341", "0.579055", "0.57773197", "0.57726264", "0.57553273", "0.57331485", "0.57264215", "0.57165086", "0.571603", ...
0.7091409
1
Hard delete all user related data. But keeps the user record itself intact.
def hard_delete_user_related_data(self): from contentcuration.viewsets.common import SQCount # Hard delete invitations associated to this account. self.sent_to.all().delete() self.sent_by.all().delete() editable_channels_user_query = ( User.objects.filter(editable_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_delete_user_data(self):\n util.log(\"Clearing all user data\", util.LogLevel.Info)\n self.db.db_clear_data_user()\n util.log(\"Done\", util.LogLevel.Info)", "def delete_all_users(self):\n\n User.query.delete()", "def delete_from_all(self, user_id):\n self.execute(TABEL...
[ "0.7916597", "0.73605067", "0.72478384", "0.7239079", "0.7239079", "0.7239079", "0.72180265", "0.7216574", "0.71505255", "0.71376425", "0.7127275", "0.70515263", "0.702429", "0.7010999", "0.70103616", "0.69733447", "0.6970275", "0.6967303", "0.6957211", "0.690086", "0.6885478...
0.7858996
1
Generate a storage URL for the given content filename.
def generate_storage_url(filename, request=None, *args): path = generate_object_storage_name(os.path.splitext(filename)[0], filename) # There are three scenarios where Studio might be run as: # # 1. In normal kubernetes, nginx will proxy for us. We'll know we're in kubernetes when the # environmen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_url(self, fname):\n gs_url = f\"{self.gs_base_url}/{fname}\"\n return f\"{gs_url}\"", "def url_for(filename):\n return \"{}{}\".format(S3_LOCATION, filename)", "def url(self, name):\n raise NotImplementedError(\"subclasses of Storage must provide a url() method\")", "def gene...
[ "0.741221", "0.6916883", "0.6495069", "0.64041996", "0.6381954", "0.6331196", "0.63248545", "0.6298421", "0.6283406", "0.6219698", "0.6213954", "0.62064636", "0.62001693", "0.6144256", "0.6127572", "0.6126819", "0.60907143", "0.60526717", "0.6050196", "0.60319525", "0.5997009...
0.7522385
0
Creates a primary secret token for the current channel using a proquint string. Creates a secondary token containing the channel id. These tokens can be used to refer to the channel to download its content database.
def generate_new_token(cls): token = proquint.generate() # Try 100 times to generate a unique token. TRIALS = 100 for __ in range(TRIALS): token = proquint.generate() if SecretToken.exists(token): continue break # after TRIALS ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_token(*args, **kwargs):\n return uuid.uuid4().hex", "def make_token():\n return secrets.token_urlsafe(36)", "def create_token():\n def token_helper():\n token = util.prompt_for_user_token(username=\"robbo1992\", scope='user-library-read playlist-modify-private playlist-modify',\n ...
[ "0.6273261", "0.61023384", "0.59821135", "0.5933154", "0.5858858", "0.5839052", "0.5806878", "0.57825905", "0.57783943", "0.5771134", "0.5741565", "0.57298034", "0.5715296", "0.57003677", "0.5615241", "0.56121814", "0.5591327", "0.5570559", "0.5567019", "0.5556821", "0.553995...
0.62194896
1
Sets the current channel object to be public and viewable by anyone. If bypass_signals is True, update the model in such a way that we prevent any model signals from running due to the update. Returns the same channel object.
def make_public(self, bypass_signals=False): if bypass_signals: self.public = True # set this attribute still, so the object will be updated Channel.objects.filter(id=self.id).update(public=True) # clear the channel cache delete_public_channel_cache_keys() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze(self):\n\n for channel in self._channels:\n channel.freeze()\n\n return self", "def get_public_channels(cls, defer_nonmain_trees=False):\n if defer_nonmain_trees:\n c = (Channel.objects\n .filter(public=True)\n .exclude(deleted...
[ "0.51328635", "0.5108298", "0.4941448", "0.48809657", "0.48597497", "0.48138613", "0.4811349", "0.47951823", "0.4794614", "0.47505704", "0.4734238", "0.47219503", "0.47137436", "0.468905", "0.46821007", "0.46707952", "0.46512887", "0.4647203", "0.46458405", "0.463299", "0.460...
0.8209847
0
Get all public channels. If defer_nonmain_trees is True, defer the loading of all trees except for the main_tree.
def get_public_channels(cls, defer_nonmain_trees=False): if defer_nonmain_trees: c = (Channel.objects .filter(public=True) .exclude(deleted=True) .select_related('main_tree') .prefetch_related('editors') .defer('tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channels(self):\n return [channel for channel in self.client.channels if channel.has_nick(self)]", "def get_channels():\n r = slack.channels.list().body\n return [ c for c in r['channels'] if c['is_member'] ]", "async def fetch_dm_channels(self):\n data = await self.http.get_dm_channels...
[ "0.5398365", "0.53615564", "0.53515303", "0.532987", "0.52644664", "0.52492374", "0.5235994", "0.52151406", "0.5157197", "0.51031905", "0.5099694", "0.50897247", "0.50468653", "0.50355583", "0.5001903", "0.4960083", "0.49421734", "0.49089542", "0.48916024", "0.488307", "0.485...
0.84116495
0
Prunes history records by keeping the most recent actions for each channel and type, and deleting all other older actions
def prune(cls): keep_ids = cls.objects.distinct("channel_id", "action").order_by("channel_id", "action", "-performed").values_list("id", flat=True) cls.objects.exclude(id__in=keep_ids).delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteHistory(self):\n\t\tmc.delete( self.objects, ch = True )", "def _cull_oldest(self, n=1):\n for msg_id in self.get_history()[:n]:\n self.log.debug(\"Culling record: %r\", msg_id)\n self._culled_ids.add(msg_id)\n self.drop_record(msg_id)", "def prune_data(self, t...
[ "0.5770779", "0.555615", "0.54136056", "0.5335625", "0.53070045", "0.52481365", "0.51770025", "0.5153235", "0.5132", "0.5117526", "0.5111304", "0.51066834", "0.50770617", "0.5053378", "0.50519663", "0.50360435", "0.5020498", "0.50203353", "0.49915004", "0.49752426", "0.497411...
0.70306325
0
When `settings.IS_CONTENTNODE_TABLE_PARTITIONED` is `False`, this always returns a queryset filtered by pk. When `settings.IS_CONTENTNODE_TABLE_PARTITIONED` is `True` and a ContentNode for `pk` exists, this returns a queryset filtered by `pk` AND `tree_id`. If a ContentNode does not exist for `pk` then an empty queryse...
def filter_by_pk(cls, pk): query = ContentNode.objects.filter(pk=pk) if settings.IS_CONTENTNODE_TABLE_PARTITIONED is True: tree_id = cache.get(CONTENTNODE_TREE_ID_CACHE_KEY.format(pk=pk)) if tree_id: query = query.filter(tree_id=tree_id) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_empty_tree_with_custom_query(self):\n query = lambda x: x.filter(self.model.get_pk_column() < 0) # noqa\n tree = self.model.get_tree(self.session, query=query)\n self.assertEqual(tree, [])", "def get_queryset(self, **kwargs):\n # if getattr(self.view, 'deleted_obj_lookup...
[ "0.5514528", "0.53951705", "0.5372893", "0.5192152", "0.5058633", "0.4969901", "0.49214536", "0.48488107", "0.4801569", "0.47893074", "0.47770473", "0.47690102", "0.47626826", "0.470678", "0.46553376", "0.4652667", "0.4650437", "0.46393195", "0.46337515", "0.461711", "0.46153...
0.8623341
0
Returns all ContentNodes with a given title. If limit_to_children_of is passed in with an id, only look at all the children of the node with that id.
def get_nodes_with_title(cls, title, limit_to_children_of=None): if limit_to_children_of: root = cls.objects.get(id=limit_to_children_of) return root.get_descendants().filter(title=title) return cls.objects.filter(title=title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children(self, cont: typing.Union[str, Type(None)]) -> List[str]:\n s = requests.Session()\n\n url = \"https://en.wikipedia.org/w/api.php\"\n\n if cont is None:\n params = {\n \"action\": \"query\",\n \"format\": \"json\",\n \"tit...
[ "0.55674", "0.5446906", "0.535895", "0.5233405", "0.51123166", "0.5035905", "0.49463487", "0.48584762", "0.48395738", "0.48239738", "0.48170954", "0.47682205", "0.47341162", "0.4734011", "0.47298878", "0.47263026", "0.47163272", "0.47061732", "0.46964613", "0.46819907", "0.46...
0.83708715
0
If self is NOT an original contentnode (in other words, a copied contentnode) and a contentnode with same content_id exists then we update self's content_id.
def make_content_id_unique(self): is_node_original = self.original_source_node_id is None or self.original_source_node_id == self.node_id node_same_content_id = ContentNode.objects.exclude(pk=self.pk).filter(content_id=self.content_id) if (not is_node_original) and node_same_content_id.exists():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_contentnode_content_id(self):\n if self.contentnode and self.preset.thumbnail is False:\n self.contentnode.make_content_id_unique()", "def on_update(self):\n self.contentnode.make_content_id_unique()", "def on_create(self):\n self.contentnode.make_content_id_unique()"...
[ "0.75834775", "0.7080512", "0.63942176", "0.57548326", "0.56728023", "0.56214875", "0.5486232", "0.53267026", "0.5309254", "0.5304242", "0.5177159", "0.51469195", "0.5145442", "0.50895685", "0.50642693", "0.505531", "0.5011204", "0.4981337", "0.49786243", "0.4973797", "0.4971...
0.7977629
0
Guess the format preset of a filename based on its extension. Return None if format is unknown.
def guess_format_preset(cls, filename): _, ext = os.path.splitext(filename) ext = ext.lstrip(".") f = FormatPreset.objects.filter( allowed_formats__extension=ext, display=True ) return f.first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_import_format(fname):\n\n if fname is None:\n return None, None, None, None\n\n extension = _get_extension(fname)\n\n content_encoding = _COMPRESSION_EXTENSIONS.get(extension)\n if content_encoding:\n # remove encoding extension\n extension = _get_extension(fname[: -len(e...
[ "0.7008831", "0.69953173", "0.69654244", "0.69263697", "0.69063085", "0.6849442", "0.6782588", "0.6754293", "0.6536065", "0.65108657", "0.64346766", "0.6425744", "0.6373442", "0.635483", "0.6319639", "0.63065046", "0.62809694", "0.62068266", "0.62009776", "0.6200357", "0.6179...
0.8202259
0
Get the FormatPreset object with that exact name. Returns None if that format preset is not found.
def get_preset(cls, preset_name): try: return FormatPreset.objects.get(id=preset_name) except FormatPreset.DoesNotExist: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_format_preset(cls, filename):\n\n _, ext = os.path.splitext(filename)\n ext = ext.lstrip(\".\")\n f = FormatPreset.objects.filter(\n allowed_formats__extension=ext,\n display=True\n )\n return f.first()", "def preset_name(self) -> Optional[pulumi...
[ "0.71574295", "0.67204964", "0.6637392", "0.6637392", "0.6377436", "0.6261633", "0.6182572", "0.6166151", "0.5835646", "0.58072066", "0.57982683", "0.57925195", "0.57648367", "0.57648367", "0.56437457", "0.5487842", "0.540611", "0.5386634", "0.5307244", "0.5244932", "0.513817...
0.88849247
0
When an exercise is updated of a contentnode, update its content_id if it's a copied contentnode.
def on_update(self): self.contentnode.make_content_id_unique()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_contentnode_content_id(self):\n if self.contentnode and self.preset.thumbnail is False:\n self.contentnode.make_content_id_unique()", "def updateContent(content, **kwargs):", "def save_changes(id,content):\n\tgeneric_query(\"UPDATE docs SET content=? WHERE id=?\",(content,id))\n\ti...
[ "0.67805314", "0.60094935", "0.5964799", "0.5955239", "0.5828662", "0.5760613", "0.5746691", "0.55659604", "0.53784263", "0.53633624", "0.5356098", "0.5344221", "0.5307296", "0.52666205", "0.5260135", "0.5253975", "0.52346253", "0.5185549", "0.5185048", "0.5160586", "0.512803...
0.6899939
0
When an exercise is deleted from a contentnode, update its content_id if it's a copied contentnode.
def delete(self, *args, **kwargs): self.contentnode.make_content_id_unique() return super(AssessmentItem, self).delete(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_contentnode_content_id(self):\n if self.contentnode and self.preset.thumbnail is False:\n self.contentnode.make_content_id_unique()", "def test_move_delete(self):\r\n source_course = CourseLocator(org='testx', offering='GreekHero', branch='draft')\r\n dest_course = Cour...
[ "0.6224221", "0.615373", "0.5953568", "0.586725", "0.5839273", "0.5705993", "0.56826615", "0.56067264", "0.5603178", "0.55940664", "0.5578936", "0.55754447", "0.55582815", "0.55535865", "0.5547702", "0.5521058", "0.55152434", "0.55085963", "0.54827803", "0.5466534", "0.539841...
0.6761193
0
Returns just the filename of the File in storage, without the path e.g. abcd.mp4
def filename(self): # TODO(aron): write tests for this return os.path.basename(self.file_on_disk.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_name(self):\n return self.upload.name[6:]", "def get_file_name(self):\n return self.path.name[6:]", "def get_file_name(self):\n return str(self.get_file())", "def GetFileName(self):\n return self.file.GetPath()", "def filename(self):\n filename, ext = os.path...
[ "0.7897664", "0.78294456", "0.78021795", "0.7598705", "0.759789", "0.75643426", "0.75611573", "0.7555759", "0.7548238", "0.7544818", "0.75343204", "0.7531525", "0.7519726", "0.741577", "0.73988396", "0.73988396", "0.73988396", "0.73988396", "0.73988396", "0.73979855", "0.7375...
0.7927493
0
If the file is attached to a contentnode and is not a thumbnail then update that contentnode's content_id if it's a copied contentnode.
def update_contentnode_content_id(self): if self.contentnode and self.preset.thumbnail is False: self.contentnode.make_content_id_unique()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_content_id_unique(self):\n is_node_original = self.original_source_node_id is None or self.original_source_node_id == self.node_id\n node_same_content_id = ContentNode.objects.exclude(pk=self.pk).filter(content_id=self.content_id)\n if (not is_node_original) and node_same_content_id.e...
[ "0.6397203", "0.6355747", "0.61755824", "0.5842826", "0.57322055", "0.5388726", "0.5290565", "0.5253831", "0.5227518", "0.51430446", "0.5142117", "0.50924", "0.5084231", "0.50797665", "0.50640124", "0.5043913", "0.5023955", "0.49695253", "0.4946705", "0.49262974", "0.49106103...
0.74587786
0
Parses the provided filelike object. The parser will process the data and trigger the corresponding events in the eventhandler which was passed at initialization.
def parse(self, fobj: Union[TextIO, str]): isfilename = isinstance(fobj, str) if isfilename: fp = open(fobj, "r") self._fname = fobj else: fp = fobj for line in fp.readlines(): self._parse(line) self._currline += 1 if is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed(self, fileobj):\n self._parser.feed(fileobj)", "def _parse(self):\n tree = etree.parse(self.filename)\n root_node = tree.getroot()\n\n text_node = root_node.find(\"TEXT\")\n\n # Get text\n self.text = self._extract_text(text_node)\n\n # Get and create Eve...
[ "0.63226813", "0.6139854", "0.6042889", "0.6023836", "0.60210013", "0.60027367", "0.5962134", "0.5957131", "0.59548813", "0.58065945", "0.58055264", "0.5745993", "0.5594426", "0.5591239", "0.5560602", "0.55333054", "0.5505397", "0.5491562", "0.54793495", "0.5474364", "0.54743...
0.66705006
0
Generating prediction of image url
def predict(self,url): # get image response = requests.get(url) img = Image.open(BytesIO(response.content)) transform = transforms.Compose([transforms.Grayscale(), transforms.Resize((128,128)), t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_url(*args): \n return gennet.predict_url(*args)", "def malicious_url_prediction(url):\r\n int_features = st.text_input(\"url\")\r\n data=[int_features]\r\n vect =cv.transform(data)\r\n prediction = classifier.predict(vect)[0]\r\n print(prediction)\r\n return prediction", "d...
[ "0.7508418", "0.73332566", "0.7024503", "0.69463074", "0.693479", "0.6792607", "0.66687363", "0.66685236", "0.6600326", "0.66001624", "0.6568512", "0.6559983", "0.6546201", "0.6535374", "0.65149325", "0.6514287", "0.6489362", "0.64786375", "0.647086", "0.6468498", "0.64561135...
0.7346197
1
Fetch the first occurance of the roundtrip time of a traceroute output
def extract_rtt_from_line(self, line): if line: rtt = line.split(' ms')[0].split()[-1] return rtt else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleReturnTime(rtt):\n pass", "def round_trip_time(self):\n ...", "def get_time(network, road_id):\n return network[0][road_id][4]", "def round_trip_time(self):\r\n return self.completion_time - self.launch_time", "def get_time_of_route(network, route):\n result = 0\n for road...
[ "0.6341864", "0.6128546", "0.60329694", "0.57925576", "0.57733727", "0.5734664", "0.56939733", "0.56496906", "0.5604731", "0.5574997", "0.55408734", "0.5536908", "0.5516099", "0.5502092", "0.5473357", "0.54370797", "0.54087317", "0.5393241", "0.5386049", "0.53848565", "0.5374...
0.6199218
1
Use Naive Bayes classification to classify the email in the given file. Inputs
def classify_new_email(filename,probabilities_by_category,prior_by_category): ### TODO: Write your code here spam_distribution = 0 ham_distribution = 0 word_frequency = util.get_word_freq([filename]) for w in word_frequency: if w in probabilities_by_category[0]: spam_distributio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classifyEmail(emailid):\n trialdata = getTrialData()\n emailids = trialdata.keys()\n wordcounts = np.array([np.array(value[0]) for value in trialdata.values()])\n results = np.array([value[1] for value in trialdata.values()])\n clf = BernoulliNB()\n warnings.filterwarnings(\"ignore\", categor...
[ "0.7067866", "0.6320959", "0.62776613", "0.6217235", "0.6148841", "0.61467123", "0.61389387", "0.61266917", "0.60988337", "0.6087098", "0.60807884", "0.60766375", "0.60529613", "0.59926873", "0.59394884", "0.59220743", "0.5864244", "0.582481", "0.57939523", "0.57815576", "0.5...
0.744006
0
Set aesthetic figure dimensions to avoid scaling in latex.
def set_size(width, fraction=1): # Width of figure fig_width_pt = width * fraction # Convert from pt to inches inches_per_pt = 1 / 72.27 # Golden ratio to set aesthetic figure height golden_ratio = (5**.5 - 1) / 2 # Figure width in inches fig_width_in = fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n fig_width_pt = 800.0 \n pylab.rcParams.update(plot_params)", "def set_size(width, fraction=1):\n # Width of figure\n fig_width_pt = width * fraction\n\n # Convert from pt to inches\n inches_per_pt = 1 / 72.27\n\n # Golden ratio to set aesthetic figure height\...
[ "0.6866123", "0.68613625", "0.6796746", "0.66788816", "0.66785276", "0.66134953", "0.6596029", "0.65785915", "0.6564046", "0.6432494", "0.6378201", "0.63620794", "0.63620794", "0.63620794", "0.6296399", "0.62205094", "0.6189502", "0.61338687", "0.6092833", "0.6084857", "0.607...
0.69213086
0
Return the path to the 'history' directory of a run if it exists.
def history_path(root): history = os.path.join(root, "history") if os.path.isdir(history): return history else: raise ValueError(f"Directory {root} is not a valid root directory.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_history_filepath(config: configs.Config) -> str:\n return os.path.join(config.model_training.dir_out, histories.DEFAULT_FILENAME_HISTORY)", "def get_history_filepath():\n try:\n user_fp = os.environ[HISTORY_FILE_ENVAR]\n return os.path.expanduser(user_fp)\n except KeyError:\n ...
[ "0.72830373", "0.70284176", "0.6268641", "0.6111434", "0.60673946", "0.60420126", "0.604097", "0.5942972", "0.5912335", "0.58908653", "0.5842866", "0.57891905", "0.5719052", "0.5695", "0.5633273", "0.559934", "0.5581988", "0.55745715", "0.5566373", "0.5566373", "0.5566373", ...
0.7432333
0
Return a list of files that are present in all segment directories. This means that if only some segments have outputs combined via mppnccombine, they will not show up in the list.
def filenames(root, combined=None): segments = segment_paths(root) globname = "*.nc*" if combined is None else "*.nc" files = [] for segment in segments: globstring = os.path.join(segment, globname) segment_files = sorted(glob.glob(globstring)) segment_files = [os.path.basename(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_files(self):\n output_files = []\n for split in self.split_files:\n output_files.extend(split.filepaths)\n return output_files", "def get_processed_stations(out_dir):\n lista = [ f.split('_')[0] for f in os.listdir(out_dir) if '.nc' in f ]\n #print('Skipping these stations: ' ...
[ "0.6650802", "0.62293935", "0.61726046", "0.6101922", "0.60931695", "0.6032339", "0.6031357", "0.60044277", "0.59979707", "0.59839433", "0.59567684", "0.59507674", "0.5934818", "0.59309137", "0.59170854", "0.5915322", "0.5874277", "0.5869724", "0.58635235", "0.58629227", "0.5...
0.69464487
0
Function to get the probe function based on input args kev=Electron energy in keV ap = Objective aperture semiangle in mrad Cc = Chromatic aberration coefficient in mm dE = Delta E in eV ds=Source size in Angstroms rmax=Size of slice in Angstroms Cs=Spherical aberration Cs in mm df=Defocus in Angstroms nx=number of pix...
def get_probe_function(self, args): keV = args['electron_energy'] ap = args['aperture_semiangle'] try: Cc = args['chromatic_aberration_coefficient'] except: Cc = 0.0 try: dE = args['delta_E'] except: dE = 0.0 #Cs=ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_escape_peak_ratios(lineE,detectorelement='Si'):\n \n if(detectorelement=='Si'):\n #\n # For Si the K peak is 95% of the transition\n # and the photoionization to total cross section is ~ 95% \n # Si escape peak is typically only 0.2-1% (bigger at lower energies) \n ...
[ "0.55529374", "0.53381914", "0.52853054", "0.5099058", "0.5027606", "0.49723428", "0.49505278", "0.49468327", "0.49309486", "0.492485", "0.48951003", "0.48604053", "0.48553345", "0.48492748", "0.4835894", "0.48331407", "0.48202688", "0.48169822", "0.48095626", "0.48081058", "...
0.7722334
0
function V = stempot(xmax,ymax,nx,ny,potfile) % STEMPOT Generate a Projected Potential % inputs xmax, ymax are the size of the slice in angstroms % nx,ny are the number of pixels in the x and y directions
def stempot(self,xmax,ymax,nx,ny,atms,pixelshift,scalefactor): #zed=2 for rutherford scattering of the nucleus, less for screening zed = 1.7 ix = numpy.arange(1.0,nx) iy = numpy.arange(1.0,ny) dx = xmax/nx dy = ymax/ny rx = numpy.arange(0,xmax-dx,dx) ry =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pv2ssh(lon, lat, q, hg, c, nitr=1, name_grd=''):\n def compute_avec(vec,aaa,bbb,grd):\n\n avec=np.empty(grd.np0,)\n avec[grd.vp2] = aaa[grd.vp2]*((vec[grd.vp2e]+vec[grd.vp2w]-2*vec[grd.vp2])/(grd.dx1d[grd.vp2]**2)+(vec[grd.vp2n]+vec[grd.vp2s]-2*vec[grd.vp2])/(grd.dy1d[grd.vp2]**2)) + bbb[grd.v...
[ "0.55026484", "0.5277186", "0.5247166", "0.5227621", "0.52044696", "0.5187867", "0.51440006", "0.5141123", "0.5122087", "0.5109615", "0.50705886", "0.5066938", "0.50468874", "0.50352615", "0.50272405", "0.50120354", "0.50113237", "0.5007754", "0.49899626", "0.4925741", "0.491...
0.59604365
0
Setup to repair ships
def pressrepairships(self): self.mode.systemmenu.press5() self.mode.systemmenu.createRepairShipsGui()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repairStarshipOrder(self, shipList, systemID):\n try:\n for value in shipList:\n dOrder = {'type':'Repair Starship', 'value':value,\n 'system':systemID, 'round':self.game.myGalaxy['currentRound']}\n serverResult = self.game.server.addIndu...
[ "0.5760303", "0.5660218", "0.5599327", "0.5541553", "0.55219805", "0.55066234", "0.54234916", "0.5375672", "0.535881", "0.53339887", "0.5327871", "0.53215164", "0.5301846", "0.5295057", "0.5257931", "0.5248245", "0.5214766", "0.5206883", "0.51882225", "0.5177299", "0.5163339"...
0.60317004
0
Setup to upgrade ships
def pressupgradeships(self): self.mode.systemmenu.press5() self.mode.systemmenu.createUpgradeShipsGui()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self):", "def upgrade(self):", "def upgrade():\n config = ConfigManager()\n apps = config['apps']\n for i, app in progressbar(enumerate(apps), redirect_stdout=True):\n z = Zap(app)\n if i == 0:\n z.update(show_spinner=False)\n else:\n z.update(che...
[ "0.6437021", "0.6437021", "0.6006767", "0.57940745", "0.5673646", "0.5669572", "0.55422735", "0.5540954", "0.55118716", "0.55003494", "0.5476952", "0.5457925", "0.5368341", "0.5365153", "0.5315544", "0.5312552", "0.5306434", "0.5304693", "0.52859235", "0.5283517", "0.5267014"...
0.6492957
0
Context manager that uses the current SSH confg to switch Fabric to a specific hostname. Updates hostname and port.
def this_hostname(hostname): host_config = ssh_config(hostname) host_string = hostname port = host_config.get("port", env.default_port) with settings(host_string=host_string, port=port): yield
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHost(host, port, ssl=0):", "def cli(ctx, host, port):\n if ctx.obj is None:\n ctx.obj = {}\n ctx.obj[\"HOST\"] = host\n ctx.obj[\"PORT\"] = port", "def set_hostname(dut, host_name):\n cmd = \"sudo hostname {}\".format(host_name)\n st.config(dut, cmd)\n return", "def set_host(h...
[ "0.6020873", "0.596996", "0.59456724", "0.5915211", "0.57715243", "0.57609206", "0.5645617", "0.5644809", "0.56252044", "0.55878043", "0.5559252", "0.55540156", "0.5536847", "0.55266184", "0.5487616", "0.54839253", "0.5415029", "0.53562176", "0.53562176", "0.5323886", "0.5322...
0.61761093
0
Retreive the EnvironmentDefinition from the fabric env.
def _get_environmentdef(): if 'environmentdef' not in env: abort("Environment needs to be configured") environmentdef = env.environmentdef # If we're running via `fab`, we should restrict the environment # to the current host. if env.host_string: environmentdef = environmentdef.wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_environment(self):\n if self._cache.get(\"_environment\") is None:\n name = self.get(\"environmentname\", \"default\")\n if name:\n db = self.session\n try:\n env = db.query(models.Environment).filter(models.Environment.name==na...
[ "0.6656194", "0.64509386", "0.6434452", "0.63283604", "0.62946856", "0.62802696", "0.6259536", "0.6244079", "0.6236911", "0.62251914", "0.62041265", "0.61941886", "0.6189792", "0.61735165", "0.6141819", "0.61107904", "0.6085239", "0.6070287", "0.60530704", "0.60530704", "0.60...
0.7720367
0