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
Same as list.sort(), but returns self and thus allows chaining.
def sort(self, *args: Any, **kwargs: Any) -> BaseList: super().sort(*args, **kwargs) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_list(self,list_):\r\n list_.sort()", "def sort(self, *args, **kargs):\n list.sort(self, *args, **kargs)\n self.emit('modified')", "def sort(self, Items):\n # Pre:\n # 'Items' must be a mutable list of items of type 'T'.\n # Post:\n # Returns a list that...
[ "0.698652", "0.6864875", "0.6466243", "0.64515364", "0.6287095", "0.6252412", "0.62099224", "0.6191247", "0.6172524", "0.6144833", "0.6121214", "0.61002105", "0.60807556", "0.6005992", "0.6000834", "0.59578997", "0.5928604", "0.5904146", "0.58778435", "0.58771586", "0.5802938...
0.7906905
0
Split this container into smaller containers of the same type of size 'batch_size'. If the length of this container is not perfectly divisible by 'batch_size', the final container will be shorter than the rest.
def split_into_batches_of_size(self, batch_size: int) -> Iterator[List]: if batch_size >= len(self): yield type(self)(self) else: for run in range(0, len(self), batch_size): yield self[run:run + batch_size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_on_chunks(self, iterable, size):\n return utils.split_on_chunks(iterable, size)", "def next_explode_batch(self, batch_size):\n\n all_idx = np.arange(0, self.explode_length)\n np.random.shuffle(all_idx)\n batch_idx = all_idx[:batch_size]\n batch_imgs = [self.explode_i...
[ "0.66679996", "0.6647029", "0.65682423", "0.65567344", "0.64719105", "0.64487696", "0.64167565", "0.6398678", "0.63343215", "0.6326952", "0.63112897", "0.62693685", "0.62693685", "0.62651753", "0.6250854", "0.6248492", "0.62341845", "0.62306714", "0.6230071", "0.6223465", "0....
0.75003314
0
Return True if file `target' is missing, or is older than `reference'.
def missingOrStale(target, reference=None): if not os.path.isfile(target): return True if reference: return os.path.getmtime(target) < os.path.getmtime(reference) else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newer(source, target):\n if not os.path.exists(source):\n raise DistutilsFileError(\"file '%s' does not exist\" %\n os.path.abspath(source))\n if not os.path.exists(target):\n return True\n\n return os.stat(source).st_mtime > os.stat(target).st_mtime", "...
[ "0.71246564", "0.70820457", "0.6981222", "0.66121864", "0.63654494", "0.6188364", "0.6178757", "0.60222495", "0.60196024", "0.5942662", "0.59375006", "0.5935005", "0.59308803", "0.5885809", "0.5863201", "0.58552855", "0.5779307", "0.5766456", "0.57449186", "0.568841", "0.5681...
0.8671155
0
Gets the most specific rdf_type. Returns the URI corresponding to the lowest in the DataObject class hierarchy from among the given URIs.
def get_most_specific_rdf_type(types): mapper = PyOpenWorm.CONTEXT.mapper most_specific_types = tuple(mapper.base_classes.values()) for x in types: try: class_object = mapper.RDFTypeTable[x] if issubclass(class_object, most_specific_types): most_specific_types...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self) -> URIType:\n if self.study_instance_uid is None:\n return URIType.SERVICE\n elif self.series_instance_uid is None:\n return URIType.STUDY\n elif self.sop_instance_uid is None:\n return URIType.SERIES\n elif self.frames is None:\n ...
[ "0.6093359", "0.60854715", "0.554034", "0.5296322", "0.5230488", "0.5205593", "0.51270694", "0.51154256", "0.50827587", "0.5079269", "0.5075472", "0.5020265", "0.49683824", "0.49645853", "0.49509254", "0.49112874", "0.48547608", "0.4796295", "0.4781412", "0.477706", "0.475805...
0.7599178
0
Find out if number is even.
def is_even(number): return (number%2)==0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_even(number):\n return number % 2 == 0", "def is_even(num):\n return num % 2 == 0", "def is_even(number: int) -> bool:\n return number % 2 == 0", "def is_even(number):\n if ((number%2) == 0):\n return True\n else:\n return False", "def is_even(n):\r\n return n%2==0", ...
[ "0.9053494", "0.9034889", "0.90041065", "0.8938645", "0.8896712", "0.88882595", "0.8879262", "0.87531185", "0.8700416", "0.8586053", "0.8564545", "0.8558445", "0.85247", "0.8426129", "0.8395409", "0.83054405", "0.82596934", "0.8256843", "0.8253218", "0.8244772", "0.8192477", ...
0.90880644
0
recursively iterate all attributes of an object to convert an object to a pure map(only contains builtin types)
def recur_iter_attrs(obj): if isinstance(obj, list) or isinstance(obj, tuple): res = [] for i in obj: res.append(recur_iter_attrs(i)) return res elif isinstance(obj, dict): dic = {} for k, v in obj.items(): dic[k] = recur_iter_attrs(v) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_recursive(obj):\n if isinstance(obj, list):\n for i, l in enumerate(obj):\n obj[i] = AttrDict.make_recursive(l)\n elif isinstance(obj, dict):\n for k, v in obj.items():\n obj[k] = AttrDict.make_recursive(v)\n return AttrDict(obj)...
[ "0.6256274", "0.6182762", "0.611956", "0.60716295", "0.59637487", "0.5909074", "0.5805566", "0.5775913", "0.5772003", "0.57663935", "0.57611656", "0.5751742", "0.57454497", "0.57359624", "0.5714102", "0.56854045", "0.5679278", "0.5659475", "0.56465966", "0.56385344", "0.56287...
0.6639609
0
Function converts string to list "dispersed" with zeroes. Function is necessary for writing special values to Windows registry
def disperse_string(solid_string): normal_list = list(solid_string) return list(itertools.chain.from_iterable(zip(normal_list, [0] * len(normal_list))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros(s, zero=0):\n\treturn [zeros(s[1:] ) for i in range(s[0] ) ] if not len(s) else zero", "def fn(s):\n if len(s) == 1: return [s] # edge case \n if s.startswith(\"0\") and s.endswith(\"0\"): return []\n if s.startswith(\"0\"): return [s[:1] + \".\" + s[1:]]\n i...
[ "0.6276546", "0.6146885", "0.60171235", "0.6001595", "0.59806764", "0.59747446", "0.593996", "0.5904246", "0.5881783", "0.5871116", "0.5681117", "0.56704247", "0.56690603", "0.56546926", "0.56486815", "0.563864", "0.55844074", "0.55371785", "0.5526049", "0.5518702", "0.551870...
0.60728526
2
Convert bytes list, which is Python list with values in range [0, 255], to binary array. Function is necessary for writing special values to Windows registry
def bytes_list_to_array(bytes_list): digital_bytes = [] for elem in bytes_list: if isinstance(elem, int): digital_bytes.append(elem.to_bytes(1, 'little')) elif isinstance(elem, str): digital_bytes.append(ord(elem).to_bytes(1, 'little')) digital_bytes_array = b'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_to_bytes(val):\n return [int(x*255) for x in val]", "def from_bit_array(bin_list):\n print(bin_list)\n byte_list = [hex(int(x,2)) for x in bin_list]\n result = bytes([int(x,0) for x in byte_list])\n return result", "def bytify(binary):\n\tbytes = [0,0,0,0]\n\ti = 3\n\twhile binary:\n\n\t...
[ "0.7485727", "0.73353904", "0.6969886", "0.692457", "0.68925136", "0.6882395", "0.687321", "0.68293947", "0.67941445", "0.6748755", "0.65864176", "0.6552455", "0.6546625", "0.6508638", "0.6508638", "0.6492829", "0.6464818", "0.6463897", "0.64490473", "0.64422554", "0.643546",...
0.74200106
1
Return a string representation of this object
def __str__(self): return "SkosmosClient(api_base='{}')".format(self.api_base)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\r\n return self.__str__()", "def serialize(self):\n\n\t\treturn str(self)", "def as_string(self):\n return self.__repr__()", "def toString(self) -> str:\n raise NotImplementedError", "def serialize(self):\n\n return str(self)", "def __str__(self):\n ...
[ "0.8690287", "0.8689758", "0.8669933", "0.86497015", "0.8643615", "0.8593662", "0.8586409", "0.8555447", "0.8545644", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.85290325", "0.8...
0.0
-1
Return the configuration of the LDA.
def config(self) -> Dict[str, Any]: attr_conf = {attr: getattr(self._lda, attr, None) for attr in self.attributes} return {"params": self._lda.get_params(), "attributes": attr_conf}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self):\n return self.config", "def get_config():\n config = ml_collections.ConfigDict()\n\n config.dim = _DIM.value\n config.margin = _MARGIN.value\n\n config.num_experts = _NUM_EXPERTS.value\n\n config.num_samples = int(round(_SAMPLES_RATIO.value * _DIM.value))\n\n config.depth = _DE...
[ "0.6683904", "0.664694", "0.6520222", "0.6442374", "0.64326733", "0.64326733", "0.6398642", "0.63801837", "0.63796014", "0.637906", "0.63716674", "0.6351424", "0.6342234", "0.6342234", "0.6342234", "0.63397306", "0.6297886", "0.6278152", "0.62754923", "0.62688655", "0.6267812...
0.7432447
0
Return the configuration of the QDA.
def config(self) -> Dict[str, Any]: attr_conf = {attr: getattr(self._qda, attr, None) for attr in self.attributes} return {"params": self._qda.get_params(), "attributes": attr_conf}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\n return self._cfg", "def get_config(self):\n return self.config", "def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)", "def config(self):\n return self[CONFIG_KEY]", ...
[ "0.70671046", "0.70628023", "0.70587337", "0.7055506", "0.70128334", "0.69564295", "0.69354254", "0.68964475", "0.6891008", "0.6883623", "0.6883623", "0.68802506", "0.6878562", "0.6878562", "0.6846274", "0.6846274", "0.6846274", "0.68448836", "0.6800819", "0.67965907", "0.675...
0.7497954
0
Centers a pin in Y Requirements Alignment pin mounted. Pin should be aligned in X to within 0.25 of the Mag3 width
def center_pin(cam=cam_8): if cam not in [cam_7, cam_8]: print('cam must be one of: [cam_7, cam_8]') return -1 # Copy ROI2 geometry (HiMag Mag3 and LoMag Mag1) to ROI4 and use ROI4 centroid plugin cam.roi4.min_xyz.min_x.put(cam.roi2.min_xyz.min_x.get()) cam.roi4.min_xyz.min_y.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetAlignmentCenter(self):\n cent = self.TiltSeries_._TiltAlignmentParas.cent\n imdimX = self.TiltSeries_._imdimX\n imdimY = self.TiltSeries_._imdimY\n print(imdimX, imdimY)\n if cent[0] != imdimX//2+1 or cent[1] != imdimY//2+1:\n #rint \"Centers do not match: cen...
[ "0.6530727", "0.63778764", "0.60896593", "0.6032488", "0.58007073", "0.5784148", "0.57672673", "0.5753318", "0.5683996", "0.5666882", "0.56419", "0.56303936", "0.56197965", "0.5603084", "0.5589763", "0.5583597", "0.55815464", "0.5568885", "0.5562424", "0.5542947", "0.5531073"...
0.58367175
4
Initilise the queue with size 0 and empty data
def __init__(self, size = 0): self.data = [] self.size = size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._data = [None]*ArrayQueue.DEFAULT_CAPACITY\n self._size = 0\n self._front = 0", "def make_empty_queue():\n return Queue(0, None, None)", "def __init__(self, queueLength):\r\n self.queueLength = queueLength\r\n self.data = []\r\n return", ...
[ "0.79281473", "0.7913286", "0.76543", "0.7505615", "0.7505615", "0.7501691", "0.74106145", "0.7392602", "0.73601854", "0.7353549", "0.7339182", "0.730633", "0.7270129", "0.7244942", "0.71681535", "0.71326494", "0.709261", "0.709261", "0.709261", "0.709261", "0.709261", "0.7...
0.65200084
69
Returns the length of the queue
def __len__(self): return len(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\r\n return len(self.queue)", "def size(self):\r\n return len(self.queue)", "def qsize(self):\r\n return len(self._queue)", "def size(self):\n return len(self.__queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self...
[ "0.85218304", "0.85218304", "0.8510092", "0.8497616", "0.8497419", "0.8497419", "0.8497419", "0.8497419", "0.843837", "0.8403797", "0.83387715", "0.8329439", "0.83276945", "0.82428545", "0.8194946", "0.8171252", "0.8151139", "0.8142358", "0.797672", "0.7916072", "0.7915109", ...
0.0
-1
Returns boolean True if queue is empty and False if we have some data present
def is_empty(self): return len(self.data) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def empty(self) -> bool: \n if(self.queue is not None and len(s...
[ "0.87975156", "0.8682277", "0.86627233", "0.86627233", "0.8609134", "0.8605527", "0.85967875", "0.8543217", "0.8542111", "0.8524275", "0.85015005", "0.84722984", "0.84551764", "0.84286475", "0.842505", "0.84226465", "0.8420542", "0.83950776", "0.8338616", "0.8338616", "0.8286...
0.0
-1
Return the first element present in the queue
def front(self): if self.is_empty(): raise Exception("Queue is empty !!! Please add data to the Queue :) ") else: return self.data[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Queue is empty')\n\t\treturn self._head._element", "def first(self):\r\n if self.is_empty():\r\n raise Empty(\"Queue is empty\")\r\n return self._head._element", "def first(self):\n if self.is_empty():\n ra...
[ "0.85646725", "0.8433074", "0.8271941", "0.825775", "0.8155439", "0.8133391", "0.8109052", "0.8100387", "0.78322685", "0.7774173", "0.77433103", "0.76770425", "0.76770425", "0.7647386", "0.760932", "0.7587123", "0.756754", "0.75370353", "0.7530781", "0.75128305", "0.7497796",...
0.74428505
22
Splits input raw texts into words (tokens)
def split_to_words(qid_raw, condition_raw, output_raw): qid = re.split(SPLIT_PATTERN_NO_DILIMITER, str(qid_raw)) condition = re.split(SPLIT_PATTERN_NO_DILIMITER, str(condition_raw)) condition = [cond for cond in condition if cond != " " and cond != ""] output = re.split(SPLIT_PATTERN_WITH_DILIM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return text.split(' ')", "def tokenize(self, raw_text):\n # TODO implement\n raw_tokens = word_tokenize(raw_text.decode('utf8'))\n return self.filter_tokens(raw_tokens)\n # return self.split_by(raw_tokens, '-')", "def word_tokenize(text):\n for (regexp, repl...
[ "0.7914099", "0.766587", "0.76578075", "0.74407744", "0.74345595", "0.7426157", "0.74118954", "0.73792315", "0.73627406", "0.735913", "0.73539406", "0.7346636", "0.7282593", "0.7274609", "0.7271629", "0.72632974", "0.7240448", "0.7236909", "0.72321457", "0.7217849", "0.719459...
0.0
-1
Replaces tokens of the input list using a dictionary
def replace_using_dict(list, dictionary, drop_unknown=False): replaced_list = [] for line in list: if drop_unknown: translated_line = [dictionary[word] for word in line if word in dictionary] else: translated_line = [dictionary[word] if word in dictionary else word for wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_list_replace(re_map, words):\n return [word_replace(re_map, word) for word in words]", "def replace_entities(self, token_list, entities):\n new_token_list = []\n entities_usage = {}\n for k, _ in entities.items():\n entities_usage[k] = 0\n for token in token_lis...
[ "0.63856053", "0.6282236", "0.6268503", "0.6263758", "0.6247176", "0.6206646", "0.60814965", "0.6021747", "0.60169226", "0.5904308", "0.58789766", "0.58739334", "0.5872065", "0.5829256", "0.5790956", "0.5784738", "0.5770782", "0.5722827", "0.5713262", "0.570973", "0.56988025"...
0.66879517
0
Pad sequnces in the input list with zero
def pad_with_zero(list, max_length, pad_type): padded_list = pad_sequences(list, maxlen=max_length, padding=pad_type, truncating='post') return padded_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left_zero_pad(l: List[int], n: int) -> List[int]:\n return [0] * (n - len(l)) + l", "def pad_list(xs, pad_value=0.0, pad_left=False):\n bs = len(xs)\n max_time = max(x.size(0) for x in xs)\n xs_pad = xs[0].new_zeros(bs, max_time, * xs[0].size()[1:]).fill_(pad_value)\n for b in range(bs):\n ...
[ "0.77024096", "0.74833196", "0.74800617", "0.72278726", "0.71290225", "0.709887", "0.708432", "0.70421475", "0.70078874", "0.6902827", "0.68919396", "0.6867498", "0.68605846", "0.6846655", "0.68445545", "0.6818112", "0.68132347", "0.67973995", "0.6783716", "0.6741074", "0.670...
0.7913045
0
Set the text of the selected element to an ISO8601 formatted datetime.
def set_element_dt(self, el_name, dt, tz=None, el_idx=0): dt = d1_common.date_time.cast_naive_datetime_to_tz(dt, tz) self.get_element_by_name(el_name, el_idx).text = dt.isoformat()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_datetime(self, datetime):\n return datetime.isoformat()", "def format_iso8601(obj):\n return obj.strftime('%Y-%m-%dT%H:%M:%SZ')", "def getAttrDateTime(self, e, name):\n val = e.get(name)\n dateVal = datetime.strptime(val,\"%Y-%m-%dT%H:%M:%S\")\n return dateVal.strftime...
[ "0.60160416", "0.59837675", "0.58897847", "0.5887512", "0.5850168", "0.5818771", "0.5792185", "0.57389456", "0.5708228", "0.569295", "0.56919295", "0.56737584", "0.5640936", "0.5635818", "0.55746555", "0.55341154", "0.5521194", "0.5516898", "0.54779214", "0.5468041", "0.54578...
0.6644105
0
Parses the Handler instance to find all callables which aren't protected (starts with '_'), or instances of Handler.
def _handlers(self): if not self.__handlers: handlers = {} for key in dir(self): # Underscores are protected if key.startswith('_'): continue attr = getattr(self, key) # Tree syntax if iss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def u2handlers(self):\n return []", "def _handlers(self) -> tuple:\n return self._classname2handlers[self.deco_class.__name__]", "def get_handlers(self):\n svs = []\n paths = self.get_paths()\n for p in paths:\n s = re.sub(r\"(?<={)\\w+}\", \".*\", p).replace(\"{\"...
[ "0.60620993", "0.57250327", "0.5673089", "0.5449978", "0.54243743", "0.5415022", "0.53942007", "0.53825504", "0.5360696", "0.5359757", "0.5322516", "0.5305773", "0.5305773", "0.5225442", "0.5197529", "0.51772535", "0.5139828", "0.5113842", "0.5112694", "0.5096272", "0.5066052...
0.63426507
0
Get the UUID of the player.
def _username_to_uuid(self, username: str) -> str: http_conn = http.client.HTTPSConnection("api.mojang.com") header = {'User-Agent': 'Minecraft Username -> UUID', 'Content-Type': 'application/json'} http_conn.request( "GET", "/users/profiles/minecraft/" + username, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_id(self):\n \n return 'audio-player-%s' % hash((time.time(),))", "def get_player_id(self):\n return self.game.get_player_id()", "def get_player_id(self):\n\n return self.player_id", "def uuid(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"uuid\")", "d...
[ "0.73326635", "0.728474", "0.72775805", "0.7048046", "0.7020953", "0.7020953", "0.7020953", "0.700895", "0.700895", "0.7005704", "0.69823635", "0.69823635", "0.69647104", "0.69174725", "0.6916713", "0.6898692", "0.6894389", "0.687858", "0.6787915", "0.67823154", "0.6727314", ...
0.68489695
18
An 'array of T' type is valid iff T is a valid, nonarray type.
def _validate_array(t): basetype = t.type if is_array(basetype): raise ArrayOfArrayError(t) validate(basetype)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_array(t):\n return isinstance(t, ast.Array)", "def isarray(a):\r\n try:\r\n validity = isinstance(a, ndarray)\r\n except:\r\n validity = False\r\n\r\n return validity", "def isarray(a):\n try:\n validity=isinstance(a,ndarray)\n except:\n validity=False\n\n ...
[ "0.7268601", "0.7067942", "0.70335424", "0.69161105", "0.68694717", "0.68320364", "0.6744537", "0.6655593", "0.6631181", "0.6603789", "0.65593135", "0.65315646", "0.652849", "0.6496802", "0.64870256", "0.6449459", "0.6345396", "0.63129985", "0.6289665", "0.62599844", "0.61802...
0.8408344
0
Initialize a new Table.
def __init__(self): # Dictionary of types seen so far. Builtin types always available. # Values : list of constructors which the type defines # This is a smartdict, so keys can be retrieved. self.knownTypes = smartdict.Smartdict() for typecon in ast.builtin_types_map.values(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_table(self, table: \"Table\"):\n if not self.columns:\n self.columns = table.columns\n self._data = table.data", "def __init__(self, *args):\n _table.Table_swiginit(self, _table.new_Table(*args))", "def __init__(self, *args):\n _snap.TTable_swiginit(self, _snap....
[ "0.81200945", "0.7962949", "0.7687565", "0.7545291", "0.7409864", "0.73864406", "0.73345435", "0.72978896", "0.7226538", "0.7220205", "0.7205668", "0.7202054", "0.71976924", "0.7191461", "0.71576416", "0.71576416", "0.71576416", "0.71576416", "0.71576416", "0.71576416", "0.71...
0.0
-1
Implement a function that normalizes each row of the matrix x (to have unit length).
def uniformizationRows(x): x_norm = np.linalg.norm(x, axis=1, keepdims=True) # 行向量平方和开根号 x = x / x_norm return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeRows(x):\n\n ### YOUR CODE HERE\n norm2 = np.linalg.norm(x,2,axis = 1).reshape(x.shape[0],-1)\n x = x/norm2\n ### END YOUR CODE\n\n return x", "def normalizerows(x):\n # Compute x_norm as the norm 2 of x. Use np.linalg.norm(..., ord=2, axis= ..., keepdims=True)\n x_norm = np.lin...
[ "0.85183686", "0.84794587", "0.8413852", "0.8387981", "0.8331784", "0.8196567", "0.80282104", "0.7980823", "0.78951055", "0.75890106", "0.75781053", "0.74963975", "0.742637", "0.7392669", "0.7376092", "0.7376092", "0.73587036", "0.7262997", "0.72211283", "0.7221105", "0.71363...
0.7513161
11
Create and save a User with the given email and password.
def create_user(self, email, password, **extra_fields): if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user", "def...
[ "0.85437864", "0.8511318", "0.85077024", "0.8502027", "0.85019606", "0.84889764", "0.84889764", "0.84882575", "0.84882575", "0.84882575", "0.84854496", "0.84765774", "0.84759104", "0.8474798", "0.8474798", "0.8474798", "0.8474798", "0.8474798", "0.8474798", "0.8474798", "0.84...
0.8456341
23
Finds if a given file extension is present in the directory.
def find_specific_file_extension_in_dir(dir_path, extension): return glob.glob(os.path.join(dir_path, r'*{}'.format(extension)))[0].replace('\\', '/').split('/')[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', path):\r\n return True", "def has_extension(filepath, extensions):\n return any(filepath.endswith(ext) for ext in extensions)", "def has_extension(self, filename):\n if filename is None:\n return False\n retu...
[ "0.78296727", "0.77626044", "0.7569853", "0.7501492", "0.7461539", "0.7431779", "0.7387349", "0.73432827", "0.73432827", "0.7338431", "0.7324811", "0.7291695", "0.72345763", "0.7211979", "0.7211979", "0.71585274", "0.7156586", "0.7148936", "0.70079666", "0.6902493", "0.689557...
0.6782226
21
Return the prefixes of a dotted name. >>> dotted_prefixes("aa.bb.cc") ['aa', 'aa.bb', 'aa.bb.cc'] >>> dotted_prefixes("aa.bb.cc", reverse=True) ['aa.bb.cc', 'aa.bb', 'aa']
def dotted_prefixes(dotted_name, reverse=False): name_parts = dotted_name.split(".") if reverse: idxes = range(len(name_parts), 0, -1) else: idxes = range(1, len(name_parts)+1) result = ['.'.join(name_parts[:i]) or '.' for i in idxes] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dotted_path(segments):\n segments_without_separators = [s[:-1] for s in segments[:-1]]\n segments_without_separators.append(segments[-1])\n return '.'.join(segments_without_separators)", "def zone_names(domain):\n fragments = domain.split('.')\n return ['.'.join(fragments[i:]) for i in range(...
[ "0.6022765", "0.58671707", "0.55240303", "0.5438187", "0.53960484", "0.5386747", "0.5350526", "0.5319152", "0.53097326", "0.53032535", "0.53005904", "0.52979624", "0.516109", "0.51079416", "0.5082074", "0.5035346", "0.5027347", "0.50088865", "0.49930736", "0.49788493", "0.497...
0.85201687
0
Checks if a goat in this position could be captured.
def is_pos_safe(self, addr: str) -> bool: for tiger_pos in self.get_all_tiger_positions(): if tiger_pos.piece.can_capture_pos(addr): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_win(self):\n return UNEXPOSED not in self.get_game() and self.get_game().count(FLAG) == len(self.get_pokemon_location)", "def can_grab(self, thing):\n return False", "def can_grab(self, thing):\n return False", "def captured(self):\n return self.game.enemyTeam.flag.carri...
[ "0.63768417", "0.6304616", "0.6304616", "0.62884665", "0.62884665", "0.62662184", "0.62662184", "0.62443227", "0.61577123", "0.61482024", "0.60645723", "0.60438615", "0.6036877", "0.6024885", "0.60145944", "0.6012126", "0.6000759", "0.5974608", "0.59501183", "0.5945777", "0.5...
0.6197087
8
Move a piece between two positions by its address. Returns true if the move was successful.
def move_piece(self, addr_from: str, addr_to: str) -> bool: pos_from = self.get_pos(addr_from) pos_to = self.get_pos(addr_to) piece = pos_from.piece if isinstance(piece, Piece): res = piece.move(pos_to) # print(f"moved {piece} from {addr_from} to {addr_to}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _move(self, start: (int, int), dest: (int, int), extra_info=''):\n moving_piece = self.board[start[0]][start[1]]\n end_piece = self.board[dest[0]][dest[1]]\n\n # Check if the move is valid\n possible_moves = self.get_all_moves()\n if State.convert_to_EAN(start, dest, extra_in...
[ "0.68301886", "0.6818215", "0.66086984", "0.65005803", "0.6480579", "0.63806236", "0.63772017", "0.636649", "0.6290251", "0.6214949", "0.6214106", "0.61747766", "0.6164447", "0.6162481", "0.6105225", "0.60745883", "0.6067893", "0.60648817", "0.6052884", "0.6034089", "0.602655...
0.8092822
0
Zeroes out rates which are uninformative
def cull_uninformative_rates(rates, inform): return rates * inform
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_zero_rates(self):\r\n self.__bootstrap_zero_coupons__()\r\n self.__get_bond_spot_rates__()\r\n return [self.zero_rates[T] for T in self.get_maturities()]", "def test_result_zero(self, rate, n, init_wealth, n_bars):\n series_wealth = init_wealth + np.zeros(n_bars)\n resu...
[ "0.7177395", "0.711723", "0.68331224", "0.65118873", "0.64457047", "0.6402241", "0.63996696", "0.6244319", "0.6231271", "0.6175478", "0.6167862", "0.6146404", "0.60793495", "0.6078265", "0.5994392", "0.5977114", "0.59527403", "0.59098345", "0.5876304", "0.57722586", "0.575263...
0.6810036
3
Test that EmailUser.objects._create_user without email raise an ValueError exception
def test_private_create_user_without_email(self): with pytest.raises(ValueError) as exinfo: EmailUser.objects._create_user(None, None, False, False) self.assertIn('email must be set', str(exinfo.value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_use_with_invalid_email(self):\n with self.assertRaises(ValueError):\n get_user_model().objects.create_user(None, password='open@123')", "def test_creating_a_new_user_without_email(self):\n\n with self.assertRaises(ValueError):\n get_user_model().objects.create_...
[ "0.8980237", "0.89562356", "0.89108115", "0.8897907", "0.8890067", "0.8890067", "0.8890067", "0.8890067", "0.8890067", "0.8889543", "0.8887051", "0.88774866", "0.8872822", "0.8859131", "0.88463163", "0.8826658", "0.8751669", "0.87022865", "0.8699824", "0.8655796", "0.86059135...
0.8948492
2
Unload Sensibo config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if await hass.config_entries.async_unload_platforms(entry, PLATFORMS): del hass.data[DOMAIN][entry.entry_id] if not hass.data[DOMAIN]: del hass.data[DOMAIN] _LOGGER.debug("Unloaded entry for %s", entry...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_config(name):\n db = dbm.open(config_file, 'c')\n del db[name]\n db.close()", "def clear(self):\r\n del self.__config\r\n self.__config = {}\r\n self.save()", "def acShutdown():\n # Update config if necessary\n if cfg.update_cfg:\n cfg.save()", "def confi...
[ "0.651566", "0.6492102", "0.62874913", "0.6278922", "0.61833173", "0.6160499", "0.6151495", "0.6067035", "0.60456467", "0.59289694", "0.59132713", "0.584025", "0.58340853", "0.57949704", "0.5758732", "0.573924", "0.57035446", "0.56980896", "0.5691844", "0.56831014", "0.567023...
0.55008256
58
Returns a list with the names of edges (ordered in the same way as in the graph)
def get_edges(self): tuples = list(self.graph.edges) dict = nx.get_edge_attributes(self.graph, 'name') edges = [] for tuple in tuples: edges.append(dict[tuple]) return edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges_names(self):\n return [(edg[0].name, edg[1].name) for edg in self._edges]", "def getEdges(self):\n # for node in graph,\n # return node -> node for j in graph[node]\n\n return [\"->\".join([str(n1), str(n2)]) for n1 in self.graph.keys() for n2 in self.graph[n1]]", "def edg...
[ "0.8764807", "0.7965441", "0.73738754", "0.71742374", "0.7083922", "0.7055936", "0.7042484", "0.6955942", "0.6912451", "0.6890552", "0.6879474", "0.67920065", "0.67897445", "0.6786462", "0.6784994", "0.67837", "0.67505616", "0.6742401", "0.67248994", "0.6724661", "0.6682827",...
0.7131337
4
Return dictionary of initial storage states
def get_heat_stor(self): out = {} for node_name, node_obj in self.nodes.items(): for comp_name, comp_obj in node_obj.get_heat_stor().items(): out['.'.join([node_name, comp_name])] = comp_obj return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getstate(self):\n return {}", "def __getstate__(self):\n state = {\n 'connector_keys' : self.connector_keys,\n 'metric_key' : self.metric_key,\n 'location_key' : self.location_key,\n 'parameters' : self.parameters,\n 'mrsm_instance' : self...
[ "0.70408183", "0.70337296", "0.68019986", "0.6626433", "0.6583845", "0.6583845", "0.6563593", "0.64705276", "0.6437133", "0.64204884", "0.64204884", "0.6395019", "0.636914", "0.6354147", "0.63470924", "0.6340963", "0.63282716", "0.6304431", "0.6298344", "0.6284666", "0.628120...
0.0
-1
Add balance equations after all blocks for this node and subcomponents have been compiled
def _add_bal(self): c = self.components p = self.pipes # TODO No mass flow reversal yet if self.temperature_driven: lines = self.params['lines'].v() self.block.mix_temp = Var(self.TIME, lines) def _temp_bal_incoming(b, t, l): inco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_balances(self, recursive=True):\n if self.node:\n if recursive:\n if self.node.left:\n self.node.left.update_balances()\n if self.node.right:\n self.node.right.update_balances()\n\n self.balance = self.node....
[ "0.6054147", "0.58334726", "0.5670819", "0.56580913", "0.56235176", "0.55567765", "0.5514667", "0.5377202", "0.53753936", "0.5350596", "0.52809346", "0.52765864", "0.52592015", "0.5246449", "0.5235047", "0.5230758", "0.52254176", "0.52158594", "0.51965415", "0.51801145", "0.5...
0.546225
7
Check to see if there are unmerged patch files from /srv/patches for a given revision.
def check_patch_files(version, cfg): logger = logging.getLogger('check_patch_files') # Patches should live in /srv/patches/[version] patch_path = cfg['patch_path'] if patch_path is None: return version_base = os.path.join(patch_path, version) ext_dir = os.path.join(version_base, 'ext...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasUnappliedDatabasePatches(deploymentPath, revision):\n path = os.path.join(deploymentPath, revision, 'fluidinfo')\n with cd(path):\n with settings(warn_only=True):\n out = sudo('bin/python bin/fluidinfo '\n 'patch-status postgres:///fluidinfo', user='fluidinfo')\...
[ "0.6747199", "0.63514054", "0.5787946", "0.571065", "0.5706241", "0.56494606", "0.56411487", "0.5574085", "0.55628467", "0.5545786", "0.552631", "0.55009574", "0.54736805", "0.54680383", "0.5434093", "0.53959745", "0.5357477", "0.53343767", "0.5313679", "0.52986103", "0.52769...
0.646274
1
Returns True if quantity of items in stock is less or equal to running out level set
def running_out(self): return self.quantity <= self.running_out_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needRestock(self):\n # TODO check if the quantity<threshold and return true if it is\n # we'll set for now the threshold at *five* items\n # so we need to check if self.quantity is less than five.\n\n threshold = 5\n if self.quantity < threshold or PerishableStockItem.pastSel...
[ "0.7058821", "0.6774906", "0.6749879", "0.66084254", "0.6426332", "0.64241284", "0.6273235", "0.6272138", "0.6267329", "0.62376887", "0.62362623", "0.6151465", "0.61491424", "0.6147428", "0.61192626", "0.611071", "0.60732037", "0.6062483", "0.6035766", "0.60297716", "0.595885...
0.6798015
1
Increment 'rates_total' field and set new value to 'average_rate' field of the Item object every time new rate is set
def save(self, *args, **kwargs): self.item.rates_total += 1 self.item.average_rate += (self.item.average_rate + self.rate) / self.item.rates_total self.item.save() super(Rate, self).save(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rating_average(self, rating):\n self.num_ratings += 1\n self.rating_total += rating\n self.save(update_fields=[\"num_ratings\", \"rating_total\"])\n self.average_rating = int(round(self.rating_total/self.num_ratings))\n self.save(update_fields=[\"average_rating\"])\n ...
[ "0.7321416", "0.66296947", "0.65281373", "0.65063566", "0.65063566", "0.64591575", "0.64470184", "0.63789356", "0.6359085", "0.6314785", "0.6285263", "0.6284265", "0.6283313", "0.62690187", "0.6254097", "0.6243333", "0.6189606", "0.6189606", "0.6111474", "0.6034977", "0.59974...
0.8508447
0
Return all of the registered subclasses in this class's namespace.
def registered_subclasses(cls) -> Dict[str, RegisteredSubclassList]: return { name: cls.registered_subclasses_by_name(name) for name in cls.__registered_subclasses__.keys() if len(cls.registered_subclasses_by_name(name)) > 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_named_subclasses(cls):\n\n subclasses = set()\n\n # Search each of our subclasses...\n for subclass in cls.__subclasses__():\n # If the current class is named, add it to our list...\n if subclass.UI_NAME:\n subclasses.add(subclass)\n\n # ...
[ "0.741222", "0.740364", "0.73563385", "0.711135", "0.7018451", "0.6991726", "0.6965637", "0.6960461", "0.69340235", "0.68089914", "0.6794711", "0.67932886", "0.67883366", "0.6768203", "0.67035", "0.6696795", "0.66884154", "0.66816986", "0.66578376", "0.66443104", "0.6643126",...
0.7070527
4
Return all of the registered subclasses for a given name that are a proper subclass of this class.
def registered_subclasses_by_name(cls, name) -> RegisteredSubclassList: return [ subclass for subclass in cls.__registered_subclasses__.get(name, []) if issubclass(subclass, cls) and subclass is not cls ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subclasses(self, class_name):\n return class_name.__subclasses__()", "def all_named_subclasses(cls):\n\n subclasses = set()\n\n # Search each of our subclasses...\n for subclass in cls.__subclasses__():\n # If the current class is named, add it to our list...\n ...
[ "0.7883098", "0.7543909", "0.7074033", "0.6891646", "0.6767185", "0.67396295", "0.6564497", "0.6554241", "0.63487107", "0.6294811", "0.6273062", "0.6244816", "0.62022436", "0.6187426", "0.6159351", "0.6154411", "0.6154411", "0.61098695", "0.6094665", "0.60649866", "0.60130835...
0.839856
0
Change field to more friendly value.
def __str__(self): return self.Name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_readable(self, value):\n return value", "def get_string_value(self, obj, field):\n return smart_unicode(field.value_to_string(obj))", "def field_display(obj, field):\n return get_field_value(obj, field)", "def format_field(model, name, value):\n if value is None: return value\n ...
[ "0.64163786", "0.64045805", "0.6230152", "0.6197962", "0.6049613", "0.60457075", "0.60409987", "0.60119575", "0.5987234", "0.596578", "0.5954733", "0.5949111", "0.59255826", "0.5907281", "0.5885562", "0.58582", "0.5850745", "0.58349216", "0.5817909", "0.5727358", "0.5720516",...
0.0
-1
Change field to more friendly value.
def __str__(self): return self.Title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_readable(self, value):\n return value", "def get_string_value(self, obj, field):\n return smart_unicode(field.value_to_string(obj))", "def field_display(obj, field):\n return get_field_value(obj, field)", "def format_field(model, name, value):\n if value is None: return value\n ...
[ "0.64181435", "0.6407031", "0.62318605", "0.6199098", "0.60499734", "0.6047273", "0.6042602", "0.6009652", "0.59889525", "0.59655845", "0.5955943", "0.59459305", "0.59282154", "0.5906922", "0.58868504", "0.58601195", "0.5848213", "0.5836326", "0.5817839", "0.57272786", "0.571...
0.0
-1
Called when the user specifies an intent for this skill
def on_intent (intent_request, session): global session_attributes p_node = "" print("on_intent requestId=" + intent_request['requestId'] + ", sessionId=" + session['sessionId']) try: print("session previous node name is" + session_attributes['previous_node']) p_node = sessi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ...
[ "0.71430594", "0.69552237", "0.6948083", "0.6905248", "0.6892207", "0.6763211", "0.67538756", "0.67219484", "0.6719871", "0.67152613", "0.6698335", "0.66911006", "0.6669216", "0.6644265", "0.6641675", "0.6638301", "0.6607477", "0.65941316", "0.65746164", "0.65694714", "0.6561...
0.0
-1
Determines if nick has a given rank. Defaults to false if nick is not registered.
def _has_rank(self, nick, rank): user = nick.split('!')[0] if user in self.users and self.users[user]['authenticated_at']: actual_rank = self.users[user]['rank'] if rank == 'none': return True if rank == 'voice' and actual_rank in ('voice', 'half-op', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_rank(self, rank):\n for card in self.cards:\n if card.rank == rank:\n return True\n return False", "def is_rank(self, rank: RankLike) -> bool:\n\n if isinstance(rank, Rank):\n return self.rank == rank\n elif isinstance(rank, str):\n ...
[ "0.7856904", "0.7297953", "0.6947024", "0.61633563", "0.59573346", "0.5913768", "0.58583415", "0.5767362", "0.5685322", "0.5598793", "0.551664", "0.5485738", "0.547762", "0.54646134", "0.5406755", "0.53569126", "0.5351782", "0.53459543", "0.53358555", "0.5309997", "0.5265431"...
0.84574145
0
Make box plots from DataFrameGroupBy data.
def boxplot_frame_groupby( grouped, subplots: bool = True, column=None, fontsize: int | None = None, rot: int = 0, grid: bool = True, ax=None, figsize: tuple[float, float] | None = None, layout=None, sharex: bool = False, sharey: bool = True, backend=None, **kwargs, )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box(df):\n data = []\n\n for prop_type in df['property_type'].unique():\n df_filt = df[df['property_type'] == prop_type]\n data.append(\n go.Box(\n y=df_filt['price_paid'].values,\n x=df_filt['year'].values,\n name=prop_type,\n ...
[ "0.6913194", "0.6854868", "0.68304986", "0.6814123", "0.6789308", "0.677085", "0.67126036", "0.66805327", "0.662606", "0.6621172", "0.66030794", "0.65600044", "0.655631", "0.651553", "0.65022236", "0.6355091", "0.63200086", "0.62828976", "0.6268113", "0.6248913", "0.62152463"...
0.5870896
38
Can expand_transactions do a basic expansion?
def test_if_expand_transactions_works(self): # create pandas df to pass in, along with correct expansion # df.in: # Badge Qty Cmdty Price # 0 4 1 BP1 10 # 1 5 2 BP1 12 # 2 4 3 BP1 10 # df.out: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_transactions(session, user_id, expand=False):\n if expand:\n result = session.query(Transaction).filter(Transaction.user_phone == user_id).all()\n transaction_schema = TransactionSchema()\n transactions = [transaction_schema.dump(r).data for r in result]\n else:\n res...
[ "0.5415126", "0.5299976", "0.52820116", "0.5281367", "0.5151515", "0.5115945", "0.51059294", "0.50741404", "0.50590974", "0.50300115", "0.5011892", "0.5009598", "0.5009502", "0.50091445", "0.49657786", "0.49431652", "0.4929163", "0.49100354", "0.49046612", "0.48959568", "0.48...
0.70023584
0
Calculates the equivalent km to the input miles
def handle_calculate(self, text_input): self.output_text = f'{float(self.get_valid_value(text_input)) * MILE_TO_KM_FACTOR:.3f}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def miles_to_kilometers(miles):\n #convert miles to km:\n return miles*1.60934", "def kilometers_to_miles(km):\n #convert km to miles:\n return km*0.621371", "def km2m(km):\n return km * 1000", "def miles_to_kilometers(miles: float) -> float:\n mile = float(miles)\n kilometers = float(fl...
[ "0.78242373", "0.7524305", "0.724568", "0.7075588", "0.6966431", "0.69285303", "0.6907654", "0.6901715", "0.68600583", "0.6851965", "0.68237203", "0.6788575", "0.6679422", "0.65561616", "0.6514525", "0.6471732", "0.6447639", "0.6445172", "0.6430164", "0.64240295", "0.64205945...
0.0
-1
Get all the ns instance models
def get_ns_info(self, is_sol=False): if self.ns_filter and "ns_inst_id" in self.ns_filter: ns_inst_id = self.ns_filter["ns_inst_id"] ns_insts = NSInstModel.objects.filter(id=ns_inst_id) else: ns_insts = NSInstModel.objects.all() result = [] for ns_inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_models(self):\n self.load()\n return self._models", "def all_model_instances(self) -> Iterator['panda_core_data.model.Model']:\n for current_type in self.all_models:\n for current_instance in current_type.all_instances:\n yield current_instance", "def inde...
[ "0.68864083", "0.6847077", "0.67271155", "0.6657664", "0.6590258", "0.6571301", "0.653106", "0.6515408", "0.64586544", "0.64461714", "0.64461714", "0.6445483", "0.6393697", "0.6391405", "0.636739", "0.6303757", "0.62975174", "0.62332475", "0.62195146", "0.6209198", "0.6204461...
0.0
-1
extract patches (with or without context) from a 3D image if the user sets patch_size equal to 1 and ctx_radius equal to (0,), then all (and only) the values of idxs will be directly pulled from the numpy array (very fast!) if the user sets patch_size equal to 0, then the central pixel will not be extracted, only the s...
def extract_patches(data, idxs=None, patch_size=3, min_val=0, ctx_radius=(3,5,7), economy_patch=True, mean=False): # catch errors and setup the initialize values of required variables if idxs is None: idxs = np.where(data > min_val) if patch_size % 2 != 1 and patch_size > 0: raise SynthError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_patch(self, patch_radius, full_x, full_y, full_i, full_j):\n com_ijs = [self.center_of_mass_ij(time) for time in self.times]\n patch_grid = []\n patch_mask = []\n patch_x = []\n patch_y = []\n patch_i = []\n patch_j = []\n for t, time in enumerate...
[ "0.7090064", "0.6793001", "0.65807337", "0.6453943", "0.64293873", "0.6395926", "0.61576813", "0.61506754", "0.60751665", "0.6045121", "0.601196", "0.5989834", "0.5948674", "0.5909477", "0.5879795", "0.58778334", "0.5872079", "0.58591396", "0.58397543", "0.5822568", "0.581336...
0.6930896
1
Generate a random string with the combination of lowercase and uppercase letters
def randomString(stringLength): letters = string.ascii_letters return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string(length=1, uppercase=False, lowercase=False):\n characters = digits\n code = str()\n\n if uppercase:\n characters += ascii_uppercase\n if lowercase:\n characters += ascii_lowercase\n\n while len(code) < length:\n character = choice(characters)\n if len(co...
[ "0.7946826", "0.7738986", "0.7679305", "0.7657063", "0.7609224", "0.7529105", "0.7509637", "0.74899936", "0.73721504", "0.73713845", "0.73095775", "0.7270342", "0.7263459", "0.7245338", "0.7229803", "0.7196288", "0.7176311", "0.71762294", "0.7166171", "0.7165482", "0.7164123"...
0.0
-1
If author conditions match, run child actions.
def run(self): # If the author doesn't match, don't do anything. if not self.regex.search(self.author): return 0 # Execute the child actions. self.context.tokens['Author'] = self.author return super(FilterAuthor, self).run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # If the user name doesn't match, do nothing.\n if not self.regex.match(self.user): return 0\n\n # Execute the child actions.\n return super(FilterUser, self).run()", "def _run_actions(self):\n\n if \"install-bento\" in self.actions:\n self._do_actio...
[ "0.61574596", "0.61307675", "0.60542125", "0.5880891", "0.5762093", "0.5703147", "0.56884307", "0.56884307", "0.5659398", "0.5623402", "0.5615381", "0.5615381", "0.5615381", "0.5613559", "0.5605133", "0.5605133", "0.5571688", "0.5568924", "0.5560718", "0.5534824", "0.549065",...
0.72102934
0
Returns whether existing static bindings require an update.
def static_bindings_require_refresh(options, config_build_dir, settings): lldb_wrap_python_src_path, lldb_py_src_path = static_binding_paths(options) # Check if LLDBWrapPython.cpp C++ static binding is different than # in the build dir. if not os.path.exists(lldb_wrap_python_src_path): logging.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needs_update(self) -> bool:\n return False", "def needs_update(self):\n return not self.config.same_as(self._stored_config,\n excluded=[\"cmake_generator\"])", "def dependency_update(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, ...
[ "0.6690729", "0.644464", "0.6159469", "0.6119258", "0.6105362", "0.60355103", "0.6032068", "0.60197634", "0.599974", "0.59849477", "0.59849477", "0.59849477", "0.59849477", "0.59849477", "0.5874212", "0.58567077", "0.58344716", "0.58330137", "0.58108795", "0.577966", "0.57693...
0.6095028
5
The ID of the current affiliation according to Scopus.
def affiliation_current(self): return self._json.get('affiliation-current', {}).get('@id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affiliation_id(self):\n return self._aff_id", "def affiliate_oid(self):\n return self._affiliate_oid", "def association_id(self) -> Optional[str]:\n return pulumi.get(self, \"association_id\")", "def getIdent (self) :\n return self.id", "def id(self) -> str:\n return ...
[ "0.81198645", "0.7606688", "0.6611478", "0.66044164", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", "0.6596886", ...
0.76033723
2
Class to represent a Scopus Author query by the scopusid.
def __init__(self, author_id, refresh=False): # Load json self._id = str(int(str(author_id).split('-')[-1])) Retrieval.__init__(self, self._id, 'AuthorRetrieval', refresh) self._json = self._json['author-retrieval-response'] # Checks try: self._json = self._js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orcid_for_inspire_author(self, author):\n ids = author.get(\"ids\", [])\n for id in ids:\n if id[\"schema\"] == \"ORCID\":\n return id[\"value\"]", "def query_by_author(cls,aid):\n gds = from_cache('VG_%s'%aid)\n if not gds:\n gds = [str(g.id()...
[ "0.5821403", "0.57149875", "0.5504118", "0.54856455", "0.54786545", "0.5441735", "0.537706", "0.5319915", "0.5319915", "0.5319915", "0.52745295", "0.52745295", "0.5273645", "0.5256441", "0.5248979", "0.5248979", "0.52442986", "0.5242263", "0.523816", "0.5237666", "0.5222103",...
0.5445242
5
Initializes name or raises exceptions.
def name(self, new_name): if type(new_name) != str: raise TypeError elif len(new_name) > self.NAME_LEN_MAX: raise ValueError else: self._name = new_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self, name) :\n\t\ttry :\n\t\t\tself._name = name\n\t\texcept Exception as e:\n\t\t\traise e", "def __init__(self, name: str) -> None:\n self._name = name", "def __init__(self, name):\n self._name = name\n pass", "def __init__(self, name):\n self._name = name", "def __i...
[ "0.7331325", "0.7316429", "0.73054016", "0.72824514", "0.72824514", "0.72335076", "0.7216129", "0.71950895", "0.7117422", "0.7094429", "0.706005", "0.6988624", "0.6988624", "0.6988624", "0.6988624", "0.6988624", "0.6988624", "0.6982934", "0.6972627", "0.6972627", "0.6972627",...
0.0
-1
Returns the birth date.
def date(self): return self._date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def birth_date(self) -> str:\n return self._birth_date", "def birthdate_date(self):\n\n bday = self.birthdate\n if bday:\n dt = datetime.datetime.strptime(\n bday,\n \"%d %b %Y\") # not sure if this format even complies with spec\n # dt = ...
[ "0.869477", "0.8532876", "0.8414813", "0.84118456", "0.8086971", "0.8073747", "0.7908046", "0.78920686", "0.7741814", "0.7490186", "0.7279895", "0.7075022", "0.6997279", "0.69565374", "0.67772436", "0.67618597", "0.67498857", "0.67309785", "0.67280513", "0.67269915", "0.67071...
0.55270994
92
Returns the index of the name in the list through linear search.
def linear_search(cls, student_list, name): for i in range(len(student_list)): if name == student_list[i].name: return i return cls.NOT_FOUND
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_search(cls, student_list, name):\n index = cls.binary_search_h(student_list, name, 0,\n len(student_list) - 1)\n return index", "def linear_search(mylist, key):\r\n for i in range(len(mylist)):\r\n if mylist[i] == key:\r\n return i\...
[ "0.75526994", "0.7475514", "0.73415667", "0.73283374", "0.7212527", "0.7175193", "0.71190345", "0.69839907", "0.6914055", "0.69122297", "0.68360955", "0.6830471", "0.6802668", "0.67936033", "0.67802715", "0.67586553", "0.674661", "0.6701394", "0.66132295", "0.65922177", "0.65...
0.8503366
0
Returns the index of the name in the list through binary search.
def binary_search(cls, student_list, name): index = cls.binary_search_h(student_list, name, 0, len(student_list) - 1) return index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_search(cls, student_list, name):\n for i in range(len(student_list)):\n if name == student_list[i].name:\n return i\n return cls.NOT_FOUND", "async def _exact_search(self, name, splits_list=None): \n\n # Generates a list if not provided \n if split...
[ "0.7921743", "0.7267634", "0.7134139", "0.7120976", "0.69717205", "0.68718535", "0.6849081", "0.6835377", "0.680086", "0.6779261", "0.67450905", "0.67212695", "0.6694472", "0.66890866", "0.6676077", "0.6675736", "0.66697437", "0.66634756", "0.66575396", "0.66444063", "0.66423...
0.8307284
0
Returns the index of the largest item in the list.
def get_largest_index(student_list, length): largest_index = 0 for i in range(length): if student_list[i] > student_list[largest_index]: largest_index = i return largest_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_item(list):\n pass", "def indexOfMax(list):\n max = -np.Infinity\n index = 0\n i = 0\n for value in list:\n if value > max:\n max = value\n index = i\n i += 1\n return index", "def index_largest(seq):\n assert len(seq) > 0\n x, greatest, i...
[ "0.79740417", "0.7768458", "0.7741354", "0.7511112", "0.73583585", "0.7314375", "0.73022014", "0.72367394", "0.7216943", "0.7091791", "0.7061966", "0.7031335", "0.69689447", "0.6950506", "0.6833915", "0.6833915", "0.6833915", "0.6793978", "0.6792949", "0.6781937", "0.6779124"...
0.73254013
5
Read the iris data set and split them into training and test sets
def get_iris_data(): iris = datasets.load_iris() data = iris["data"] target = iris["target"] # Prepend the column of 1s for bias N, M = data.shape all_X = np.ones((N, M + 1)) all_X[:, 1:] = data # Convert into one-hot vectors num_labels = len(np.unique(target)) all_Y = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_in_and_split_data(iris_data):\n iris_data = datasets.load_iris()\n data = iris_data['data']\n targets = iris_data['target']\n train_data, test_data, train_targets, test_targets = train_test_split(data, targets, test_size=0.1) \n return (train_data, test_data, train_targets, test_targets)", ...
[ "0.86840147", "0.7412835", "0.73949766", "0.72888356", "0.71956486", "0.7190181", "0.7138559", "0.71093816", "0.70930296", "0.7055825", "0.6988381", "0.6981499", "0.6958128", "0.695424", "0.6951528", "0.69407564", "0.69405776", "0.6924203", "0.69197077", "0.6915284", "0.69124...
0.7305273
3
haveibeenpwned.com API setup class, contains required headers, api key etc
def __init__(self, api_key): self._api_key = api_key self.headers = { "hibp-api-key": api_key, "user-agent": "haveibeenpywned.py", } """Dict of additional headers required for api calls to the haveibeenpwned.com api"""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,url=\"localhost\",api=None,apikeyfile=None):\n self.url = url\n\n if api == None:\n if apikeyfile == None:\n try:\n self.api = self.apikey()\n except:\n self.api = \"\"\n else:\n ...
[ "0.74662167", "0.74065113", "0.7307669", "0.7267622", "0.7248045", "0.72415316", "0.7164782", "0.70773506", "0.7052166", "0.7046896", "0.7025002", "0.7021696", "0.69985604", "0.6948251", "0.69243574", "0.689379", "0.6875908", "0.68664426", "0.685007", "0.6796857", "0.6784413"...
0.80104417
0
Returns all "data classes". A "data class" is an attribute of a record compromised in a breach. For example, many breaches expose data classes such as "Email addresses" and "Passwords".
def get_data_classes(self): return self._do_request("dataclasses")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataclasses(self):\n return self._dataclasses", "def get_classes(self):\n query = read_query('structure exploration/classes')\n response = self._submit_query(query)\n\n return [elem['c']['value'].split('/')[-1] for elem in response]", "def return_classes(self):\n\n\t\t \n\t\t ...
[ "0.7593299", "0.6969874", "0.69365895", "0.6611238", "0.6560574", "0.6528585", "0.6518693", "0.65047234", "0.65005875", "0.6491597", "0.64866287", "0.6425726", "0.64042854", "0.63857615", "0.6369201", "0.63456434", "0.62851804", "0.6271262", "0.6267843", "0.6267843", "0.62238...
0.79020566
0
Generates a set of random angle positions for each joint.
def _pick_random_angles_(self): movej_q = self._q_ref.copy() while True: reset_angles = self._rand_obj_.uniform(self._angles_low, self._angles_high) movej_q[self._joint_indices] = reset_angles inside_bound, inside_buffer_bound, mat, xyz = self._check_bound(movej_q) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_joint_angles(robot):\n n = len(robot.a)\n ub = np.array(list(robot.ub.values()))\n lb = np.array(list(robot.lb.values()))\n\n ja = np.random.random(n) * (ub - lb) + lb\n ja = list_to_variable_dict(ja)\n return ja", "def randomize_trajectory(self):\n self.angle = randint(-360, ...
[ "0.74707836", "0.65016574", "0.647303", "0.6099726", "0.6061551", "0.59800303", "0.5957063", "0.5844553", "0.58117163", "0.57865286", "0.57756066", "0.5731834", "0.5723282", "0.5719301", "0.5636434", "0.5618039", "0.5589569", "0.55706424", "0.5530735", "0.5530735", "0.5518055...
0.6849419
1
Calculate a sha256 hash of the first MB of a file and every 512MB offset
def fast_hash(infile): m = hashlib.sha256() with open(infile, 'rb', 1024 * 1024) as f: l = f.read(1024 * 1024) while (len(l) > 0): m.update(l) f.seek(1024 * 1024 * (512 - 1), 1) l = f.read(1024 * 1024) return m.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeHash(filename):\n fileHash = hashlib.sha256()\n with open(filename, \"rb\") as f:\n for chunk in iter(lambda: f.read(4096), b\"\"):\n fileHash.update(chunk)\n return fileHash.hexdigest()", "def hash_for_file(file_name, block_size=2 ** 20):\n hasher = SHA256.new()\n sou...
[ "0.7526049", "0.7483799", "0.7458667", "0.73816144", "0.7287259", "0.72815084", "0.7263004", "0.71712226", "0.71708715", "0.7146456", "0.713434", "0.7113393", "0.7069692", "0.7042622", "0.7037928", "0.70223695", "0.70124155", "0.7011414", "0.70032585", "0.69882447", "0.698549...
0.7718487
0
Calculate relative positionaware dotproduct selfattention. The attention calculation is augmented with learned representations for the relative position between each element in q and each element in k and v.
def dot_product_attention_relative(q, k, v, bias, relative_embedding_keys, relative_embedding_values, dropout=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaled_dot_product_attention(q, k, v, mask): # noqa\n\n matmul_qk = tf.matmul(\n q, k, transpose_b=True\n ) # (..., seq_len_q, seq_len_k)\n\n # scale matmul_qk\n dk = tf.cast(tf.shape(k)[-1], tf.float32)\n scaled_attention_logits = matmul_qk / tf.math.sqrt(dk)\n\n # add the mask to t...
[ "0.68195266", "0.68038666", "0.6799893", "0.6799893", "0.67888033", "0.6776201", "0.6765243", "0.67502666", "0.67109114", "0.67029536", "0.6660924", "0.65879524", "0.6382919", "0.63718426", "0.6223819", "0.6204725", "0.604961", "0.600069", "0.59804153", "0.5865115", "0.586252...
0.7610927
0
Nonparametric bootstrapping for mean and standard deviation of data.
def bootstrap(data, iterations=10000): boot_mean = [] for n in range(0, iterations): boot = resample(data, replace=True, n_samples=None, random_state=None) boot_mean.append(np.mean(boot)) final_mean = np.mean(boot_mean) final_std ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n df = pd.read_csv('data/Boston.csv')\n n_obs = len(df)\n np.random.seed(111)\n\n # Part a\n medv_mean = np.mean(df['medv'])\n print('medv mean = {:.3f}'.format(medv_mean))\n\n # Part b\n medv_stan_err = statistics.stdev(df['medv']) / np.sqrt(n_obs)\n print('medv standard err...
[ "0.64253616", "0.63953525", "0.6324652", "0.6264044", "0.62474877", "0.62136763", "0.6040646", "0.6036641", "0.60337794", "0.6004637", "0.59977597", "0.5925892", "0.59084326", "0.5883746", "0.5877968", "0.58090675", "0.5792603", "0.5782245", "0.5737146", "0.5729175", "0.57289...
0.6924311
0
Calculate the square of the standard deviation divided by mean. Returns a dataframe.
def calc_sq_std(df): sq_std = df.dropna() sq_std = (df['std'].divide(df['mean']))**2 sq_std.name = 'sq_std' sq_std = pd.DataFrame(sq_std) sq_std = sq_std.dropna() return sq_std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_std(self):\r\n cov = self.to_sparse().diagonal()\r\n std = np.sqrt(cov)\r\n return pd.Series(std, index=self.data.index, name=\"STD\")", "def std(dfs):\n df_mean = mean(dfs)\n df_sq = sum([(df - df_mean)*(df - df_mean) for df in dfs])\n return df_sq / len(dfs)", "def stdev(items...
[ "0.713817", "0.7034297", "0.7009347", "0.6928206", "0.6914255", "0.6885497", "0.68430775", "0.683856", "0.6800903", "0.67548", "0.6750036", "0.67378706", "0.6733283", "0.6724245", "0.6690851", "0.66537976", "0.66349167", "0.6623512", "0.6600477", "0.6569947", "0.6564526", "...
0.8169658
0
Return points as a DataFrame
def get_df(self): return pd.DataFrame(self.points)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reach_points_as_dataframe(self) -> pd.DataFrame:\n df_pt = pd.DataFrame([pt.as_dictionary for pt in self._reach_points])\n df_pt.spatial.set_geometry('SHAPE')\n return df_pt", "def as_DF(self):\n\n gs_df = pd.DataFrame(self.P, columns=self.xvec, index=self.yvec)\n gs_df.col...
[ "0.7914209", "0.70626533", "0.6857107", "0.66520613", "0.65722036", "0.65693396", "0.6465779", "0.6420738", "0.6405561", "0.6378418", "0.6370319", "0.6352421", "0.6351393", "0.63387316", "0.63144183", "0.63144183", "0.63144183", "0.63144183", "0.63144183", "0.62535036", "0.61...
0.82998013
0
Get a timestamp of the current date in the preferred format
def get_timestamp(): return time.strftime('%Y-%m-%d %H:%M:%S')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_date_time_stamp():\n return datetime.now().strftime('%Y.%m.%d %H:%M:%S.%f')[:-7]", "def timestamp(): \n timestamp = datetime.today().strftime('%Y-%m-%d')\n \n return timestamp", "def get_current_timestamp_str(self):\n return str(time.mktime(datetime.datetime.now().timetuple()))",...
[ "0.81133074", "0.8088549", "0.80845183", "0.8037244", "0.79379404", "0.7909125", "0.7861129", "0.78309476", "0.7793799", "0.7789436", "0.77821374", "0.7781246", "0.77583665", "0.7755523", "0.77465737", "0.77060443", "0.76667833", "0.7661988", "0.76394886", "0.76190346", "0.76...
0.7522288
25
Generate the XML string representation of this object. It doesn't use any special python module to keep compatibility with Slicer
def to_xml(self): output = '<?xml version="1.0" encoding="utf8"?><GeometryTopologyData>' if self.num_dimensions != 0: output += ('<NumDimensions>%i</NumDimensions>' % self.num_dimensions) output += ('<CoordinateSystem>%s</CoordinateSystem>' % self.__coordinate_system_to_str__(self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toXML(self):\n return self._xmlpre+\"\\n\".join(map(lambda f:f.toXML(),self._items))+self._xmlpost", "def get_xml(self):\n return etree.tostring(self.get_etree())", "def xml(self):\n raise NotImplementedError('must be implemented by all subclasses')", "def __str__(self):\n result ...
[ "0.7444018", "0.7417709", "0.73246074", "0.72655046", "0.71488553", "0.7119824", "0.7117236", "0.70290947", "0.70209783", "0.6985477", "0.69573355", "0.69437337", "0.6937302", "0.6921697", "0.6891177", "0.6852785", "0.6818636", "0.67883563", "0.6773768", "0.6747661", "0.67208...
0.65540385
42
Get the xml string representation of the point
def to_xml(self): # lines = super(FileCatNoEmpty, self).cat(filepath) structure = super(Point, self).to_xml() coords = GeometryTopologyData.__to_xml_vector__(self.coordinate, self.format) # description_str = '' # if self.description is not None: # description_str = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toXML(self, *args):\n return _libsbml.Point_toXML(self, *args)", "def to_xml(self):\n output = '<?xml version=\"1.0\" encoding=\"utf8\"?><GeometryTopologyData>'\n if self.num_dimensions != 0:\n output += ('<NumDimensions>%i</NumDimensions>' % self.num_dimensions)\n\n ou...
[ "0.8101803", "0.7010831", "0.6940374", "0.6851222", "0.67575705", "0.6746641", "0.67308795", "0.66953325", "0.6676879", "0.6654264", "0.6587637", "0.6562918", "0.65483993", "0.65205294", "0.6508712", "0.6501561", "0.64824957", "0.64060384", "0.6381412", "0.63755596", "0.63748...
0.81740326
0
Return a new instance of a Point object from xml "BoundingBox" element
def from_xml_node(xml_bounding_box_node): structure = Structure.from_xml_node(xml_bounding_box_node) coordinates_start = [] for coord in xml_bounding_box_node.findall("Start/value"): coordinates_start.append(float(coord.text)) coordinates_size = [] for coord in xml_bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_box_from_xml(bounds):\n return bounds['@maxlat'], bounds['@minlat'], bounds['@maxlon'], bounds['@minlon'],", "def get_bounding_box_from_xml_path(path: Path) -> np.ndarray:\n with open(path, mode=\"r\") as file:\n bs = BeautifulSoup(file, \"xml\")\n\n x_min = float(bs.bndbox.xmin.string)\n...
[ "0.6762533", "0.6513566", "0.64866483", "0.63503605", "0.632924", "0.6262937", "0.6238842", "0.61690426", "0.6150288", "0.59898925", "0.5892474", "0.58671874", "0.5836598", "0.5829366", "0.5809731", "0.57863283", "0.5755876", "0.56877697", "0.56653863", "0.56519485", "0.56515...
0.75214934
0
Get the xml string representation of the bounding box
def to_xml(self): start_str = GeometryTopologyData.__to_xml_vector__(self.start, self.format) size_str = GeometryTopologyData.__to_xml_vector__(self.size, self.format) structure = super(BoundingBox, self).to_xml() return '<BoundingBox>%s<Start>%s</Start><Size>%s</Size></BoundingBox>' % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toXML(self):\n return _libsbml.BoundingBox_toXML(self)", "def get_box_from_xml(bounds):\n return bounds['@maxlat'], bounds['@minlat'], bounds['@maxlon'], bounds['@minlon'],", "def test_bounding_box_io(self):\n\n s = \"\"\"<element><id>floor1</id><category>floor</category><bounds>\\\n<corne...
[ "0.7772671", "0.7068699", "0.6873577", "0.6646032", "0.65720594", "0.6563929", "0.65543574", "0.6476132", "0.6381904", "0.63593704", "0.6266397", "0.62451667", "0.62451667", "0.62089556", "0.62076813", "0.620574", "0.619256", "0.61894584", "0.61849076", "0.6179268", "0.615582...
0.7647968
1
Sets pin to 0 output level.
def off(self) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pin(self):\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(self.pin, GPIO.OUT)\n GPIO.output(self.pin, GPIO.LOW)\n time.sleep(3)\n GPIO.output(self.pin, GPIO.HIGH)", "def gpio_output_low(self, pin: int) -> None:\n self._pins[pin - 1] = \"...
[ "0.71061224", "0.7041869", "0.7000544", "0.69910437", "0.6893605", "0.68816113", "0.6743418", "0.6674658", "0.6450905", "0.6414794", "0.64028215", "0.63959575", "0.63413215", "0.629648", "0.6288892", "0.62748", "0.6255868", "0.62488633", "0.6238575", "0.62362516", "0.62336636...
0.0
-1
Sets pin to 1 output level.
def on(self) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pin(self):\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(self.pin, GPIO.OUT)\n GPIO.output(self.pin, GPIO.LOW)\n time.sleep(3)\n GPIO.output(self.pin, GPIO.HIGH)", "def set(pin, val=1):\n if val not in [0,1]:\n raise RuntimeError\n ...
[ "0.69885653", "0.6881948", "0.6804933", "0.6759037", "0.667056", "0.65865165", "0.65591294", "0.65591294", "0.6550606", "0.64962894", "0.6437662", "0.63883775", "0.6325998", "0.6258773", "0.6255017", "0.62526935", "0.62266445", "0.62118626", "0.61594224", "0.61354446", "0.609...
0.0
-1
Turns on PWM functionality on the associated pin.
def init(self) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pwm_pin(self, pin_obj):\n self.hw_interfaces[\"pwm\"][pin_obj.name] = PWM(pin=pin_obj)", "def togglePWMEnable(self):\n mask = 1 << 3\n self._injectFault(\"PWM1TCR\", self.TCR, mask)", "def on(self):\n if not self._is_on:\n self._pwms.enable(self._pin_index, self._fre...
[ "0.7507943", "0.7288023", "0.7279597", "0.7279189", "0.7175336", "0.7156948", "0.7088378", "0.70339763", "0.69491214", "0.6779807", "0.67297035", "0.6723542", "0.6712733", "0.67055964", "0.6699761", "0.6647362", "0.6586929", "0.6568149", "0.6535646", "0.65287006", "0.6479545"...
0.0
-1
Generates a START condition on the bus (SDA transitions to low while SCL is high).
def start(self) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_start(self):\n self._state = service.ServiceStateMachine(['READY'], default_state='READY')\n self._temperature = 50\n self._set_state_internal(force=True)", "def acqstart(self, val):\n data = val & self.ACQSTART_MASK\n self._ftdi.spi_write(self.ACQSTART_ADDR, [data], bur...
[ "0.533664", "0.51825917", "0.51726115", "0.5062321", "0.5021848", "0.49577686", "0.49486732", "0.4933952", "0.49305284", "0.4905358", "0.49017555", "0.48968908", "0.487109", "0.48656768", "0.48656768", "0.48656768", "0.48656768", "0.48656768", "0.48656768", "0.48656768", "0.4...
0.0
-1
Reset clipping plane to the initial position
def resetClipping(self): if self.ui.checkBox.isChecked(): self.changeClippingPlane()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_camera_clipping_range(self):\n self.ResetCameraClippingRange()", "def reset(self):\n self.x_pos1 = 0\n self.x_pos2 = self.x_pos1 + self.width\n self.y_pos = self.offset_y\n self.velocity = self.origin_velocity", "def reset(self):\n self._x = 0\n self._...
[ "0.72114533", "0.68878317", "0.67456526", "0.6715707", "0.66233075", "0.66181415", "0.65896136", "0.6578817", "0.6536948", "0.6497763", "0.6484316", "0.6471452", "0.6400927", "0.63769555", "0.63728917", "0.6343672", "0.63340217", "0.633372", "0.632881", "0.6328413", "0.632614...
0.7311386
0
late initialization using attributes ``N`` and ``popsize``
def initialize(self, es): r = es.sp.weights.mueff / es.popsize self.index_to_compare = 0.5 * (r**0.5 + 2.0 * (1 - r**0.5) / np.log(es.N + 9)**2) * (es.popsize) # TODO self.index_to_compare = 0.30 * es.popsize # TODO self.damp = 2 - 2 / es.N # sign-rule: 2 self.c = 0.3 # sign-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, N):\n pass", "def __init__(self, size = 100):\n\t\tself.__parent = [i for i in range(size)]\n\t\tself.__rank = [0 for _ in range(size)]", "def qf_init(self, N):\n for x in range(N):\n self.id.append(x)\n\n for x in range(N):\n self.sz.append(1)", ...
[ "0.74300265", "0.696399", "0.68804914", "0.6877807", "0.6848971", "0.67619073", "0.6749006", "0.6723467", "0.67146224", "0.6686835", "0.6671072", "0.6653456", "0.6628384", "0.6623292", "0.66192466", "0.66084754", "0.6566455", "0.656438", "0.6558431", "0.655732", "0.655732", ...
0.0
-1
the first and second value in ``function_values`` must reflect two mirrored solutions. Mirrored solutions must have been sampled in direction / in opposite direction of the previous mean shift, respectively.
def update(self, es, function_values, **kwargs): # On the linear function, the two mirrored samples lead # to a sharp increase of the condition of the covariance matrix, # unless we have negative weights (which we have now by default). # Otherwise they should not be used to update the co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizefunction(self , values):\n maxv = np.max(values)\n minv = np.min(values)\n def f(x):\n return (x - minv)/(maxv-minv)\n return f", "def _restrict_along_direction(value_and_gradients_function,\n position,\n direction):\n def _...
[ "0.5213453", "0.5194283", "0.51106", "0.5087232", "0.5041832", "0.5018956", "0.4948366", "0.49431592", "0.49379903", "0.4915298", "0.49128544", "0.4912666", "0.4899099", "0.48883718", "0.4830111", "0.48290446", "0.48279116", "0.47945482", "0.47945154", "0.4787185", "0.4783373...
0.5703827
0
Checks if the object has either a valid DOI or URL
def test_has_valid_resource(self): ev = self.qctx(Evidence)() allEvidence = set(ev.load()) qualityEvidence = set() for evobj in allEvidence: ref = evobj.reference() if isinstance(ref, Document): doi = ref.doi() if doi: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_doi(doi):\n\n try:\n req = requests.get('http://dx.doi.org/%s' % doi, timeout=2.5)\n except (Timeout, RequestException) as e:\n logger.error('Can not validate doi: ' + str(e))\n raise\n else:\n return req.status_code == 200", "def is_valid(self, doi):\n do...
[ "0.664218", "0.6509624", "0.6371124", "0.6319777", "0.6193954", "0.6177623", "0.6164984", "0.61067796", "0.6100734", "0.6020571", "0.59995127", "0.59993356", "0.5990723", "0.5988188", "0.5985087", "0.5978379", "0.5974516", "0.59663296", "0.595839", "0.5951592", "0.59475064", ...
0.56157315
47
Gets the status of this order based on a few conditions.
def get_status(self): # update status # TODO: this needs to consider "partial" status based on the testcodes that are defined # in the panel. # get the condition OK aliquot condition instance result_item_cls = models.get_model(self._meta.app_label, 'resultitem') aliquot_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_order_status():\n symbol = App.config[\"symbol\"]\n\n # Get currently active order and id (if any)\n order = App.order\n order_id = order.get(\"orderId\", 0) if order else 0\n if not order_id:\n log.error(f\"Wrong state or use: check order status cannot find the order id.\")\...
[ "0.69561034", "0.694322", "0.6855676", "0.68541086", "0.66167575", "0.64354783", "0.6378744", "0.62970495", "0.62887", "0.62887", "0.62887", "0.6262306", "0.62575763", "0.62280935", "0.6224763", "0.61609876", "0.6115667", "0.60789305", "0.6074266", "0.6071368", "0.60649365", ...
0.72342694
0
Returns the Element specified by or None Looks at the real not the select2 widget, since that doesn't create the DOM until we click on it.
def option_in_select(browser, select_name, option): select = find_field(browser, 'select', select_name) assert select try: return select.find_element_by_xpath(str( './/option[normalize-space(text()) = "%s"]' % option)) except NoSuchElementException: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_selenium_select(self):\n\n if self.exists():\n\n element = self.element()\n\n if element.tag_name == u'select':\n return SeleniumSelect(element)", "def element(self):\n if isinstance(self._selector, tuple):\n return self._driver.find_element(...
[ "0.6852096", "0.6456852", "0.6172631", "0.60803807", "0.60538006", "0.59906584", "0.59722203", "0.59425443", "0.59387374", "0.59002507", "0.5898433", "0.58677405", "0.5866694", "0.58614147", "0.57861197", "0.5746658", "0.56525344", "0.56332093", "0.5614359", "0.5601628", "0.5...
0.48249903
88
Returns a pandas timeseries dataframe with the cycle id as the value.
def get_cycle_obs(self, begin_date): return self.data_provider.get_cycle_obs(begin_date)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeseries_dataframe(self):\n return", "def data_frame(dict_cycle, number):\n list1, list2 = (list(dict_cycle.get('cycle_'+str(number)).items()))\n zipped_list = list(zip(list1[1], list2[1]))\n data = pd.DataFrame(zipped_list, columns=['Potential', 'Current'])\n return data", "def retrie...
[ "0.66727316", "0.6615727", "0.627", "0.62005085", "0.6010478", "0.5969151", "0.59121937", "0.57969636", "0.5769604", "0.57303125", "0.5718447", "0.56777257", "0.5594098", "0.55817556", "0.55712366", "0.5552834", "0.55071044", "0.5490255", "0.5456189", "0.54433453", "0.5428817...
0.4944678
78
Create sort options JSON dump for InvenioSearchJS.
def format_sortoptions(sort_options): return json.dumps(dict( options=sorted_options(sort_options) ), sort_keys=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_sortoptions(sort_options):\n return json.dumps({\"options\": sorted_options(sort_options)})", "def searchkit_sort_options(sort_options, default_sort):\n return [\n {\n \"text\": v[\"title\"],\n \"sortBy\": k,\n \"sortOrder\": v.get(\"default_order\", \"asc...
[ "0.7647973", "0.6721828", "0.6474501", "0.62434304", "0.6147201", "0.6114072", "0.59847856", "0.585511", "0.5677213", "0.56770813", "0.5661485", "0.5627517", "0.55311555", "0.54182565", "0.5365508", "0.53565365", "0.53188163", "0.5306118", "0.5306118", "0.5284684", "0.5251678...
0.75585943
1
Initializes a waveform from multiple waveforms.
def __init__(self, *waveforms): if len(waveforms) < 2: raise ValueError("Needs at least two waveforms to form a " "CompositeWaveform.") for wf in waveforms: self._validate(wf) self._waveforms = list(waveforms)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, wavelengths=[], intensities=[]):\n wavelengths = [float(i) for i in wavelengths]\n intensities = [float(i) for i in intensities]\n if len(wavelengths) and not len(intensities):\n self.wavelengths = pylab.array(wavelengths)\n self.intensities = pylab.arr...
[ "0.6732369", "0.633956", "0.6135821", "0.60347545", "0.600781", "0.5973297", "0.58889836", "0.5862459", "0.5856629", "0.58562154", "0.58272624", "0.58228755", "0.57738274", "0.5771001", "0.5671579", "0.56585145", "0.56542605", "0.5653904", "0.565056", "0.56315523", "0.5593559...
0.7351188
0
Convert a node id to a bitcoin address.
def node_id_to_address(node_id): return b2a_hashed_base58(b'\0' + node_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_to_node_id(address):\n return a2b_hashed_base58(address)[1:]", "def toAddr(self, addressString: unicode) -> ghidra.program.model.address.Address:\n ...", "def AioNodeToIpAddressString(node):\n ip = aio_node_to_ip_address.AioNodeToIpAddress(node)\n return '%d.%d.%d.%d' % (ip.a, ip.b, ip....
[ "0.6943163", "0.6050124", "0.6009167", "0.5976289", "0.58893955", "0.577559", "0.56174105", "0.558131", "0.5552375", "0.549397", "0.5488261", "0.5478707", "0.5433137", "0.5413362", "0.53965724", "0.5384793", "0.5361286", "0.5309592", "0.5294386", "0.5252372", "0.52402204", ...
0.88026035
0
Split list into chunks of the given size. Original order is preserved.
def chunks(items, size): return [items[i:i+size] for i in range(0, len(items), size)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]", "def split_to_chunks(of_list, chunk_size):\n assert of_list is not None\n\n for i in range(0, len(of_list), chunk_size):\n yield of_list[i:i + chunk_size]", "def split_...
[ "0.8559774", "0.82934535", "0.8153084", "0.8006796", "0.799206", "0.7990606", "0.79425645", "0.78783", "0.782068", "0.7762646", "0.7737744", "0.77330047", "0.7712356", "0.77036834", "0.7669049", "0.76601946", "0.7656016", "0.7634975", "0.7581418", "0.7567102", "0.7544625", ...
0.78850025
7
Returns the total size of all files in a directory.
def get_folder_size(start_path): # source http://stackoverflow.com/a/1392549 total_size = 0 for dirpath, dirnames, filenames in os.walk(start_path): for f in filenames: fp = os.path.join(dirpath, f) total_size += os.path.getsize(fp) return total_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_size(directory: str) -> int:\n size = 0\n for file in os.listdir(directory):\n filename = os.path.join(directory, file)\n size += os.path.getsize(filename)\n return size", "def dirsize(self):\n total = 0\n for p in self.select_file(recursive=True):\n try:\n...
[ "0.85994136", "0.8468758", "0.82439613", "0.8155375", "0.8154064", "0.8081626", "0.8017493", "0.776276", "0.7736956", "0.77107847", "0.76583356", "0.7378454", "0.7371622", "0.734555", "0.73357457", "0.7308904", "0.72537863", "0.7246301", "0.70917696", "0.70613694", "0.7047035...
0.6855207
31
Generates a simple string representing this order, in the format of '5x chais, 2x table'
def description(self): item_counts = [f'{i.quantity}x {i.item.name}' for i in self.items] return ','.join(item_counts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order2string(order):\n nparray = np.array(order)\n num_x = np.sum(nparray==0)\n num_y = np.sum(nparray==1)\n num_z = np.sum(nparray==2)\n string_repr = \"$\"\n if num_x == 0 and num_y == 0 and num_z == 0:\n return \"constant\"\n if num_x > 0:\n ...
[ "0.67842156", "0.6756943", "0.66362876", "0.66337097", "0.6528493", "0.64398247", "0.6369542", "0.6322151", "0.6309945", "0.6275073", "0.62696475", "0.6183502", "0.61820257", "0.61726725", "0.6169974", "0.61690223", "0.6123048", "0.61156565", "0.6108299", "0.6099818", "0.6096...
0.0
-1
Initializes the LatexFloat with a caption and a tag.
def __init__(self, caption, tag): self._caption = caption self._tag = tag.replace(" ", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, caption, tag, image_path, scale=.7):\n super(LatexImage, self).__init__(caption, tag)\n self._image_path = image_path\n self._scale = scale", "def visit_caption(self, node):\n self.body.append(self.starttag(node, \"figcaption\", \"\"))", "def initDocTagText(self):...
[ "0.5589178", "0.5471002", "0.54125345", "0.52791595", "0.5256642", "0.52242815", "0.5221189", "0.5187113", "0.5012101", "0.50118905", "0.49141017", "0.48652402", "0.48545364", "0.48213896", "0.4816042", "0.4792866", "0.47889185", "0.4769716", "0.4769716", "0.4769716", "0.4769...
0.6798125
0
The pytorch autograd version of calculating residual
def phy_residual(self, x, t, u, v): u_t = torch.autograd.grad( u, t, grad_outputs=torch.ones_like(u), retain_graph=True, create_graph=True )[0] u_x = torch.autograd.grad( u, x, grad_outputs=torch.ones_lik...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residuals(self) -> npt.NDArray[np.float64]:\n return self.data - self.theory", "def _residual_edp(self, params):\n data = self.F**2\n model = np.absolute(self._model())**2\n sigma = self.sigma\n return (data[self.mask]-model[self.mask]) / sigma[self.mask] \n \n # The following th...
[ "0.70183986", "0.6871696", "0.68147755", "0.6750128", "0.6652142", "0.66166586", "0.6602038", "0.65820956", "0.6567983", "0.653666", "0.6498291", "0.6447466", "0.6439558", "0.6423172", "0.6394977", "0.6276244", "0.62630713", "0.6256495", "0.6216926", "0.620914", "0.61731714",...
0.6797474
3
Convert arrays to MultiIndex.
def from_arrays( cls, arrays, sortorder: int | None = None, names: Sequence[Hashable] | Hashable | lib.NoDefault = lib.no_default, ) -> MultiIndex: error_msg = "Input must be a list / sequence of array-likes." if not is_list_like(arrays): raise TypeError(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listify(array, valuename, colnames):\n multiindex = pd.MultiIndex.from_product([range(i) for i in array.shape])\n colmapping = {\"level_\"+str(i): colnames[i] for i in range(len(colnames))}\n\n return pd.DataFrame({valuename: pd.Series(index=multiindex, data=array.flatten())}).reset_index().rename(colmappin...
[ "0.6568427", "0.6020459", "0.5958974", "0.5663307", "0.56514394", "0.56280124", "0.55209684", "0.549699", "0.5490428", "0.54442114", "0.5416948", "0.5405946", "0.5315614", "0.53122175", "0.5239235", "0.52379495", "0.5225342", "0.5222101", "0.5185408", "0.5156308", "0.51496154...
0.58396184
3
Return the dtypes as a Series for the underlying MultiIndex. Examples >>> idx = pd.MultiIndex.from_product([(0, 1, 2), ('green', 'purple')], ... names=['number', 'color']) >>> idx MultiIndex([(0, 'green'), (0, 'purple'), (1, 'green'), (1, 'purple'), (2, 'green'), (2, 'purple')], names=['number', 'color']) >>> idx.dtype...
def dtypes(self) -> Series: from pandas import Series names = com.fill_missing_names([level.name for level in self.levels]) return Series([level.dtype for level in self.levels], index=Index(names))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dtypes(self) -> pd.Series:\n return pd.Series(\n [field.dtype for field in self._internal.index_fields],\n index=pd.Index(\n [name if len(name) > 1 else name[0] for name in self._internal.index_names]\n ),\n )", "def make_series_dtype(self):\n ...
[ "0.72793233", "0.58683264", "0.57514507", "0.57469267", "0.56303644", "0.55622905", "0.55187994", "0.54342955", "0.5349008", "0.5337053", "0.5252856", "0.51584876", "0.51045334", "0.5075535", "0.49397582", "0.4921555", "0.48933786", "0.4867922", "0.48633084", "0.47980618", "0...
0.7409178
0
Return the number of elements in the underlying data.
def size(self) -> int: # override Index.size to avoid materializing _values return len(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\r\n return self.data_array.size", "def size(self):\n ret = 0\n for ii in self.__data:\n ret += int(ii.get_size())\n return ret", "def data_count(self):\n return(len(self.data))", "def getNumData(self):\n return len(self.data)", "def count_elements_in_data...
[ "0.85899806", "0.8423803", "0.8414217", "0.8210661", "0.80919904", "0.8047665", "0.8039008", "0.8034847", "0.8028368", "0.7915025", "0.7895275", "0.7874186", "0.7864957", "0.7843419", "0.7843419", "0.7843419", "0.7843419", "0.7843419", "0.7837047", "0.7822931", "0.78134686", ...
0.0
-1
Integer number of levels in this MultiIndex. Examples >>> mi = pd.MultiIndex.from_arrays([['a'], ['b'], ['c']]) >>> mi MultiIndex([('a', 'b', 'c')], ) >>> mi.nlevels 3
def nlevels(self) -> int: return len(self._levels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Nlevels(self):\n return self._nlevels", "def n_levels(self):\n return self.primary_header['Number of levels']", "def n_levels(self):\n return len(self.scales)", "def __len__(self):\n return self.data.index.get_level_values(0).to_series().nunique()", "def size(self, subset=No...
[ "0.75933546", "0.731903", "0.7178818", "0.65723294", "0.64887375", "0.6476538", "0.6376688", "0.5913918", "0.58839625", "0.57709014", "0.5510854", "0.5493949", "0.5455473", "0.53948176", "0.5392115", "0.53767926", "0.536649", "0.5358589", "0.534354", "0.53428805", "0.5314514"...
0.7621207
0
return the number of bytes in the underlying data deeply introspect the level data if deep=True include the engine hashtable this is in internal routine
def _nbytes(self, deep: bool = False) -> int: # for implementations with no useful getsizeof (PyPy) objsize = 24 level_nbytes = sum(i.memory_usage(deep=deep) for i in self.levels) label_nbytes = sum(i.nbytes for i in self.codes) names_nbytes = sum(getsizeof(i, objsize) for i in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(self):\n return (\n sys.getsizeof(self.children) +\n sys.getsizeof(self.parent) +\n sys.getsizeof(self.dataset_id) +\n sys.getsizeof(self.k) +\n self.filter.get_size()\n )", "def _tree_depth(self):\n retu...
[ "0.6753621", "0.6542395", "0.64652896", "0.6415443", "0.63772947", "0.63761693", "0.6366233", "0.6358291", "0.6357476", "0.6357162", "0.6316735", "0.63133305", "0.63085866", "0.62735164", "0.6263637", "0.6212407", "0.6205844", "0.6205844", "0.61761713", "0.6151221", "0.615030...
0.7882383
0
Set new names on index. Each name has to be a hashable type.
def _set_names(self, names, *, level=None, validate: bool = True): # GH 15110 # Don't allow a single string for names in a MultiIndex if names is not None and not is_list_like(names): raise ValueError("Names should be list-like for a MultiIndex") names = list(names) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setIndexNames(self):\n self.xi = self.i1\n self.yi = self.i2", "def set_index_names(self, names, axis=0):\n self.get_axis(axis).names = names", "def setIndexNames(self):\n self.theta = self.i1\n self.radial = self.i2", "def setName(self, *args):\n return _libsbml...
[ "0.6842202", "0.68311644", "0.65839916", "0.646326", "0.6418336", "0.63339156", "0.6309426", "0.618173", "0.6102824", "0.6080749", "0.6042175", "0.6033473", "0.6000016", "0.5945332", "0.59041435", "0.58616143", "0.58616143", "0.5859123", "0.583149", "0.57843554", "0.57787365"...
0.6435984
4
Return a boolean if the values are equal or decreasing.
def is_monotonic_decreasing(self) -> bool: # monotonic decreasing if and only if reverse is monotonic increasing return self[::-1].is_monotonic_increasing
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_decreasing(values):\n\n return all([i >= j for i, j in zip(values, values[1:])])", "def is_increasing(values):\n\n return all([i <= j for i, j in zip(values, values[1:])])", "def is_sorted(self):\n previous = 0 # Setting to 0 shouldn't be an issue aslong as MIN_VALUE is at least 0\n ...
[ "0.75411683", "0.7101109", "0.65814716", "0.6485186", "0.6383295", "0.6379341", "0.6370533", "0.62918895", "0.6273469", "0.62532073", "0.61968917", "0.6188817", "0.6163151", "0.6135353", "0.6113867", "0.6112549", "0.6101412", "0.61003673", "0.60794723", "0.60569924", "0.60431...
0.7104333
1