query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This method cleans the article and stores its text as an array of tokens.
def clean_article(self): # split into tokens by white space tokens = self.text.split(" ") # remove punctuation from each token table = str.maketrans('', '', punctuation) tokens = [w.translate(table) for w in tokens] # type: List[Any] # remove remaining tokens that are no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_article(text):\n tokens = word_tokenize(text)\n tokens = [word.lower() for word in tokens]\n table = str.maketrans('', '', string.punctuation)\n stripped = [w.translate(table) for w in tokens]\n words = [word for word in stripped if word.isalpha()]\n stop_words = list(set(stopwords.word...
[ "0.7043471", "0.67270625", "0.6516325", "0.6378018", "0.6344264", "0.622695", "0.614711", "0.6139909", "0.6131427", "0.6115884", "0.6110651", "0.60859597", "0.60601443", "0.5983729", "0.594026", "0.5925575", "0.58895236", "0.58883774", "0.58861184", "0.5879671", "0.58617383",...
0.80028117
0
This method cleans the article and stores its text as an array of tokens.
def clean_title(self): # split into tokens by white space tokens = self.title.split(" ") # remove punctuation from each token table = str.maketrans('', '', punctuation) tokens = [w.translate(table) for w in tokens] # type: List[Any] # remove remaining tokens that are not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_article(self):\n # split into tokens by white space\n tokens = self.text.split(\" \")\n # remove punctuation from each token\n table = str.maketrans('', '', punctuation)\n tokens = [w.translate(table) for w in tokens] # type: List[Any]\n # remove remaining token...
[ "0.80028117", "0.7043471", "0.67270625", "0.6516325", "0.6378018", "0.6344264", "0.622695", "0.614711", "0.6139909", "0.6131427", "0.6115884", "0.6110651", "0.60859597", "0.60601443", "0.5983729", "0.594026", "0.5925575", "0.58895236", "0.58883774", "0.58861184", "0.5879671",...
0.0
-1
Checks if the object type is Curve (Bezier or Poly)
def check_for_include(self, obj): if obj.type == "CURVE": o = [] for i in obj.data.splines: o.append(i.type == "POLY" or i.type == "BEZIER") return False not in o elif obj.type in ("FONT", "MESH"): return True else: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_curve(geo):\n geo = geo.strip().upper()\n\n for a_geo_type_in_curve_geo_types_list in CURVE_TYPES:\n if geo.startswith(a_geo_type_in_curve_geo_types_list):\n return True\n\n continue\n\n return False", "def isSetCurve(self):\n return _libsbml.GeneralGlyph_isSetCurv...
[ "0.71811", "0.6912535", "0.6880067", "0.6817006", "0.6736922", "0.65712845", "0.5855768", "0.58122057", "0.57633835", "0.5762677", "0.56897485", "0.5660685", "0.5658567", "0.55876714", "0.5569677", "0.5546161", "0.5546161", "0.5493285", "0.5474039", "0.5450919", "0.54200774",...
0.6597929
5
Return the colors as a dict, pass False to return the colors as empty strings.
def get_colors(use=True): colors = { "BLACK": "\033[0;30m", "DARK_GRAY": "\033[1;30m", "RED": "\033[0;31m", "LIGHT_RED": "\033[1;31m", "GREEN": "\033[0;32m", "LIGHT_GREEN": "\033[1;32m", "BLUE": "\033[0;34m", "LIGHT_BLUE": "\033[1;34m", "MAGENT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getColorDict():\n scribus.statusMessage(\"Reading existing colors...\")\n colornames = scribus.getColorNames()\n scribus.progressTotal(len(colornames))\n i=0\n colordict={}\n for name in colornames:\n colordict[name]=None\n i=i+1\n scribus.progressSet(i)\n return color...
[ "0.7529682", "0.75150573", "0.72052366", "0.72052366", "0.706275", "0.70247364", "0.6812726", "0.67655677", "0.67530453", "0.67110866", "0.65626585", "0.65444833", "0.65171444", "0.6508933", "0.64823407", "0.64574736", "0.6440049", "0.64372265", "0.6426611", "0.6386645", "0.6...
0.66816056
10
(str)> float returns the floating point value of the string.
def func2(str): numlist=[] if type(str) == type(""): for i in range(1,len(str)-1): numlist.append(str[i]) return (''.join(numlist)) else: return (str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ffloat(string):\n try:\n return float(string.strip())\n except:\n return 0", "def _string_to_float(s):\n try:\n f = float(s)\n return f\n except ValueError:\n return None", "def convertFloat(s):\n try:\n float(s)\n return \"FLOAT\"\n except...
[ "0.8546683", "0.8239328", "0.819822", "0.8147667", "0.80112", "0.80088556", "0.79984194", "0.79949915", "0.79915977", "0.7946013", "0.7945833", "0.79354113", "0.79073596", "0.7880307", "0.7858204", "0.7817916", "0.7723053", "0.7696582", "0.76049405", "0.7601665", "0.7586115",...
0.0
-1
Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document)
def decode(self, s, _w=WHITESPACE.match): obj, end = self.raw_decode(s, idx=_w(s, 0).end()) end = _w(s, end).end() if end != len(s): raise ValueError(errmsg("Extra data", s, end, len(s))) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_json(s):\n return json.dumps(s.as_dict())", "def as_json_response(s):\n return JsonResponse(s.as_dict(), safe=False)", "def json_str(js: Union[Dict[str, Any], Input, str]) -> str:\n if type(js) is dict:\n js = json.dumps(js)\n elif type(js) is Input:\n js = json.dumps(j...
[ "0.7388296", "0.65003926", "0.64174974", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", "0.6318498", ...
0.0
-1
Return an ASCIIonly JSON representation of a Python string
def py_encode_basestring_ascii(s): if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: #ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string2json(self, string):\n kwargs = {\n 'cls': BytesEncoder, # use the IPython bytes encoder\n 'indent': 1,\n 'sort_keys': True,\n 'separators': (',', ': '),\n }\n return cast_unicode(json.dumps(string, **kwargs), 'utf-8')", "def convert_to_...
[ "0.8173381", "0.7761752", "0.73871756", "0.7306732", "0.7114988", "0.6949071", "0.6896345", "0.68929964", "0.6786643", "0.67857534", "0.6751209", "0.66860336", "0.66523707", "0.66367877", "0.6627448", "0.66205585", "0.6590046", "0.6590046", "0.6590046", "0.6590046", "0.659004...
0.0
-1
Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true (the default), all nonASCII characters in the output are escaped with uXXX...
def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, sort_keys=False, **kw):\n # cached encoder\n if (not skipkeys and ensure_ascii and\n check_circular and allow_nan and\n ...
[ "0.7924769", "0.77903694", "0.6524399", "0.6503693", "0.62670636", "0.61370224", "0.6004708", "0.594949", "0.5944932", "0.5944588", "0.5775617", "0.57584876", "0.5744523", "0.5742253", "0.57364005", "0.5690301", "0.5642338", "0.5639437", "0.56211835", "0.5618809", "0.5606785"...
0.64990914
4
Deserialize ``fp`` (a ``.read()``supporting filelike object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf8 (e.g. latin1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS2) are not ...
def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=pars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(fp, encoding=None, cls=None, object_hook=None, **kw):\n return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook, **kw)", "def loads(s, encoding=None, cls=None, object_hook=None, **kw):\n if cls is None and encoding is None and object_hook is None and not kw:\n r...
[ "0.7293943", "0.65587294", "0.65374607", "0.6383867", "0.6201921", "0.5933564", "0.5818438", "0.5784626", "0.57603693", "0.5735734", "0.56446373", "0.5640207", "0.5640207", "0.55731785", "0.55139834", "0.54571855", "0.5453068", "0.5411509", "0.5382753", "0.53796095", "0.53011...
0.72969973
0
Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf8 (e.g. latin1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS2) are not...
def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): if (cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loads(s, encoding=None, cls=None, object_hook=None, **kw):\n if cls is None and encoding is None and object_hook is None and not kw:\n return _default_decoder.decode(s)\n if cls is None:\n cls = JSONDecoder\n if object_hook is not None:\n kw['object_hook'] = object_hook\n retur...
[ "0.7732326", "0.61127037", "0.6108639", "0.6009877", "0.5966442", "0.5819212", "0.5740602", "0.5717355", "0.5683387", "0.5583477", "0.55475616", "0.54385495", "0.537776", "0.5369719", "0.53582513", "0.5342634", "0.53109586", "0.5293138", "0.52851325", "0.5256766", "0.52532005...
0.81791747
0
Return the index of the column name.
def get_column(filename, column_name): with open(filename) as f: for header in f: columns = header.rstrip().split("\t") return columns.index(column_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_index(self, column_name: str) -> int:\n return self._column_indices[column_name]", "def get_column_index(self, colName):\n\t\treturn self._columns[colName]", "def ColumnIndex(self, name):\n assert name in self.name_to_index\n return self.name_to_index[name]", "def column_index...
[ "0.8352076", "0.8296324", "0.78778845", "0.7873328", "0.76707447", "0.7655371", "0.76520175", "0.7476225", "0.7388049", "0.72301", "0.7154702", "0.71135074", "0.7095704", "0.7084302", "0.70835805", "0.7029427", "0.7018983", "0.7018983", "0.7003758", "0.69128233", "0.69123125"...
0.7282101
9
Ensure the product is product bundle or not, check field is_pack and product_pack_ids not null
def test_bundle_is_product_pack(self): template = self.product_apple_bundle product_pack_ids = template.product_pack_ids self.assertTrue(template.is_pack, 'Product template is a bundle pack') self.assertTrue(len(product_pack_ids) != 0, 'Product: a product bundle should have product pack'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bundle_not_have_variants(self):\n template = self.product_apple_bundle\n attribute_line_ids = template.attribute_line_ids\n self.assertTrue(template.is_pack, \"Product bundle is doesn't have variants\")\n self.assertEqual(len(attribute_line_ids), 0, 'Product: a product bundle s...
[ "0.71575254", "0.62919265", "0.62767357", "0.6086994", "0.60214347", "0.5789446", "0.5702167", "0.56271875", "0.5619558", "0.55911547", "0.5573343", "0.55681586", "0.5524635", "0.5517069", "0.5486753", "0.5453613", "0.5451007", "0.54371196", "0.5426224", "0.5425665", "0.54062...
0.7887591
0
Return the name of the device if any.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")", "def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):...
[ "0.89726496", "0.89726496", "0.8584672", "0.8584672", "0.8584672", "0.850212", "0.84946066", "0.84203684", "0.8395054", "0.8395054", "0.8378909", "0.8316349", "0.8307453", "0.8161342", "0.81572443", "0.8089769", "0.80879545", "0.8074055", "0.8007309", "0.7998442", "0.79543054...
0.0
-1
Return the device state attributes.
def device_state_attributes(self): attrs = {} attrs[ATTR_ATTRIBUTION] = DEFAULT_ATTRIBUTION attrs[ATTR_BRAND] = DEFAULT_BRAND attrs[ATTR_CAMERA_TYPE] = self._camera_type return attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self._attrs", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self...
[ "0.93168503", "0.92452604", "0.92202556", "0.92145616", "0.92145616", "0.9210586", "0.9210586", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.9190543", "0.91438437...
0.8087328
65
split an iterable into chunks to save memory
def chunks(iterable: Iterable, size: int) -> Iterable: it = iter(iterable) item = list(itertools.islice(it, size)) while item: yield item item = list(itertools.islice(it, size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_on_chunks(self, iterable, size):\n return utils.split_on_chunks(iterable, size)", "def iter_chunks(iterable, size):\n it = iter(iterable)\n while True:\n chunk = tuple(itertools.islice(it, size))\n if len(chunk) == 0:\n break\n yield chunk", "def chunks(i...
[ "0.8511554", "0.8224855", "0.8179555", "0.8087969", "0.8084508", "0.80512273", "0.80118257", "0.80011153", "0.80011153", "0.80011153", "0.7993999", "0.7954756", "0.7866506", "0.7843542", "0.7784331", "0.7740036", "0.773274", "0.7720725", "0.7703208", "0.7687204", "0.7666663",...
0.81905323
2
Check if var string is num. Should use it only with strings.
def is_num(var): try: int(var) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)", "def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False", "def is_number(s):\n try:\n int(s)\n return True\n except ValueError:\n r...
[ "0.7958641", "0.7956612", "0.79361004", "0.79090446", "0.7736743", "0.77220017", "0.771952", "0.77045625", "0.7702437", "0.7699047", "0.7696539", "0.7688711", "0.765359", "0.7636614", "0.7621389", "0.76209664", "0.76209664", "0.76209664", "0.7620311", "0.7599242", "0.7584519"...
0.83546185
0
Sets the id of this CarrierProposedAssignment.
def id(self, id): if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n self.__id = id", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\n self.id = id_", "def set_id(self, id):\n ...
[ "0.70227313", "0.6614614", "0.6438083", "0.6430146", "0.6403813", "0.63766086", "0.63766086", "0.63766086", "0.634863", "0.634863", "0.634863", "0.634863", "0.634863", "0.63077736", "0.6281507", "0.6281507", "0.6281507", "0.6281507", "0.6281507", "0.6281507", "0.6281507", "...
0.0
-1
Sets the shipping_docs of this CarrierProposedAssignment.
def shipping_docs(self, shipping_docs): if (self.local_vars_configuration.client_side_validation and shipping_docs is not None and len(shipping_docs) > 40): raise ValueError("Invalid value for `shipping_docs`, length must be less than or equal to `40`") # noqa: E501 self._s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shipping(self, shipping):\n\n self._shipping = shipping", "def free_shipping(self, free_shipping):\n\n self._free_shipping = free_shipping", "def shipper_reference(self, shipper_reference):\n\n self._shipper_reference = shipper_reference", "def default_shipping(self, default_shipping...
[ "0.6744463", "0.6087139", "0.570811", "0.54640007", "0.5361297", "0.5191443", "0.51317793", "0.5130795", "0.5047276", "0.5019647", "0.4938617", "0.48367798", "0.47788686", "0.47168353", "0.46891648", "0.466864", "0.46050453", "0.45823067", "0.45809397", "0.44549394", "0.44093...
0.78439474
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CarrierProposedAssignment): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088463", "0.8088463", "0.80553037", "0.7983272", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", "0.7966844", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, CarrierProposedAssignment): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026", "0.80427635", "0.80427635", "0.80427635", "0.80427635", "0.80427635", "0.80427635", "0.8...
0.0
-1
Construct a RepeatedDomain with the specified input (kernel) domain and number of repeats.
def __init__(self, num_repeats, domain): self.num_repeats = num_repeats self._domain = domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat(self, n, new_axis, domain=None):\n if new_axis is None:\n new_axis = self.get_new_axis_name()\n\n return stack_cuboids([self.copy() for i in xrange(n)], new_axis, domain)", "def repeat(x, repeats, axis=None):\r\n return RepeatOp(axis=axis)(x, repeats)", "def repeat_nd(x, ...
[ "0.57387286", "0.54704624", "0.5405786", "0.5364515", "0.53023005", "0.52789116", "0.5085169", "0.50566363", "0.49996588", "0.49146834", "0.48994163", "0.4891534", "0.48751357", "0.48550293", "0.4852493", "0.48360586", "0.48120174", "0.47808582", "0.47407442", "0.4721467", "0...
0.6504928
0
Return the number of spatial dimensions of the kernel domain.
def dim(self): return self._domain.dim
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_observation_dimension(self):\n return len(self._get_observation_np())", "def get_num_dimensions(self):\n dimensions = self.data.shape\n return dimensions[1]", "def domain_size(self):\n all_vars = self.all_variables()\n if not all_vars:\n return 0\n ...
[ "0.73848426", "0.7381147", "0.7352471", "0.72833985", "0.7278738", "0.7278738", "0.72706336", "0.72483623", "0.72472656", "0.72399867", "0.72273445", "0.7227136", "0.7226565", "0.71597886", "0.7158675", "0.71023047", "0.707447", "0.70661587", "0.7065379", "0.7061803", "0.7054...
0.0
-1
r"""Check if a point is inside the domain/on its boundary or outside.
def check_point_inside(self, points): return all([self._domain.check_point_inside(point) for point in points])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_point_within(self, x, y):\n return abs(x - self._x_position) <= self._x_length / 2 and abs(y - self._y_position) <= self._y_length / 2", "def is_point_in(self, point):\n return (self.upperleft[0] <= point[0] <= self.upperright[0] and self.upperleft[1] <= point[1] <= self.bottomleft[1])", "...
[ "0.7733035", "0.76522005", "0.76522005", "0.75808537", "0.7537005", "0.74708223", "0.74178964", "0.738179", "0.738179", "0.73303086", "0.7317933", "0.72900873", "0.72799176", "0.7249871", "0.72477007", "0.7246835", "0.72228026", "0.72186345", "0.71271574", "0.7101021", "0.707...
0.7103086
19
Return a list of ClosedIntervals representing a bounding box for this domain.
def get_bounding_box(self): return self._domain.get_bounding_box()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounds(self):\n log.debug(str(inspect.stack()[1][3]) + \"--> OC.get_bounds()\")\n\n # TODO: Move the operation out of here.\n\n xmin = Inf\n ymin = Inf\n xmax = -Inf\n ymax = -Inf\n\n # for obj in self.object_list:\n for obj in self.get_list():\n ...
[ "0.71748376", "0.67746264", "0.6704462", "0.6520981", "0.64957726", "0.6494311", "0.64898074", "0.6469474", "0.64590883", "0.6459039", "0.64575493", "0.6436007", "0.636689", "0.63554573", "0.6353764", "0.6281879", "0.6275346", "0.6233851", "0.6216193", "0.61879647", "0.616234...
0.56381714
88
assigne liste des mots clefs(liste de texte)
def set_mot_clef(self, mc: [str]): self.mot_clef = mc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nettoyage(liste_car: List[str]) -> List[str]:\n a_supprimer = string.punctuation + \"«»°\" + string.digits + string.whitespace\n i = 0\n while i < len(liste_car):\n if liste_car[i] in a_supprimer:\n del liste_car[i]\n continue\n i += 1\n return liste_car", "def...
[ "0.6159967", "0.60047764", "0.59133774", "0.58610797", "0.5831696", "0.5818759", "0.57822216", "0.5767478", "0.5758132", "0.57293713", "0.57079726", "0.570482", "0.56933457", "0.56893224", "0.56707644", "0.56526357", "0.5630538", "0.56285894", "0.56007946", "0.5590737", "0.55...
0.0
-1
Plot histogram showing distribution of error.
def plot_distribution(error, name, units): mean = error.mean() std = error.std() maximum = error.max() minimum = error.min() stats = 'Mean = %.5f\nStd = %.5f\nMax = %.5f\nMin = %.5f' % \ (mean, std, maximum, minimum) title = 'Distribution of %s Errors in Final Policy' % name plt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_loss(self):\n #x = [k for k in range(self.rep)]\n loss = self.min_list[:,0]//100 #For clarity\n #plt.plot(x,self.min_list[:,0])\n plt.hist(loss,density=True)\n plt.xlabel(self.list_name + '_loss//100')\n plt.ylabel('Frequency')\n #plt.xticks(range(8),[0,250...
[ "0.7070574", "0.6814539", "0.6747597", "0.6467419", "0.64446235", "0.6435879", "0.64288515", "0.6424587", "0.63492936", "0.63145113", "0.62904435", "0.6268153", "0.62652314", "0.6195938", "0.61867166", "0.61658627", "0.61658627", "0.61658627", "0.614358", "0.6128955", "0.6115...
0.7280739
0
Returns ``True`` iff this represents a sequence node.
def is_sequence(self) -> bool: return isinstance(self.yaml_node, yaml.SequenceNode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sequence(item):\n return (not hasattr(item, \"strip\") and\n (hasattr(item, \"__getitem__\") or hasattr(item, \"__iter__\")))", "def __eq__(self, sequence):\n try:\n return self.seq == sequence.seq\n except AttributeError:\n return self.seq == sequ...
[ "0.6775892", "0.6482359", "0.6443539", "0.6421949", "0.63702387", "0.62746257", "0.62161356", "0.6149324", "0.6131712", "0.6076955", "0.6064164", "0.60340804", "0.6000043", "0.5990869", "0.597421", "0.59481806", "0.5928189", "0.59117824", "0.5877819", "0.584987", "0.5818856",...
0.8480926
0
Whether the given attribute exists and has a compatible type. Returns true iff the attribute exists and is an instance of the given type. Matching between types passed as typ and
def has_attribute_type(self, attribute: str, typ: Optional[Type]) -> bool: if not self.has_attribute(attribute): return False attr_node = self.get_attribute(attribute).yaml_node if typ in scalar_type_to_tag: tag = scalar_type_to_tag[typ] return cast(str, att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_type(self, attr: Optional[str] = None) -> bool:\n try:\n self.validate_type(attr)\n except TypeError:\n return False\n return True", "def matches(self, attr):\n if attr is None: \n return False\n if attr.tablename and attr.tablename != self.table...
[ "0.7414183", "0.6487584", "0.6484442", "0.6371943", "0.62810826", "0.6266043", "0.6219949", "0.6164317", "0.60901755", "0.60262185", "0.60111713", "0.59359443", "0.5924008", "0.59112006", "0.59112006", "0.5900771", "0.586003", "0.5858145", "0.582538", "0.5809024", "0.57873213...
0.7961611
0
Converts a sequence attribute to a map. This function takes an attribute of this Node that is a sequence of mappings and turns it into a mapping of mappings. It assumes that each of the mappings in the original sequence has an attribute containing a unique value, which it will use as a key for the new outer mapping. An...
def seq_attribute_to_map(self, attribute: str, key_attribute: str, value_attribute: Optional[str] = None, strict: Optional[bool] = True) -> None: if not self.has_attribute(attribute): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_attribute_to_map(\n self,\n attribute: str,\n key_attribute: str,\n value_attribute: Optional[str] = None\n ) -> None:\n if not self.has_attribute(attribute):\n return\n\n attr_node = self.get_attribute(attribute)\n if...
[ "0.720468", "0.7083137", "0.6812432", "0.63154966", "0.59632903", "0.5922722", "0.5853591", "0.5813682", "0.58105356", "0.57916176", "0.5718592", "0.5674626", "0.567138", "0.56451875", "0.56383806", "0.56383806", "0.5611101", "0.55853736", "0.55699277", "0.5558416", "0.555115...
0.78979546
0
Finds an attribute's index in the yaml_node.value list.
def __attr_index(self, attribute: str) -> Optional[int]: attr_index = None for i, (key_node, _) in enumerate(self.yaml_node.value): if key_node.value == attribute: attr_index = i break return attr_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(attribute, attributes):\n for i in range(14):\n if attribute == attributes[i]:\n return i", "def get_attribute_idx(data, stimulus_idx, attribute):\n attribute_names = data['stimuli'][stimulus_idx]['dimnames']\n for attribute_idx, attribute_str in enumerate(attribute_names...
[ "0.7036254", "0.69291824", "0.6626064", "0.6451901", "0.640627", "0.63049465", "0.6201203", "0.6087007", "0.60067385", "0.58729714", "0.5822153", "0.57865816", "0.57865816", "0.57728976", "0.57261354", "0.57202137", "0.57089096", "0.57067335", "0.5682343", "0.5678663", "0.567...
0.76638424
0
Require an attribute on the node to not have a given value. This requires the attribute to exist, and to not have the given value.
def require_attribute_value_not( self, attribute: str, value: Union[int, str, float, bool, None]) -> None: self.require_mapping() found = False for key_node, value_node in self.yaml_node.value: if (key_node.tag == 'tag:yaml.org,2002:str' an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_attribute_value(\n self, attribute: str,\n value: Union[int, str, float, bool, None]) -> None:\n self.require_mapping()\n found = False\n for key_node, value_node in self.yaml_node.value:\n if (key_node.tag == 'tag:yaml.org,2002:str'\n ...
[ "0.65751064", "0.65005225", "0.63015485", "0.6177203", "0.61516255", "0.6133649", "0.6101392", "0.5974399", "0.5958457", "0.5927537", "0.5901931", "0.58238953", "0.581339", "0.58058035", "0.57940775", "0.5782123", "0.5751083", "0.5701721", "0.5692893", "0.5649074", "0.5617267...
0.75786364
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81942594", "0.80949026", "0.8028581", "0.8018849", "0.79934716", "0.7990885", "0.7980801", "0.79750925", "0.7960907", "0.79557455", "0.79372376", "0.7934255", "0.79340357", "0.79309034", "0.7925931", "0.7924125", "0.79232645", "0.7922545", "0.79224193", "0.79218626", "0.79...
0.7828554
81
Verify if the requested collapse is legal fro a triangle mesh.
def is_collapse_legal(mesh, u, v, allow_boundary=False): # collapsing of boundary vertices is currently not supported # change this to `and` to support collapsing to or from the boundary if not allow_boundary: if mesh.is_vertex_on_boundary(v) or mesh.is_vertex_on_boundary(u): return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self):\n if len(self.exterior) < 3:\n return False\n return self.to_shapely_polygon().is_valid", "def _check_matrix(self, x, *args):\n if self._special and x.determinant() != 1:\n raise TypeError('matrix must have determinant one')\n F = self.invaria...
[ "0.5980599", "0.58915365", "0.58741415", "0.58708334", "0.5822911", "0.5791064", "0.5685197", "0.5659432", "0.5616843", "0.55770415", "0.55677634", "0.55509025", "0.55356765", "0.5532787", "0.5528641", "0.5527729", "0.54898053", "0.5481598", "0.54696536", "0.5461385", "0.5460...
0.6624501
0
Checks the lifetimes of all obstacles currently in memory to see if any have died. If any obstacles have reached a lifetime of zero (meaning they have been absent from ``obstacle_lifetime`` frames) they are removed from the obstacle list
def remove_dead_obstacles(obstacle_list): for obstacle in obstacle_list: obstacle.lifetime -= 1 if obstacle.lifetime == 0: obstacle_list.remove(obstacle) print(obstacle)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_bounds(self):\n for i, missile in enumerate(self.missile_list):\n if missile.out_of_bounds(self.world):\n del self.missile_list[i]\n self.gameevents.add(\"bounds_remove\", \"missile\")\n for i, shell in enumerate(self.shell_list):\n if she...
[ "0.64343715", "0.6409492", "0.60506034", "0.59842384", "0.5793107", "0.5777674", "0.57635856", "0.5731944", "0.5731804", "0.57115096", "0.5699845", "0.5683519", "0.56752443", "0.56432754", "0.5641558", "0.56411207", "0.55879456", "0.55014884", "0.5500536", "0.5484237", "0.545...
0.7803291
0
Calculate pressure from ycoordinate.
def p_from_y(y): p = np.exp(-y) return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pressure(self):\r\n self._read_temperature()\r\n\r\n # Algorithm from the BME280 driver\r\n # https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c\r\n adc = self._read24(_BME280_REGISTER_PRESSUREDATA) / 16 # lowest 4 bits get dropped\r\n var1 = float(self._t_...
[ "0.65667474", "0.63158137", "0.631088", "0.627763", "0.62507606", "0.6092104", "0.6059851", "0.6043016", "0.59535044", "0.59435827", "0.5929539", "0.59232265", "0.5905908", "0.58699447", "0.5782434", "0.5768621", "0.5742784", "0.5727153", "0.57255083", "0.57211375", "0.570741...
0.6401572
1
Returns the base farmer reward at a certain block height. The base fee reward is 1/8 of total block reward Returns the coinbase reward at a certain block height. These halving events will not be hit at the exact times (3 years, etc), due to fluctuations in difficulty. They will likely come early, if the network space a...
def calculate_base_farmer_reward(height: uint32) -> uint64: if height == 0: return uint64(int((1 / 8) * 21000000 * _mojo_per_chia)) elif height < 3 * _blocks_per_year: return uint64(int((1 / 8) * 2 * _mojo_per_chia)) elif height < 6 * _blocks_per_year: return uint64(int((1 / 8) * 1 *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_base_farmer_reward(height: uint32) -> uint64:\n if height == 0:\n return uint64(int((1 / 10) * 21000062 * _mojo_per_ethgreen))\n elif height < 3 * _blocks_per_year:\n return uint64(int((1 / 10) * 20 * _mojo_per_ethgreen))\n elif height < 6 * _blocks_per_year:\n return ui...
[ "0.7641979", "0.67641103", "0.6175415", "0.6112026", "0.59947336", "0.59317964", "0.5906596", "0.5788265", "0.5610718", "0.5589029", "0.5584933", "0.5560157", "0.55037165", "0.54936564", "0.5431093", "0.5423161", "0.54177886", "0.53681", "0.53593916", "0.53413624", "0.5321954...
0.76290315
1
Takes an item as a parameter and inserts it into the 0th index of the list that is representing the Deque. The runtime is linear, or O(n), because every time you insert into the front of a list, all the other items in the list need to shift one position to the right.
def add_front(self, item): self.items.insert(0, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertFront(self, item):\n self.sentinel.insertAfter(item)\n self.N += 1", "def enqueue_front(self, item):\n self._items.insert(0, item)", "def enqueue(queue, item):\n new_node = Node(item, None)\n if empty_queue(queue):\n queue.front = new_node\n queue.back = new_n...
[ "0.74772114", "0.71903616", "0.7164885", "0.7092206", "0.7046138", "0.70150757", "0.7004098", "0.6971647", "0.696565", "0.69649714", "0.692787", "0.6920665", "0.6903612", "0.6897061", "0.6876932", "0.68563926", "0.6834835", "0.6816592", "0.67839766", "0.67836297", "0.67836297...
0.6990222
7
Returns the value found at the 0th index of the list, which represents the front of the Deque. The runtime is constant because all we're doing is indexing into a list.
def peek_front(self): if self.items: return self.items[0] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Front(self):\n if self.count == 0:\n return -1\n return self.queue[self.headIndex]", "def get_front(self) -> int:\r\n if self.size == 0:\r\n return -1\r\n if self.frontIndex == self.capacity - 1:\r\n return self.deque[0]\r\n return self.dequ...
[ "0.7808785", "0.77438754", "0.77421767", "0.7723376", "0.7712832", "0.7712832", "0.7711708", "0.75888807", "0.7572023", "0.75459397", "0.75434506", "0.75129974", "0.74928254", "0.7479616", "0.74282086", "0.741268", "0.73637325", "0.73514116", "0.7345181", "0.7327259", "0.7311...
0.71832377
24
Returns the value found at the 1st, or last, index. The runtime is constant because all we're doing is indexing into a list.
def peek_rear(self): if self.items: return self.items[-1] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(_list, _index):\n # print(_list, len(_list))\n if _index >= len(_list):\n return None\n return _list[_index]", "def _get_list_value(index, array):\r\n if len(array) == 0:\r\n return None\r\n elif index >= 0 and index < len(array):\r\n return array[index]\r\n r...
[ "0.75849", "0.713405", "0.70764416", "0.7067748", "0.6927484", "0.6900818", "0.68979496", "0.68834436", "0.6834518", "0.6829196", "0.68202806", "0.6787368", "0.677742", "0.6730051", "0.6714962", "0.6664381", "0.6615653", "0.6600296", "0.6568302", "0.65640825", "0.6551074", ...
0.0
-1
Initialize viewport with initial Face rotation and position.
def __init__(self, size): self.__size = size self.__height, self.__width = self.__size self.__output_image = zeros(self.__width * self.__height * 4, dtype='f') self.__light = None self.__face = None self.__model_matrix = zeros((4, 4),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_viewport(self):\n self.add_uniform('viewport', vartype=\"float\", ndim=2, data=(1., 1.))\n self.add_uniform('window_size', vartype=\"float\", ndim=2)#, data=(600., 600.))\n if self.constrain_ratio:\n self.add_vertex_main(\"gl_Position.xy = gl_Position.xy / viewport;\"...
[ "0.7020884", "0.6175097", "0.61723566", "0.6149855", "0.61317664", "0.61283696", "0.6105559", "0.60647255", "0.60593605", "0.60478395", "0.60478395", "0.60478395", "0.60415", "0.602421", "0.60181725", "0.6000403", "0.5950733", "0.5863496", "0.58586884", "0.58458847", "0.58416...
0.52276856
91
Get rotation matrix from specific point of view and scale.
def __get_rotation_matrix(coordinates, side_length): assert len(coordinates) == 3 glLoadIdentity() glOrtho(-side_length, side_length, -side_length, side_length, -4 * side_length, 4 * side_length) x, y, z = coordinates gluLookAt(x, y, z, 0.0, 0.0, 0.0, 0.0, 1.0, 0....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_rotation_matrix(self, origin, angle, scale):\n # scaling will be ignored at this step\n rotation_matrix = cv2.getRotationMatrix2D(origin, angle * 180 / np.pi, scale)\n return rotation_matrix", "def get_matrix(transform):\n\n rotation = transform.rotation\n locatio...
[ "0.6760221", "0.6702179", "0.6702179", "0.6646584", "0.6589252", "0.6522939", "0.6482538", "0.6213437", "0.61767185", "0.61677426", "0.61467403", "0.6135659", "0.609653", "0.60869116", "0.60733074", "0.6066591", "0.60479957", "0.60175145", "0.6001089", "0.5994596", "0.5945654...
0.5568591
58
Initialisation of ARD on the weights
def initAlpha(self): alpha = [ s.zeros(self.K,) for m in range(self.M) ] for m in range(self.M): tmp = bernoulli.rvs(p=0.5, size=self.K) tmp[tmp==1] = 1. tmp[tmp==0] = 1E5 alpha[m] = tmp return alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def __init__(self, weights):\n self._weights = weights", "def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)", "def InitWeights(self):\n self.w = -1 + 2 * np.random.rand(self.num_of_inputs,)\n self...
[ "0.72505295", "0.711942", "0.71062124", "0.70970845", "0.7046074", "0.70379", "0.7028717", "0.7021893", "0.7014068", "0.6998069", "0.697517", "0.696841", "0.696841", "0.696841", "0.6962236", "0.6951577", "0.6915964", "0.6867122", "0.68590575", "0.6816859", "0.6798318", "0.6...
0.0
-1
Respond to a request for a specific API version.
def show(self, request): # data = VERSIONS[request.url_version] LOG.debug('request: %s ' % request) data = VERSIONS['1.0'] LOG.debug('data: %s ' % data) LOG.debug("conf: sections:%s" % conf.sections()) v = Version(data["id"], data["status"], request.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, version):\n version_found = False\n api_spec = self._create_api_spec(version)\n for base_api in current_app.appbuilder.baseviews:\n if isinstance(base_api, BaseApi) and base_api.version == version:\n base_api.add_api_spec(api_spec)\n versi...
[ "0.771236", "0.6951032", "0.69210196", "0.68890315", "0.67442405", "0.6709198", "0.67004126", "0.66128737", "0.65911984", "0.65547436", "0.64480793", "0.6417986", "0.6415046", "0.6402901", "0.62554765", "0.6216004", "0.620213", "0.6191911", "0.61596644", "0.61003375", "0.6089...
0.5746528
69
This starts a movie playing.
def movie_start(filename, size=None, loops=0): if renpy.game.less_updates: return global default_size if size is not None: default_size = size filename = [ filename ] if loops == -1: loop = True else: loop = False filename = filename * (loops + 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_film(self, file):\n directory_name = os.path.dirname(file)\n file_name = os.path.basename(file)\n self.Media = self.vlc_instance.media_new(\n str(os.path.join(directory_name, file_name))\n )\n #self.Media.get_meta()\n self.vlc_media_player_instance.set_...
[ "0.6928271", "0.68753964", "0.6810379", "0.67979765", "0.6776151", "0.67657876", "0.6754822", "0.672618", "0.65975463", "0.659223", "0.65790725", "0.6543319", "0.65346766", "0.65223193", "0.6488615", "0.64360607", "0.6327664", "0.6299091", "0.6284722", "0.62824196", "0.626308...
0.7057459
0
Called to update the video playback. Returns true if a video refresh is needed, false otherwise.
def frequent(): if not playing(): return 0 pss = renpy.audio.audio.pss if pss.needs_alloc(): if renpy.display.video.fullscreen and renpy.display.draw.fullscreen_surface: surf = renpy.display.draw.fullscreen_surface else: get_movie_texture() sur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_video(self):\n stream_status = self.communications.get_video()\n if self.__video_status[\"last_video_streaming\"] != stream_status: # Set initial video status\n self.__video_status[\"last_video_streaming\"] = stream_status\n self.__live_video_stream(stream_status)",...
[ "0.6688936", "0.658644", "0.6539732", "0.6521593", "0.6362628", "0.63457036", "0.6297211", "0.62862444", "0.6277879", "0.6249531", "0.62054175", "0.61760485", "0.6166755", "0.6026714", "0.5937955", "0.59339017", "0.59078604", "0.5877138", "0.5855286", "0.58499956", "0.5829884...
0.0
-1
Convert class labels from scalars to onehot vectors.
def dense_to_one_hot(labels_dense, num_classes, nlevels=1): if nlevels == 1: num_labels = labels_dense.shape[0] index_offset = np.arange(num_labels) * num_classes labels_one_hot = np.zeros((num_labels, num_classes), dtype=np.int32) labels_one_hot.flat[index_offset + labels_dense.rave...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)", "def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)", "def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:...
[ "0.82503515", "0.8076697", "0.8051534", "0.797685", "0.7907419", "0.7899711", "0.7892668", "0.7870854", "0.7849299", "0.7849299", "0.7826309", "0.78255224", "0.77681756", "0.77642655", "0.77528447", "0.77528447", "0.77528447", "0.7748242", "0.77435005", "0.7736248", "0.772139...
0.69234896
100
Converts the passed ``torch.Tensor`` into an MPI compatible memory view.
def as_mpi_memory(cls, obj) -> MPI.memory: return MPI.memory.fromaddress(obj.data_ptr(), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tensor2np(x):\n if x is None:\n return x\n return x.cpu().detach().numpy()", "def tensoras(tensor):\r\n\r\n if pytorch.is_dense(tensor):\r\n m = tensor.detach().cpu().numpy()\r\n if m.ndim == 0:\r\n m = m.item()\r\n elif pytorch.is_sparse(tensor):\r\n m = py...
[ "0.6040068", "0.5859078", "0.57170117", "0.56398106", "0.55598223", "0.55364287", "0.55121785", "0.55109876", "0.5441032", "0.5419318", "0.54167664", "0.5393284", "0.53805405", "0.5341093", "0.52922857", "0.52922857", "0.52727497", "0.5244679", "0.52280575", "0.5225818", "0.5...
0.6596614
0
Start time. Returns datetime.datetime Start time.
def stime(self): try: return self['datetime_1'] except TypeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()", "def start_time(self):\n return self._start_time", "def start_time(self):\n return self._start_time", "def start_time(self):\n return self._start_time", "def start_time(self):...
[ "0.82458675", "0.81831324", "0.81831324", "0.81831324", "0.81831324", "0.81831324", "0.81831324", "0.81831324", "0.81831324", "0.8116447", "0.8112509", "0.80959326", "0.8085424", "0.8059318", "0.80205154", "0.8014188", "0.8002273", "0.7994192", "0.7990335", "0.7987373", "0.79...
0.0
-1
End time. Returns datetime.datetime End time.
def etime(self): try: return self['datetime_2'] except TypeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return self._end_time", "def end_time(self):\n return...
[ "0.8302829", "0.8302829", "0.8302829", "0.8302829", "0.8302829", "0.8302829", "0.8234296", "0.81941664", "0.8157635", "0.81356686", "0.8125194", "0.8101188", "0.8071822", "0.80627143", "0.8023915", "0.80111617", "0.7864001", "0.7823088", "0.7756086", "0.7695986", "0.7566802",...
0.0
-1
Unified time. Returns datetime.datetime Unified time.
def time(self): try: if self.single_date: return self.stime else: return self.stime + (self.etime - self.stime) / 2 except TypeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime(self):\n time = self.time()\n if time is None or time < 0 or time >= 24:\n time = 0\n\n try:\n d = datetime(self.year(), self.month(), self.day()) + \\\n timedelta(hours=time)\n return d\n except:\n return", ...
[ "0.7089799", "0.70536745", "0.66383517", "0.6633456", "0.6552339", "0.6519578", "0.64865863", "0.6485815", "0.6485173", "0.6440672", "0.64395326", "0.6403102", "0.639547", "0.63868666", "0.63580936", "0.6344479", "0.63436735", "0.633635", "0.6294259", "0.62863344", "0.6257093...
0.59365654
49
Encodes a datetime.datetime/datetime.date object into a string. The format is selected by the input type.
def encode_datetime(self, datetime_obj): if isinstance(datetime_obj, np.datetime64): datetime_obj = pd.Timestamp(datetime_obj).to_pydatetime() if isinstance(datetime_obj, dt.datetime): return datetime_obj.strftime("%Y%m%dT%H%M%S") elif isinstance(datetime_obj, dt.date): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_str(obj: \"date\") -> str:\n return obj.isoformat()", "def _json_date_encoder(obj):\r\n if isinstance(obj, datetime.date):\r\n return obj.isoformat()\r\n elif isinstance(obj, decimal.Decimal):\r\n return float(obj)", "def serialize_datetime(self, obj):\r\n if isinstanc...
[ "0.71302384", "0.7109175", "0.70197827", "0.68770516", "0.6831181", "0.67757094", "0.6583432", "0.6481591", "0.6468879", "0.64643687", "0.64485806", "0.63885844", "0.63885844", "0.63756126", "0.6359516", "0.63388795", "0.6336358", "0.63352734", "0.63190234", "0.63190234", "0....
0.7274154
0
Create a batch data loader from the given data set. Using PyTorch Datasets and DataLoaders is especially useful when working with large datasets, which cannot be stored in the computer memory (RAM) all at once.
def batch_loader(data_set: Union[IterableDataset, Dataset], batch_size: bool, shuffle=False) -> DataLoader: return DataLoader( data_set, batch_size=batch_size, collate_fn=lambda x: x, shuffle=shuffle )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def torch_dataset_loader(dataset, batch_size, shuffle, kwargs):\n loader = DataLoader(TorchData(dataset),\n batch_size=batch_size,\n shuffle=shuffle,\n **kwargs)\n return loader", "def get_train_loader(batch_size, train_set, train_sampler...
[ "0.77821296", "0.7729841", "0.7583086", "0.7543602", "0.7505361", "0.73916286", "0.7378085", "0.73509383", "0.7318953", "0.7256234", "0.72534716", "0.7249414", "0.7178658", "0.71183634", "0.70683247", "0.70636624", "0.70601434", "0.7057616", "0.70348173", "0.7028938", "0.7028...
0.83228797
0
always returns the first element of deque
def shiftDeque(d): while True: try: yield d.popleft() except IndexError: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n return self.deque[0]", "def peek_front(self):\n if ((self.is_empty()) or self.data_[self.front_]== None): #If we trip this if block we raise an error since we know the deque should be empty \n raise IndexError\n return self.data_[self.front_]", "def first(self...
[ "0.84488004", "0.79360116", "0.7746329", "0.76808614", "0.7645211", "0.7639249", "0.762313", "0.749628", "0.7492738", "0.7457152", "0.741343", "0.74087065", "0.7353525", "0.73528373", "0.73248875", "0.7298108", "0.7284449", "0.725862", "0.72445774", "0.72322553", "0.7222274",...
0.0
-1
Sets the portal_id of this DomainCdnConfig.
def portal_id(self, portal_id): if ( self.local_vars_configuration.client_side_validation and portal_id is None ): # noqa: E501 raise ValueError( "Invalid value for `portal_id`, must not be `None`" ) # noqa: E501 self._portal_id = portal_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdn_id(self, cdn_id):\n if (\n self.local_vars_configuration.client_side_validation and cdn_id is None\n ): # noqa: E501\n raise ValueError(\n \"Invalid value for `cdn_id`, must not be `None`\"\n ) # noqa: E501\n\n self._cdn_id = cdn_id", ...
[ "0.55934244", "0.51600987", "0.5107088", "0.49715006", "0.4926963", "0.4926963", "0.48706025", "0.4793998", "0.4793998", "0.4751209", "0.4733723", "0.47114223", "0.47056538", "0.4692235", "0.4685643", "0.46855214", "0.46855214", "0.4683949", "0.4674446", "0.46645427", "0.4638...
0.714327
0
Sets the updated of this DomainCdnConfig.
def updated(self, updated): if ( self.local_vars_configuration.client_side_validation and updated is None ): # noqa: E501 raise ValueError( "Invalid value for `updated`, must not be `None`" ) # noqa: E501 self._updated = updated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, enabled=None, cnames=None, comment=None):\r\n new_config = DistributionConfig(self.connection, self.config.origin,\r\n self.config.enabled, self.config.caller_reference,\r\n self.config.cnames, self.config.comment...
[ "0.61457133", "0.6012143", "0.5533672", "0.5487523", "0.5451057", "0.53852856", "0.53796333", "0.5379178", "0.53790927", "0.5350403", "0.53225625", "0.526653", "0.52570295", "0.5256097", "0.5256097", "0.5248329", "0.52436644", "0.5241478", "0.5224215", "0.522279", "0.5217135"...
0.0
-1
Sets the cert_id of this DomainCdnConfig.
def cert_id(self, cert_id): if ( self.local_vars_configuration.client_side_validation and cert_id is None ): # noqa: E501 raise ValueError( "Invalid value for `cert_id`, must not be `None`" ) # noqa: E501 self._cert_id = cert_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cert(self, value):\n self._cert = value", "def certificate_issuer_id(self, certificate_issuer_id):\n\n self._certificate_issuer_id = certificate_issuer_id", "def domain_id(self, domain_id):\n\n self._domain_id = domain_id", "def cdn_id(self, cdn_id):\n if (\n self.l...
[ "0.648625", "0.6392923", "0.6203288", "0.60979635", "0.58235055", "0.5755207", "0.5619148", "0.55615526", "0.5454727", "0.54514563", "0.54440945", "0.53902763", "0.53735274", "0.53687096", "0.5311898", "0.5269552", "0.52254456", "0.52254456", "0.52238023", "0.51928", "0.51670...
0.7080936
0
Sets the cert_expiration_date of this DomainCdnConfig.
def cert_expiration_date(self, cert_expiration_date): if ( self.local_vars_configuration.client_side_validation and cert_expiration_date is None ): # noqa: E501 raise ValueError( "Invalid value for `cert_expiration_date`, must not be `None`" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expiration_date(self, expiration_date):\n\n self._expiration_date = expiration_date", "def default_expiration_date(self, default_expiration_date):\n\n self._default_expiration_date = default_expiration_date", "def expire_date(self, expire_date):\n\n self._expire_date = expire_date", ...
[ "0.702627", "0.631459", "0.623729", "0.6228444", "0.5916856", "0.5886791", "0.58783084", "0.58200675", "0.573661", "0.56915843", "0.56055045", "0.550793", "0.5497357", "0.5497357", "0.5497357", "0.53920704", "0.5325578", "0.53121614", "0.52689147", "0.5239478", "0.5223498", ...
0.7684126
0
Sets the cdn_id of this DomainCdnConfig.
def cdn_id(self, cdn_id): if ( self.local_vars_configuration.client_side_validation and cdn_id is None ): # noqa: E501 raise ValueError( "Invalid value for `cdn_id`, must not be `None`" ) # noqa: E501 self._cdn_id = cdn_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdn_group_id(self, cdn_group_id):\n if (\n self.local_vars_configuration.client_side_validation\n and cdn_group_id is None\n ): # noqa: E501\n raise ValueError(\n \"Invalid value for `cdn_group_id`, must not be `None`\"\n ) # noqa: E501...
[ "0.6751273", "0.64474905", "0.63107586", "0.57109094", "0.57109094", "0.5673157", "0.5568244", "0.55629635", "0.55209315", "0.55209315", "0.5468026", "0.5344063", "0.5288086", "0.5288086", "0.5288086", "0.52240205", "0.5215256", "0.5193647", "0.5177345", "0.5156801", "0.51568...
0.78794616
0
Sets the ssl_status of this DomainCdnConfig.
def ssl_status(self, ssl_status): if ( self.local_vars_configuration.client_side_validation and ssl_status is None ): # noqa: E501 raise ValueError( "Invalid value for `ssl_status`, must not be `None`" ) # noqa: E501 allowed_values = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EnableSSL(self):\n if self.force_auto_sync:\n self.get('EnableSSL')\n return self._EnableSSL", "def sslEnabled(self):\n return self.__ssl_enabled", "def org_apache_felix_https_enable(self) -> ConfigNodePropertyBoolean:\n return self._org_apache_felix_https_enable", ...
[ "0.5986671", "0.57002133", "0.5694897", "0.5691406", "0.5669873", "0.5641464", "0.56147826", "0.55851567", "0.55304885", "0.5435148", "0.54266405", "0.5370975", "0.5335345", "0.5290155", "0.52690315", "0.51991135", "0.5174704", "0.51646584", "0.5159507", "0.51494426", "0.5132...
0.7408194
0
Sets the http_body of this DomainCdnConfig.
def http_body(self, http_body): if ( self.local_vars_configuration.client_side_validation and http_body is None ): # noqa: E501 raise ValueError( "Invalid value for `http_body`, must not be `None`" ) # noqa: E501 self._http_body = http_body
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_body(self, body):\r\n self._body = body", "def body(self, body):\n\n self._body = body", "def body(self, body):\n\n self._body = body", "def body(self, body):\n\n self._body = body", "def body(self, body):\n\n self._body = body", "def set_html_body(self, body):\...
[ "0.60335475", "0.56352365", "0.56352365", "0.56352365", "0.56352365", "0.5598677", "0.55717003", "0.55717003", "0.5538598", "0.54585415", "0.5390114", "0.5363716", "0.5360905", "0.52701056", "0.51489925", "0.4921352", "0.48959738", "0.4815857", "0.4753281", "0.4703872", "0.46...
0.67727053
0
Sets the cname of this DomainCdnConfig.
def cname(self, cname): if ( self.local_vars_configuration.client_side_validation and cname is None ): # noqa: E501 raise ValueError( "Invalid value for `cname`, must not be `None`" ) # noqa: E501 self._cname = cname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cname(self, cname):\n self.__cname = cname", "def set_dns_cname ( route53_conn, dns_name, cname_value ) :\n r53 = boto.route53.record.ResourceRecordSets( route53_conn, route_53_hosted_zoneid )\n monitor_dns = r53.add_change( 'UPSERT', dns_name, 'CNAME', ttl=60 )\n monitor_dns.add_value( cnam...
[ "0.7353354", "0.6787573", "0.58306545", "0.53468287", "0.5271034", "0.5239655", "0.51808816", "0.51600695", "0.51451194", "0.5144209", "0.5098337", "0.5098337", "0.5089497", "0.50215065", "0.50136745", "0.4982769", "0.4982769", "0.49471718", "0.49317634", "0.49140587", "0.491...
0.71347517
1
Sets the cname_target of this DomainCdnConfig.
def cname_target(self, cname_target): if ( self.local_vars_configuration.client_side_validation and cname_target is None ): # noqa: E501 raise ValueError( "Invalid value for `cname_target`, must not be `None`" ) # noqa: E501 self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cname(self, cname):\n self.__cname = cname", "def set_dns_cname ( route53_conn, dns_name, cname_value ) :\n r53 = boto.route53.record.ResourceRecordSets( route53_conn, route_53_hosted_zoneid )\n monitor_dns = r53.add_change( 'UPSERT', dns_name, 'CNAME', ttl=60 )\n monitor_dns.add_value( cnam...
[ "0.6161715", "0.56571543", "0.5562238", "0.5540022", "0.5436753", "0.53446907", "0.5285181", "0.5193794", "0.51671326", "0.51671326", "0.5136968", "0.51182085", "0.50536823", "0.5025541", "0.5025541", "0.49958748", "0.4989106", "0.49535507", "0.49437654", "0.49051666", "0.486...
0.7836978
0
Sets the minimum_tls_version of this DomainCdnConfig.
def minimum_tls_version(self, minimum_tls_version): if ( self.local_vars_configuration.client_side_validation and minimum_tls_version is None ): # noqa: E501 raise ValueError( "Invalid value for `minimum_tls_version`, must not be `None`" )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_tls_version(self, value):\n self._set_attr('min-tls-version', value)", "def min_tls_version(self):\n return self._data.get('min-tls-version', None)", "def tls_min_version(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"tls_min_version\")", "def tls_min_version(s...
[ "0.77457994", "0.6668995", "0.63330346", "0.63330346", "0.61167383", "0.59885263", "0.5895673", "0.5703485", "0.5678821", "0.5657199", "0.5350185", "0.5332084", "0.5294296", "0.5229303", "0.5229303", "0.5223897", "0.51976055", "0.5140413", "0.50779045", "0.50440055", "0.50440...
0.77915806
0
Sets the alternate_origin_hostname of this DomainCdnConfig.
def alternate_origin_hostname(self, alternate_origin_hostname): if ( self.local_vars_configuration.client_side_validation and alternate_origin_hostname is None ): # noqa: E501 raise ValueError( "Invalid value for `alternate_origin_hostname`, must not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hostname(self, hostname):\n raise NotImplementedError()", "def setorigin(self):\n try:\n origin = self.repo.remotes.origin\n if origin.url != self.origin_url:\n log.debug('[%s] Changing origin url. Old: %s New: %s',\n self.name, ...
[ "0.56432724", "0.54825515", "0.54443306", "0.5413333", "0.532358", "0.5307988", "0.5294168", "0.52682024", "0.525112", "0.525112", "0.5229715", "0.5222777", "0.5208188", "0.5167246", "0.51632434", "0.5094791", "0.5084198", "0.50662804", "0.50589204", "0.50213253", "0.500995",...
0.8355488
0
Sets the id of this DomainCdnConfig.
def id(self, id): if ( self.local_vars_configuration.client_side_validation and id is None ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdn_id(self, cdn_id):\n if (\n self.local_vars_configuration.client_side_validation and cdn_id is None\n ): # noqa: E501\n raise ValueError(\n \"Invalid value for `cdn_id`, must not be `None`\"\n ) # noqa: E501\n\n self._cdn_id = cdn_id", ...
[ "0.6935357", "0.6685087", "0.63644964", "0.6236037", "0.62207425", "0.605074", "0.5987751", "0.5978477", "0.5967704", "0.59580815", "0.594113", "0.5936219", "0.59316784", "0.59316784", "0.59316784", "0.59293944", "0.5901403", "0.58987373", "0.58987373", "0.58987373", "0.58987...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DomainCdnConfig): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, DomainCdnConfig): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8456063", "0.83918154", "0.8144437", "0.8140196", "0.8132038", "0.8093834", "0.80918837", "0.80918837", "0.80918837", "0.80852824", "0.80852824", "0.807626", "0.807626", "0.80657643", "0.8042481", "0.8042481", "0.8042481", "0.8042481", "0.8042481", "0.8042481", "0.8042481"...
0.0
-1
Convert the attrs in dict format to an HTML format.
def html_attrs(attrs): html = "" for a in attrs.items(): if a[1]: html = html + "%s=\"%s\" "%(a) return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_html(self):\n return mark_safe(\" \".join([\n self.attribute_template % (k, escape(v if not callable(v) else v()))\n for k, v in six.iteritems(self) if not v in EMPTY_VALUES]))", "def as_html(self):\r\n return mark_safe(' '.join(['%s=\"%s\"' % (k, escape(v if not callab...
[ "0.70117486", "0.695933", "0.6773837", "0.65951836", "0.65663487", "0.64095175", "0.6309713", "0.6248152", "0.62135077", "0.6161173", "0.6120539", "0.6120539", "0.6055554", "0.6021254", "0.5976593", "0.59342164", "0.58393645", "0.5828953", "0.58143544", "0.5798742", "0.577115...
0.7669962
0
Adds the input ``Time`` to the member data.
def add(self, time): self.elapsed_time = self.elapsed_time + time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_time_field(self) -> None:\n self.data[\"time\"] = [datetime(int(yyyy), int(mm), int(dd)) + timedelta(hours=hh) for yyyy, mm, dd, hh in zip(self.data[\"year\"], self.data[\"month\"], self.data[\"day\"], self.data[\"hour\"])]\n for key in [\"year\", \"doy\", \"month\", \"day\", \"hour\"]:\n ...
[ "0.7233926", "0.68125725", "0.68125725", "0.68125725", "0.68125725", "0.68125725", "0.6792184", "0.67791176", "0.67418265", "0.66158056", "0.6458627", "0.64531475", "0.6406397", "0.6406397", "0.6384579", "0.6381727", "0.6359148", "0.63020056", "0.6232178", "0.6099516", "0.609...
0.7325025
0
Calcula la distancia entre 2 puntos
def distancia_puntos(c, p): return sqrt((c[0] - p[0]) ** 2 + (c[1] - p[1]) ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Dist(p1,p2):\n x1, y1 = p1\n x2, y2 = p2\n return (((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)))**0.5", "def dist(pnt1, pnt2):\n return ((pnt2[0] - pnt1[0])**2 + (pnt2[1] - pnt1[1])**2 + (pnt2[2] - pnt1[2])**2)**0.5", "def dist(p0, p1):\n return math.sqrt((p0[0] - p1[0])**2 + (p0[1] - p1[1])**2)", "def di...
[ "0.7362617", "0.728506", "0.7268491", "0.72286063", "0.7210529", "0.72010565", "0.71855736", "0.71011376", "0.7066864", "0.6998343", "0.6996693", "0.69886875", "0.6974783", "0.6940832", "0.6930779", "0.6888006", "0.687785", "0.6871968", "0.6859085", "0.68269545", "0.67970455"...
0.6984056
12
Add an edge to the terminal graph.
def edge(self, viz_edge: VizEdge) -> None: # Take CallNode as an example, instead of "arguments point to CallNode", # we want "CallNode points to arguments" in ast-dump form. # # The direction of edge is typically controlled by the implemented VizParser. # Reverse start/end here ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEdge(self, edge):\n Digraph.addEdge(self, edge)\n rev = Edge(edge.getDestination(), edge.getSource())\n Digraph.addEdge(self, rev)", "def add_edge(self, ed):\n self.edge.append(ed)\n self.update_node2edge()", "def addEdge(self, edge: Edge):\n self.edges.append(e...
[ "0.8188227", "0.7988535", "0.798623", "0.7941954", "0.7829566", "0.7819214", "0.7818084", "0.78145087", "0.7801904", "0.7656984", "0.76379526", "0.7498607", "0.74936247", "0.748312", "0.7463189", "0.7420311", "0.74041027", "0.7362618", "0.73130333", "0.7306188", "0.73019713",...
0.6688736
74
Does the home() view exist in readingTime views.py module?
def test_index_exists(self): name_exists = 'index' in self.views_module_listing is_callable = callable(self.views_module.index) self.assertTrue(name_exists, f"{FAILURE_HEADER}index() view does not exist{FAILURE_FOOTER}") self.assertTrue(is_callable, f"{FAILURE_HEADER}index() fun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(self, *args, **kwargs):\n pass", "def home(request):\r\n return render(request, 'home.html')", "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home(request):\n if request.user.is_authenticated():\n return HttpResponseRedirect('logged-in')\n else:\n ...
[ "0.67487735", "0.67265314", "0.6704355", "0.6703212", "0.6628878", "0.6602242", "0.65504307", "0.6549451", "0.654646", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0.65421665", "0....
0.0
-1
Return the index.html file
def index(request): products = Product.objects.all() highlights = Original.objects.filter(status='h') context = { "index_page": "active", "products": products, "highlights": highlights, "title": "Home" } return render(request, "index.html", context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self):\n return open(os.path.join(self.staticdir, \"index.html\"))", "def index(self):\n single = os.path.join(\n os.path.dirname(os.path.abspath(__file__)),\n 'index.html')\n return serve_file(single)", "def index():\n return render_template('index.html'...
[ "0.8606564", "0.8470716", "0.80533785", "0.8032279", "0.8032279", "0.79846454", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", "0.7935351", ...
0.0
-1
get projects from PRIDE API in JSON format
def get_projects(self, page_size, page, sort_direction, sort_conditions): request_url = self.api_base_url + "projects?" + "pageSize=" + str(page_size) + "&page=" + str(page) + "&sortDirection=" + sort_direction + "&sortConditions=" + sort_conditions headers = {"Accept": "application/JSON"} respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/projects\").json()", "def get_projects(self, _is_simple=False):\n req_url = f\"{self.url}/projects\"\n if _is_simple:\n req_url += \"?simple=true\"\n ret = requests.get(req_url, headers = self.r...
[ "0.8043558", "0.79441667", "0.7811482", "0.7772093", "0.7648546", "0.7594347", "0.7584866", "0.7351949", "0.71447414", "0.7141094", "0.71276116", "0.71189463", "0.71062654", "0.7029739", "0.7020208", "0.70063436", "0.7001726", "0.6986282", "0.6980471", "0.6962776", "0.6950579...
0.7064863
13
Parse start date and time from item and page date string
def _parse_start(self, item, date_str): # Remove day of week if present date_str = re.search(r"[\d/]{8,10}", date_str).group() time_str = item.css("th::text, td::text").extract_first().replace(".", "") time_str = time_str.replace("noon", "pm").replace("\u200b", "").strip() if tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_start(self, item, start_time):\n date_str = item.css(\"*::text\").extract_first()\n if not date_str:\n return\n date_match = re.search(r\"\\w{3,9} \\d{1,2}, \\d{4}\", date_str)\n if date_match:\n parsed_date = datetime.strptime(date_match.group(), \"%B %...
[ "0.78154385", "0.77333003", "0.7730685", "0.77083975", "0.76962423", "0.7560113", "0.74035656", "0.7384176", "0.6911045", "0.6673306", "0.65389997", "0.64185536", "0.6290325", "0.6180849", "0.604949", "0.60147244", "0.5883331", "0.58133066", "0.5775677", "0.57316464", "0.5725...
0.7962969
0
Attempts to resolve the path to the notebook being run. If ``nb_path`` is ``None``, ``self._notebook`` is checked, then the working directory is searched for ``.ipynb`` files. If none are found, or more than one is found, a ``ValueError`` is raised.
def _resolve_nb_path(self, nb_path): if nb_path is None and self._notebook is not None: nb_path = self._notebook elif nb_path is None and glob("*.ipynb"): notebooks = glob("*.ipynb") assert len(notebooks) == 1, "nb_path not specified and > 1 notebook in working direc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_notebook(fullname, path=None):\n name = fullname.rsplit(\".\", 1)[-1]\n if not path:\n path = [\"\"]\n for d in path:\n nb_path = os.path.join(d, name + \".ipynb\")\n if os.path.isfile(nb_path):\n return nb_path\n # let import Notebook_Name find \"Notebook N...
[ "0.6580517", "0.6118046", "0.58428234", "0.576427", "0.57623804", "0.5714794", "0.55501455", "0.5385478", "0.53419024", "0.5300512", "0.50883085", "0.50240266", "0.496012", "0.48980036", "0.48768246", "0.48107374", "0.47637558", "0.47499642", "0.47413197", "0.46858308", "0.46...
0.87936026
0
Converts a unicode string to a list of Gen 4 ords.
def _encode(self, obj, ctx): # enforce unicode if not isinstance(obj, unicode): obj = obj.decode('utf8') ordlist = [] for chr_ in obj: ord_ = get_ord(chr_) if ord_ == 0xFFFF: break ordlist.append(ord_) wh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genes():\n return [\"b2935\", \"b0723\", \"b0451\"]", "def convert_unicode_field(string):\n values = []\n for codepoint in [s for s in string.split(DATA_FILE_CODEPOINT_SEPARATOR) if (s != DATA_FILE_VALUE_NOT_AVAILABLE) and (len(s) > 0)]:\n values.append(u\"\".join([hex_to_unichr(c) for c in c...
[ "0.62269527", "0.61642605", "0.5799742", "0.5648823", "0.5575587", "0.55142087", "0.5414773", "0.52928764", "0.5257816", "0.5257731", "0.524945", "0.5230362", "0.5229091", "0.51891154", "0.51623523", "0.51380014", "0.5131101", "0.5103279", "0.5087546", "0.5076178", "0.5064731...
0.0
-1
Returns data from the sharing tab matrix (without table headers) as a list of lists. Checkbox cells are converted to simple True or False values.
def sharing_tab_data(browser=default_browser): sharing_data = [] table = browser.css('table#user-group-sharing').first for row in table.body_rows: rowdata = [] for td in row.css('td'): if td.classes == ['listingCheckbox']: spans = td.css('span') i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getValues(self):\n result = []\n for cbox in self.checkboxes:\n if cbox.isChecked():\n result.append(cbox.text())\n\n return result", "def get_list_of_bool2(self):\n pass", "def getBooleanArray2D(self) -> typing.List[typing.List[bool]]:\n ...", ...
[ "0.5816053", "0.5718316", "0.5542492", "0.5476723", "0.54671836", "0.5434284", "0.53326106", "0.53111166", "0.520821", "0.5190636", "0.5146882", "0.5128814", "0.5124371", "0.5090551", "0.5088574", "0.50795037", "0.50554514", "0.5036728", "0.501896", "0.50076437", "0.4971182",...
0.7464631
0
Return a dictionary of precipitation data
def precipitation(): # * Convert the query results to a Dictionary using `date` as the key and `prcp` as the value. session = Session(engine) results = session.query(Measurement.date, Measurement.prcp).all() session.close() all_precips = [] for date, prcp in results: precip_dict = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precip():\n # Query Measurement data\n session = Session(engine)\n results = session.query(Measurement.date, Measurement.prcp).all()\n\n # Create a dictionary from the row data and append to a list of precipitation data\n precip_data = []\n for date, prcp in results:\n precip_dict = {}...
[ "0.77907515", "0.765826", "0.7600521", "0.7586806", "0.7567548", "0.75225663", "0.7522503", "0.7519379", "0.7469789", "0.7416705", "0.74074495", "0.74047124", "0.7334887", "0.7278978", "0.7237182", "0.7231496", "0.7219214", "0.7158702", "0.71543884", "0.7144464", "0.71443415"...
0.7461461
9
For resnet, the lr starts from 0.1, and is divided by 10 at 80 and 120 epochs
def adjust_learning_rate(optimizer, epoch, model_type): if model_type == 1: if epoch < 80: lr = args.lr elif epoch < 120: lr = args.lr * 0.1 else: lr = args.lr * 0.01 elif model_type == 2: if epoch < 60: lr = args.lr elif ep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lr_schedule(epoch):\r\n lr = 1e-3\r\n if epoch > 180:\r\n lr *= 0.5e-3\r\n elif epoch > 160:\r\n lr *= 1e-3\r\n elif epoch > 120:\r\n lr *= 1e-2\r\n elif epoch > 80:\r\n lr *= 1e-1\r\n print('Learning rate: ', lr)\r\n return lr", "def lr_schedule(epoch):\n ...
[ "0.75904906", "0.75839096", "0.75839096", "0.75839096", "0.75839096", "0.75574", "0.7455129", "0.74261856", "0.74075645", "0.7266066", "0.71985835", "0.71878034", "0.7080241", "0.70345134", "0.6999357", "0.6973989", "0.69720703", "0.69368285", "0.6934154", "0.691139", "0.6863...
0.0
-1
Given the name of a player, get their player id.
def get_player_id(self, player): url = self.base_url + "/player/player/findplayer.html" params = {"q": player, "start": 0, "count": "Infinity"} url += "?" + urllib.parse.urlencode(params) resp = self.fetch(url) resp_json = json.loads(resp) if len(resp_json["items"]) == 0:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPlayerIDFromName(name):\n\n # Connect to the database.\n conn, c = main.connect()\n\n # Select the player that matches the name.\n SQL = \"SELECT playerID FROM player WHERE playerName=%s\"\n data = (name, )\n c.execute(SQL, data)\n\n toReturn = c.fetchone()\n\n conn.commit()\n con...
[ "0.80792814", "0.73504037", "0.73234665", "0.7244146", "0.7242505", "0.724178", "0.71127903", "0.70395905", "0.70017236", "0.6993391", "0.6948186", "0.6889687", "0.6885614", "0.6831397", "0.6820351", "0.6788249", "0.6772983", "0.6754158", "0.6715333", "0.6713837", "0.6680971"...
0.7381623
1
Test index page routing
def test_pizza(): response = app.test_client().get('/') assert response.status_code == 200 assert response.data == b'Welcome to the Pizza Parlour'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_view(self):\n response = self.client.get(url_for('main.index'))\n self.assertEqual(response.status_code, 200)", "def test_index_view(self):\n response = self.client.get('/')\n eq_(response.status_code, 200)", "def test_index_view(self):\n response = self.client...
[ "0.81209177", "0.800697", "0.79658145", "0.78916675", "0.78889596", "0.7773339", "0.7745272", "0.7703268", "0.7597389", "0.75915843", "0.7550458", "0.75051934", "0.7474155", "0.74727756", "0.74524444", "0.74524444", "0.74519575", "0.742032", "0.74157953", "0.73282784", "0.732...
0.0
-1
Testing email for new user is normalised
def test_new_email_normalised(self): email = "test@RANDOMEMAIL.org" user = get_user_model().objects.create_user( email, password="password" ) self.assertEqual(user.email, email.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_email_normalize(self):\n email = \"test@TadfhaafGRGS.pl\"\n user = get_user_model().objects.create_user(email, \"test123123123123\")\n\n self.assertEqual(email.lower(), user.email)", "def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user...
[ "0.79856116", "0.79837924", "0.79782945", "0.79782945", "0.79782945", "0.79641944", "0.79592794", "0.79516447", "0.7945084", "0.79426855", "0.7928316", "0.7907911", "0.7896453", "0.7864062", "0.7832128", "0.77200925", "0.76658666", "0.7632567", "0.7615156", "0.7545456", "0.75...
0.8326955
0
test the tag string representation
def test_tag_str(self): # create a new tag object tag = models.Tag.objects.create( user=sample_user(), name="TestTag" ) self.assertEqual(str(tag), tag.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Internal'\n )\n\n self.assertEqual(str(tag), tag.name)", "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Docke...
[ "0.72309095", "0.7106471", "0.6974805", "0.6974805", "0.69673026", "0.69394904", "0.6932888", "0.68880403", "0.66872", "0.64928925", "0.6373894", "0.63520837", "0.626638", "0.62179214", "0.61101854", "0.6109479", "0.6108113", "0.6086843", "0.6058148", "0.59807706", "0.5975097...
0.6963216
5
Create an annotation stub for supplied resource using indicated body
def createROAnnotation(self, rouri, resuri, bodyuri): annotation = self.createAnnotationRDF(rouri, resuri, bodyuri) (status, reason, headers, data) = self.doRequest(rouri, method="POST", ctype="application/vnd.wf4ever.annotation", body=annotation) if status !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createAnnotationRDF(self, rouri, resuri, bodyuri):\n annotation = (ANNOTATION_TEMPLATE%\n { \"xmlbase\": str(rouri)\n , \"resuri\": str(resuri)\n , \"bodyuri\": str(bodyuri)\n })\n return annotation", "def _resource_factory(self, raw) -> ApiResource:\...
[ "0.59096384", "0.5704778", "0.5512156", "0.54000103", "0.5386209", "0.53420734", "0.5241351", "0.5238442", "0.52195", "0.5121084", "0.5085806", "0.50165915", "0.5011306", "0.49885812", "0.49490753", "0.49367875", "0.49353758", "0.49123883", "0.4907055", "0.4906865", "0.489702...
0.5789368
1
Get the unique_id for a Frigate entity.
def get_frigate_entity_unique_id( config_entry_id: str, type_name: str, name: str ) -> str: return f"{config_entry_id}:{type_name}:{name}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self) -> str:\n return get_frigate_entity_unique_id(\n self._config_entry.entry_id, \"sensor_status\", \"frigate\"\n )", "def unique_id(self) -> str:\n return get_frigate_entity_unique_id(\n self._config_entry.entry_id,\n \"sensor_object_count\"...
[ "0.73676723", "0.7269622", "0.71320254", "0.6869185", "0.68507355", "0.6782743", "0.67562115", "0.6730469", "0.6730469", "0.67145634", "0.6707839", "0.6707839", "0.6707839", "0.6706498", "0.6706498", "0.6706498", "0.6706498", "0.6706498", "0.66890013", "0.6678395", "0.6678395...
0.71048295
3
Get the Frigate device model string.
def _get_model(self) -> str: return str(self.hass.data[DOMAIN][self._config_entry.entry_id][ATTR_MODEL])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model(self) -> str:\n return self.camera_info[\"device_model\"]", "def get_model(self) -> str:\n return self._get_string(openvr.Prop_ModelNumber_String)", "def get_model() -> str:\r\n ret = None\r\n try:\r\n with open('/proc/device-tree/model') as file:\r\n for line in...
[ "0.76943696", "0.76081073", "0.76018447", "0.7232272", "0.71063805", "0.7038289", "0.70258796", "0.69933015", "0.6933828", "0.6922336", "0.68626106", "0.67362505", "0.6681581", "0.6637021", "0.6625765", "0.6585435", "0.6533983", "0.6533983", "0.6526806", "0.63669944", "0.6332...
0.73890936
3
group list of list by a specific index.
def group_by(data, index): sorted_data = sorted(data, key=lambda x: x[index]) groupby_data = groupby(sorted_data, lambda x: x[index]) return groupby_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group(lst, n):\n return zip(*[lst[i::n] for i in range(n)])", "def generate_groups(client_list, criteria_index):\n groups_dict = {}\n for index, client in enumerate(client_list):\n value = client.data[criteria_index]\n if not value in groups_dict:\n groups_dict[value] = []\n...
[ "0.68073034", "0.62525886", "0.6218242", "0.6206346", "0.60408396", "0.5865919", "0.57993555", "0.5794339", "0.5731817", "0.57275206", "0.5670307", "0.56697", "0.5665398", "0.5637447", "0.5633781", "0.5629734", "0.5569514", "0.5522488", "0.5518673", "0.5513203", "0.54876506",...
0.7700986
0
Add scalebars to axes Adds a set of scale bars to ax, matching the size to the ticks of the plot and optionally hiding the x and y axes
def add_scalebar(ax, matchx=True, matchy=True, hidex=True, hidey=True, **kwargs): def f(axis): l = axis.get_majorticklocs() return len(l) > 1 and (l[1] - l[0]) if matchx: kwargs['sizex'] = f(ax.xaxis) kwargs['labelx'] = str(kwargs['sizex']) if matchy: kwargs['sizey'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_scalebar(ax, num, unit, fig, bbox_to_anchor=[0,0,1,1], x_label=None, y_label=None):\n if isinstance(num, tuple):\n num_x, num_y = num[0], num[1]\n else:\n num_x, num_y = num, num\n if isinstance(num, tuple):\n unit_x, unit_y = unit[0], unit[1]\n else:\n unit_x, unit_...
[ "0.72202325", "0.67583823", "0.67583823", "0.67583823", "0.63575494", "0.6252333", "0.61110824", "0.60805094", "0.6036374", "0.6016568", "0.59870887", "0.593551", "0.5933453", "0.5901336", "0.5885512", "0.5867424", "0.5865369", "0.5845011", "0.58125204", "0.57948875", "0.5777...
0.73673975
0
Bin reward to {+1, 0, 1} by its sign.
def reward(self, reward): return float(np.sign(reward))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reward(self, reward):\r\n return np.sign(reward)", "def reward(self, reward):\n return np.sign(reward)", "def reward(self, reward):\n return np.sign(reward)", "def reward(self, reward):\n return np.sign(reward)", "def reward(self, reward):\n return np.sign(reward)", ...
[ "0.7170663", "0.70812565", "0.70812565", "0.70812565", "0.70812565", "0.70812565", "0.6516397", "0.61955494", "0.60499823", "0.60499823", "0.6048698", "0.60147136", "0.5961627", "0.5949438", "0.59057444", "0.5822291", "0.5816496", "0.57978296", "0.57128024", "0.5707449", "0.5...
0.6652758
6
Close the connection to the database.
def close(self): self.connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_connection(cls):\n db.close()", "def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None", "def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()", "def Close(self):\n l_...
[ "0.8693136", "0.8501889", "0.8321094", "0.83082736", "0.8272193", "0.8170999", "0.8104556", "0.80233586", "0.8014553", "0.79848075", "0.7933265", "0.7930158", "0.7927017", "0.79215", "0.79093546", "0.7897055", "0.78905183", "0.78902656", "0.78752756", "0.7787804", "0.7787804"...
0.0
-1
Project vector `u` onto vector `v` Convert the Points into np.array and then use
def project_vector(u, v): u_np = np.array([u.get_x(), u.get_y()]) v_np = np.array([v.get_x(), v.get_y()]) proj = (np.dot(u_np, v_np) / np.dot(v_np, v_np)) * v_np return Point(proj[0], proj[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uv(u, v):\n uv = np.zeros((2, 2))\n uv[0][0] = u[0]\n uv[1][0] = u[1]\n uv[0][1] = v[0]\n uv[1][1] = v[1]\n return uv", "def _proj(u,v):\n return (np.einsum('i...,i...->...',u,v)/np.einsum('i...,i...->...',u,u))*u", "def duv(self, u, v):\n return np.column_stack(\n ...
[ "0.7269047", "0.7046182", "0.7015806", "0.6938667", "0.69117814", "0.6761432", "0.67162526", "0.6706705", "0.6696067", "0.6604717", "0.6579529", "0.64625746", "0.64539975", "0.6404402", "0.6379771", "0.6362266", "0.6357186", "0.6327987", "0.6313808", "0.6284396", "0.62422574"...
0.8113677
0
Returns the List of Points that defines the Gates Returns List of Points The List of Points that defines the Gates of the Wall
def get_gates(self): return self.gates
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oneEntryPoints(self):\n points = []\n if self.isRed:\n for x in range(self.midWidth, self.width):\n for y in range(0, self.height):\n if (x, y) not in self.walls:\n adjacent = self.adjacentValidPoints(x, y)\n ...
[ "0.68935215", "0.6858011", "0.66832757", "0.6658015", "0.6571304", "0.64857227", "0.647982", "0.64680153", "0.6459585", "0.6457116", "0.6428824", "0.63826954", "0.63322294", "0.62874544", "0.62874544", "0.62874544", "0.62874544", "0.62874544", "0.6282821", "0.6282821", "0.619...
0.5861392
44
Test if unauthenticated will be redirected to login page
def test_add_product_view_for_unauthenticated_users(client): add_product_url = reverse('add-product') response = client.get(add_product_url) assert response.status_code == 302 assert response.url == "/accounts/login/?next=/products/add-product/"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_redirect_if_not_logged_in(self):\n response = self.client.get(self.account_overview_url)\n self.assertEqual(response.status_code, 302)\n self.assertRedirects(response, self.login_url)", "def test_redirect_when_not_logged_in(self):\r\n self.logout()\r\n course_wiki_page...
[ "0.7787556", "0.7648166", "0.76366794", "0.7626825", "0.76077497", "0.75069386", "0.7471995", "0.7471995", "0.7448445", "0.7327461", "0.72055364", "0.7184386", "0.71768904", "0.71692437", "0.713444", "0.7126062", "0.7123754", "0.71160024", "0.71160024", "0.71160024", "0.71010...
0.0
-1
Veryfies that list view returns all created products
def test_product_list_view(sample_product, user_company, client): product_list_url = reverse('product-list') response = client.get(product_list_url) assert response.status_code == 200 assert Product.objects.count() == 9 products = Product.objects.all() content = response.content.decode(response....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_list_view(request):\n queryset = Product.objects.all()\n context = {\n \"object_list\": queryset\n }\n\n return render(request, \"products/product_list.html\", context)", "def all_products(request):\n\n products = Product.objects.all()\n return render(request, 'products.html'...
[ "0.76710874", "0.74285233", "0.7416532", "0.73523736", "0.73315704", "0.7265167", "0.72566205", "0.70875335", "0.70781904", "0.7023204", "0.6984352", "0.6974742", "0.6964903", "0.69328207", "0.6835238", "0.6812944", "0.6775822", "0.6733721", "0.6732091", "0.6694664", "0.66862...
0.0
-1
Verifies that all routes for products returning "OK" status if exists and 404 if not
def test_product_detail_view(client, sample_product, user_company, authenticated_user): products = Product.objects.all() for product in products: product_detail_view = reverse('product-detail', kwargs={'pk': product.pk}) response = client.get(product_detail_view) #The view should return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_product_not_found(self):\n resp = self.app.get(\"/products/0\")\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)", "def test_trucks_api_error(self):\n resp = self.app.get('/asfdasdf')\n self.assertEqual(resp.status_code, 404)\n assert \"NOT FOUND\" i...
[ "0.6948749", "0.6321058", "0.63120013", "0.62850505", "0.6257371", "0.6216281", "0.6212385", "0.6179696", "0.6155453", "0.61530423", "0.6112075", "0.6110079", "0.60805446", "0.60777617", "0.6060571", "0.6052491", "0.60472834", "0.60396665", "0.60372424", "0.6021137", "0.60027...
0.5943388
25
Assign a registered instance to a layer.
def assign_instance(InstanceId=None, LayerIds=None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_instance(self, instance):\n self.instance = instance", "def register_layer(key, module):\n register(key, module, layer_dict)", "def putLayer(self, layer):\t\n\t\t# force use different address id ( prevent use same defined layer more than once, eg: bottleneck in torchvision)\n\t\t# tmp_la...
[ "0.6242037", "0.6161679", "0.6132995", "0.5936071", "0.59317166", "0.5850365", "0.5835677", "0.5813594", "0.56972367", "0.567106", "0.5670981", "0.5670981", "0.5670981", "0.5670981", "0.5670981", "0.5670981", "0.5670981", "0.5658966", "0.5587182", "0.5584452", "0.55191666", ...
0.6805995
0
Requests a description of one or more layers in a specified stack.
def describe_layers(StackId=None, LayerIds=None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_stack(cfn, stack_name):\n try:\n stacks = cfn.describe_stacks(StackName=stack_name)[\"Stacks\"]\n return stacks[0]\n except ClientError as e:\n if \"does not exist\" not in e.response[\"Error\"][\"Message\"]:\n raise e\n return None", "def describe_stack_summary(StackId=None):\n ...
[ "0.577908", "0.55523837", "0.55034184", "0.54681355", "0.5400006", "0.539834", "0.52887154", "0.5279896", "0.5156389", "0.5143111", "0.51420945", "0.5101896", "0.50756633", "0.5072962", "0.50555223", "0.4989658", "0.49862868", "0.49649313", "0.496198", "0.49598914", "0.491865...
0.70992595
0
Describes the operating systems that are supported by AWS OpsWorks Stacks.
def describe_operating_systems(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_supported_os(self):\r\n return self.os", "def GetOperatingSystems(self, reason=None):\n query = []\n _AppendReason(query, reason)\n return self._SendRequest(HTTP_GET, \"/%s/os\" % GANETI_RAPI_VERSION,\n query, None)", "def operatingsystem(self):\n # ty...
[ "0.6498918", "0.64331657", "0.64208287", "0.62678206", "0.6204934", "0.6198747", "0.60045093", "0.5897908", "0.5888538", "0.5849524", "0.58367825", "0.5819666", "0.57756984", "0.5747962", "0.5743054", "0.57257926", "0.5721145", "0.5696014", "0.5670472", "0.5670472", "0.565753...
0.7535174
0
Initialize _init_optimizing object. Returns
def _init_optimizing(self): try: model_config = self._conf.get(PredictConstance.BASE_CONFIG, PredictConstance.MODEL_CONFIG) conf = configparser.ConfigParser() conf.read(model_config) self._optimizing = optimizing.Optimizin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self, *args, **kwargs): \n super().initialize(*args, **kwargs)\n self.updates_per_optimize = 1", "def initialize(self, *args):\n return _SALOMERuntime.OptimizerAlgASync_initialize(self, *args)", "def initialize_optimization(self):\n\n if self.FLAGS.optimizer == \"Adam\" :...
[ "0.720435", "0.68492883", "0.6793287", "0.671453", "0.66703504", "0.65767103", "0.655801", "0.6554908", "0.6524802", "0.64999706", "0.64458036", "0.6428565", "0.6422132", "0.64200056", "0.6411262", "0.6410988", "0.639894", "0.639894", "0.639894", "0.639894", "0.63704264", "...
0.7080019
1