query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
changes the estimate of a story
def set_state(self, state): return self.update(current_state=state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_estimate(self, estimate):\r\n update_story_url =\"https://www.pivotaltracker.com/services/v3/projects/{}/stories/{}?story[estimate]={}\".format(self.project_id, self.story_id, estimate)\r\n response = _perform_pivotal_put(update_story_url)", "def estimate(self, estimate):\n\n self...
[ "0.7031372", "0.6343698", "0.63049126", "0.6181432", "0.61523265", "0.61381894", "0.61381894", "0.61381894", "0.6072239", "0.6002296", "0.59474117", "0.58674514", "0.5820868", "0.57961833", "0.579501", "0.57798946", "0.5774591", "0.5730863", "0.57292694", "0.57292694", "0.559...
0.0
-1
returns all projects for the given user
def all(cls): projects_url = 'https://www.pivotaltracker.com/services/v5/projects' root = _perform_pivotal_get(projects_url) if root is not None: return [Project.from_json(project_node) for project_node in root]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects_of_user(self, user_id):\n res = self.conn.cursor().execute(\"\"\"SELECT * FROM projects p JOIN users_projects up \n ON p.id = up.project_id \n WHERE owner=? OR up.user_id=?\n GROUP BY p.id\n ORDER BY last_update DESC\"\"\", (user_id, user_id,))\n return re...
[ "0.8428174", "0.8384723", "0.79425204", "0.77670926", "0.7678094", "0.75687045", "0.75545335", "0.74962413", "0.71681637", "0.7070704", "0.70580006", "0.70128125", "0.70014966", "0.6903883", "0.6897157", "0.6875102", "0.6849584", "0.6834363", "0.680805", "0.67691106", "0.6757...
0.6513738
36
Given a filter strong, returns an list of stories matching that filter. If none will return an empty list
def get_stories(self, filter_string): story_filter = quote(filter_string, safe='') stories_url = "https://www.pivotaltracker.com/services/v5/projects/{}/stories?filter={}".format(self.project_id, story_filter) response = _perform_pivotal_get(stories_url) return [Story.from_json(story_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetStories(self, filt=None):\n stories = self._ApiQueryStories(filt)\n parsed = xml.dom.minidom.parseString(stories)\n els = parsed.getElementsByTagName('story')\n lst = []\n for el in els:\n lst.append(Story.FromXml(el.toxml()))\n return lst", "def get_st...
[ "0.69686466", "0.68707925", "0.6780581", "0.6072194", "0.57923883", "0.55801576", "0.5537283", "0.5517888", "0.55005556", "0.5456136", "0.53563553", "0.53528243", "0.5330737", "0.5328852", "0.5321616", "0.5312549", "0.5293955", "0.5254234", "0.52464867", "0.5211708", "0.52068...
0.68931544
1
Trys to find a story, returns None is not found
def load_story(self, story_id): story_url = "https://www.pivotaltracker.com/services/v5/projects/{}/stories/{}".format(self.project_id, story_id) try: response = _perform_pivotal_get(story_url) return Story.from_json(response) except requests.HTTPError as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_project_for_story(story_id):\n\n for project in Project.all():\n story = project.load_story(story_id)\n if story is not None:\n return project\n\n #Not found\n print \"No project found for story: #{}\".format(story_id)\n return None", "def find_project_for_story(stor...
[ "0.69340485", "0.69320595", "0.6724299", "0.6648634", "0.6648634", "0.6448824", "0.6275495", "0.61668295", "0.60917515", "0.59969276", "0.59336185", "0.57456106", "0.5718233", "0.56849074", "0.5503793", "0.5470415", "0.54643285", "0.5407619", "0.5346339", "0.53063333", "0.529...
0.63508797
6
parses test from an ElementTree node, if not found returns empty string
def _parse_text(node, key): element = node.get(key) if element is not None: if element is not None: return element.strip() else: return '' else: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text(html_element):\n return html_element.xpath(\"string()\") or '' # avoid returning None", "def _text_or_none(root, tag):\n elem = root.find(tag)\n return None if elem is None else elem.text", "def getvalueofnode(node):\r\n return node.text if node is not None else None", "def get_xml_node...
[ "0.6748603", "0.6473355", "0.6360497", "0.63567054", "0.6348899", "0.6348899", "0.61676735", "0.6147493", "0.60667485", "0.6018955", "0.6018538", "0.59955496", "0.59062517", "0.5893643", "0.58674324", "0.58527267", "0.5846146", "0.5835796", "0.58166975", "0.5803846", "0.57694...
0.55551094
35
parses an int from an ElementTree node, if not found returns None
def _parse_int(node, key): element = node.get(key) if element is not None: return int(element) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_int(node, key):\r\n element = node.find(key)\r\n if element is not None:\r\n return int(element.text)\r\n else:\r\n return None", "def parseint(el):\n return parse(el, int)", "def convertStringToInt(xmlNode):\n try:\n val = int(xmlNode.text)\n return val\n except (V...
[ "0.8366567", "0.68826133", "0.6643716", "0.6231448", "0.6134712", "0.60349727", "0.588818", "0.5871328", "0.58434844", "0.58222824", "0.579166", "0.579166", "0.57692295", "0.57690537", "0.576285", "0.5756573", "0.57532364", "0.5742738", "0.57313293", "0.56075567", "0.55872804...
0.8116926
1
parses an int from an ElementTree node, if not found returns None
def _parse_array(node, key): element = node.get(key) if element is not None: return element else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_int(node, key):\r\n element = node.find(key)\r\n if element is not None:\r\n return int(element.text)\r\n else:\r\n return None", "def _parse_int(node, key):\n element = node.get(key)\n if element is not None:\n return int(element)\n else:\n return None", ...
[ "0.8367579", "0.8118374", "0.6884305", "0.6645017", "0.6233981", "0.61355865", "0.60378796", "0.5886808", "0.5873809", "0.58425933", "0.58218664", "0.57906896", "0.57906896", "0.57680535", "0.57679677", "0.5765342", "0.5755473", "0.5754299", "0.5744531", "0.57337207", "0.5608...
0.0
-1
parses an boolean from an ElementTree node, if not found returns None
def _parse_boolean(node, key): element = node.get(key) if element is not None: return bool(element) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_boolean(node, key):\r\n element = node.find(key)\r\n if element is not None:\r\n if element.text == 'true':\r\n return True\r\n else:\r\n return False\r\n else:\r\n return None", "def _get_bool(element, name, context, default=None):\n\n value = el...
[ "0.83501446", "0.6932032", "0.692632", "0.65882355", "0.65580535", "0.6457279", "0.63471276", "0.6239328", "0.60651743", "0.59987414", "0.59204286", "0.58954495", "0.5884764", "0.5840993", "0.5837576", "0.58079356", "0.5725734", "0.57157356", "0.5690965", "0.56830674", "0.567...
0.83073354
1
The main function which creates the pipeline and runs it.
def run(argv=None, save_main_session=True): parser = argparse.ArgumentParser() parser.add_argument( '--input', dest='input', required=True, help='the path to the GCS bucket gs://[MY_BUCKET].') parser.add_argument('--output_bigquery', required=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(): # pragma: no cover\n parser = argparse.ArgumentParser(\"Gets the pipeline definition for the pipeline script.\")\n\n parser.add_argument(\n \"-n\",\n \"--module-name\",\n dest=\"module_name\",\n type=str,\n help=\"The module name of the pipeline to import.\",\n...
[ "0.7739427", "0.7644563", "0.75256467", "0.7364628", "0.7342245", "0.73182887", "0.72909564", "0.7233398", "0.714563", "0.71010876", "0.70866466", "0.6975917", "0.6910914", "0.6865726", "0.68652093", "0.6856626", "0.68380326", "0.67722625", "0.6676087", "0.6654785", "0.664282...
0.0
-1
Checks if value is string
def is_string(value): return isinstance(value, string_types)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_string(value):\n return isinstance(value, basestring)", "def is_string(value):\n return isinstance(value, (str, bytes))", "def is_str(value):\n return isinstance(value, str)", "def is_str(value):\n if not type(value) is str:\n return False\n else:\n return ...
[ "0.9107861", "0.8918223", "0.8523971", "0.8515217", "0.8453598", "0.8125419", "0.7979231", "0.7958063", "0.79491997", "0.7895432", "0.78782254", "0.7839749", "0.7812564", "0.7717646", "0.7706175", "0.7699907", "0.7680495", "0.7613579", "0.7592373", "0.75193715", "0.7495523", ...
0.8770375
2
Checks if value is numeric
def is_number(value): try: int(value) return True except (ValueError, TypeError): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric(value):\n return isinstance(value, int) or isinstance(value, float)", "def isnumeric(self):\n return isnumeric(self)", "def is_numeric(self) -> bool:\n return False", "def is_numeric(val):\n if \\\n isinstance(val, int) or \\\n isinstance(val, float):\n return Tr...
[ "0.8750814", "0.85061204", "0.845897", "0.8278223", "0.81097364", "0.8088921", "0.80040044", "0.800126", "0.7970921", "0.7883481", "0.7831016", "0.78303236", "0.77649546", "0.7755307", "0.77498674", "0.77416146", "0.7682248", "0.7658912", "0.76538044", "0.7639092", "0.759825"...
0.74015015
31
Casts value to integer if possible, otherwise returns None
def parse_int(value): try: return int(value) except (ValueError, TypeError): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_int_cast(value):\n try: \n return int(value)\n except:\n return value", "def make_intger(value):\n if value:\n return int(value)\n return None", "def try_to_convert(value):\n try:\n return int(value)\n except:\n return value", "def to_int_or_none(v...
[ "0.823257", "0.8035303", "0.784336", "0.77596205", "0.7645561", "0.7490847", "0.740933", "0.7406496", "0.73861754", "0.7308594", "0.727302", "0.7253395", "0.7218561", "0.7177565", "0.7166133", "0.71471345", "0.70647126", "0.70647126", "0.70647126", "0.70098716", "0.7009223", ...
0.7385982
9
Casts value to float if possible, otherwise returns None
def parse_float(value): try: return float(value) except (ValueError, TypeError): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tryFloat(value):\n try:\n return float(value)\n except:\n return value", "def try_float(value: Any) -> Optional[float]:\n try:\n return float(value)\n except (TypeError, ValueError):\n return None", "def _floatOrCall(val):\n try:\n return float(val)\n ex...
[ "0.84449446", "0.82896173", "0.81444955", "0.81367767", "0.8066771", "0.7990059", "0.7960814", "0.7936786", "0.7852048", "0.7763123", "0.7711431", "0.7700527", "0.7606403", "0.758742", "0.7527296", "0.7521377", "0.7510209", "0.7455718", "0.7454064", "0.7453202", "0.7342957", ...
0.78222346
9
Checks if value is a dict
def is_dict(value): return isinstance(value, dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_dict(val):\n\n return isinstance(val, dict)", "def _is_dict(item):\n return isinstance(item, dict)", "def isDict(data):\n\ttry:\n\t\tfrom types import DictType\n\t\tif type(data) == DictType:\n\t\t\treturn True\n\texcept ImportError:\n\t\tif type(data) == type({}):\n\t\t\treturn True\n\treturn ...
[ "0.8891944", "0.84969", "0.7979519", "0.7861109", "0.7839897", "0.77455854", "0.75733715", "0.74826515", "0.72116905", "0.7184174", "0.7079954", "0.7000585", "0.6909393", "0.6878562", "0.68191737", "0.6789989", "0.66548675", "0.6653721", "0.66456836", "0.65667856", "0.6566524...
0.8975367
0
Checks if value is a list
def is_list(value): return isinstance(value, list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_list(val):\n\n return isinstance(val, list)", "def is_list(value):\n return isinstance(value, list) or None", "def _is_list(item):\n return isinstance(item, list)", "def isList(data):\n\ttry:\n\t\tfrom types import ListType\n\t\tif type(data) == ListType:\n\t\t\treturn True\n\texcept Impor...
[ "0.9028631", "0.8771568", "0.8495955", "0.8216776", "0.81552017", "0.8091219", "0.8072429", "0.79981005", "0.7949894", "0.7946823", "0.7922643", "0.77240074", "0.7716478", "0.76670384", "0.7631471", "0.761264", "0.7607154", "0.7554368", "0.75167143", "0.7500501", "0.7436007",...
0.9064887
0
Get epoch time (seconds) from either passed in UTC datetime or current datetime
def get_epoch_time(utc_datetime=None): if not utc_datetime: utc_datetime = datetime.datetime.utcnow() return math.ceil((utc_datetime - EPOCH_START).total_seconds())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _current_epoch_secs():\n now = datetime.datetime.utcnow()\n epoch = datetime.datetime(1970, 1, 1)\n return (now - epoch).total_seconds()", "def epoch_time(when):\n if not when: return 0\n epoch = datetime.utcfromtimestamp(0)\n delta = when - epoch\n return int(delta.total_seconds())", "def t...
[ "0.7687502", "0.75600356", "0.7200416", "0.7182325", "0.69882435", "0.6922301", "0.68947226", "0.68947226", "0.68390167", "0.6823786", "0.67153645", "0.6711426", "0.6711426", "0.6687371", "0.6630511", "0.6630511", "0.66261214", "0.6570021", "0.6527329", "0.65121967", "0.65042...
0.77804226
0
Get epoch time (milliseconds) from either passed in UTC datetime or current datetime
def get_epoch_time_milliseconds(utc_datetime=None): epoch_seconds = get_epoch_time(utc_datetime) return epoch_seconds * MILLISECONDS_IN_SECOND
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_epoch_time(utc_datetime=None):\n if not utc_datetime:\n utc_datetime = datetime.datetime.utcnow()\n return math.ceil((utc_datetime - EPOCH_START).total_seconds())", "def epoch_time_now():\n return int(time.time())", "def epoch_time(when):\n if not when: return 0\n epoch = datetime...
[ "0.78353167", "0.75055903", "0.74338925", "0.7330113", "0.72694373", "0.726492", "0.7158576", "0.7086221", "0.69683", "0.68982023", "0.6857221", "0.6855786", "0.6811981", "0.6789083", "0.6776045", "0.6776045", "0.6746983", "0.67409736", "0.6735191", "0.6717645", "0.67158127",...
0.75269914
1
Get local timezone offset from UTC
def get_timezone_offset(): timezone = get_localzone() offset_minutes = timezone.utcoffset(datetime.datetime.now()).total_seconds() // SECONDS_IN_MINUTE return parse_int(offset_minutes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_utc_offset():\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n # XXX: `return -time.timezone`?\n return timedelta.total_seconds()", "def _local_time_offset():\n if time.localtime().tm_isdst and time.daylight:\n return -time.altzone\n else:\n return -time.t...
[ "0.8392", "0.795721", "0.7448938", "0.7305791", "0.7229861", "0.72130525", "0.70817757", "0.7041948", "0.7028021", "0.697982", "0.6969199", "0.6959004", "0.68061054", "0.6785264", "0.67403036", "0.67114854", "0.66978824", "0.66267407", "0.6565507", "0.6550441", "0.65430564", ...
0.75287604
2
Flatten list with nested lists
def flatten_list(_list): if not _list: return [] return reduce(operator.add, _list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(nested_list):\r\n return list(chain.from_iterable(nested_list))", "def flatten(l):\n return [item for sublist in l for item in sublist]", "def flatten(l):\n return [item for sublist in l for item in sublist]", "def flatten(nested_list):\n return [item for a_list in nested_list for ite...
[ "0.84890586", "0.8251321", "0.8251321", "0.8241384", "0.82125753", "0.8181201", "0.81790406", "0.8174396", "0.81205565", "0.8084219", "0.80747086", "0.8027984", "0.79991627", "0.7992243", "0.79724604", "0.79416746", "0.7903368", "0.79027283", "0.7898295", "0.78796387", "0.786...
0.698751
92
Removes Nonetype dict values
def remove_empty_values(_dict): return {k: v for k, v in list(_dict.items()) if v is not None}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_nonetype(dictionary):\n\n return {k: v for k, v in dictionary.items() if v is not None}", "def _remove_empty_values(data: T) -> T:\n if not isinstance(data, dict):\n return data\n return {k: _remove_empty_values(v) for k, v in data.items() if v is not None}", "def nonull_dict(self):\...
[ "0.8104306", "0.73003215", "0.70699674", "0.69735897", "0.6717337", "0.67100805", "0.6706329", "0.6688274", "0.6626616", "0.6622698", "0.660085", "0.6581392", "0.6558225", "0.65107256", "0.6503204", "0.64970636", "0.6477513", "0.6472595", "0.6467408", "0.6453751", "0.64316624...
0.66332585
8
Returns True if val is Falsy, otherwise returns False
def is_empty(val): return not bool(val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_truthy(val):\n return bool(val)", "def non_empty(val):\n return val is not None and val != \"\"", "def _val_is_null(self, val):\r\n return val is None", "def not_none(value):\n return not value is None", "def is_false(value):\n \n return (value is False)", "def empty(self...
[ "0.7918933", "0.790834", "0.742545", "0.7357178", "0.73020804", "0.70956635", "0.70306563", "0.7005919", "0.7005919", "0.7005919", "0.7005919", "0.7005919", "0.69641405", "0.6962459", "0.69548154", "0.69414115", "0.6874724", "0.6852935", "0.6849699", "0.6779061", "0.6711758",...
0.82153666
0
Converts a class instance object into a dict
def to_dict(obj): if isinstance(obj, dict): data = {} for (key, val) in obj.items(): data[key] = to_dict(val) return data if hasattr(obj, "__iter__") and not isinstance(obj, str): return [to_dict(v) for v in obj] if hasattr(obj, "attribute_map"): data = {}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classToDict(obj=None):\n\tif obj == None:\n\t\treturn {}\n\n\t_obj = {}\n\t_obj.update(obj.__dict__)\n\n\treturn _obj", "def to_dict(self) -> dict:\n return dict(\n class_str=f\"{self.class_object.__module__}.{self.class_object.__name__}\",\n run=self.method_str,\n arg...
[ "0.8284112", "0.7591948", "0.75852686", "0.74207574", "0.74207574", "0.74207574", "0.74207574", "0.74207574", "0.74207574", "0.74207574", "0.7412081", "0.7412081", "0.7389214", "0.72103626", "0.71764773", "0.71414965", "0.7118799", "0.7117786", "0.6955448", "0.6949504", "0.69...
0.0
-1
Retrieves value via key for dicts or attribute for instance objects
def get_value_from_object(obj, key): if is_dict(obj): return obj.get(key) return getattr(obj, key, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, key):\n return self.get_attribute(key)", "def __getattr__(self, key):\n if key.startswith(\"_\") or key in self.__dict__:\n return object.__getattribute__(self, key)\n\n return self._util.find_value(key)", "def get(self, key):\n return getattr(self, ...
[ "0.7574579", "0.75522757", "0.7539975", "0.75269693", "0.74773043", "0.7461936", "0.7419633", "0.7377124", "0.73120284", "0.73040634", "0.7297685", "0.7297685", "0.7251051", "0.72466475", "0.7242363", "0.72343105", "0.72278005", "0.7204014", "0.71389705", "0.706953", "0.70677...
0.7163424
18
Return the food "Item" string with most calories
def get_food_most_calories(df=df): return df[df.Calories == df.Calories.max()]["Item"].values[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_food_most_calories(df=df):\r\n max_calories_row = df.loc[df['Calories'].idxmax()]\r\n return max_calories_row['Item']", "def get_longest_item(self,items):\n # Assume longest is initially zero\n longest = 0\n for item in items:\n # get length of item name\n ...
[ "0.75917083", "0.6445081", "0.64260274", "0.6388405", "0.62523913", "0.61627793", "0.6064445", "0.6044672", "0.60257804", "0.592605", "0.59001374", "0.58869326", "0.582938", "0.58228385", "0.5761905", "0.5699086", "0.56825083", "0.5679168", "0.56749237", "0.5670001", "0.56378...
0.75638163
1
Calulate the Protein/Calories ratio of foods and return the 5 foods with the best ratio. This function has a excl_drinks switch which, when turned on, should exclude 'Coffee & Tea' and 'Beverages' from this top 5. You will probably need to filter out foods with 0 calories to get the right results. Return a list of the ...
def get_bodybuilder_friendly_foods(df=df, excl_drinks=False): if excl_drinks: fltr_excl_drinks = ~df["Category"].isin(["Coffee & Tea", "Beverages"]) else: fltr_excl_drinks = True df_nzc = df[(df.Calories != 0) & fltr_excl_drinks] # non zero calories fltr = (df_nzc.Protein / df_nzc.Calori...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bodybuilder_friendly_foods(df=df, excl_drinks=False):\r\n df_calories = df[df['Calories'] > 0]\r\n if excl_drinks:\r\n df_calories = df_calories[~df_calories['Category'].isin(['Beverages', 'Coffee & Tea'])]\r\n df_calories['Protein/Calories Ratio'] = df_calories['Protein']/df_calories['Calo...
[ "0.74542266", "0.59881717", "0.59221107", "0.5832556", "0.579231", "0.57728446", "0.5715874", "0.5698817", "0.5600146", "0.5584469", "0.55476344", "0.54607743", "0.5436297", "0.5423807", "0.5420557", "0.5348513", "0.5281259", "0.5276994", "0.52353954", "0.5232096", "0.5221799...
0.7044193
1
Hydrodynamic added mass matrix of a vertical cylinder
def cylindervert_addedmass(R, z1, z2, rho, Ca=1, AxCa=1, m_f=0, z_f=0, m_mg=0, z_mg=0): if z1<z2: raise Exception('z1 should be above z2') if z1<0: # Fully submerged ztop = z1 A0=0 nAx=2 else: # Partially submerged ztop = 0 A0 = np.pi*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_mass_matrix(self, model):\n # Create list of mass matrices for each equation to be put into block\n # diagonal mass matrix for the model\n mass_list = []\n mass_inv_list = []\n\n # get a list of model rhs variables that are sorted according to\n # where they are...
[ "0.637787", "0.6240188", "0.6122389", "0.6016837", "0.58427894", "0.5698982", "0.5682351", "0.5587956", "0.55861175", "0.55698025", "0.5528634", "0.5519884", "0.5518754", "0.5508576", "0.5492544", "0.54866624", "0.5483343", "0.5426447", "0.54144776", "0.53910035", "0.53630376...
0.69000477
0
Send requests to clients.
def send_requests( cell, command: str, requests: dict, clients, job_id=None, timeout_secs=2.0, optional=False ) -> [ClientReply]: if not isinstance(requests, dict): raise TypeError("requests must be a dict but got {}".format(type(requests))) if len(requests) == 0: return [] target_msg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self):\n url = \"{}:{}\".format(self.url, self.port)\n headers = dict(self.request.get_headers())\n body = self.request.get_body()\n self.response = requests.post(url, data=body, headers=headers)", "def run(self):\n for data in self.__iter_data():\n for clie...
[ "0.69840693", "0.6932697", "0.6913437", "0.6767269", "0.67594546", "0.6660864", "0.6638871", "0.6626219", "0.6530264", "0.6477695", "0.64743817", "0.6377647", "0.63009816", "0.6277067", "0.627261", "0.6263703", "0.6253584", "0.6224855", "0.62181497", "0.614856", "0.61296386",...
0.5762971
61
Add the subcommand params
def __add_arguments__(cls, parser: ArgumentParser) -> None: parser.add_argument( "-d", "--data_dict_guid", required=True, type=str, help=( "The indexd Globally Unique Identifier (GUID) for the data dictionary." ), )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_cli(self, subparser):", "def add_arguments(self, sub_parser):\n sp = sub_parser", "def add_args_to_subparser(the_parser, subcommand_name):\n\n the_parser.add_argument(CmdArgs.verbose_optional, help=CmdArgs.verbose_help,\n action='store_true',\n )\n\n if subcommand_name in DCA_...
[ "0.70540386", "0.699733", "0.6889521", "0.67277366", "0.6686509", "0.6667923", "0.6620825", "0.65319335", "0.64671093", "0.64458746", "0.6429621", "0.63842183", "0.6271993", "0.62618905", "0.62585723", "0.6215762", "0.61681825", "0.6161732", "0.6118418", "0.6112021", "0.61114...
0.0
-1
Does a None user return False
def test_user_is_none(self): self.assertFalse(send_rotate_to_can(None, self.BIN_NUM))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__user_passed_as_none(self):\r\n access.has_access(None, 'staff', 'global', None)", "def is_not_none(e):\n return e is not None", "def is_none(obj):\n return obj is None", "def not_none(value):\n return not value is None", "def NoPrompt(self) -> bool:", "def validUser(self):\n...
[ "0.73663986", "0.68698525", "0.68031555", "0.67773694", "0.6765492", "0.6731775", "0.67047375", "0.6696048", "0.66367894", "0.65957487", "0.65957487", "0.65957487", "0.65957487", "0.65957487", "0.65849674", "0.6499765", "0.64993566", "0.64586663", "0.64354175", "0.64343435", ...
0.7621539
0
A CanInfo where a matching user cannot be found returns False
def test_can_info_does_not_exist(self): fake_user = User(username='Fake', password='') self.assertFalse(send_rotate_to_can(fake_user, self.BIN_NUM))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user(self):\n try:\n if self.get_customer()[0][0] == self.dni:\n return True\n else:\n return False\n except:\n return False", "def has_user(self, user): # pylint: disable=unused-argument\r\n return False", "def can_...
[ "0.6713832", "0.6679743", "0.6537976", "0.6529905", "0.64860743", "0.62871456", "0.627677", "0.62588006", "0.62487483", "0.61500865", "0.6142585", "0.608562", "0.6068029", "0.6054016", "0.60393703", "0.6035473", "0.6035473", "0.60319674", "0.59979326", "0.5986419", "0.5980946...
0.6814037
0
When the channel on the CanInfo is None, return False
def test_request_channel_is_none(self): CanInfo.objects.filter(can_id=self.UUID).update(channel_name=None) self.assertFalse(send_rotate_to_can(self.USER, self.BIN_NUM))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_channel(self):\n return True", "def ccheck(self, msg):\r\n if msg.channel == self.channel or (msg.channel.is_private and self.ispm):\r\n return True\r\n return False", "def single_channel():\n return True", "def is_empty(self):\n return self.channels is No...
[ "0.7227819", "0.7064459", "0.66487986", "0.6543717", "0.6476909", "0.6457839", "0.6433133", "0.63275003", "0.6317527", "0.6239171", "0.62300515", "0.62059534", "0.61681944", "0.612439", "0.607638", "0.6019896", "0.5983071", "0.5969868", "0.59639364", "0.5955076", "0.5921539",...
0.76990074
0
When called with valid input, the func returns True
def test_valid_input_succeeds(self, async_patch, chan_patch): self.assertTrue(send_rotate_to_can(self.USER, self.BIN_NUM)) async_patch.assert_called_once() chan_patch.assert_called_once()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInputValid(self, input):\r\n pass", "def validar_tipo_funcion(self,input_tipo_funcion):\n if input_tipo_funcion == '1' or input_tipo_funcion == '2':\n return True\n else:\n print('Ingresar el tipo de funcion correcto\\n')\n return False", "def is_vali...
[ "0.7468785", "0.7100605", "0.7010672", "0.66801006", "0.66554797", "0.6634613", "0.6612717", "0.65901816", "0.6574027", "0.6543741", "0.6522157", "0.6509934", "0.64252675", "0.6400693", "0.6391594", "0.63770753", "0.63703626", "0.6322566", "0.63215524", "0.63177425", "0.63121...
0.0
-1
Convenience method for adding votes quickly
def make_votes(vote_tuples: List[Tuple[Disposable, Category, int]]): for vote_tuple in vote_tuples: DisposableVote.objects.create(disposable=vote_tuple[0], category=vote_tuple[1], count=vote_tuple[2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vote(self, source, target):\n\n if self.votes.get(source, None)==target:\n return # Don't need to change a thing.\n self.votes[source] = target\n\n qty = self.voted.get(target, 0)\n self.voted[target] = qty + 1\n pass", "def create_vote(self, data, header):\n...
[ "0.69376814", "0.6790934", "0.65891206", "0.6546198", "0.64263237", "0.6371001", "0.6360519", "0.63571346", "0.6300057", "0.6134885", "0.61106765", "0.6109361", "0.60497344", "0.60495496", "0.60224354", "0.6021868", "0.6017667", "0.6013002", "0.59648633", "0.5962487", "0.5956...
0.54053795
66
Returns votes as a list sorted tuples
def test_success(self): disposable_under_min = Disposable.objects.create(name=self.DISPOSABLE_NAME + '_1') disposable_over_min = Disposable.objects.create(name=self.DISPOSABLE_NAME + '_2') category_1 = Category.objects.create(name=self.CATEGORY_NAME + '_1') category_2 = Category.objects....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_votes(self) -> List[dict]:", "def vote_types_to_insert_tuples(self):\n\n votes = []\n for vote, voters in self.votes_dict.items():\n for person_id in voters:\n bioguide_id = self.convert_to_bioguide_id(person_id)\n votes.append((self.vote_id, bio...
[ "0.74246526", "0.6834612", "0.645745", "0.63321215", "0.62396115", "0.6177314", "0.6093413", "0.6045923", "0.59933805", "0.59321815", "0.5887036", "0.585958", "0.585958", "0.58558565", "0.58447206", "0.5818226", "0.5750173", "0.57335335", "0.5641475", "0.5639363", "0.5636478"...
0.0
-1
If votes is not a QuerySet or contains the wrong model, TypeError is raised
def test_wrong_input_type(self): with self.assertRaises(TypeError): votes_to_percentages(['not', 'a', 'queryset']) with self.assertRaises(TypeError): votes_to_percentages(Disposable.objects.all())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_votes(self):\n with self.assertRaises(ValueError):\n votes_to_percentages(DisposableVote.objects.none())", "def vote(request, model, object_id):\n if request.method != 'POST':\n raise Http404\n\n vote_type = request.POST.get('type', None)\n if vote_type == 'up' an...
[ "0.6306854", "0.59208554", "0.58282936", "0.55802065", "0.5557189", "0.55157584", "0.5507421", "0.542246", "0.53265035", "0.5298787", "0.52821714", "0.52754", "0.5245972", "0.52318245", "0.522503", "0.522503", "0.5198582", "0.51905507", "0.5157574", "0.5144505", "0.5129177", ...
0.61271936
1
If votes is empty, a ValueError is raised
def test_empty_votes(self): with self.assertRaises(ValueError): votes_to_percentages(DisposableVote.objects.none())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_vote_value(self) -> None:\n self.clear_votes()\n try:\n message = \"successfully voted\"\n QuestionVote.objects.create(\n question=self.question,\n user=self.user,\n )\n except django.db.IntegrityError:\n ...
[ "0.6663037", "0.6053366", "0.5947015", "0.5833709", "0.574379", "0.5649357", "0.5536872", "0.5523675", "0.54281944", "0.54198414", "0.5394457", "0.5368231", "0.5327113", "0.5319719", "0.5312464", "0.5308163", "0.5286258", "0.5258488", "0.5245959", "0.52093315", "0.5204067", ...
0.76942736
0
Busca un cero usando el metodo de la biseccion. func es la funcion, a y b encajonan el cero, tol=toleracia
def biseccion(func, a, b, tol=1e-4): p = (a + b) / 2 while np.fabs(func(p)) > tol: p = (a + b) / 2 if func(a) * func(p) < 0: b = p elif func(a) * func(p) > 0: a = p else: return p return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bisezione(f,a,b,toll=10**-5):\n m = (a+b)/2\n f_m = f(m)\n while abs(f_m) > toll:\n if f(a)*f_m < 0:\n b = m\n elif f(b)*f_m < 0:\n a = m\n elif f_m == 0:\n print(\"Trovata solzione esatta\")\n return m\n else:\n print(...
[ "0.5555701", "0.5502055", "0.5292556", "0.52499145", "0.5237464", "0.51849324", "0.5158482", "0.5082896", "0.50477093", "0.5032028", "0.50297546", "0.5017506", "0.5013907", "0.5013907", "0.50065714", "0.5002977", "0.49987894", "0.49891984", "0.4987446", "0.49794155", "0.49753...
0.58301175
0
Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the earth's poles. It comes from the
def get_distance_metres(aLocation1, aLocation2): dlat = aLocation2.lat - aLocation1.lat dlong = aLocation2.lon - aLocation1.lon return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat * dlat) + (dlong * dlong)) * 1.113195e5", "def get_distance_metres(aLocation1, aLocation2):\n \n dlat = aLocation2.lat - aLocation1.lat\n ...
[ "0.6568299", "0.6561358", "0.6553495", "0.637603", "0.62047136", "0.61963755", "0.6160584", "0.60860103", "0.6035235", "0.6024634", "0.60170466", "0.6015125", "0.595105", "0.58767265", "0.5678368", "0.56759465", "0.56699306", "0.5649891", "0.56387025", "0.56362545", "0.557508...
0.6597437
3
return the child point q corresponding to p in the parent. note that q.side == p.side THINK ABOUT IT
def parent_to_child(p): a,b = LINES[p.side] if p.x < 0.5: return Point(a, p.side, 2*p.x) else: return Point(b, p.side, 2*p.x - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent(self,p):\n node = self._validate(p)\n return self._make_position(node._parent)", "def parent(self, p):\n node = self._validate_position(p)\n return self._make_position(node)", "def parent(self, p):\n node = self._validate(p)\n return self._make_position(node._parent...
[ "0.70021415", "0.6914503", "0.68851006", "0.67637295", "0.67503387", "0.67251015", "0.67251015", "0.67251015", "0.6384844", "0.636594", "0.6338018", "0.63363457", "0.63363457", "0.62673676", "0.62673676", "0.624849", "0.6232469", "0.6232469", "0.619909", "0.609522", "0.598931...
0.7743672
0
return a random endpoint in the current child not on taken_side
def random_endpoint(child, taken_side=None): sides = [s for s in SIDES[child] if s != taken_side] return Point(child, random.choice(sides), 0 if random.random() < 0.5 else 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_random_pos_on_a_side(self):\n pass", "def throw(self):\n self.side = random.randint(1, self.num_sides)", "def get_random_node(self):\n if random.randint(0, 100) > self.goal_sample_rate:\n random_node = self.Node(\n random.uniform(self.min_rand, self.max_r...
[ "0.70703185", "0.6206867", "0.61404693", "0.5760542", "0.5755857", "0.5748231", "0.56564564", "0.56409484", "0.56029654", "0.5594463", "0.5553292", "0.5547132", "0.55098593", "0.5449766", "0.544954", "0.5447059", "0.5444465", "0.54438233", "0.5443404", "0.54398537", "0.543976...
0.832961
0
Making the app with the appropriate model
def make_app(app_name,test_path_name): os.chdir("%s/applications/%s" % (os.environ['WEB2PY_PATH'], app_name)) sys.path.append("%s/applications/%s" % (os.environ['WEB2PY_PATH'], app_name)) os.mkdir("private") os.mkdir("databases") os.mkdir("models") os.mkdir("controllers") os.mkdir("cron") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_models( self ):", "def create_model(self):\n pass", "def create_model(self):\n pass", "def MakeModel(self):\n pass", "def make_model():\n m = model_class(*argv[2:-1])\n modelobj[\"model\"] = m", "def build_model():", "def create_model(self):\n self.c...
[ "0.76872945", "0.7480678", "0.7480678", "0.7320529", "0.71223515", "0.70909554", "0.7080036", "0.7054855", "0.67873114", "0.6778293", "0.6778293", "0.66369003", "0.65938574", "0.65088844", "0.6454276", "0.64333963", "0.6380836", "0.63659495", "0.6346846", "0.6325231", "0.6314...
0.0
-1
Initialize your data structure here.
def __init__(self): self.dict_val = {} self.list_val = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Inserts a value to the set. Returns true if the set did not already contain the specified element.
def insert(self, val): if val not in self.dict_val: self.dict_val[val] = len(self.list_val) self.list_val.append(val) return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, val: int) -> bool:\n if val not in self.set:\n self.set.add(val)\n return True\n return False", "def insert(self, val: int) -> bool:\n if val not in self.value_set:\n self.value_set.add(val)\n self.values.append(val)\n r...
[ "0.79811615", "0.7609193", "0.75026786", "0.74757975", "0.72451335", "0.7214355", "0.72004515", "0.71698004", "0.7163759", "0.71472853", "0.7050296", "0.69489676", "0.6947622", "0.69283795", "0.69102895", "0.6901064", "0.6877732", "0.68744594", "0.68744594", "0.68744594", "0....
0.6766326
30
Removes a value from the set. Returns true if the set contained the specified element.
def remove(self, val): if val in self.dict_val: list_index = self.dict_val[val] last_ele_index = len(self.list_val) -1 if list_index == last_ele_index: self.dict_val.pop(val) self.list_val.pop() else: self.dict_val[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, val: int) -> bool:\n if val in self.set:\n self.set.remove(val)\n return True\n return False", "def remove(self, val: int) -> bool:\n if val in self.set:\n self.set.remove(val);\n self.nums.remove(val);\n return True;\n ...
[ "0.77930635", "0.75551057", "0.7473599", "0.73119354", "0.71162957", "0.7087725", "0.6993605", "0.6947912", "0.6900206", "0.6857312", "0.68533075", "0.68369204", "0.683563", "0.68265235", "0.68240684", "0.68240684", "0.68151236", "0.6778695", "0.67610794", "0.6740816", "0.672...
0.59892625
56
Get a random element from the set.
def getRandom(self): random_index = randint(0, len(self.list_val)-1) return self.list_val[random_index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.6400411", "0.6398...
0.67226046
8
Loads a .py module from github (raw) Returns a module object
def get_module_from_github(url): with urlopen(url) as response: if response.code == 200: text = str(response.read(), encoding="utf-8") _, path = mkstemp(suffix=".py", text=True) with open(path, mode='wt', encoding='utf-8') as fh: fh.write(text) directory, file_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_module(self, fullname):\n LOGGER.info('Loading module {0}'.format(fullname))\n if fullname in sys.modules:\n return sys.modules[fullname]\n\n splitted_names = fullname.split('.')\n if 'github' in splitted_names:\n if len(splitted_names) >= 3:\n ...
[ "0.6863036", "0.65888363", "0.64832926", "0.6392326", "0.637052", "0.6313743", "0.62788546", "0.62697667", "0.62596184", "0.6259035", "0.6255723", "0.6192319", "0.6162507", "0.61570686", "0.6147943", "0.6132673", "0.6108426", "0.60681444", "0.6066579", "0.60329056", "0.599268...
0.78711605
0
add arrays if same size
def add_arrays(arr1, arr2): if len(arr1) != len(arr2): return (None) newList = [] for i in range(len(arr1)): newList.append(arr1[i] + arr2[i]) return (newList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_arrays(arr1, arr2):\n n = len(arr1)\n m = len(arr2)\n if n != m:\n return None\n return [arr1[i] + arr2[i] for i in range(n)]", "def add_arrays(arr1, arr2):\n if len(arr1) != len(arr2):\n return None\n return [arr1[i] + arr2[i] for i in range(len(arr1))]", "def add_array...
[ "0.71250224", "0.69281167", "0.685106", "0.6629997", "0.64913726", "0.6319001", "0.6189537", "0.61789906", "0.6029093", "0.59556526", "0.59398544", "0.5926189", "0.5923303", "0.5905513", "0.5905358", "0.59026784", "0.5841788", "0.5840734", "0.58387214", "0.5792717", "0.579048...
0.6807467
3
get the GitHub repositories for the given GitHub account. The return value is a list of dictionaries which contain the
def get_repositories(github_user): if not github_user: return [1, {"message": "GitHub username missing"}] else: # build Request object request = urllib2.Request("https://api.github.com/users/" + str(github_user) + "/repos") request.get_method =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_repositories(self):\n \n endpoint = 'repositories'\n parameters = [('pagelen', '100')]\n \n if len(self.organization):\n endpoint += f'/{self.organization}' \n parameters.append(('role', 'contributor')) \n else: \n parameter...
[ "0.7529048", "0.74907756", "0.74827784", "0.7447826", "0.7432313", "0.72589123", "0.72472", "0.7082406", "0.7080536", "0.7045065", "0.689988", "0.68599993", "0.67653745", "0.66932744", "0.6630378", "0.6583988", "0.6570344", "0.6546088", "0.6527473", "0.6517846", "0.6502189", ...
0.7452759
3
retuns the quote's text with tagged part of quote chunks
def serialize_quote(self): partofs = PartOfQuote.objects.filter(part_of=self) quote = self.text for x in partofs: quote = quote.replace(x.text, create_tag(x)) return quote
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_quote(self, text):\n return [\"<blockquote>\"] + text", "def process_quote_text(quote_text):\n quote_text = quote_text.replace('―', '').replace('\\n\\n', '\\n')\n quote_text = quote_text[:-1] if quote_text[-1] == '\\n' else quote_text\n for char in HTML:\n quote_text = quote_text...
[ "0.6213396", "0.6097698", "0.6085885", "0.6053056", "0.5988718", "0.5977862", "0.5800565", "0.5786364", "0.57424855", "0.57417625", "0.5605103", "0.5602675", "0.55760896", "0.55452555", "0.5529984", "0.5528037", "0.5527219", "0.5504466", "0.5502221", "0.5453675", "0.54405576"...
0.6584478
0
Increase the number of xor gateways (split + join)
def inc_xor_gateways(self): self.num_xor_gateways += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(a, b):", "def __init__(self, width, partition_points):\n super().__init__(width, partition_points, XORCombiner, \"xor\")", "def xor_network():\n # fmt: off\n tpm = np.array([\n [0, 0, 0],\n [0, 1, 1],\n [1, 0, 1],\n [1, 1, 0],\n [1, 1, 0],\n [1, 0,...
[ "0.6017773", "0.5604052", "0.55942357", "0.55624527", "0.5541649", "0.55383646", "0.55364746", "0.55166155", "0.546064", "0.5433929", "0.5414978", "0.5412313", "0.5385111", "0.53839195", "0.5364891", "0.5353381", "0.5341885", "0.53325903", "0.53294843", "0.5320235", "0.528355...
0.7862372
0
Increase the number of tau transitions
def inc_tau_trans(self): self.num_tau_trans += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _kendall_tau_add(self, len_old: int, diff_pos: int, tau_old: float):\n return 2.0 / (len_old + 1) * (float(diff_pos) / len_old - tau_old)", "def _kendall_tau_add(self, len_old, diff_pos, tau_old):\n return 2./(len_old+1)*(float(diff_pos)/len_old-tau_old)", "def tau_turnover(self):\n re...
[ "0.6267952", "0.6195915", "0.5895552", "0.58890814", "0.58763903", "0.5635565", "0.5554859", "0.5525284", "0.5503111", "0.5492844", "0.5483372", "0.5452114", "0.54350936", "0.5365188", "0.5355348", "0.5350318", "0.5350318", "0.53370744", "0.52750194", "0.52710396", "0.5266659...
0.81626916
0
Increase the number of xor gateways (split + join)
def inc_para_gateways(self): self.num_para_gateways += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inc_xor_gateways(self):\r\n self.num_xor_gateways += 1", "def xor(a, b):", "def __init__(self, width, partition_points):\n super().__init__(width, partition_points, XORCombiner, \"xor\")", "def xor_network():\n # fmt: off\n tpm = np.array([\n [0, 0, 0],\n [0, 1, 1],\n ...
[ "0.7862372", "0.6017773", "0.5604052", "0.55942357", "0.55624527", "0.5541649", "0.55383646", "0.55364746", "0.55166155", "0.546064", "0.5433929", "0.5414978", "0.5412313", "0.5385111", "0.5364891", "0.5353381", "0.5341885", "0.53325903", "0.53294843", "0.5320235", "0.5283553...
0.53839195
14
Create a task with the specified label in the BPMN
def add_task(bpmn, counts, label): from pm4py.objects.bpmn.bpmn_graph import BPMN task = BPMN.Task(name=label) bpmn.add_node(task) return bpmn, task, counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_task():", "def create_task(self, name, value):\n pass", "def add_task():\n # get values from user\n responses = accept_inputs([\"Task label\", \"Short task description\", \"Parent task label\"])\n # insert into db\n query_no_results(\"insert into task values(?, ?, ?)\",\n [responses[\"...
[ "0.74706125", "0.73837596", "0.67262894", "0.66487724", "0.660005", "0.64948", "0.6458578", "0.642163", "0.6415165", "0.6370665", "0.6368903", "0.627783", "0.6273318", "0.6252123", "0.62488365", "0.6243665", "0.62112993", "0.61936545", "0.6173977", "0.61645275", "0.6154962", ...
0.77884877
0
Create a task with the specified label in the BPMN
def add_tau_task(bpmn, counts): from pm4py.objects.bpmn.bpmn_graph import BPMN counts.inc_tau_trans() tau_name = "tau_" + str(counts.num_tau_trans) tau_task = BPMN.Task(name=tau_name) bpmn.add_node(tau_task) counts.append_tau(tau_task) return bpmn, tau_task, counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_task(bpmn, counts, label):\r\n from pm4py.objects.bpmn.bpmn_graph import BPMN\r\n task = BPMN.Task(name=label)\r\n bpmn.add_node(task)\r\n return bpmn, task, counts", "def create_task():", "def create_task(self, name, value):\n pass", "def add_task():\n # get values from user\n r...
[ "0.77884877", "0.74706125", "0.73837596", "0.67262894", "0.66487724", "0.660005", "0.64948", "0.6458578", "0.642163", "0.6415165", "0.6370665", "0.6368903", "0.627783", "0.6273318", "0.6252123", "0.62488365", "0.6243665", "0.62112993", "0.61936545", "0.6173977", "0.61645275",...
0.0
-1
Converts the process tree into a BPMN diagram
def apply(tree, parameters=None): from pm4py.objects.bpmn.bpmn_graph import BPMN counts = Counts() bpmn = BPMN() start_event = BPMN.StartEvent(name="start", isInterrupting=True) end_event = BPMN.EndEvent(name="end") bpmn.add_node(start_event) bpmn.add_node(end_event) bpmn, counts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(tree, parameters=None):\r\n if parameters is None:\r\n parameters = {}\r\n\r\n filename = tempfile.NamedTemporaryFile(suffix='.gv')\r\n viz = Digraph(\"pt\", filename=filename.name, engine='dot', graph_attr={'bgcolor': 'transparent'})\r\n image_format = exec_utils.get_param_value(Param...
[ "0.64183974", "0.6041855", "0.5755564", "0.5745011", "0.56953716", "0.5644346", "0.56082964", "0.56012684", "0.5590524", "0.5508792", "0.55045563", "0.5479414", "0.5470811", "0.54702455", "0.54491806", "0.5445808", "0.53943044", "0.5390817", "0.53524595", "0.5321172", "0.5316...
0.5951535
2
Finds the %(xxx)s fields in the line
def findall(pattern, text): spl = re.compile(pattern).split(text) result = [] beginTag = "" endTag = None beginFormat = "" endFormat = "" initText = text for s in spl: text = text[len(s)+2:] end = text.find(")s") var = "" if len(text) > 0: var = text[:end] result.append(var) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_match_line(smali_line):\n field_match = re.search(r'^([ ]*?)\\.field(.*?) (?P<fieldName>([^ ]*?)):(?P<fieldType>([^ ]*?))(.*?)$', smali_line) # Match a field definition\n if field_match is None:\n print smali_line, # Otherwise print back the line unchanged\n return None # Return None...
[ "0.60582006", "0.5731516", "0.57304376", "0.5697478", "0.5634348", "0.55844456", "0.5543935", "0.55422086", "0.55196947", "0.55156314", "0.53141963", "0.5300573", "0.52981657", "0.5276216", "0.5263423", "0.52230364", "0.52230364", "0.5220427", "0.5214748", "0.51958853", "0.51...
0.0
-1
Parse the www/template.html and createsthe content of file lib/htmltemplate/htmlclasses.py
def parse(force=False): from htmltemplate import WWW_DIR, TEMPLATE_FILE, TEMPLATE_PY # pylint: disable=duplicate-string-formatting-argument print("Parse html template") lines = open(WWW_DIR+TEMPLATE_FILE).readlines() pyClassFile = open(TEMPLATE_PY,"w") pyClassFile.write("''' File automatically generated wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_template_file(self):\n pass", "def create_page(self, data):\n env = Environment(loader=FileSystemLoader(self.template_folder), trim_blocks=True, lstrip_blocks=True)\n template = env.get_template(self.template_file_name)\n template_vars = {'class_name': self.get_class_name(dat...
[ "0.683075", "0.64649874", "0.63023174", "0.6233896", "0.6180485", "0.6096842", "0.6082805", "0.6066677", "0.606245", "0.6048339", "0.60287607", "0.6013675", "0.6008966", "0.59312356", "0.5891936", "0.589168", "0.5890535", "0.5880855", "0.58584857", "0.58117074", "0.5795981", ...
0.7633674
0
Computes labels and inertia using a full distance matrix. This will overwrite the 'distances' array inplace.
def _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances): n_samples = X.shape[0] if norm == 'L2': labels, mindist = pairwise_distances_argmin_min( X=X, Y=centers, metric='euclidean', metric_kwargs={'squared': True}) elif norm == 'L1': labels, mindist = pai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_labels_array(X, sample_weight, x_squared_norms, centers,\n labels, distances):\n n_clusters = centers.shape[0]\n n_samples = X.shape[0]\n store_distances = 0\n inertia = 0.0\n\n dtype = numpy.float32 if centers.dtype == numpy.float32 else numpy.float64\n center...
[ "0.60576165", "0.57919693", "0.566674", "0.5591969", "0.5492387", "0.5474446", "0.54441214", "0.54441214", "0.53986883", "0.5384593", "0.536254", "0.53395325", "0.5278341", "0.5267286", "0.5205148", "0.51953477", "0.5181319", "0.5104884", "0.5094013", "0.50924665", "0.5090735...
0.5923138
1
Compute label assignment and inertia for a CSR input Return the inertia (sum of squared distances to the centers).
def _assign_labels_csr(X, sample_weight, x_squared_norms, centers, labels, distances): if (distances is not None and distances.shape != (X.shape[0], )): raise ValueError( # pragma: no cover f"Dimension mismatch for distance got " f"{distances.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances):\n n_samples = X.shape[0]\n if norm == 'L2':\n labels, mindist = pairwise_distances_argmin_min(\n X=X, Y=centers, metric='euclidean', metric_kwargs={'squared': True})\n elif norm == 'L1':\n labels, mi...
[ "0.6343941", "0.6155145", "0.60731876", "0.60731876", "0.5934831", "0.559293", "0.53774434", "0.51854795", "0.51426697", "0.5118599", "0.5113782", "0.5048841", "0.50409395", "0.5031311", "0.50264436", "0.49963742", "0.49298674", "0.49185535", "0.48398253", "0.48210448", "0.47...
0.6106635
2
Compute label assignment and inertia for a dense array Return the inertia (sum of squared distances to the centers).
def _assign_labels_array(X, sample_weight, x_squared_norms, centers, labels, distances): n_clusters = centers.shape[0] n_samples = X.shape[0] store_distances = 0 inertia = 0.0 dtype = numpy.float32 if centers.dtype == numpy.float32 else numpy.float64 center_squared_norm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances):\n n_samples = X.shape[0]\n if norm == 'L2':\n labels, mindist = pairwise_distances_argmin_min(\n X=X, Y=centers, metric='euclidean', metric_kwargs={'squared': True})\n elif norm == 'L1':\n labels, mi...
[ "0.6656771", "0.6450749", "0.6450749", "0.6350035", "0.5823881", "0.55588937", "0.53670824", "0.5243251", "0.5157411", "0.5128821", "0.51261294", "0.5085243", "0.50835097", "0.5076023", "0.5030381", "0.50157094", "0.5007782", "0.50049764", "0.49917826", "0.499178", "0.4986359...
0.5858702
4
E step of the Kmeans EM algorithm. Compute the labels and the inertia of the given samples and centers. This will compute the distances inplace.
def _labels_inertia_skl(X, sample_weight, x_squared_norms, centers, distances=None): n_samples = X.shape[0] sample_weight = _check_sample_weight(sample_weight, X) # set the default value of centers to -1 to be able to detect any anomaly # easily labels = numpy.full(n_samples,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elbow_kmeans_inertia(self, corpus):\n scores = list()\n for k in range(self.start, self.stop, self.step):\n km = KMeans(n_clusters = k, init='k-means++')\n clusters = km.fit(corpus.vectors)\n scores.append(clusters.inertia_)\n x = range(self.start, self.sto...
[ "0.6930812", "0.6692901", "0.6514794", "0.6504772", "0.6504772", "0.6045274", "0.6025965", "0.601551", "0.59673953", "0.5845275", "0.5827864", "0.58093023", "0.5808858", "0.57981193", "0.57616395", "0.57563055", "0.5753769", "0.5696652", "0.5684393", "0.56720054", "0.56545335...
0.5698043
17
M step of the Kmeans EM algorithm Computation of cluster centers / means.
def _centers_dense(X, sample_weight, labels, n_clusters, distances): n_samples = X.shape[0] n_features = X.shape[1] dtype = X.dtype centers = numpy.zeros((n_clusters, n_features), dtype=dtype) weight_in_cluster = numpy.zeros((n_clusters,), dtype=dtype) for i in range(n_samples): c = la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kmean(X,initial_centroids,max_iters):\n m = np.size(X,0)\n K = np.size(initial_centroids,0)\n centroids = initial_centroids\n idx = np.zeros((m,1))\n for i in range(1,max_iters):\n idx = nearest_cluster(X,centroids)\n centroids = update_centroids(X,idx,K)\n return centroids,idx"...
[ "0.70350665", "0.699393", "0.6979743", "0.696526", "0.6915693", "0.68942094", "0.6865702", "0.684901", "0.6830166", "0.6764042", "0.67536515", "0.6724023", "0.67217946", "0.66845345", "0.6659626", "0.6626015", "0.6616965", "0.65954787", "0.6579198", "0.651009", "0.65003926", ...
0.0
-1
M step of the Kmeans EM algorithm Computation of cluster centers / means.
def _centers_sparse(X, sample_weight, labels, n_clusters, distances): n_samples = X.shape[0] n_features = X.shape[1] data = X.data indices = X.indices indptr = X.indptr dtype = X.dtype centers = numpy.zeros((n_clusters, n_features), dtype=dtype) weight_in_cluster = numpy.zeros((n_clust...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kmean(X,initial_centroids,max_iters):\n m = np.size(X,0)\n K = np.size(initial_centroids,0)\n centroids = initial_centroids\n idx = np.zeros((m,1))\n for i in range(1,max_iters):\n idx = nearest_cluster(X,centroids)\n centroids = update_centroids(X,idx,K)\n return centroids,idx"...
[ "0.7033124", "0.69931483", "0.697844", "0.6964179", "0.69160795", "0.6894264", "0.68639165", "0.68479836", "0.6828838", "0.67626286", "0.67529327", "0.67225045", "0.67207605", "0.6685065", "0.6659513", "0.6624939", "0.66152656", "0.65932685", "0.65787625", "0.6508347", "0.649...
0.0
-1
Loads a user's credential from the local store
def load_client_credentials(self, client_id): if type(client_id) == unicode: client_id = client_id.encode('ascii') store = self._load_credential_store() if client_id not in store: raise CredentialError('Credential not found') credentials = store[client_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_user_credentials(self, storage):\n # Set up a Flow object to be used if we need to authenticate.\n flow = client.flow_from_clientsecrets(\n self.client_secrets,\n scope=self.api_scopes,\n message=tools.message_if_missing(self.client_secrets))\n\n # Re...
[ "0.7489276", "0.72774404", "0.7095127", "0.6651355", "0.6590045", "0.6546759", "0.65442824", "0.6517842", "0.6513666", "0.6513548", "0.6475095", "0.6447604", "0.6432999", "0.63774925", "0.6376368", "0.6362355", "0.63598603", "0.6345368", "0.63307637", "0.6324121", "0.63175136...
0.6147568
48
Stores the user's credential locally
def store_client_credentials(self, client_id, credentials): if self._dry_run: return if type(client_id) == unicode: client_id = client_id.encode('ascii') store = self._load_credential_store() store[client_id] = credentials store.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_credentials(credentials):\n credentials. save_details()", "def save_credentials(credentials):\n Credentials.save_credentials(credentials)", "def save_credentials(self):\n Stores.account_store.append(self.register_stores())", "def set_credentials():", "def _save_credentials(self):\n ...
[ "0.74976534", "0.74774575", "0.7350081", "0.68912125", "0.6877835", "0.6777746", "0.67593485", "0.67196393", "0.6719163", "0.6645062", "0.65745836", "0.6570378", "0.6541808", "0.6488741", "0.648621", "0.6484932", "0.6477593", "0.6450852", "0.6397134", "0.6338806", "0.6288492"...
0.60327643
35
Interactively retrieves the crendential for a user_id client_id user identifier client_secret user's secret key persist True to immediately store the credential, False otherwise (default)
def get_client_credentials_intractive(self, client_id, client_secret, persist=False): if type(client_id) == unicode: client_id = client_id.encode('ascii') if type(client_secret) == unicode: client_secret = client_secret.encode('ascii') flow = OAuth2WebServerFlow(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_credentials():\n store = Storage(CLIENT_CREDENTIALS_FILE)\n credentials = store.get()\n if not credentials or credentials.invalid:\n flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)\n flow.user_agent = APPLICATION_NAME\n if flags:\n credentials = to...
[ "0.577868", "0.57673126", "0.5747401", "0.5735007", "0.5692768", "0.5685396", "0.5674494", "0.56565887", "0.5637241", "0.5617159", "0.5594525", "0.55890554", "0.5583921", "0.55628043", "0.5555722", "0.554597", "0.55318135", "0.552191", "0.552191", "0.55188334", "0.55112743", ...
0.62820846
0
Remove the locally stored credentials
def remove_client_credentials(self): if self._dry_run: return os.unlink(self._store_pathname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_credential(credentials):\n credentials.delete_credentials()", "def delete_credentials(self):\n Credentials.credentials_list.remove(self)", "def delete_credentials(self):\n Credentials.credentials_list.remove(self)", "def delete_credentials(self):\n Credentials.credentials_l...
[ "0.7707641", "0.75258327", "0.75258327", "0.75258327", "0.74404943", "0.7261854", "0.70868516", "0.7018398", "0.6845732", "0.67399734", "0.67137116", "0.6710589", "0.6710589", "0.6691028", "0.65997237", "0.65893865", "0.6577486", "0.6569618", "0.6546576", "0.6540298", "0.6538...
0.8074535
0
Returns the credential store if the file exists
def _load_credential_store(self): try: return shelve.open(self._store_pathname) except Exception: raise CredentialError('Unable to open credential store: ' + self._store_pathname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_creds_file(self):\n filename = self.filename\n\n home = str(Path.home())\n filepath = home + os.sep + filename\n self.path = filepath\n if not os.path.isfile(filepath):\n return False\n\n j = json.load(open(filepath))\n self.keys = j\n retu...
[ "0.70948315", "0.70730686", "0.70023566", "0.6916191", "0.6912367", "0.69121444", "0.689295", "0.6887308", "0.6858863", "0.68382764", "0.68215716", "0.6797262", "0.6796208", "0.6744389", "0.67271996", "0.6713757", "0.67029476", "0.6693516", "0.6684445", "0.6670447", "0.665934...
0.73352385
0
Flushes and closes the credential store
def _save_credential_store(self, store): store.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.save()\n # self.fileKey = None\n if self.openAccount:\n self.openAccount.close()\n self.openAccount = None", "def close(self):\n self.password = None\n self.session.close()", "async def aclose(self) -> None:\n\t\tawait self._store...
[ "0.6961587", "0.6681481", "0.65697914", "0.6494412", "0.6471906", "0.64025295", "0.6352745", "0.63433146", "0.6317204", "0.6268953", "0.62491477", "0.6214849", "0.62142926", "0.62142706", "0.6199774", "0.61757946", "0.61647165", "0.61625445", "0.614162", "0.6118002", "0.61150...
0.76500064
0
Is point inside rectangle?
def inside(point, rectangle): ll = rectangle.getP1() # assume p1 is ll (lower left) ur = rectangle.getP2() # assume p2 is ur (upper right) return (ll.getX() < point.getX() < ur.getX() \ and ll.getY() < point.getY() < ur.getY())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inside(point, rectangle):\n\n ll = rectangle.getP1() # assume p1 is ll (lower left)\n ur = rectangle.getP2() # assume p2 is ur (upper right)\n\n return ll.getX() < point.getX() < ur.getX() and ll.getY() < point.getY() < ur.getY()", "def in_rectangle(rect, point):\n if point[0] < rect[0]:\n ret...
[ "0.857744", "0.8539096", "0.8449531", "0.81022304", "0.808994", "0.7911476", "0.7871285", "0.7795241", "0.7795241", "0.7786331", "0.7713887", "0.7588043", "0.7583801", "0.7561834", "0.750968", "0.7509136", "0.7504957", "0.74918765", "0.74900085", "0.7455613", "0.74207807", ...
0.85302395
2
adds a user in db and logs in with client
async def logged_user(client, user_role: UserRole) -> UserDict: async with LoggedUser( client, {"role": user_role.name}, check_if_succeeds=user_role != UserRole.ANONYMOUS, ) as user: print("-----> logged in user", user["name"], user_role) yield user print("<----- ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user(self):\n query = \"INSERT INTO users (first_name, last_name, email, password) VALUES (%s, %s, %s, %s)\"\n self.cursor.execute(query,(\n self.first_name, \n self.last_name, \n self.email, \n self.password))", "def add_user():\n\n email = re...
[ "0.7450643", "0.7444013", "0.7359897", "0.7343089", "0.7343089", "0.7342936", "0.72070235", "0.72030425", "0.7196619", "0.71812373", "0.71759194", "0.7145116", "0.70981145", "0.7079603", "0.7073478", "0.7066623", "0.70568806", "0.70527464", "0.70483714", "0.70367074", "0.7011...
0.0
-1
Extract location from FX node stack trace.
def _location_from_fx_stack_trace( node_stack_trace: str, ) -> Optional[diagnostics.infra.Location]: if "File" not in node_stack_trace: return None lines = node_stack_trace.strip().split("\n") idx = 0 while idx < len(lines) and "File" not in lines[idx]: idx += 1 if idx + 1 >= le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_loc(node):\n lineno = node.lineno\n end_lineno = get_last_deep_child(node).lineno\n return end_lineno - lineno", "def frame_location_info(self):\n\n return str(self.active_frame.f_code.co_filename) + \":\" + str(self.active_frame.f_lineno)", "def getStackPosition(self):\r\n ...
[ "0.64482874", "0.6389762", "0.63267493", "0.62837934", "0.61853236", "0.61039037", "0.6071818", "0.6055752", "0.60536265", "0.60212994", "0.6014216", "0.5930068", "0.58694696", "0.57997334", "0.5782252", "0.5774222", "0.5765356", "0.57514143", "0.57455015", "0.57362705", "0.5...
0.79784185
0
Map FX value to TorchScript value. When creating TorchScript graph from FX graph, we need a mapping from FX variable to TorchScript variable. This function maps FX variable, fx_node_arg, to torch.jit.Value.
def _retrieve_or_adapt_input_to_graph_set( fx_node_arg: fx_type_utils.Argument, fx_name_to_onnxscript_value: Dict[ str, Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_building.TorchScriptTensor, ...], ], ], tracer: onnxscript_gr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_module(\n self,\n node: torch.fx.Node,\n parent_onnxscript_graph: onnxscript_graph_building.TorchScriptGraph,\n fx_name_to_onnxscript_value: Dict[\n str,\n Union[\n onnxscript_graph_building.TorchScriptTensor,\n Tuple[onnxscri...
[ "0.60945934", "0.5849507", "0.56277806", "0.55226827", "0.51107115", "0.5005654", "0.49181044", "0.48638496", "0.48501047", "0.48006842", "0.47544688", "0.47219574", "0.46902397", "0.46803787", "0.46616042", "0.46607846", "0.46585023", "0.46428233", "0.4638741", "0.4633322", ...
0.6808531
0
Filter out kwargs that are not supported by onnxscript.
def filter_incompatible_and_dtype_convert_kwargs(kwargs): filtered = {} for key, value in kwargs.items(): if key in { "layout", "device", "requires_grad", "pin_memory", "memory_format", "implicit", }: continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_kwargs(self, kwargs, fn):\n # Do not do the cleaning if server config\n # doesnt ask to ignore\n if not self.server.IGNORE_UNEXPECTED_KWARGS:\n return kwargs\n\n expected_kwargs = set(inspect.getargspec(fn).args)\n got_kwargs = set(kwargs.keys())\n un...
[ "0.6788961", "0.67657816", "0.67221266", "0.65621364", "0.6542933", "0.64375836", "0.634828", "0.6306685", "0.6291283", "0.62237483", "0.6220919", "0.6185022", "0.61614615", "0.61276275", "0.6097082", "0.6097082", "0.60908985", "0.60781664", "0.60769814", "0.6075632", "0.6041...
0.63005596
8
Fill the meta information of onnxscript_values with that from the fx FakeTensor.
def _fill_tensor_shape_type( onnxscript_values: Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_building.TorchScriptTensor, ...], ], name: str, expected_values: Union[ fx_type_utils.META_VALUE_TYPE, List[fx_type_utils.META_VALUE_TYPE], T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_values(self):\n\n if self.featureType != \"gene\":\n self.transcriptId = self.meta['transcript_id']\n self.transcriptName = self.meta['transcript_name']\n self.transcriptBioType = self.meta['transcript_biotype']\n if self.featureType == 'exon':\n ...
[ "0.60349166", "0.5497529", "0.5374807", "0.5361385", "0.5248724", "0.5213704", "0.5072275", "0.5041288", "0.50263256", "0.5021723", "0.50011504", "0.49802682", "0.48824126", "0.48571992", "0.48536652", "0.4850609", "0.48376772", "0.47934875", "0.4792228", "0.4781153", "0.4781...
0.5958788
1
Find and Fill in the not provided kwargs with default values.
def _fill_in_default_kwargs( node: torch.fx.Node, ) -> Tuple[List[fx_type_utils.Argument], Dict[str, fx_type_utils.Argument]]: # TODO(titaiwang): aten::sym_size has overload, but fx graph is using # overloadpacket for some reasons. # https://github.com/pytorch/pytorch/issues/97201 # We manually ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_processing(\n kwargs, skip_translate, invalid\n): # pylint: disable=unused-argument\n # If any defaults were not expicitly passed, add them\n for item in DEFAULTS:\n if item not in kwargs:\n kwargs[item] = DEFAULTS[item]", "def initDefaults(self, kwargs):\n \n ...
[ "0.7165048", "0.6829549", "0.67571056", "0.6736027", "0.6671759", "0.64057815", "0.63244796", "0.62315786", "0.6147562", "0.6132198", "0.6132198", "0.6104103", "0.6103743", "0.60846704", "0.60212654", "0.59888554", "0.5965676", "0.59474736", "0.5919431", "0.59106565", "0.5910...
0.60449433
14
Map all FX arguments of a node to arguments in TorchScript graph.
def _wrap_fx_args_as_onnxscript_args( complete_args: List[fx_type_utils.Argument], complete_kwargs: Dict[str, fx_type_utils.Argument], fx_name_to_onnxscript_value: Dict[ str, Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_building.TorchScri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argument_nodes(self) -> Dict[str, Dict[str, Any]]:\n\n return {nid: attrs for nid, attrs\n in self.graph.nodes.items()\n if attrs['domain'] == 'semantics'\n if attrs['type'] == 'argument'}", "def _args_to_params(self, args, tree):\n with tree.treeCh...
[ "0.6571726", "0.63093925", "0.6138915", "0.60906535", "0.6064826", "0.60604185", "0.5929366", "0.5906892", "0.5774789", "0.57424855", "0.56249785", "0.55811024", "0.5452873", "0.54425997", "0.54049885", "0.52817243", "0.52753174", "0.5195056", "0.51817924", "0.51687247", "0.5...
0.58531046
8
Execute a single FX node to produce its ONNX counterpart.
def run_node( self, node, fx_graph_module: torch.fx.GraphModule, onnxfunction_dispatcher: onnxfunction_dispatcher.OnnxFunctionDispatcher, op_level_debug: bool, onnxscript_graph: onnxscript_graph_building.TorchScriptGraph, onnxscript_tracer: onnxscript_graph_buildi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_action(self, name, nodes=[]):\n\n # Input validation\n if not isinstance(name, basestring):\n raise ValueError('Expecting name to be of type string')\n elif not isinstance(nodes, list):\n raise ValueError('Expecting nodes to be of type list')\n else:\n ...
[ "0.5837696", "0.5792414", "0.5658847", "0.53823787", "0.5304985", "0.52669436", "0.5247038", "0.52167517", "0.51781666", "0.5175934", "0.51452214", "0.51237565", "0.5113879", "0.511272", "0.5109358", "0.5085253", "0.5078764", "0.5072938", "0.5070524", "0.50499076", "0.5036854...
0.5780858
2
Analyze all FX nodes and trigger their ONNX translation.
def run( self, fx_graph_module: torch.fx.GraphModule, onnxfunction_dispatcher: onnxfunction_dispatcher.OnnxFunctionDispatcher, op_level_debug: bool, parent_onnxscript_graph: Optional[ onnxscript_graph_building.TorchScriptGraph ] = None, ) -> onnxscript_gra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_all(self):\n # print(\"running all nodes\")\n executed = set()\n node_update_states = {node: node.block_updates for node in self.flow_view.node_items}\n\n def traverse_upwards(node):\n # Traverse upwards to the top of data flow graph\n if node in executed:\...
[ "0.5955147", "0.5696952", "0.5282757", "0.5258196", "0.5086458", "0.5082405", "0.5066062", "0.4959041", "0.49447897", "0.48941177", "0.4879543", "0.4877243", "0.48755184", "0.48611692", "0.48575807", "0.4835983", "0.48266494", "0.48140976", "0.4813692", "0.48115253", "0.47984...
0.44346142
73
Export a fx.GraphModule submodule to ONNXScript graph. The export process specifically targets `call_module` nodes that are created by the exporter's `Modularize` pass. Each `call_module` node has an associated fx.GraphModule by `node.target` underneath the root fx.GraphModule. These `call_module` nodes are exported as...
def call_module( self, node: torch.fx.Node, parent_onnxscript_graph: onnxscript_graph_building.TorchScriptGraph, fx_name_to_onnxscript_value: Dict[ str, Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_buil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(\n self,\n fx_graph_module: torch.fx.GraphModule,\n onnxfunction_dispatcher: onnxfunction_dispatcher.OnnxFunctionDispatcher,\n op_level_debug: bool,\n parent_onnxscript_graph: Optional[\n onnxscript_graph_building.TorchScriptGraph\n ] = None,\n ) -> o...
[ "0.6208346", "0.57180774", "0.5517651", "0.5326858", "0.53166723", "0.51689684", "0.5160342", "0.49694705", "0.49519387", "0.49379078", "0.4789286", "0.47887295", "0.47632617", "0.47464138", "0.47271678", "0.4721467", "0.46698704", "0.46584198", "0.46493828", "0.46453112", "0...
0.6967324
0
initialize the parameters of a matrix where row may not equal to column
def init_params_weight(row,column): W = np.random.rand(row, column) W = W*2.0-1.0 return W.astype(config.floatX) # @UndefinedVariable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rows, cols):\n if rows <= 0:\n raise ValueError('Number of matrix rows must be greater than zero.')\n if cols <= 0:\n raise ValueError('Number of matrix cols must be greater than zero.')\n\n self.__rows = rows\n self.__cols = cols\n\n # Cr...
[ "0.6686605", "0.6631014", "0.6458797", "0.6404342", "0.6389679", "0.6373615", "0.63321877", "0.629574", "0.62533295", "0.6238518", "0.6202394", "0.6166935", "0.6165265", "0.6163629", "0.6160024", "0.615275", "0.61468124", "0.6145931", "0.6144003", "0.6133367", "0.61225617", ...
0.5729696
75
Initializes values of shared variables.
def init_params(options): params = OrderedDict() # event embedding, shape = (n_events, dim_proj) randn = np.random.randn(options['n_events'], options['dim_proj']) params['Eemb'] = (0.1 * randn).astype(config.floatX) # shape = dim_proj * dim_proj gru_Wz = ortho_weigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, shared_states):\n self.shared_states = shared_states", "def initialize(self):\n self.gc1.reset_parameters()\n self.gc2.reset_parameters()\n\n for s in self.scores:\n stdv = 1. / math.sqrt(s.size(1))\n s.data.uniform_(-stdv, stdv)\n for b...
[ "0.6779747", "0.6453956", "0.63955384", "0.6382046", "0.62847936", "0.6279247", "0.6274994", "0.6227626", "0.6177413", "0.61567944", "0.61562914", "0.5976777", "0.5969991", "0.59585494", "0.59332573", "0.59310424", "0.5920022", "0.59114635", "0.5887475", "0.5874637", "0.58626...
0.0
-1
Initializes values of shared variables.
def init_timeparams(options): params = OrderedDict() # for time prediction ''' W_t = np.zeros(options['dim_proj']) params['W_t'] = W_t.astype(config.floatX) b_t = np.zeros(1) params['b_t'] = b_t.astype(config.floatX) ''' W_t = init_params_weight(options['dim_proj'], 1) params['W_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, shared_states):\n self.shared_states = shared_states", "def initialize(self):\n self.gc1.reset_parameters()\n self.gc2.reset_parameters()\n\n for s in self.scores:\n stdv = 1. / math.sqrt(s.size(1))\n s.data.uniform_(-stdv, stdv)\n for b...
[ "0.6779747", "0.6453956", "0.63955384", "0.6382046", "0.62847936", "0.6279247", "0.6274994", "0.6227626", "0.6177413", "0.61567944", "0.61562914", "0.5976777", "0.5969991", "0.59585494", "0.59332573", "0.59310424", "0.5920022", "0.59114635", "0.5887475", "0.5874637", "0.58626...
0.0
-1
When we pickle the model. Needed for the GPU stuff.
def unzip(zipped): new_params = OrderedDict() for kk, vv in zipped.items(): new_params[kk] = vv.get_value() return new_params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self):\n\n # =============================================================\n # Default : pickle the trained model. Change this (and the load\n # function, below) only if the library you used does not support\n # pickling.\n # self.Model_made.save(\"Model_made.h5\")...
[ "0.729523", "0.71684945", "0.7048711", "0.6926901", "0.6920757", "0.68764675", "0.6849646", "0.6813288", "0.676527", "0.67518246", "0.6702777", "0.6690291", "0.66546464", "0.66486233", "0.6641536", "0.6636516", "0.66235536", "0.6599797", "0.65966827", "0.65717363", "0.6562999...
0.0
-1
Create an instance given a pika.Channel and the queue's name.
def __init__(self, channel, name): self._channel = channel self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, address, queue_name):\n self.connection = pika.BlockingConnection(\n pika.ConnectionParameters(address))\n self.queue_name = queue_name\n\n # create the channel\n self.channel = self.connection.channel()\n\n # declare the queue\n self.channel....
[ "0.72593534", "0.67092425", "0.6607363", "0.6365913", "0.6218047", "0.612146", "0.6114935", "0.6107209", "0.60616267", "0.6022323", "0.59582514", "0.5950831", "0.5877045", "0.5811072", "0.5806285", "0.58027333", "0.58027333", "0.5743847", "0.5737904", "0.56923246", "0.5690657...
0.64403397
3
Read and return a Message, or None if the queue is empty. The message will not be removed from the queue until it is given to the ack method.
def read(self): method_frame, header_frame, body = self._channel.basic_get(self.name) if method_frame: pika_message = PikaMessage(body, delivery_info=method_frame, properties=header_frame, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def Read(self) -> Optional[Message]:\n return await self._read_queue.Get()", "def get_message_from_queue(self):\n message = None, None\n\n try:\n message = self.queue.get(block=True, timeout=3)\n except Empty:\n self.fail(msg='Queue get() failed empty')\n\n...
[ "0.83968794", "0.830303", "0.7767356", "0.7531215", "0.7508752", "0.7503659", "0.73573506", "0.7304828", "0.72310835", "0.68459785", "0.68259597", "0.68143344", "0.6812509", "0.6812509", "0.6810992", "0.6801684", "0.6772707", "0.6722598", "0.6715863", "0.669206", "0.66530365"...
0.678288
16
Publish a message to the queue.
def publish(self, message): pika_message = message.to_pika_message() self._channel.basic_publish(exchange='', routing_key=self.name, properties=pika_message.properties, body=message.body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish(self, queue, message):\n # 1. Setup the channel to use to publish message\n channel_handler = ChannelHandler(self._connection)\n\n # 2. Open the channel before using it\n channel_handler.open_channel()\n\n # 3. Send the message via the channel\n channel_handler...
[ "0.83145195", "0.8257633", "0.8137625", "0.78768563", "0.7872951", "0.7872951", "0.7700813", "0.76516354", "0.76425815", "0.7557691", "0.7495841", "0.74745727", "0.7464773", "0.74477214", "0.74076813", "0.7277452", "0.727579", "0.72567654", "0.72424924", "0.7192547", "0.71908...
0.7496424
10
Dump the queue to a Writer.
def dump(self, writer, destructive=False): last_msg_written = None while True: msg = self.read() if msg is None: break writer.write(msg, flush=False) last_msg_written = msg writer.flush() if last_msg_written is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dump_queue(self):\n outfile = self.registryValue('dumpFile')\n with open(outfile, 'w') as h:\n i = 1\n for nick, msg in self._queue:\n if msg is None:\n msg = '[no message]'\n h.write(\"% 2d\\t%s\\t%s\\n\" % (i, nick, msg))\n...
[ "0.774027", "0.7001941", "0.6492832", "0.5981659", "0.59782356", "0.5962679", "0.5918825", "0.5918825", "0.5890873", "0.58122337", "0.5795633", "0.5715342", "0.5674621", "0.56307125", "0.56109387", "0.5584605", "0.55812585", "0.5557218", "0.55240506", "0.55081534", "0.5502447...
0.6718713
2
Restore a queue from a message reader. This publishes to the queue any messages returned by the reader. Any existing messages in the queue will still be in the queue.
def restore(self, reader): while True: msg = reader.read() if msg is None: break self.publish(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recover(self):\n if self._message_storage:\n for neighbor in self.neighbors:\n self.channel.queue_declare(queue=str(self.id) + str(neighbor))\n for message in self._message_storage:\n self.channel.basic_publish(\n exchang...
[ "0.5806696", "0.563494", "0.56112945", "0.5548665", "0.54663706", "0.54382193", "0.536221", "0.5321514", "0.53204316", "0.5261433", "0.5235016", "0.5229662", "0.5212791", "0.5189782", "0.51616454", "0.5141593", "0.5140806", "0.51346123", "0.5111369", "0.50946546", "0.50933266...
0.7559581
0
The setup_logger function is the main logging function for logger.py
def setup_logger(name): #Get PC host name hostname = socket.gethostname() #Log variables logging.basicConfig(level=logging.INFO) logger = logging.getLogger(name) #Create a file handler handler = logging.FileHandler('\\\\fs01\\share\\IT\\Shane\\log\\ProdFloorTool.log') handler.setLevel(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_logger() -> None:\n LOGGER.setLevel(logging.DEBUG)\n formatter = logging.Formatter('%(levelname)s \\t|%(asctime)s \\t| %(name)s \\t| %(message)s')\n\n if not check_if_dir_exists(FILENAMES.LOG_DIR):\n os.mkdir(to_abs_file_path(FILENAMES.LOG_DIR))\n\n file_handler: logging.FileHandler =...
[ "0.79862726", "0.79311246", "0.7756955", "0.7720516", "0.7691152", "0.76133066", "0.76054025", "0.7578109", "0.75746125", "0.75124633", "0.7449716", "0.7423982", "0.73865104", "0.73601073", "0.7352111", "0.7335472", "0.7330719", "0.73136663", "0.7297487", "0.72935814", "0.729...
0.0
-1
pull alarm from queue if you want
def pull_alarm(self): self.job = MATCH_QUEUE.take(timeout=settings.QUEUE_WAIT_TIMEOUT) if not self.job: raise lock.PassEmpty # JSON数据格式,反序列化 try: self.alarm_list = map(json.loads, self.job.body.strip().splitlines()) except Exception as error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alarm(self, interval, call):", "async def alarm(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:\n self.__read_verbose_param(context)\n chat_id = update.effective_message.chat_id\n job_removed = remove_job_if_exists(str(chat_id), context)\n due = 1.0\n con...
[ "0.62227225", "0.590374", "0.58129394", "0.5800809", "0.5796147", "0.57914853", "0.57625484", "0.57412857", "0.5735919", "0.56989264", "0.5624381", "0.55708325", "0.5546818", "0.55423856", "0.5510702", "0.54998934", "0.5499139", "0.5491048", "0.54501593", "0.5438655", "0.5430...
0.74262494
0
check whether match for every alarmalarm_defmatch_key the match result will be self.matched_alarm_list
def match_alarm(self): for alarm in self.alarm_list: is_matched = False self._match_alarm_by_def(alarm) if alarm["_match_info"].get("alarm_def_id"): self.matched_alarm_list.append(alarm) is_matched = True if is_matched: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match_alarm_by_def(self, alarm, origin_alarm_def_id=None,\n unmatch_log=None):\n if unmatch_log is None and settings.ENV == \"TEST\":\n unmatch_log = True\n\n matched_alarm_def_id = None\n for alarm_def in self.alarm_def_list:\n for match_k...
[ "0.77223146", "0.61824495", "0.61445177", "0.59490174", "0.58866197", "0.5850368", "0.5601849", "0.5581404", "0.5487921", "0.5483094", "0.53939867", "0.5369485", "0.5360608", "0.53533703", "0.5322929", "0.5289111", "0.52547723", "0.52222395", "0.52204394", "0.5210209", "0.519...
0.82694453
0
match alarm by alarm_def alarm["_match_info"]["alarm_def_id"] will be matched alarm_def's id
def _match_alarm_by_def(self, alarm, origin_alarm_def_id=None, unmatch_log=None): if unmatch_log is None and settings.ENV == "TEST": unmatch_log = True matched_alarm_def_id = None for alarm_def in self.alarm_def_list: for match_key, match_func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_alarm(self):\n for alarm in self.alarm_list:\n is_matched = False\n self._match_alarm_by_def(alarm)\n if alarm[\"_match_info\"].get(\"alarm_def_id\"):\n self.matched_alarm_list.append(alarm)\n is_matched = True\n\n if is_mat...
[ "0.7166458", "0.57819176", "0.5482392", "0.531153", "0.5286329", "0.5285556", "0.52826345", "0.5204021", "0.51818633", "0.5035592", "0.5033543", "0.49758896", "0.49523956", "0.4948084", "0.49357826", "0.49351478", "0.49312088", "0.4913772", "0.48917705", "0.48898852", "0.4885...
0.798852
0
Parse the options given on the commandline.
def parse_commandline(): parser = optparse.OptionParser() parser.add_option("-f", "--focus", default=4096, type=int) parser.add_option("-a", "--aperture", default=0, type=int) parser.add_option("--doFocus", action="store_true", default=False) parser.add_option("--doAperture", action="store_true", d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def parse_options():\n global parser\n parser.add_option(\"-r\", \"--regions\", dest=\"inp...
[ "0.8171175", "0.80961615", "0.7746937", "0.7738773", "0.7717089", "0.7697129", "0.76757884", "0.76618207", "0.7641152", "0.76168007", "0.76156235", "0.7517674", "0.75049365", "0.7454774", "0.74478596", "0.7407758", "0.74015284", "0.73989666", "0.7382181", "0.7362337", "0.7352...
0.7484479
13
Create a new user profile.
def create_user(self, email, username, password=None): if not email: raise ValueError("User must have an email address.") email = self.normalize_email(email) user = self.model(email=email, username=username) if len(password) > settings.MAX_PASSWORD_LENGTH: trunc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user_profile(instance, created, **_):\n if created:\n Profile.objects.create(user=instance)", "def create_profile_for_new_user(sender, created, instance, **kwargs):\n if created:\n profile = self.get_model('profile')(user=instance)\n profile.save()", ...
[ "0.8199888", "0.8134278", "0.8054886", "0.8054886", "0.8054886", "0.8027518", "0.8012905", "0.7972059", "0.7947595", "0.7938652", "0.79293025", "0.79179204", "0.79078394", "0.7900708", "0.7898959", "0.7898056", "0.78598624", "0.78444153", "0.7833614", "0.77818", "0.7730875", ...
0.0
-1
Create and save a new super user with given details.
def create_superuser(self, email, username, password): user = self.create_user(email=email, username=username, password=password) user.is_superuser = True user.is_staff = True user.roles = "UA" user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, su_id, first_name, last_name, email, phone_number, password):\n user = self.create_user(\n su_id,\n first_name,\n last_name,\n email,\n phone_number,\n password=password,\n )\n user.is_admin = True\n ...
[ "0.75945723", "0.7580427", "0.7527406", "0.7478871", "0.7450758", "0.7445099", "0.7425628", "0.7416191", "0.7392533", "0.7375858", "0.736865", "0.73646367", "0.73574257", "0.7355683", "0.73288596", "0.7315855", "0.7315171", "0.73073936", "0.73052645", "0.7299508", "0.72939473...
0.0
-1
Return string representation of the user.
def __str__(self): return self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.user)", "def __str__(self):\n return str(self.user)", "def __str__(self):\n return str(self.user)", "def __str__(self):\n return str(self.user)", "def __str__(self):\n return str(self.user)", "def __str__(self):\r\n return str...
[ "0.8076493", "0.8076493", "0.8076493", "0.8076493", "0.8076493", "0.7992244", "0.79252493", "0.7744952", "0.7744952", "0.7744952", "0.7744952", "0.76876277", "0.75422984", "0.7532189", "0.7523841", "0.75130755", "0.7482391", "0.7477944", "0.744449", "0.7418454", "0.7410065", ...
0.67684555
73
this function allow you to make a recurrent purchase
def visa_purchase(trans_ref=None,amount=None,authData=None,cust_id=None): url = purchase_endpoint + '/api/v3/purchases' content_type = 'application/json' token = getAccessToken()['access_token'] authorisation = 'Bearer {}'.format(token) signature, nonce,time_stamp = signatureCipherBasic(url=url,amou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase(self, item_type):", "def purchase_item(self):\r\n self.purchased_callback()\r\n self.status = 'purchased'\r\n self.fulfilled_time = datetime.now(pytz.utc)\r\n self.save()", "def complete_purchase(self, customer_credit=0):\r\n \r\n #take the products first, the...
[ "0.7442968", "0.69071877", "0.64995915", "0.6417066", "0.6392027", "0.63751346", "0.63690966", "0.6291778", "0.6260867", "0.62545675", "0.62414044", "0.61661375", "0.6111375", "0.60883194", "0.6057145", "0.60300756", "0.60215", "0.6009986", "0.59586805", "0.59426266", "0.5933...
0.56832415
49
this function allow you to make a recurrent purchase
def isw_callback(md=None, pa_res=None): url = cardinal_endpoint + '/collections/api/v1/pay/cardinalCallBack' headers = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'Accept-Encoding':'gzip, deflate, br', 'Accept-Language':'fr-FR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase(self, item_type):", "def purchase_item(self):\r\n self.purchased_callback()\r\n self.status = 'purchased'\r\n self.fulfilled_time = datetime.now(pytz.utc)\r\n self.save()", "def complete_purchase(self, customer_credit=0):\r\n \r\n #take the products first, the...
[ "0.74405634", "0.6904896", "0.6498141", "0.6417136", "0.6390882", "0.63738596", "0.63698274", "0.6291254", "0.6261255", "0.62541085", "0.62398434", "0.61642915", "0.61121917", "0.6085493", "0.6055924", "0.6028366", "0.6019635", "0.60086", "0.5958378", "0.59414726", "0.5934235...
0.0
-1
this function validates the isw request on request to the page
def otp_validation(payment_id=None, transaction_id=None,eci_flag=None): url = purchase_endpoint + '/api/v3/purchases/otps/auths' content_type = 'application/json' token = getAccessToken()['access_token'] authorisation = 'Bearer {}'.format(token) signature, nonce,time_stamp = signatureCipher(url=url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _verify_page(self):", "def request_is_valid(request):\n return 'method' in request", "def _check_page(self, html_content):\n if \"Sign in for the best experience\" in html_content:\n valid_page = False\n elif \"The request could not be satisfied.\" in html_content:\n ...
[ "0.7168039", "0.6946615", "0.6821953", "0.66795486", "0.65611035", "0.6385028", "0.6332552", "0.63323814", "0.6299964", "0.6257827", "0.62516487", "0.6193026", "0.6144603", "0.61057043", "0.6100672", "0.60928345", "0.6077101", "0.60518163", "0.60263807", "0.60008645", "0.6000...
0.0
-1