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 |
|---|---|---|---|---|---|---|
inits layers and loads pretrained detectronbackbonearchitecture (Conv_Body and RPN) also freezes weights of Conv_Body and RPN | def _init_modules(self, pretrained_weights=None):
if pretrained_weights is None:
if cfg.MODEL.LOAD_PRETRAINED_BACKBONE_WEIGHTS:
print("\n-------------------------------------------")
print("Load pre-trained ImageNet weights")
print("\n-----------------... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()",
"def load_pretrained_layers(self):\n # Current state of base\n state_dict = self.state_dict()\n param_names = list(state_dict.keys())\n\n # VGG base with p... | [
"0.71189755",
"0.70397174",
"0.7027052",
"0.69417554",
"0.6910521",
"0.6740351",
"0.6731823",
"0.66610456",
"0.66405517",
"0.6577447",
"0.6523255",
"0.6508466",
"0.6504946",
"0.6497513",
"0.64923275",
"0.6489189",
"0.6480545",
"0.64784837",
"0.64296126",
"0.64292455",
"0.6413... | 0.7570021 | 0 |
Freeze all the weights by setting requires_grad to False | def freeze_params(m):
for p in m.parameters():
p.requires_grad = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze(self):\n # Freeze.\n self.frozen = True\n for param in self.parameters():\n param.requires_grad = False",
"def __freeze(self):\r\n features_layer = self._model._net\r\n for param in features_layer.parameters():\r\n param.requires_grad = False",
... | [
"0.8163218",
"0.7909783",
"0.7748271",
"0.7748042",
"0.769451",
"0.74692297",
"0.7455538",
"0.7449576",
"0.73030096",
"0.72458893",
"0.7239034",
"0.7226676",
"0.71990705",
"0.7145645",
"0.7145645",
"0.71134984",
"0.70635736",
"0.7044902",
"0.703389",
"0.70303506",
"0.6969782"... | 0.6920431 | 21 |
Return the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = "%s %s" % (self.firstname, self.lastname)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.83421856",
"0.82273436",
"0.80990887",
"0.8067676",
"0.80525744",
"0.8043721",
"0.7993416",
"0.7992513",
"0.7992513",
"0.7992513",
"0.7978309",
"0.7963202",
"0.7957057",
"0.79399455",
"0.7936728",
"0.79338795",
"0.79154027",
"0.7901051",
"0.7892942",
"0.787005",
"0.7855431... | 0.7836986 | 23 |
Load a json file into a dictionary. | def load_json_data(filepath):
with open(filepath,'r') as f:
return json.load(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dictionary_from_json_file(_json_file):\n with open(_json_file) as _f:\n _dict = json.load(_f)\n return _dict",
"def load_json(filename: str) -> Dict:\n \n with open(filename, 'r') as json_file:\n return json.load(json_file)",
"def load_json(file_path):\n\n \n with open(file_... | [
"0.8363557",
"0.8338333",
"0.8320464",
"0.82969475",
"0.82234544",
"0.81782365",
"0.8013226",
"0.79915285",
"0.7987343",
"0.79690105",
"0.7937751",
"0.7909713",
"0.7884572",
"0.7804587",
"0.7787159",
"0.77430487",
"0.7736438",
"0.7696512",
"0.76654094",
"0.7624713",
"0.761705... | 0.7284489 | 55 |
Helper function to create a DNAC API endpoint URL | def create_url(path, controller_ip=DNAC):
print("3")
return "https://%s:%s/api/v1/%s" % (controller_ip, DNAC_PORT, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _construct_url(self, endpoint):\n return self.base_url + self.api_path + endpoint.strip('/')",
"def _generate_url(self, endpoint:str, params:Dict[str, str]=None) -> str:\n if params:\n return f\"{self.BASE_URL}/{self._api_version}{endpoint}?{urlencode(params)}\"\n return f\"{s... | [
"0.74553895",
"0.7263086",
"0.71828544",
"0.70809686",
"0.7072189",
"0.7025123",
"0.6959241",
"0.69526494",
"0.6904076",
"0.6899243",
"0.68190056",
"0.6773523",
"0.6765315",
"0.67568064",
"0.670167",
"0.6700871",
"0.66979635",
"0.66481155",
"0.6630661",
"0.6624139",
"0.659704... | 0.7301918 | 1 |
Return name of entity. | def __unicode__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_name(self):\n return self.__entity_name",
"def entity_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"entity_name\")",
"def entity_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"entity_name\")",
"def get_entity_name() -> str:\n return \"NewsIt... | [
"0.8907802",
"0.820066",
"0.820066",
"0.8056209",
"0.7864174",
"0.7640121",
"0.74469143",
"0.74123406",
"0.73490596",
"0.73426497",
"0.73414713",
"0.7337244",
"0.7319754",
"0.7319754",
"0.7319754",
"0.7296547",
"0.72426",
"0.72426",
"0.72426",
"0.72422755",
"0.7239047",
"0.... | 0.0 | -1 |
Standard Gaussian resolution shape | def cmd_gaus():
cmds = []
cmds.append("r_m[0.0,-1,1]")
cmds.append("r_s[2.5,0,10]")
cmds.append('Gaussian::res(x,r_m,r_s)')
return cmds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianPSF(shape, sigma):\n psf = dg.drawGaussiansXY(shape,\n numpy.array([0.5*shape[0]]),\n numpy.array([0.5*shape[1]]),\n sigma = sigma)\n return psf/numpy.sum(psf)",
"def gaussian(t, params):\n DeprecationWarning... | [
"0.7061774",
"0.68136966",
"0.66752356",
"0.66123235",
"0.6581177",
"0.6564699",
"0.6488385",
"0.6479203",
"0.6461302",
"0.64511245",
"0.6427417",
"0.6424794",
"0.64032036",
"0.6365047",
"0.6363483",
"0.634068",
"0.63382334",
"0.6334149",
"0.6326717",
"0.62985986",
"0.6276975... | 0.0 | -1 |
Double Gaussian resolution shape | def cmd_dgaus():
cmds = []
cmds.append("r_m[0.0,-1,1]")
cmds.append("r_s[1.5,0,10]")
cmds.append('Gaussian::gaus_c(x,r_m,r_s)')
cmds.append("rt_m[0.0,-1,1]")
cmds.append("rt_s[3,0,10]")
cmds.append('Gaussian::gaus_t(x,rt_m,rt_s)')
cmds.append("f[0.85]") # fraction of core
cmds.appen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianPSF(shape, sigma):\n psf = dg.drawGaussiansXY(shape,\n numpy.array([0.5*shape[0]]),\n numpy.array([0.5*shape[1]]),\n sigma = sigma)\n return psf/numpy.sum(psf)",
"def _FSpecialGauss(size, sigma):\n radius = s... | [
"0.6787509",
"0.6654982",
"0.66337276",
"0.66337276",
"0.66320175",
"0.6613296",
"0.65926105",
"0.65867645",
"0.6575697",
"0.65732044",
"0.6569151",
"0.655808",
"0.65469366",
"0.65372825",
"0.6490164",
"0.648877",
"0.6482354",
"0.6478889",
"0.6478889",
"0.6478889",
"0.6471241... | 0.0 | -1 |
Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
return DEVICE_CLASSES.get(self.sensor_data["model"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n return self.sensor_type[\"class\"]",
"def device_class(self):\n return SENSOR_TYPES[self.sensor][3].get(\"device_class\")",
"def get_class(self):\n return devices.get_class(self.type)",
"def device_class(self):\n return BINARY_SENSORS[self.info_type][\"de... | [
"0.85230726",
"0.84733164",
"0.8445045",
"0.8313233",
"0.83095866",
"0.82431525",
"0.82431525",
"0.82431525",
"0.82431525",
"0.82431525",
"0.81998587",
"0.8195822",
"0.8126947",
"0.811179",
"0.811179",
"0.811179",
"0.80615914",
"0.80560696",
"0.80560696",
"0.8038193",
"0.8038... | 0.8728038 | 0 |
Puts the current key in the set of keys that are being held. You will need to add things here to handle firing the bullet. | def on_key_press(self, key: int, modifiers: int):
self.held_keys.add(key)
if key == arcade.key.SPACE:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_key_press(self, key: int, modifiers: int):\r\n if self.ship.alive:\r\n self.held_keys.add(key)\r\n\r\n if key == arcade.key.SPACE:\r\n # TODO: Fire the bullet here!\r\n bullet = Bullet()\r\n bullet.fire(self.ship.angle, self.ship.cent... | [
"0.7319262",
"0.73013127",
"0.65387064",
"0.6480956",
"0.6470683",
"0.64591974",
"0.6403872",
"0.63643605",
"0.63235325",
"0.63204604",
"0.62915784",
"0.6281717",
"0.62527555",
"0.62524116",
"0.62199354",
"0.62199354",
"0.6201979",
"0.61854833",
"0.6171041",
"0.61541516",
"0.... | 0.71870714 | 2 |
Function to return file names of non sequential files. | def makenonpaddedname(match):
prefix = match.string[:match.start()]
suffix = match.string[match.end():]
template = prefix + "%d" + suffix
return match.expand(template) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filenames():\n filenames = []\n for filename in Path('.').glob('*.pdf'):\n if 'reordered' not in filename.stem:\n filenames.append(filename)\n\n return filenames",
"def file_names(acqfolder):\n log.info('anonymizer.py file_names {0}'.format(acqfolder))\n\n subj_path = pat... | [
"0.69865555",
"0.651861",
"0.6497563",
"0.6302609",
"0.6282272",
"0.62494314",
"0.6221374",
"0.6137554",
"0.6136812",
"0.61338407",
"0.61069524",
"0.6095974",
"0.6037756",
"0.59998757",
"0.5997438",
"0.5992087",
"0.5979648",
"0.59283125",
"0.59123707",
"0.5909974",
"0.5887527... | 0.0 | -1 |
Updates status, with a potential orbit plot | def status_update(status, n_pha, media):
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
message = MESSAGE_TEMPLATE.format(n_pha)
if media:
api.update_with_media(media, status=message)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_plot():\n pass",
"def _UpdatePlot( self ):\n self._BusyDoOp( self._UpdatePlotImpl )",
"def plot_orbit(self) :\r\n self.x_vals = np.zeros((self.n_bodies,len(self.hist)))\r\n self.y_vals = np.zeros((self.n_bodies,len(self.hist)))\r\n self.z_vals = np.zeros((self.n_bodies... | [
"0.6796556",
"0.63692766",
"0.6116714",
"0.6047096",
"0.5933866",
"0.5927585",
"0.58541495",
"0.5845447",
"0.5773369",
"0.57610697",
"0.57588494",
"0.57351047",
"0.57293034",
"0.5729273",
"0.5715754",
"0.57089525",
"0.57027143",
"0.56948096",
"0.56861925",
"0.5683036",
"0.564... | 0.0 | -1 |
Takes an input string and a desired tab width and replaces each \\t in the string with ' 'tab_width. | def replace_tabs(string: str, tab_width: int = 4) -> str:
return string.replace('\t', ' '*tab_width) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tabify(st: str, width: int) -> str:\n assert width % 8 == 0\n if len(st) >= width:\n # Ensure some empty space at the end\n return f'{st}\\t'\n padding = width - len(st)\n tabcount = padding // 8\n if padding % 8 > 0:\n tabcount += 1\n return st + ('\\t' * tabcount)",
"... | [
"0.79256225",
"0.739376",
"0.71211773",
"0.681988",
"0.67956686",
"0.6614125",
"0.64676315",
"0.64483476",
"0.60130465",
"0.5952855",
"0.5934942",
"0.58639157",
"0.58335614",
"0.58081925",
"0.5782443",
"0.573624",
"0.562251",
"0.54950684",
"0.5416732",
"0.5385577",
"0.5355708... | 0.8873786 | 0 |
Returns a string that contains enough spaces to center the text in the context of the length given Defaults to centering the text in the width of the entire console text is stripped of leading and trailing whitespace before starting If length len(text) is odd, then the extra space is appended to the end of the string I... | def centered_text(text: str, length: int = -1) -> str:
t = text.strip()
# If length is longer than the console width, then squeeze it to fit
num_col = shutil.get_terminal_size((80, 20)).columns
if length > num_col:
length = num_col
if len(t) >= length:
return t
space_tot = le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(text, width=72, pad_character=\" \"):\n\n length = len(text)\n prefix = (width - length) // 2\n suffix = width - prefix - length\n return (prefix * \" \") + text + (suffix * \" \")",
"def centered_text(text, width=120): # width=120 is maring width default to 120\n if text == '*':\n ... | [
"0.7882105",
"0.7357453",
"0.71607906",
"0.7024332",
"0.69741356",
"0.6834833",
"0.67831206",
"0.6599976",
"0.659696",
"0.63803214",
"0.6379917",
"0.6359718",
"0.6241984",
"0.62080324",
"0.6192681",
"0.61334115",
"0.61273116",
"0.6125977",
"0.6117825",
"0.6113696",
"0.6087233... | 0.8688855 | 0 |
Returns a string composed of num dashes | def dashed_line(num: int, dash: str = '#') -> str:
temp = ""
for i in range(num):
temp += dash
return temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashatize(num):\n if num is None:\n return 'None'\n if num == 0:\n return '0'\n num = str(num)\n num = num.strip('-')\n ret = ''\n c = 0\n for digit in str(num):\n if int(digit) % 2 != 0:\n if c == 0 and len(str(num)) == 1:\n ret += digit\n ... | [
"0.75286597",
"0.7116371",
"0.7006892",
"0.6703599",
"0.65451103",
"0.6515679",
"0.6462735",
"0.63251245",
"0.6288942",
"0.6230601",
"0.6169304",
"0.6147508",
"0.6146",
"0.6102892",
"0.60897624",
"0.6087948",
"0.60765064",
"0.601851",
"0.60087353",
"0.5990099",
"0.5989406",
... | 0.7588893 | 0 |
Return all of the configurations we find in this slot. Can be more than one. We use this on startup to build the regions list. | def GetSlotConfiguration(slotnum):
slotDirectory = GetSlotDirectory(slotnum)
regionDir = os.path.join(slotDirectory, "bin", "Regions")
configFiles = glob.glob(os.path.join(regionDir,"*.xml"))
result = {}
for config in configFiles:
if (os.access(config, os.O_RDONLY) == False):
co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n\n return {section: self.sections[section].get_values() for section in self.sections}",
"def configs(self):\n return self._configs",
"def configs(self):\n\n return self.__configs",
"def config(self) -> dict:\n return self._configs",
"def configs(self) -> l... | [
"0.690648",
"0.6745133",
"0.66438174",
"0.6623901",
"0.66007847",
"0.65331554",
"0.6530625",
"0.65080863",
"0.6454023",
"0.63908523",
"0.6381798",
"0.634091",
"0.63036627",
"0.626329",
"0.6225224",
"0.6216168",
"0.6207627",
"0.6207627",
"0.6180901",
"0.6180814",
"0.61522985",... | 0.62134564 | 16 |
Get last block height in one specific transform storage. | async def last_block_height(self, api_params: dict) -> Optional[int]:
transform_id: str = api_params['transform_id']
db = self.transform_storage_dbs[transform_id]
value = db.get(Storage.LAST_BLOCK_HEIGHT_KEY)
try:
height = int(value)
except Exception:
h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_height():\n return resize.transforms[1].size",
"def last_block(self):\n return self.chain[len(self.chain) - 1]",
"def fetch_last_height(self, cb):\r\n self.send_command('blockchain.fetch_last_height', cb=cb)",
"def getLastBlock(self):\n if (len(self.chain) == 0):\n ... | [
"0.6924638",
"0.65283996",
"0.6526843",
"0.65190667",
"0.6423764",
"0.63814086",
"0.63814086",
"0.63433397",
"0.6323127",
"0.6305308",
"0.6257912",
"0.6246961",
"0.6206633",
"0.61390156",
"0.6127977",
"0.60946774",
"0.60820806",
"0.6063295",
"0.6004294",
"0.5996273",
"0.59911... | 0.7295609 | 0 |
Create a plain button with grey background and black text | def __init__(
self, text="Ok", font=None, size=30, state: int = Button.INACTIVE
) -> None:
super().__init__(state)
self._font = Font(font, size)
self._text = text
self.rect = Rect(0, 0, 0, 0)
self.redraw() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_button(self, parent, text=\"Button\", command=None, row=0, column=0):\n but = Button(parent, text=text, command=command, relief='flat', padx=5, pady=5)\n but.grid(row=row, column=column, sticky=EW)\n return but",
"def __create_button(self, parent, flag):\n btns = {\n ... | [
"0.6861607",
"0.67599237",
"0.6582718",
"0.65808904",
"0.65053374",
"0.6474949",
"0.64376765",
"0.6433827",
"0.6399615",
"0.6356601",
"0.6275925",
"0.6242429",
"0.6238343",
"0.6204678",
"0.6166762",
"0.6152648",
"0.613938",
"0.6084935",
"0.6072933",
"0.6066731",
"0.6052635",
... | 0.6228837 | 13 |
Yield successive nsized chunks from lst. | def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i : i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"de... | [
"0.83071756",
"0.81939614",
"0.81910837",
"0.81910837",
"0.8190213",
"0.81267184",
"0.81218547",
"0.81218547",
"0.80773693",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",
"0.80533457",... | 0.80526286 | 35 |
Look up a user by their ID. | async def lookup(self, ctx, user_id: int):
if user_id <= 0:
return await ctx.send(
"I can already tell you this guy does not exist. "
"Try using an actual User ID."
)
elif len(str(user_id)) == 4:
return await ctx.send(
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def get_single_user(self, id):\n for user in self.users:\n if user['id'] == id:\n return user",
"def lookupUser_byID(self, user_id):\n sql = \"SELECT * FROM Users WHERE id='%s'\"\\\n % (user_id)... | [
"0.8270228",
"0.82623696",
"0.8250017",
"0.81246173",
"0.81151164",
"0.80321884",
"0.7968494",
"0.7942783",
"0.7942783",
"0.7942783",
"0.7942783",
"0.79169846",
"0.7888149",
"0.7873626",
"0.78533673",
"0.78477633",
"0.7841482",
"0.78250325",
"0.7818835",
"0.780344",
"0.778755... | 0.0 | -1 |
Instantiate a new MongoClient and return the collection | def __enter__(self):
self.client = pymongo.MongoClient(self.conn_info["conn_str"], username=self.conn_info["username"],
password=self.conn_info["password"])
db = self.client.get_database()
try:
collection = db.get_collection(self.coll_str)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mongo_client():\n return MongoClient(STRING_CONNECTION)",
"def mongo_client(request):\n _client = MongoClient()\n return _client",
"def _get_mongo_client():\n return pymongo.MongoClient(mongo_uri)",
"def get_db_collection():\n\n client = MongoClient(\n app.config['MONGODB_URI'],\n ... | [
"0.8032362",
"0.7753136",
"0.7738257",
"0.7730823",
"0.7597799",
"0.7586646",
"0.7473212",
"0.7459132",
"0.74169505",
"0.7394337",
"0.7370175",
"0.72333086",
"0.72165936",
"0.7172144",
"0.7111903",
"0.70264876",
"0.7000244",
"0.6980332",
"0.69779396",
"0.6962124",
"0.69039994... | 0.7380584 | 10 |
Initialize the weights of a neural network. | def init_weights(m):
if isinstance(m, nn.Linear):
nn.init.normal_(m.weight, mean=0.1, std=0.01)
nn.init.constant_(m.bias, 0.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_weights(self):\n pass",
"def initialize_weights(self, weights_initializer, bias_initializer):\n wshapes = [\n [self.input_size, self.hidden_size[0]],\n [self.hidden_size[0], self.hidden_size[1]],\n [self.hidden_size[1], self.output_size]\n ]\n... | [
"0.8312774",
"0.8191624",
"0.8170487",
"0.81307644",
"0.81094116",
"0.8052099",
"0.80146927",
"0.8012727",
"0.7929012",
"0.79015076",
"0.78690237",
"0.7849139",
"0.7824348",
"0.7817047",
"0.7795276",
"0.77776146",
"0.7740009",
"0.7719938",
"0.76778454",
"0.76582754",
"0.76481... | 0.7267429 | 57 |
Graphically show the clustering of the hidden representations. Saves the plot in 'cwd/plots' directory. | def print_clusters(vectors, labels, nclusters, show=False):
plt.figure(1)
plt.clf()
vecs2D = TSNE(n_components=2).fit_transform(vectors)
colors = cycle('bgrcmykbgrcmykbgrcmykbgrcmyk')
for k, col in zip(range(nclusters), colors):
my_members = labels == k
cluster_vecs2D = vecs2D[my_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_clusters(self):\n pass",
"def plotClusters(self):\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n fig.set_size_inches(18.5, 9.5)\n ax.set_title('Identification of Cluster Particles with Voronoi Volumes', fontsize=22)\n ax.set_xlabel('x [m]', ... | [
"0.70459795",
"0.6877346",
"0.6616605",
"0.66142416",
"0.6459819",
"0.6419078",
"0.6390127",
"0.63865054",
"0.6370039",
"0.6363703",
"0.6351985",
"0.6300115",
"0.6241648",
"0.62412906",
"0.621885",
"0.61625296",
"0.609284",
"0.60797143",
"0.60749924",
"0.60629463",
"0.6057906... | 0.6410482 | 6 |
Set the variables to their initial values. Needed when sampling modifies the variables and we want to sample again. | def reset_pipeline(self):
self.pipeline_X = self.init_pipeline_X
self.pipeline_y = self.init_pipeline_y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_variables(self):\n self.sess.run(self.init)",
"def reset(self):\n for var in self.var_list:\n var.value = None\n var.domain = copy.deepcopy(var.init_domain)",
"def set_initial_values(self):\n\n pass",
"def reset_initial_seed(self, x0: Dict[str, ArrayT... | [
"0.7115037",
"0.6858043",
"0.6843621",
"0.6821857",
"0.68065757",
"0.67398846",
"0.6738298",
"0.67285854",
"0.6668068",
"0.6636889",
"0.66340226",
"0.66261333",
"0.65688825",
"0.6566039",
"0.65651214",
"0.6552995",
"0.65356857",
"0.65236604",
"0.6481246",
"0.6466567",
"0.6463... | 0.0 | -1 |
A pandas dataframe representing the cashflows from the income stream. | def cash_flows_df(self) -> pd.DataFrame:
cash_flows = pd.DataFrame(
index=self.date_range,
data=self._values,
columns=[self.name]
)
return cash_flows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def investments_table(self):\n table = pd.DataFrame(index=[etf.buy_date for etf in self.etfs.values()])\n table['Ticker'] = [name.split('-')[0].split('.')[0] for name in self.etfs.keys()]\n table['Buying Price (€)'] = [etf.buy_price for etf in self.etfs.values()]\n table['Number of Shar... | [
"0.663227",
"0.6487351",
"0.6382273",
"0.6234031",
"0.62265664",
"0.60174555",
"0.60097367",
"0.5889223",
"0.5876676",
"0.5821334",
"0.5777549",
"0.57711875",
"0.57652515",
"0.57452124",
"0.5738639",
"0.57224095",
"0.57214725",
"0.57196844",
"0.57148147",
"0.5710445",
"0.5704... | 0.82112074 | 0 |
Returns the next nearest page boundary from `n` | def next_page(n):
PAGE_SIZE = 4096
return (n + PAGE_SIZE - 1) // PAGE_SIZE * PAGE_SIZE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round_near(n, p):\n base = 10**p\n\n return math.ceil(round(base * n * 2) / 2) / base",
"def nearest(n, number):\n return math.floor((n / number) + 0.5) * number",
"def get_closest(a, n):\n pos = bisect_left(a, n)\n if pos == 0:\n return a[0]\n if pos == len(a):\n return a[-... | [
"0.6394747",
"0.63907826",
"0.6263046",
"0.6243817",
"0.6148424",
"0.60373133",
"0.60117996",
"0.5871792",
"0.5820438",
"0.5804876",
"0.57938933",
"0.5791112",
"0.57203776",
"0.57193154",
"0.57193154",
"0.57193154",
"0.57139105",
"0.56849575",
"0.5683129",
"0.5679386",
"0.567... | 0.73715574 | 0 |
Format Event attributes to a dictionary in order to prepare data to be inserted to the database. | def event_info_to_dic(self):
event_info = {
'event_category': self.event_category,
'event_location': self.event_location,
'event_age_range': self.event_age_range,
'event_date': self.event_date,
'event_time': self.event_time,
'event_descript... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _EventToDict(self, event_object):\n event_values = {}\n for attribute_name, attribute_value in event_object.GetAttributes():\n # Ignore attributes that cause issues (and need correcting).\n if attribute_name in (u'pathspec', u'regvalue', u'tag'):\n continue\n\n event_values[attribut... | [
"0.7052704",
"0.69316",
"0.6827482",
"0.65590626",
"0.6479102",
"0.6476226",
"0.64500475",
"0.64383775",
"0.6383981",
"0.63700473",
"0.625962",
"0.6200087",
"0.6140077",
"0.6081016",
"0.6049497",
"0.6044852",
"0.60055083",
"0.60016525",
"0.5958699",
"0.5932972",
"0.5893463",
... | 0.7170539 | 0 |
Takes the ObjectId of the creator as param, Return an instance of the last event created by this user from the db. | def get_last_event_crated_by_user(cls, user_id):
try:
# Credit for the sorting part of the code to Neil Lunn
# from stackoverflow (
# https://stackoverflow.com/questions/49871030/
# how-fetch-latest-records-using-find-one-in-pymongo)
event = events_col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_event(self, since=None):\n cursor = self.conn.cursor()\n since = since or time.time()\n cursor.execute(\"\"\"\n SELECT * FROM events\n WHERE date < ? AND countdown <= 0\n ORDER BY date DESC LIMIT 1\"\"\", (since, ))\n raw = cursor.fetchone()\n if... | [
"0.6150634",
"0.60127324",
"0.57242155",
"0.5644116",
"0.5644116",
"0.56306756",
"0.56165147",
"0.5602574",
"0.5574103",
"0.5527292",
"0.5523488",
"0.5470176",
"0.5441347",
"0.5394686",
"0.5383745",
"0.5382348",
"0.5325782",
"0.5298208",
"0.5248284",
"0.52440834",
"0.521903",... | 0.7369775 | 0 |
Return whether the byteorder string is valid or not. | def check_byteorder(byteorder):
if not byteorder:
print('WARN: byteorder not given, using system byteorder.',
file=sys.stderr)
return None
elif byteorder in ENDIAN_CHARMAP.keys():
return byteorder
else:
raise BadByteorderException('%s not a valid byteorder.\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_binary(bytes_data):\n # From: https://stackoverflow.com/a/7392391\n return bool(bytes_data.translate(None, _TEXTCHARS))",
"def isStrictPubKeyEncoding(pubKey):\n if len(pubKey) == 33 and (pubKey[0] == 0x02 or pubKey[0] == 0x03):\n # Compressed\n return True\n if len(pubKey) == 65... | [
"0.64110535",
"0.6280978",
"0.62748444",
"0.6236036",
"0.6109709",
"0.6071637",
"0.6060703",
"0.59746486",
"0.59664",
"0.5966033",
"0.5957287",
"0.59495014",
"0.59452623",
"0.59450674",
"0.5902838",
"0.58954924",
"0.5853991",
"0.5848576",
"0.5842857",
"0.5838136",
"0.58200127... | 0.59032995 | 14 |
gets _vy attribute of Ball | def getYVelocity(self):
return self._vy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vel_y(self, *args, **kwargs) -> Any:\n pass",
"def verticalBounce(self):\n self._vy = random.uniform(-1.1,-.9) * self._vy",
"def set_xyvxvy(self, y):\n self.x = y[0]\n self.y = y[1]\n self.vx = y[2]\n self.vy = y[3]",
"def getVelocity(self):\n return self.v",
... | [
"0.6559114",
"0.63365656",
"0.62993044",
"0.62750775",
"0.6143195",
"0.6141476",
"0.61090714",
"0.60762995",
"0.6031575",
"0.6014166",
"0.6000758",
"0.5994763",
"0.59892905",
"0.59534085",
"0.59172595",
"0.5902815",
"0.589019",
"0.58460635",
"0.58299166",
"0.58198285",
"0.581... | 0.62280494 | 4 |
getter for y pos of ball | def getYpos(self):
return self.y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_y(self):\n return self.position.y",
"def get_pos_y(self):\n return self.__pos_y",
"def y(self):\r\n return self.position.y",
"def __get_y__(self):\n return self.Direction['y']",
"def getBallPos(self) -> (int,int):\n return self.x, self.y",
"def get_y_position(self)... | [
"0.7891347",
"0.7834176",
"0.7785785",
"0.76634204",
"0.7573686",
"0.7558997",
"0.7516041",
"0.750449",
"0.74919546",
"0.7452227",
"0.7452227",
"0.7451312",
"0.7423825",
"0.7392996",
"0.73483646",
"0.73150754",
"0.73132163",
"0.7293349",
"0.72762716",
"0.72368556",
"0.7200504... | 0.790157 | 0 |
For the curve C, Computes the locals extremas of curvature. | def PerformCurExt(self, *args):
return _Geom2dLProp.Geom2dLProp_CurAndInf2d_PerformCurExt(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curvatureEnergy(self, controlpoints):\n # only remember each curvature energy if the given control points are\n # the snakes current control points\n memorize_energies = np.equal(controlpoints, self.controlpoints).all()\n # reset the curvature energy list if necessary\n if me... | [
"0.67130774",
"0.65826344",
"0.65556866",
"0.6366551",
"0.6336396",
"0.6316116",
"0.6272855",
"0.61964786",
"0.6080913",
"0.60582566",
"0.60562235",
"0.6024462",
"0.5986874",
"0.5933708",
"0.5834163",
"0.5833787",
"0.58295995",
"0.5770191",
"0.5752753",
"0.57357043",
"0.56431... | 0.0 | -1 |
returns the last parameter bound of the curve. FirstParameter must be less than LastParameter. | def LastParameter(*args):
return _Geom2dLProp.Geom2dLProp_Curve2dTool_LastParameter(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Geom2dLProp_Curve2dTool_LastParameter(*args):\n return _Geom2dLProp.Geom2dLProp_Curve2dTool_LastParameter(*args)",
"def get_bounds(self, parameter_name=None):\n if parameter_name is None:\n return [self.get_bounds(p)\n for p in self.shape_parameters]\n if paramete... | [
"0.6457522",
"0.60364425",
"0.6001334",
"0.59667796",
"0.5922735",
"0.5891345",
"0.587714",
"0.58416635",
"0.581489",
"0.5797794",
"0.579475",
"0.5766311",
"0.57518166",
"0.57250553",
"0.5715133",
"0.56862664",
"0.56837034",
"0.5680519",
"0.5672987",
"0.5671046",
"0.56687105"... | 0.7123234 | 0 |
returns the last parameter bound of the curve. FirstParameter must be less than LastParameter. | def Geom2dLProp_Curve2dTool_LastParameter(*args):
return _Geom2dLProp.Geom2dLProp_Curve2dTool_LastParameter(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LastParameter(*args):\n return _Geom2dLProp.Geom2dLProp_Curve2dTool_LastParameter(*args)",
"def get_bounds(self, parameter_name=None):\n if parameter_name is None:\n return [self.get_bounds(p)\n for p in self.shape_parameters]\n if parameter_name in self.sha... | [
"0.7122676",
"0.6038244",
"0.5999881",
"0.5964987",
"0.5922051",
"0.5889614",
"0.5876017",
"0.5840431",
"0.5814702",
"0.57982117",
"0.5793289",
"0.5765686",
"0.5750727",
"0.5727082",
"0.57131803",
"0.5686352",
"0.5685996",
"0.56792235",
"0.5671481",
"0.56697",
"0.5668643",
... | 0.6457023 | 1 |
Reset the distance to 0 | def reset_dist(self):
# Called from CM1KEmulator.reset_indexcomp(), i.e., whenever LCOMP is updated
log.trace("Neuron.reset_dist()")
self.dist = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self) -> None:\n self._dist['current'] = np.copy(self._dist['initial'])",
"def reset(self):\n self.m = normalize(self.m0)\n self.t = 0.0",
"def reset(self):\n self._x = 0\n self._y = 0",
"def _update_distance_(self):\n pass",
"def reset(self):\n se... | [
"0.7505246",
"0.67828476",
"0.6779062",
"0.6744572",
"0.674133",
"0.66887504",
"0.66600883",
"0.6635699",
"0.66124755",
"0.660485",
"0.660485",
"0.65931296",
"0.6554118",
"0.6514976",
"0.65002465",
"0.649002",
"0.64835036",
"0.64688206",
"0.6462586",
"0.64298105",
"0.6422773"... | 0.7933506 | 0 |
Returns first n items of the iterable as a list. | def take(iterable, n):
return list(itertools.islice(iterable, n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(n, iterable):\n return list(itertools.islice(iterable, n))",
"def take(n, iterable):\n return list(itertools.islice(iterable, n))",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(num, iterable):\n ... | [
"0.81575644",
"0.81575644",
"0.81350166",
"0.81350166",
"0.77691907",
"0.76996034",
"0.7413426",
"0.71268004",
"0.6986541",
"0.6937001",
"0.68909377",
"0.68847245",
"0.68090135",
"0.6808583",
"0.6805742",
"0.6782021",
"0.67778486",
"0.6764092",
"0.6736692",
"0.6717172",
"0.67... | 0.82187545 | 0 |
Gets the keyguard_disabled of this EnterprisePolicyData. Should KeyGuard be disabled? | def keyguard_disabled(self):
return self._keyguard_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyguard_disabled(self, keyguard_disabled):\n\n self._keyguard_disabled = keyguard_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disable_secret_rotation(self) -> bool:\n return self._get_disable_secret... | [
"0.7200868",
"0.63610506",
"0.63610506",
"0.62397677",
"0.59635055",
"0.59635055",
"0.59004337",
"0.5887258",
"0.58351266",
"0.58351266",
"0.5832192",
"0.5817052",
"0.576621",
"0.57593375",
"0.57593375",
"0.57201785",
"0.5690402",
"0.56840986",
"0.5679228",
"0.56697977",
"0.5... | 0.8478754 | 0 |
Gets the safe_boot_disabled of this EnterprisePolicyData. Should SafeBoot be disabled? | def safe_boot_disabled(self):
return self._safe_boot_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_boot_disabled(self, safe_boot_disabled):\n\n self._safe_boot_disabled = safe_boot_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled_switch(self):\n return self.disabled",
"def enable_secure... | [
"0.7390593",
"0.6653444",
"0.6653444",
"0.64111996",
"0.6409013",
"0.6250641",
"0.6250641",
"0.62343067",
"0.62289745",
"0.62265426",
"0.6220577",
"0.6220577",
"0.6206231",
"0.6206231",
"0.61575866",
"0.61411977",
"0.61411977",
"0.61411977",
"0.61411977",
"0.61411977",
"0.614... | 0.83765495 | 0 |
Gets the status_bar_disabled of this EnterprisePolicyData. Should Status Bar be disabled? | def status_bar_disabled(self):
return self._status_bar_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_bar_disabled(self, status_bar_disabled):\n\n self._status_bar_disabled = status_bar_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def is_enabled(self):\n enabled = self.settings.get('show_status_bar_tex... | [
"0.74535227",
"0.6722495",
"0.6722495",
"0.6646602",
"0.6449252",
"0.64188486",
"0.63019514",
"0.63019514",
"0.621331",
"0.621331",
"0.61662",
"0.6083129",
"0.6083129",
"0.6022058",
"0.6003529",
"0.6003529",
"0.6002849",
"0.59575355",
"0.5948241",
"0.593245",
"0.5929588",
"... | 0.8697627 | 0 |
Gets the factory_reset_disabled of this EnterprisePolicyData. Should Factory Reset be disabled? | def factory_reset_disabled(self):
return self._factory_reset_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factory_reset_disabled(self, factory_reset_disabled):\n\n self._factory_reset_disabled = factory_reset_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def disabled(self):\n return self._disabled",
"def disable... | [
"0.7113954",
"0.6575864",
"0.6575864",
"0.63107055",
"0.63107055",
"0.621083",
"0.59006196",
"0.58927983",
"0.58911175",
"0.58911175",
"0.5849069",
"0.5849069",
"0.5818833",
"0.57972836",
"0.5781367",
"0.57740253",
"0.57740253",
"0.57740253",
"0.57740253",
"0.57740253",
"0.57... | 0.83381164 | 0 |
Gets the screenshot_disabled of this EnterprisePolicyData. Should Screenshot capability be disabled? | def screenshot_disabled(self):
return self._screenshot_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screenshot_disabled(self, screenshot_disabled):\n\n self._screenshot_disabled = screenshot_disabled",
"def GetBitmapDisabled(self):\n\n return self.bmpDisabled",
"def GetDisabledBitmap(self):\r\n \r\n return self.GetRotatedBitmap(True)",
"def ConvertToDisabled(*args, **kwargs)... | [
"0.72738385",
"0.6528808",
"0.6448583",
"0.593619",
"0.5917232",
"0.5917232",
"0.56591266",
"0.5643724",
"0.5611778",
"0.5580503",
"0.5577834",
"0.5573268",
"0.55604684",
"0.5482783",
"0.54307055",
"0.54307055",
"0.54008627",
"0.53978443",
"0.53978443",
"0.5394065",
"0.538796... | 0.8231866 | 0 |
Gets the usb_connectivity_disabled of this EnterprisePolicyData. Should USB connectivity be disabled? | def usb_connectivity_disabled(self):
return self._usb_connectivity_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usb_connectivity_disabled(self, usb_connectivity_disabled):\n\n self._usb_connectivity_disabled = usb_connectivity_disabled",
"def usb_file_transfer_disabled(self):\n return self._usb_file_transfer_disabled",
"def internet_advertising_disabled(self) -> pulumi.Output[Optional[bool]]:\n ... | [
"0.73084444",
"0.6636932",
"0.66190463",
"0.65761167",
"0.65761167",
"0.6522063",
"0.6507995",
"0.6430008",
"0.6430008",
"0.6398719",
"0.6220172",
"0.6180341",
"0.60755545",
"0.60755545",
"0.60121185",
"0.5991282",
"0.59806025",
"0.59806025",
"0.59601355",
"0.5942131",
"0.594... | 0.85685694 | 0 |
Gets the sms_disabled of this EnterprisePolicyData. Should SMS functionality be disabled? | def sms_disabled(self):
return self._sms_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sms_disabled(self, sms_disabled):\n\n self._sms_disabled = sms_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def disabled_by_microsoft(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"disabled_by_micro... | [
"0.7172404",
"0.6881718",
"0.6881718",
"0.6523218",
"0.65190893",
"0.65190893",
"0.651552",
"0.63809675",
"0.6341673",
"0.6341673",
"0.6332978",
"0.6332978",
"0.62760913",
"0.62579006",
"0.62335503",
"0.6168145",
"0.6153863",
"0.61510116",
"0.61399907",
"0.61192054",
"0.61059... | 0.8752758 | 0 |
Gets the outgoing_calls_disabled of this EnterprisePolicyData. Should Outgoing Calls be disabled? | def outgoing_calls_disabled(self):
return self._outgoing_calls_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outgoing_calls_disabled(self, outgoing_calls_disabled):\n\n self._outgoing_calls_disabled = outgoing_calls_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def sms_disabled(self):\n return self._sms_disabled",
... | [
"0.72864264",
"0.6248445",
"0.6248445",
"0.59462637",
"0.5855898",
"0.58264804",
"0.582112",
"0.582112",
"0.5801426",
"0.578343",
"0.5775901",
"0.5728235",
"0.5728235",
"0.57163405",
"0.5705044",
"0.5642422",
"0.5589621",
"0.5560569",
"0.5510928",
"0.5505026",
"0.5462166",
... | 0.84614015 | 0 |
Gets the camera_disabled of this EnterprisePolicyData. Should Camera be disabled? | def camera_disabled(self):
return self._camera_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camera_disabled(self, camera_disabled):\n\n self._camera_disabled = camera_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def with_allows_camera(self):\n return self.with_allowed_capture_methods(CAMERA)",
"de... | [
"0.67820245",
"0.6464067",
"0.6464067",
"0.61199194",
"0.60771465",
"0.60771465",
"0.60660094",
"0.6052308",
"0.60207635",
"0.6010918",
"0.60093695",
"0.5928136",
"0.5919576",
"0.58646256",
"0.5849397",
"0.5849397",
"0.583894",
"0.58233166",
"0.58186275",
"0.58186275",
"0.580... | 0.83048266 | 0 |
Gets the nfc_beam_disabled of this EnterprisePolicyData. Should NFC capability be disabled? | def nfc_beam_disabled(self):
return self._nfc_beam_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nfc_beam_disabled(self, nfc_beam_disabled):\n\n self._nfc_beam_disabled = nfc_beam_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def disabled(self):\n return self._disabled",
"def disabled(self):\n re... | [
"0.68498826",
"0.65092266",
"0.65092266",
"0.61811626",
"0.61811626",
"0.6083915",
"0.6083915",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6023776",
"0.6018145",
"0.60106605... | 0.83862484 | 0 |
Gets the disable_play_store of this EnterprisePolicyData. Should Google Play Store be disabled on the device? | def disable_play_store(self):
return self._disable_play_store | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_play_store(self, disable_play_store):\n\n self._disable_play_store = disable_play_store",
"def google_assistant_disabled(self):\n return self._google_assistant_disabled",
"def get_disable_vpa(self) -> bool:\n return self._get_disable_vpa(enable_validation=True)",
"def app_uni... | [
"0.67411476",
"0.62381124",
"0.5966748",
"0.5835287",
"0.5787932",
"0.5758111",
"0.5758111",
"0.54934967",
"0.54858977",
"0.5424671",
"0.5370296",
"0.53417575",
"0.53410286",
"0.53410286",
"0.53338623",
"0.53246135",
"0.52758753",
"0.52758753",
"0.52413815",
"0.5234032",
"0.5... | 0.7489574 | 0 |
Gets the usb_file_transfer_disabled of this EnterprisePolicyData. Should USB File transfer capability be disabled? | def usb_file_transfer_disabled(self):
return self._usb_file_transfer_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usb_file_transfer_disabled(self, usb_file_transfer_disabled):\n\n self._usb_file_transfer_disabled = usb_file_transfer_disabled",
"def usb_connectivity_disabled(self):\n return self._usb_connectivity_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self... | [
"0.7598133",
"0.6734313",
"0.61178195",
"0.61178195",
"0.59960717",
"0.5880824",
"0.5690624",
"0.5690624",
"0.5653857",
"0.56121093",
"0.553727",
"0.55300695",
"0.55204105",
"0.55204105",
"0.5482276",
"0.5482276",
"0.5481272",
"0.5475121",
"0.5470619",
"0.54598343",
"0.542640... | 0.87092835 | 0 |
Gets the tethering_disabled of this EnterprisePolicyData. Should USB Tethering capability be enabled? | def tethering_disabled(self):
return self._tethering_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tethering_disabled(self, tethering_disabled):\n\n self._tethering_disabled = tethering_disabled",
"def get_disabled_switch(self):\n return self.disabled",
"def usb_connectivity_disabled(self):\n return self._usb_connectivity_disabled",
"def get_disabled(self):\n return self._d... | [
"0.73254204",
"0.68872803",
"0.67699915",
"0.6558379",
"0.6558379",
"0.6185234",
"0.61407804",
"0.6069275",
"0.6066387",
"0.6058252",
"0.6055202",
"0.6055202",
"0.6051816",
"0.6051816",
"0.6040931",
"0.6040931",
"0.6005233",
"0.5985059",
"0.5978466",
"0.5978466",
"0.59162706"... | 0.8331209 | 0 |
Gets the date_time_config_disabled of this EnterprisePolicyData. Should Date/Time configuration capability be disabled? | def date_time_config_disabled(self):
return self._date_time_config_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_time_config_disabled(self, date_time_config_disabled):\n\n self._date_time_config_disabled = date_time_config_disabled",
"def time_enabled(self):\n return self._time_enabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disab... | [
"0.76061946",
"0.61147267",
"0.58484846",
"0.58484846",
"0.5555435",
"0.55163604",
"0.54714346",
"0.54714346",
"0.54160744",
"0.5353573",
"0.5353046",
"0.5353046",
"0.5340037",
"0.5340037",
"0.53051424",
"0.5288566",
"0.5288566",
"0.5260728",
"0.5248667",
"0.5201838",
"0.5185... | 0.84551173 | 0 |
Gets the app_uninstall_disabled of this EnterprisePolicyData. Should App uninstall capability be disabled? | def app_uninstall_disabled(self):
return self._app_uninstall_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_uninstall_disabled(self, app_uninstall_disabled):\n\n self._app_uninstall_disabled = app_uninstall_disabled",
"def adb_disabled(self):\n return self._adb_disabled",
"def disable_local_app_install(self):\n return self._disable_local_app_install",
"def get_disabled(self):\n ... | [
"0.74822974",
"0.5971417",
"0.5911451",
"0.5854653",
"0.5854653",
"0.58457893",
"0.571765",
"0.5676504",
"0.5659239",
"0.55945665",
"0.5547171",
"0.5545721",
"0.55407566",
"0.5423077",
"0.5422401",
"0.54107237",
"0.5398602",
"0.53798693",
"0.53621984",
"0.5330927",
"0.5330927... | 0.84912926 | 0 |
Sets the app_uninstall_disabled of this EnterprisePolicyData. Should App uninstall capability be disabled? | def app_uninstall_disabled(self, app_uninstall_disabled):
self._app_uninstall_disabled = app_uninstall_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_uninstall_disabled(self):\n return self._app_uninstall_disabled",
"def disable(self):\n self._installed_apps_remove()",
"def disable_local_app_install(self, disable_local_app_install):\n\n self._disable_local_app_install = disable_local_app_install",
"def disable_local_app_instal... | [
"0.78517693",
"0.64427704",
"0.6069429",
"0.5957001",
"0.5747844",
"0.57043254",
"0.5674913",
"0.549833",
"0.5425248",
"0.5392206",
"0.53725624",
"0.5351736",
"0.5334732",
"0.52983314",
"0.5258369",
"0.52551895",
"0.52491987",
"0.5238037",
"0.52285385",
"0.5210205",
"0.521020... | 0.86784655 | 0 |
Gets the google_assistant_disabled of this EnterprisePolicyData. Should Google Assistant feature be disabled? | def google_assistant_disabled(self):
return self._google_assistant_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def google_assistant_disabled(self, google_assistant_disabled):\n\n self._google_assistant_disabled = google_assistant_disabled",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def disabled(self):\n return self._disabled",
... | [
"0.71877706",
"0.68915147",
"0.68915147",
"0.63962644",
"0.63962644",
"0.63898474",
"0.63898474",
"0.6332069",
"0.6332069",
"0.63273716",
"0.63197803",
"0.6299147",
"0.62521595",
"0.62521595",
"0.623085",
"0.62268746",
"0.6211239",
"0.6211239",
"0.6211239",
"0.6211239",
"0.62... | 0.8664455 | 0 |
Gets the adb_disabled of this EnterprisePolicyData. Should Android Debugger be disabled? | def adb_disabled(self):
return self._adb_disabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adb_disabled(self, adb_disabled):\n\n self._adb_disabled = adb_disabled",
"def _isdisable(self):\n return self.dp.state()==PyTango.DevState.DISABLE",
"def get_disabled(self):\n return self._disabled",
"def get_disabled(self):\n return self._disabled",
"def usb_connectivity_d... | [
"0.7170552",
"0.71516275",
"0.6721604",
"0.6721604",
"0.6597002",
"0.6489791",
"0.6427642",
"0.63761896",
"0.63761896",
"0.63490367",
"0.632234",
"0.632234",
"0.62178594",
"0.6215352",
"0.61542517",
"0.61542517",
"0.6152051",
"0.6150517",
"0.614931",
"0.6102324",
"0.6102324",... | 0.84772503 | 0 |
Gets the phone_policy of this EnterprisePolicyData. | def phone_policy(self):
return self._phone_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phone(self):\n\n return self._phone",
"def phone(self):\n return self._phone",
"def phone(self):\n return self._phone",
"def phone(self):\n return self._phone",
"def personal_phone(self):\n return self._personal_phone",
"def getPhone(self):\n return self.phon... | [
"0.64020115",
"0.63283277",
"0.63283277",
"0.63283277",
"0.6299696",
"0.62436295",
"0.6183605",
"0.59960383",
"0.59289145",
"0.592715",
"0.59175825",
"0.5837716",
"0.5826304",
"0.5793685",
"0.5793685",
"0.5772779",
"0.5724893",
"0.5711506",
"0.55813533",
"0.55791116",
"0.5515... | 0.8572655 | 0 |
Sets the phone_policy of this EnterprisePolicyData. | def phone_policy(self, phone_policy):
self._phone_policy = phone_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phone(self, phone):\n if self.local_vars_configuration.client_side_validation and phone is None: # noqa: E501\n raise ValueError(\"Invalid value for `phone`, must not be `None`\") # noqa: E501\n\n self._phone = phone",
"def setPhone(self, phone):\n self.phone = phone\n ... | [
"0.6692906",
"0.659589",
"0.6418374",
"0.64074653",
"0.64074653",
"0.64074653",
"0.64074653",
"0.64074653",
"0.633074",
"0.6215301",
"0.59624034",
"0.59274197",
"0.57776195",
"0.5515008",
"0.55033946",
"0.5404319",
"0.5404319",
"0.5344793",
"0.5344793",
"0.5344793",
"0.534479... | 0.8585835 | 0 |
Gets the device_password_policy of this EnterprisePolicyData. | def device_password_policy(self):
return self._device_password_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_validation_policy(self) -> 'outputs.PasswordValidationPolicyResponse':\n return pulumi.get(self, \"password_validation_policy\")",
"def device_password_policy(self, device_password_policy):\n\n self._device_password_policy = device_password_policy",
"def device_update_policy(self):\n... | [
"0.6621351",
"0.64411545",
"0.63904023",
"0.62989235",
"0.62989235",
"0.61246306",
"0.61246306",
"0.6047178",
"0.6047178",
"0.6033519",
"0.6033519",
"0.58371216",
"0.570245",
"0.55293566",
"0.5502047",
"0.54860216",
"0.5485863",
"0.5461407",
"0.5431872",
"0.534722",
"0.534015... | 0.85603786 | 0 |
Sets the device_password_policy of this EnterprisePolicyData. | def device_password_policy(self, device_password_policy):
self._device_password_policy = device_password_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_password_policy(self):\n return self._device_password_policy",
"def device_update_policy(self, device_update_policy):\n\n self._device_update_policy = device_update_policy",
"def unconfigure_enable_policy_password(device,\n password,\n ... | [
"0.67319477",
"0.63873446",
"0.6014038",
"0.59457594",
"0.54061604",
"0.5340421",
"0.5269174",
"0.52671254",
"0.52561945",
"0.5237785",
"0.52311504",
"0.5182032",
"0.51553065",
"0.51503515",
"0.51477236",
"0.51477236",
"0.51477236",
"0.51477236",
"0.5145184",
"0.5092492",
"0.... | 0.87224925 | 0 |
Gets the minimum_password_length of this EnterprisePolicyData. What is the minimum length for your device's password | def minimum_password_length(self):
return self._minimum_password_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_min_length(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"password_min_length\")",
"def password_min_length(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"password_min_length\")",
"def password_min_length(self) -> Optional[pulumi.Input[int]]:\n ... | [
"0.8269237",
"0.81490684",
"0.81490684",
"0.73351914",
"0.7320023",
"0.72430795",
"0.7170308",
"0.71399117",
"0.7060607",
"0.6872928",
"0.6872928",
"0.6820458",
"0.6628853",
"0.6577",
"0.64872855",
"0.64872855",
"0.6469215",
"0.6380859",
"0.6363847",
"0.6363847",
"0.6340418",... | 0.8571683 | 0 |
Sets the minimum_password_length of this EnterprisePolicyData. What is the minimum length for your device's password | def minimum_password_length(self, minimum_password_length):
if minimum_password_length is not None and minimum_password_length < 4:
raise ValueError("Invalid value for `minimum_password_length`, must be a value greater than or equal to `4`")
self._minimum_password_length = minimum_password_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_password_length(self):\n return self._minimum_password_length",
"def AddPasswordPolicyMinLength(parser):\n parser.add_argument(\n '--password-policy-min-length',\n type=int,\n required=False,\n default=None,\n help='Minimum number of characters allowed in the password... | [
"0.7464518",
"0.7165207",
"0.710996",
"0.710996",
"0.7072664",
"0.687956",
"0.6592008",
"0.6480402",
"0.6480402",
"0.6480402",
"0.6480402",
"0.6392565",
"0.6348436",
"0.6323774",
"0.6073071",
"0.6009355",
"0.59730333",
"0.59730333",
"0.59248763",
"0.58945364",
"0.5894292",
... | 0.8176562 | 0 |
Gets the device_update_policy of this EnterprisePolicyData. | def device_update_policy(self):
return self._device_update_policy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_update_policy(self, device_update_policy):\n\n self._device_update_policy = device_update_policy",
"def device_password_policy(self):\n return self._device_password_policy",
"def policy(self) -> HwPolicy:\n return self._policy",
"def removal_policy(self) -> typing.Optional[aws... | [
"0.6432895",
"0.57799953",
"0.56302893",
"0.55358505",
"0.55358505",
"0.55358505",
"0.54661334",
"0.53477",
"0.53179884",
"0.52889603",
"0.5261793",
"0.5185718",
"0.5161576",
"0.5151737",
"0.513496",
"0.513496",
"0.513496",
"0.513496",
"0.5073536",
"0.49513724",
"0.49513724",... | 0.8377561 | 0 |
Gets the settings_app_password of this EnterprisePolicyData. Lock Password (optional) for the ESPER Settings app | def settings_app_password(self):
return self._settings_app_password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings_app_password(self, settings_app_password):\n\n self._settings_app_password = settings_app_password",
"def device_password_policy(self):\n return self._device_password_policy",
"def _password(self):\n if 'password' in self._config:\n return self._config['password']\n... | [
"0.7278267",
"0.6232522",
"0.62071407",
"0.60912085",
"0.60912085",
"0.60771084",
"0.6060172",
"0.6055608",
"0.59419876",
"0.59418386",
"0.593273",
"0.59198594",
"0.5890641",
"0.5890315",
"0.5867784",
"0.5866768",
"0.5865266",
"0.5863915",
"0.5863915",
"0.5863915",
"0.5840755... | 0.8161488 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, EnterprisePolicyData):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84560555",
"0.83913696",
"0.8143685",
"0.81403786",
"0.8131871",
"0.8093231",
"0.80915105",
"0.80915105",
"0.80915105",
"0.8084564",
"0.8084564",
"0.8075547",
"0.8075547",
"0.8065006"
] | 0.0 | -1 |
Utility method to read a json file schema | def read_json(json_file):
with open(json_file) as schema:
val = json.load(schema)
return val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_json_schema(filename):\n\n relative_path = join('schemas', filename)\n absolute_path = join(dirname(__file__), relative_path)\n\n with open(absolute_path) as schema_file:\n return json.loads(schema_file.read())",
"def read_json_schema(schema_file_path):\n with open(schema_file_path) ... | [
"0.7936051",
"0.7901159",
"0.78531134",
"0.7839239",
"0.7739872",
"0.7726507",
"0.7724807",
"0.76740587",
"0.765706",
"0.7566453",
"0.69441533",
"0.6715418",
"0.6645315",
"0.6624186",
"0.6619392",
"0.66133434",
"0.6612658",
"0.6610534",
"0.65290445",
"0.6522143",
"0.65186304"... | 0.7506015 | 10 |
Initialize a new Perceptron instance. A perceptron classifies data points as either belonging to a particular class (+1) or not (1). `dimensions` is the dimensionality of the data. For example, dimensions=2 would mean that the perceptron must classify 2D points. | def __init__(self, dimensions):
self.w = nn.Parameter(1, dimensions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_perceptron(train_exs: List[SentimentExample], feat_extractor: FeatureExtractor) -> PerceptronClassifier:\n raise Exception(\"Must be implemented\")",
"def train_perceptron(train_exs: List[SentimentExample], feat_extractor: FeatureExtractor) -> PerceptronClassifier:\n raise Exception(\"Must be imp... | [
"0.6328094",
"0.6328094",
"0.60307497",
"0.57515126",
"0.57284737",
"0.57270014",
"0.57080954",
"0.56603783",
"0.5654134",
"0.5612423",
"0.55629176",
"0.55192095",
"0.5508208",
"0.5499397",
"0.545328",
"0.54508346",
"0.5441534",
"0.54262036",
"0.5389387",
"0.5385642",
"0.5373... | 0.5599541 | 11 |
Calculates the predicted class for a single data point `x`. | def get_prediction(self, x):
"*** YOUR CODE HERE ***"
dotProduct = nn.as_scalar(self.run(x))
if dotProduct < 0:
return -1
else:
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self,x):\n preds = [tree.predict(x) for tree in self.forest]\n if self.classify:\n cls_counts = [0] * self.param['numClasses']\n for p in preds:\n cls_counts[p] += 1\n return argmax(cls_counts)\n else:\n return sum(preds) /... | [
"0.7661864",
"0.75725013",
"0.7557718",
"0.754271",
"0.751603",
"0.7362721",
"0.73497975",
"0.73497975",
"0.73248315",
"0.72767216",
"0.7252811",
"0.72328496",
"0.72281516",
"0.7220185",
"0.72055614",
"0.71956426",
"0.71938753",
"0.71757466",
"0.71692836",
"0.71511495",
"0.71... | 0.0 | -1 |
Set the action command object based on the yaml provided value. | def get_action_command(self):
if self.action.value == "start":
self.action_command = self.ServerStartSubCommand()
else:
self.action_command = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAction(self, value):\n return self._set(action=value)",
"def set_action_cmd(self, action):\n if self.args.snapcheck is True:\n action = \"snapcheck\"\n if self.args.check is True:\n action = \"check\"\n if self.args.snap is True:\n action = \"sn... | [
"0.60741985",
"0.5902346",
"0.5685571",
"0.5663917",
"0.5653658",
"0.5653658",
"0.5568884",
"0.5453069",
"0.5453069",
"0.5453069",
"0.5453069",
"0.5453069",
"0.5453069",
"0.5444866",
"0.5422436",
"0.54030555",
"0.5380244",
"0.53319967",
"0.53319967",
"0.53319967",
"0.5295152"... | 0.5252781 | 27 |
Create a DaosServerConfig object. | def __init__(self):
super(DaosServerConfig, self).__init__("/run/server_config/*")
# Parameters
self.name = BasicParameter(None, "daos_server")
self.access_points = BasicParameter(None) # e.g. "<host>:<port>"
self.port = BasicParameter(None, 10001)
self.provider = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_config(self) -> None:\n pass",
"def create_config(self) -> None:\n pass",
"def __init__(self, index=None):\n namespace = \"/run/server_config/servers/*\"\n if isinstance(index, int):\n namespace = \"/run/server_config/servers/{}/*\".format(index)\n ... | [
"0.6484697",
"0.6484697",
"0.6008529",
"0.59743756",
"0.5901469",
"0.5690002",
"0.56122255",
"0.55644786",
"0.55335927",
"0.54810846",
"0.54810846",
"0.5434671",
"0.54337317",
"0.5401697",
"0.5370176",
"0.5357134",
"0.5341255",
"0.53370327",
"0.5334033",
"0.5316994",
"0.53133... | 0.7148316 | 0 |
Create a yaml file from the parameter values. | def create_yaml(self, filename):
log_dir = os.environ.get("DAOS_TEST_LOG_DIR", "/tmp")
# Convert the parameters into a dictionary to write a yaml file
yaml_data = {"servers": []}
for name in self.get_param_names():
if name != "servers_per_host":
value = getat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveToFile(self,filename):\n path = os.path.dirname(__file__)+\"/\"+filename\n stream = open(path,\"w\")\n yaml.dump(self.parameters(),stream)",
"def user_create_yaml(self):\n pass",
"def yaml_from_params(input, yamlout=None):\n # Values to put in quotes in the YAML file\n add_quotes ... | [
"0.7031866",
"0.69381",
"0.6852262",
"0.6583802",
"0.65791804",
"0.63603985",
"0.63350266",
"0.632087",
"0.6317282",
"0.6237005",
"0.6174158",
"0.61437964",
"0.61359924",
"0.6088672",
"0.60867244",
"0.6028629",
"0.5943792",
"0.5898062",
"0.5865599",
"0.58397055",
"0.5832636",... | 0.664645 | 3 |
Attempts to get an iterable's itemtype without iterating over it, not even partly. Note that iterating over an iterable might modify its inner state, e.g. if it is an iterator. Note that obj is expected to be an iterable, not a typing.Iterable. This function leverages various alternative ways to obtain that info, e.g. ... | def get_iterable_itemtype(obj):
# support further specific iterables on demand
if isinstance(obj, _typechecked_Iterable):
return obj.itemtype
try:
if isinstance(obj, range):
tpl = tuple(deep_type(obj.start), deep_type(obj.stop), deep_type(obj.step))
return Union[tpl]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_iterable(obj):\n if obj is None:\n return ()\n\n if (isinstance(obj, collections.Iterable) and\n not isinstance(obj, six.string_types)):\n return obj\n\n return (obj,)",
"def getIter(object):\n iterator = None\n try:\n iterator = iter(object)\n except Typ... | [
"0.6349445",
"0.60908026",
"0.6062485",
"0.5892823",
"0.58469146",
"0.5830642",
"0.5809319",
"0.5732307",
"0.5696652",
"0.56577265",
"0.56553054",
"0.5632198",
"0.5613213",
"0.5610289",
"0.54935426",
"0.54694635",
"0.543611",
"0.53736067",
"0.53349006",
"0.53149056",
"0.52387... | 0.8030404 | 0 |
Python version independent function to check if a typing.Tuple object contains an ellipsis. | def is_Tuple_ellipsis(tpl):
try:
return tpl.__tuple_use_ellipsis__
except AttributeError:
try:
if tpl.__args__ is None:
return False
# Python 3.6
if tpl.__args__[-1] is Ellipsis:
return True
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ellipsis(node):\n return isinstance(node, gast.Constant) and node.value == Ellipsis",
"def _handle_ellipsis(value: Any, annotation: Any) -> bool:\n return value == ...",
"def is_variadic(self):\n if self.is_function() and self.args:\n return self.args[-1].endswith(\"...\")\n ... | [
"0.6667289",
"0.6526774",
"0.63408387",
"0.62675333",
"0.6230002",
"0.61231893",
"0.5935019",
"0.59146523",
"0.5835167",
"0.5799875",
"0.5777628",
"0.5664965",
"0.5664788",
"0.565639",
"0.5650909",
"0.5643989",
"0.56232226",
"0.5580962",
"0.55418825",
"0.5530617",
"0.55229425... | 0.85951304 | 0 |
Tests if an object is an iterator. This function is intentionally not capitalized, because it does not check w.r.t. (capital) Iterator class from typing. | def is_iterator(obj):
return isinstance(obj, collections.Iterator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_iterator(obj: Any) -> bool:\n if isinstance(obj, collections.abc.Iterator):\n return True\n else:\n try:\n return iter(obj) is obj\n except TypeError:\n return False",
"def is_iterator(obj):\n cls = obj.__class__\n return hasattr(cls, '__next__') and ... | [
"0.8979375",
"0.8547539",
"0.8483118",
"0.81119794",
"0.7411472",
"0.74110585",
"0.7298827",
"0.72313434",
"0.7209773",
"0.7188771",
"0.7155902",
"0.7039577",
"0.69884765",
"0.6983092",
"0.6875408",
"0.67790437",
"0.6655707",
"0.66470045",
"0.664298",
"0.662143",
"0.658055",
... | 0.9035219 | 0 |
Python version independent check if an object is a type. For Python 3.7 onwards(?) this is not equivalent to ``isinstance(tp, type)`` any more, as that call would return ``False`` for PEP 484 types. Tested with CPython 2.7, 3.5, 3.6, 3.7 and Jython 2.7.1. | def is_Type(tp):
if isinstance(tp, type):
return True
try:
typing._type_check(tp, '')
return True
except TypeError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_type(obj):\n return type(obj) is type or type(obj) is types.ClassType",
"def is_type(obj: Any) -> bool:\n return type(obj).__name__ == \"type\"",
"def has_exactly_type(obj, tpe):\r\n return type(obj) == tpe",
"def _isinstancetype(an_obj):\n if an_obj is None: return False\n if not PY3K:... | [
"0.7941886",
"0.7800008",
"0.76952165",
"0.7620394",
"0.7613953",
"0.75986016",
"0.7465807",
"0.7419771",
"0.7332141",
"0.71256024",
"0.7068957",
"0.7029514",
"0.69825554",
"0.6938877",
"0.6898511",
"0.68506974",
"0.6850466",
"0.6807822",
"0.67732465",
"0.67732465",
"0.677324... | 0.76709735 | 3 |
Helper for _issubclass, a.k.a pytypes.issubtype. This subclasscheck treats Mappingvalues as covariant. | def _issubclass_Mapping_covariant(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
if is_Generic(subclass):
suborigin = _origin(subclass)
if suborigin is None or not issubclass(suborigin, Mapping):
return _issub... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubclass_safe(value, type_):\n try:\n return issubclass(value, type_)\n except (TypeError, AttributeError):\n # Cannot perform issubclass on some types\n return False",
"def _issubclass_2(subclass, superclass, bound_Generic, bound_typevars,\n bound_typevars_readonly, f... | [
"0.72249764",
"0.71801305",
"0.70425856",
"0.6948541",
"0.64964324",
"0.64868784",
"0.64306223",
"0.6357397",
"0.63514256",
"0.6306663",
"0.62834364",
"0.6234352",
"0.6225228",
"0.6199874",
"0.61888766",
"0.61707646",
"0.6109152",
"0.60952836",
"0.6090366",
"0.6071789",
"0.59... | 0.80307674 | 0 |
Retrieves the parameter value of a given TypeVar from a Generic. Returns None if the generic does not contain an appropriate value. Note that the TypeVar is compared by instance and not by name. E.g. using a local TypeVar T would yield different results than using typing.T despite the equal name. | def get_arg_for_TypeVar(typevar, generic, arg_holder=None):
if not is_Generic(generic):
generic = get_Generic_type(generic)
return _get_arg_for_TypeVar(typevar, generic,
generic if arg_holder is None else arg_holder) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_vartype(scalar):\n return VARINFO_DICT[type(scalar)]",
"def form_get(var, convert=None, default=_DEFAULT):\n\n return _parameter_get(request.form, var, convert, default)",
"def get_generic_param_type(type_: Type, i: int, expected_type: Type):\n type_param = type_.__orig_bases__[0].__args__[i]... | [
"0.569946",
"0.5491743",
"0.54188025",
"0.53047514",
"0.5279419",
"0.52657616",
"0.52205276",
"0.5170485",
"0.51688814",
"0.51482314",
"0.508686",
"0.50577927",
"0.49991065",
"0.49764058",
"0.4957105",
"0.4925923",
"0.49086618",
"0.4879741",
"0.48618522",
"0.48428175",
"0.482... | 0.71086454 | 0 |
Helper for _issubclass, a.k.a pytypes.issubtype. | def _issubclass_Generic(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
# this function is partly based on code from typing module 3.5.2.2
if subclass is None:
return False
subclass = _extra_inv(subclass)
origin = _ori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubclass_(arg1, arg2):\n try:\n return issubclass(arg1, arg2)\n except TypeError:\n return False",
"def issubclass_safe(value, type_):\n try:\n return issubclass(value, type_)\n except (TypeError, AttributeError):\n # Cannot perform issubclass on some types\n ... | [
"0.79693806",
"0.77963567",
"0.74987507",
"0.74248827",
"0.72930634",
"0.7287544",
"0.72473264",
"0.7244965",
"0.7235188",
"0.7154764",
"0.7133687",
"0.7130599",
"0.7103767",
"0.7098614",
"0.70740604",
"0.7029137",
"0.7010398",
"0.69921726",
"0.6990751",
"0.69684446",
"0.6958... | 0.67713994 | 43 |
Helper for _issubclass, a.k.a pytypes.issubtype. | def _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
# this function is partly based on code from typing module 3.5.2.2
subclass = _extra_inv(subclass)
if not is_Type(subclass):
# To TypeError.
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubclass_(arg1, arg2):\n try:\n return issubclass(arg1, arg2)\n except TypeError:\n return False",
"def issubclass_safe(value, type_):\n try:\n return issubclass(value, type_)\n except (TypeError, AttributeError):\n # Cannot perform issubclass on some types\n ... | [
"0.79691404",
"0.7796277",
"0.74985415",
"0.7425355",
"0.72926915",
"0.7287119",
"0.72477835",
"0.7245316",
"0.7234554",
"0.7154465",
"0.7134522",
"0.7129982",
"0.7103742",
"0.70984006",
"0.7073698",
"0.7029286",
"0.70102906",
"0.69922197",
"0.69905996",
"0.69680697",
"0.6958... | 0.6240112 | 77 |
Helper for _issubclass, a.k.a pytypes.issubtype. | def _issubclass_Union(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
if not follow_fwd_refs:
return _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubclass_(arg1, arg2):\n try:\n return issubclass(arg1, arg2)\n except TypeError:\n return False",
"def issubclass_safe(value, type_):\n try:\n return issubclass(value, type_)\n except (TypeError, AttributeError):\n # Cannot perform issubclass on some types\n ... | [
"0.79693806",
"0.77963567",
"0.74987507",
"0.74248827",
"0.72930634",
"0.7287544",
"0.72473264",
"0.7244965",
"0.7235188",
"0.7154764",
"0.7133687",
"0.7130599",
"0.7103767",
"0.7098614",
"0.70740604",
"0.7029137",
"0.7010398",
"0.69921726",
"0.6990751",
"0.69684446",
"0.6958... | 0.66757864 | 52 |
Helper for _issubclass, a.k.a pytypes.issubtype. | def _has_base(cls, base):
if cls is base:
return True
elif cls is None:
return False
try:
for bs in cls.__bases__:
if _has_base(bs, base):
return True
except:
pass
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubclass_(arg1, arg2):\n try:\n return issubclass(arg1, arg2)\n except TypeError:\n return False",
"def issubclass_safe(value, type_):\n try:\n return issubclass(value, type_)\n except (TypeError, AttributeError):\n # Cannot perform issubclass on some types\n ... | [
"0.79704076",
"0.7798395",
"0.7501563",
"0.74257004",
"0.72929996",
"0.72874963",
"0.72472686",
"0.7244967",
"0.72380066",
"0.71578413",
"0.71344805",
"0.713397",
"0.7107198",
"0.7102151",
"0.7079654",
"0.7029404",
"0.7013383",
"0.6995514",
"0.6993804",
"0.6972097",
"0.696194... | 0.6003606 | 96 |
Helper for _issubclass, a.k.a pytypes.issubtype. | def _issubclass_2(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _recursion_check):
if is_Tuple(superclass):
return _issubclass_Tuple(subclass, superclass, bound_Generic, bound_typevars,
bound_typevars_readonly, follow_fwd_refs, _re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issubclass_(arg1, arg2):\n try:\n return issubclass(arg1, arg2)\n except TypeError:\n return False",
"def issubclass_safe(value, type_):\n try:\n return issubclass(value, type_)\n except (TypeError, AttributeError):\n # Cannot perform issubclass on some types\n ... | [
"0.79691404",
"0.7796277",
"0.74985415",
"0.7425355",
"0.72926915",
"0.7287119",
"0.72477835",
"0.7234554",
"0.7154465",
"0.7134522",
"0.7129982",
"0.7103742",
"0.70984006",
"0.7073698",
"0.7029286",
"0.70102906",
"0.69922197",
"0.69905996",
"0.69680697",
"0.6958379",
"0.6922... | 0.7245316 | 7 |
Access this via ``pytypes.is_of_type``. Works like ``isinstance``, but supports PEP 484 style types from ``typing`` module. | def _isinstance(obj, cls, bound_Generic=None, bound_typevars=None,
bound_typevars_readonly=False, follow_fwd_refs=True, _recursion_check=None):
if bound_typevars is None:
bound_typevars = {}
# Special treatment if cls is Iterable[...]
if is_Generic(cls) and cls.__origin__ is typing.Itera... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _isinstance(cls, x):\n return isinstance(x, cls.PYTHON_TYPE_CHECK)",
"def is_type(value):\n if isinstance(value, type):\n return issubclass(value, Type)\n return isinstance(value, Type)",
"def _isinstance(self, value: Any, typ: Any) -> bool:\n typ_args = getattr(typ, '__a... | [
"0.7589273",
"0.75746596",
"0.7396936",
"0.70493704",
"0.70258564",
"0.69741166",
"0.6971388",
"0.6839726",
"0.6817796",
"0.6776496",
"0.67656595",
"0.6722682",
"0.6706711",
"0.64954865",
"0.6452313",
"0.6429848",
"0.6421443",
"0.63997704",
"0.6382379",
"0.6359887",
"0.631984... | 0.575237 | 76 |
User should not be able to sign up with invalid first name | def test_user_signup_with_invalid_first_name(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_signup_missing_first_name(self):\n\n invalid_u = User.signup(\"test@test.com\", \"testuser\", \"testpass\", None, \"User\", None)\n \n uid = 99999\n invalid_u.id = uid\n\n with self.assertRaises(exc.IntegrityError) as context:\n db.session.commit()",
"def te... | [
"0.7791735",
"0.74545634",
"0.7342376",
"0.73098814",
"0.7102159",
"0.7068166",
"0.7065002",
"0.6875844",
"0.6863673",
"0.6793918",
"0.6748383",
"0.67190206",
"0.6716781",
"0.67107785",
"0.66857076",
"0.6675032",
"0.6674217",
"0.6670775",
"0.6659421",
"0.6654315",
"0.6651879"... | 0.8829329 | 0 |
Return the area of a polygon. The node coordinates must be ordered, but the direction does not matter we return the absvalue >>> points_x = [4, 4, 8, 8, 4, 4] >>> points_z = [6, 4, 4, 8, 8, 6] >>> self._get_area_polygon(points_x, points_z) ... 128 | def _get_area_polygon(points_x, points_z):
area = 0
j = len(points_x) - 1
for i in range(len(points_x)):
area = area + (
points_x[j] + points_x[i]
) * (points_z[j] - points_z[i])
j = i
return np.abs(area / 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AreaOfPolygon(points):\n # Note: area will be negative for clockwise shapes.\n # See http://paulbourke.net/geometry/polyarea/\n A = 0\n N = len(points)\n for i in xrange(0, N):\n x_i = points[i][0]\n y_i = points[i][1]\n x_ip1 = points[(i+1) % N][0]\n y_ip1 = points[(i+1) % N][1]\n A += (x_... | [
"0.7786078",
"0.7780968",
"0.75890505",
"0.72880936",
"0.723615",
"0.712512",
"0.70573545",
"0.7033072",
"0.6938555",
"0.688246",
"0.6873714",
"0.68340415",
"0.6779926",
"0.6709136",
"0.6657601",
"0.6601326",
"0.6589193",
"0.6557975",
"0.64694965",
"0.6412047",
"0.6401731",
... | 0.84951603 | 0 |
Knot vector for V direction. | def knotvector_v(self):
return self._knot_vector_v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knotvector_u(self):\n return self._knot_vector_u",
"def make_k_matrix(self):\r\n K = self.uv_vol + self.Epsilon * self.guv_vol + \\\r\n (self.Epsilon / self.Beta) * self.uv_bound\r\n return K",
"def k(self) -> np.ndarray:\n return self._vector[12:18]",
"def K(self, ... | [
"0.76220715",
"0.6758518",
"0.6702464",
"0.6466854",
"0.6342065",
"0.63208073",
"0.6267283",
"0.6239728",
"0.621496",
"0.6190831",
"0.6182039",
"0.6182039",
"0.6182039",
"0.61748487",
"0.61739725",
"0.6055274",
"0.60101086",
"0.59867924",
"0.59712756",
"0.5943418",
"0.5929724... | 0.86731815 | 0 |
Size of the control points array in Vdirection. | def ctrlpts_size_v(self):
return self._control_points_size_v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v_size(self) -> int:\n return len(self.Nodes)",
"def ctrlpts_size_u(self):\n return self._control_points_size_u",
"def _get_vector_size(self):\n if len(self):\n return len(self.values()[0])\n else:\n return 0",
"def v_size(self) -> int:\n return se... | [
"0.7082896",
"0.69444096",
"0.6854408",
"0.67856467",
"0.67614645",
"0.6754222",
"0.67497224",
"0.6739692",
"0.6684733",
"0.66512626",
"0.6612611",
"0.661229",
"0.6599841",
"0.65916854",
"0.65756106",
"0.65467596",
"0.65384233",
"0.6515039",
"0.64856726",
"0.64856726",
"0.647... | 0.7896886 | 0 |
Assort the plots by their types | def assort_plots_by_type(params):
# type: (Dict) -> Dict
params['internal']['user']['plots'] = dict()
for t in params['internal']['available']['plot_types']:
params['internal']['user']['plots'][t] = []
for i in range(len(params['data'])):
plot_type = params['data'][i]['plot_type']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sort_distributions(plot_data, plot_labels, plot_colors, sort_type):\r\n if sort_type == 'median':\r\n sort_key = lambda item: np.median(item[0])\r\n elif sort_type == 'alphabetical':\r\n sort_key = lambda item: item[1]\r\n else:\r\n raise ValueError(\"Invalid sort type '%s'.\" % ... | [
"0.6878626",
"0.5778905",
"0.560378",
"0.5590676",
"0.55773777",
"0.5572109",
"0.5459261",
"0.5459167",
"0.5422412",
"0.539574",
"0.53957087",
"0.5386678",
"0.5363811",
"0.53259015",
"0.52869207",
"0.5273937",
"0.52533203",
"0.5244021",
"0.52354383",
"0.5210002",
"0.52080005"... | 0.7245197 | 0 |
Examples >>> counts = np.array([np.arange(0, 10), np.arange(2, 12), ... np.arange(1, 11), np.arange(3, 13), ... np.arange(1, 11), np.arange(3, 13)]) >>> reb = quick_chan_rebin(counts, 2) >>> np.allclose(reb, [[2, 4, 6, 8, 10, 12, 14, 16, 18, 20], ... [4, 6, 8, 10, 12, 14, 16, 18, 20, 22], ... [4, 6, 8, 10, 12, 14, 16, ... | def quick_chan_rebin(counts, current_rebin):
nchan = counts.shape[0]
nbin = counts.shape[1]
n = int(nchan // current_rebin)
rebinned_counts = np.sum(
counts[:n * current_rebin, :].reshape((n, current_rebin, nbin)), axis=1)
return rebinned_counts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quick_resample(counts, current_rebin):\n nchan = counts.shape[0]\n nbin = counts.shape[1]\n\n n = int(nbin // current_rebin)\n\n reshaped = np.copy(counts[:, :n * current_rebin]).reshape((nchan, n, current_rebin))\n rebinned_counts = np.zeros((reshaped.shape[0], reshaped.shape[1]))\n for i in... | [
"0.6885492",
"0.56438416",
"0.5496909",
"0.54585487",
"0.5378317",
"0.5376209",
"0.53373975",
"0.5318333",
"0.531653",
"0.5288927",
"0.5265355",
"0.5235045",
"0.52322924",
"0.5184941",
"0.5149579",
"0.51289743",
"0.5112643",
"0.50999886",
"0.5084255",
"0.5074004",
"0.50737196... | 0.81301224 | 0 |
Convert a numerical value to a twobyte string, possibly scaling it. | def _numToTwoByteString(value, numberOfDecimals=0, LsbFirst=False, signed=False):
_checkNumerical(value, description='inputvalue')
_checkInt(numberOfDecimals, minvalue=0, description='number of decimals')
_checkBool(LsbFirst, description='LsbFirst')
_checkBool(signed, description='signed parameter')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_bytes(num):\n for x in ['_B', 'KB', 'MB', 'GB', 'TB']:\n if num < 1000.0:\n return \"%3.1f%s\" % (num, x)\n num /= 1000.0",
"def convert_bytes(num):\n for x in [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\"]:\n if num < 1024.0:\n return \"%3.1f %s\" % (num... | [
"0.72740144",
"0.7190377",
"0.71665424",
"0.71665424",
"0.71658516",
"0.71658516",
"0.71658516",
"0.71449167",
"0.7040926",
"0.70362234",
"0.6840456",
"0.6732123",
"0.6657601",
"0.66489995",
"0.66304076",
"0.6618418",
"0.66145444",
"0.6614358",
"0.6596666",
"0.65783983",
"0.6... | 0.633489 | 29 |
Convert a numerical value to a bytestring. Floats are stored in two or more consecutive 16bit registers in the subordinate. The encoding is according to the standard IEEE 754. ====================================== ================= =========== ================= Type of floating point number in subordinate Size Registe... | def _floatToBytestring(value, numberOfRegisters=2):
_checkNumerical(value, description='inputvalue')
_checkInt(numberOfRegisters, minvalue=2, maxvalue=4, description='number of registers')
formatcode = '>' # Big-endian
if numberOfRegisters == 2:
formatcode += 'f' # Float (4 bytes)
len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def float_to_bytes(value):\n return struct.pack(\"f\", value)",
"def _(_: FloatType, value: float) -> bytes:\n return _FLOAT_STRUCT.pack(value)",
"def _eight_byte_real(value):\n if value == 0:\n return b\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n if value < 0:\n byte1 = 0x80\n ... | [
"0.74674374",
"0.71433324",
"0.6903937",
"0.6767149",
"0.6660212",
"0.64884853",
"0.6483161",
"0.6404",
"0.636254",
"0.6341348",
"0.6275583",
"0.62709236",
"0.6114611",
"0.60986537",
"0.6035321",
"0.6028881",
"0.599403",
"0.59838635",
"0.58646595",
"0.58136564",
"0.5776636",
... | 0.8276027 | 0 |
Convert a fourbyte string to a float. Floats are stored in two or more consecutive 16bit registers in the subordinate. For discussion on precision, number of bits, number of registers, the range, byte order | def _bytestringToFloat(bytestring, numberOfRegisters=2):
_checkString(bytestring, minlength=4, maxlength=8, description='bytestring')
_checkInt(numberOfRegisters, minvalue=2, maxvalue=4, description='number of registers')
numberOfBytes = _NUMBER_OF_BYTES_PER_REGISTER * numberOfRegisters
formatcode = '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _eight_byte_real_to_float(value):\n short1, short2, long3 = struct.unpack(\">HHL\", value)\n exponent = (short1 & 0x7F00) // 256 - 64\n mantissa = (\n ((short1 & 0x00FF) * 65536 + short2) * 4294967296 + long3\n ) / 72057594037927936.0\n if short1 & 0x8000:\n return -mantissa * 16.0... | [
"0.7470786",
"0.74318516",
"0.7103544",
"0.7005888",
"0.6994107",
"0.6939263",
"0.69239426",
"0.68887585",
"0.6880526",
"0.68470025",
"0.67834526",
"0.6701328",
"0.66949296",
"0.6661138",
"0.6644472",
"0.66269624",
"0.66118807",
"0.65827215",
"0.65448064",
"0.6533189",
"0.649... | 0.7406645 | 2 |
Convert a bytestring to a text string. Each 16bit register in the subordinate are interpreted as two characters (1 byte = 8 bits). For example 16 consecutive registers can hold 32 characters (32 bytes). Not much of conversion is done, mostly error checking. | def _bytestringToTextstring(bytestring, numberOfRegisters=16):
_checkInt(numberOfRegisters, minvalue=1, description='number of registers')
maxCharacters = _NUMBER_OF_BYTES_PER_REGISTER * numberOfRegisters
_checkString(bytestring, 'byte string', minlength=maxCharacters, maxlength=maxCharacters)
textstri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_string(_bytes: bytes)-> str:\n # print('input bytes: ', _bytes)\n # print('string: ', binascii.hexlify(_bytes))\n # print('string2: ', _bytes.hex())\n # print('string3: ', \" \".join([\"{:02x}\".format(x) for x in _bytes]))\n return \" \".join([\"{:02x}\".format(x) for x in _bytes])",... | [
"0.6858568",
"0.6473457",
"0.6466122",
"0.6423756",
"0.6343179",
"0.62925404",
"0.6059009",
"0.6014008",
"0.59258753",
"0.58383787",
"0.58005893",
"0.5796121",
"0.57599574",
"0.5754958",
"0.57511795",
"0.5738729",
"0.5706455",
"0.5706418",
"0.5699039",
"0.56968075",
"0.568890... | 0.7891027 | 0 |
Convert a list of numerical values to a bytestring. Each element is 'unsigned INT16'. | def _valuelistToBytestring(valuelist, numberOfRegisters):
MINVALUE = 0
MAXVALUE = 65535
_checkInt(numberOfRegisters, minvalue=1, description='number of registers')
if not isinstance(valuelist, list):
raise TypeError('The valuelist parameter must be a list. Given {0!r}.'.format(valuelist))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytes_from_ints(int_list):\n return b\"\".join((chr(i) for i in int_list))",
"def pack_varint_list(data: List[int]) -> bytes:\n result = b\"\"\n for value in data:\n result += pack_varint(value)\n return result",
"def encode_vector_of_t(value: list):\n return encode_u32(len(value)... | [
"0.75301605",
"0.70787585",
"0.68788797",
"0.6854181",
"0.6844067",
"0.67711735",
"0.6754887",
"0.6653223",
"0.6611075",
"0.6580483",
"0.64618695",
"0.6448465",
"0.6376787",
"0.63119197",
"0.6294289",
"0.62507117",
"0.62284726",
"0.6198753",
"0.61360943",
"0.61356246",
"0.610... | 0.71929723 | 1 |
Convert a bytestring to a list of numerical values. The bytestring is interpreted as 'unsigned INT16'. | def _bytestringToValuelist(bytestring, numberOfRegisters):
_checkInt(numberOfRegisters, minvalue=1, description='number of registers')
numberOfBytes = _NUMBER_OF_BYTES_PER_REGISTER * numberOfRegisters
_checkString(bytestring, 'byte string', minlength=numberOfBytes, maxlength=numberOfBytes)
values = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_list(data: bytes) -> list:\n byte_data = BytesIO(data)\n byte_list = []\n single_byte = byte_data.read(1)\n while single_byte != b\"\" and single_byte != \"\":\n single_int = byte_to_int(single_byte)\n byte_list.append(single_int)\n single_byte = byte_data.read(1)\n retu... | [
"0.67877626",
"0.66386366",
"0.65680945",
"0.64775056",
"0.64014256",
"0.63623005",
"0.6339995",
"0.6328401",
"0.62438655",
"0.623285",
"0.6220906",
"0.6198238",
"0.6154097",
"0.61317194",
"0.60831237",
"0.6038976",
"0.60374814",
"0.60102326",
"0.6003738",
"0.5963996",
"0.595... | 0.73067546 | 0 |
Pack a value into a bytestring. | def _pack(formatstring, value):
_checkString(formatstring, description='formatstring', minlength=1)
try:
result = struct.pack(formatstring, value)
except:
errortext = 'The value to send is probably out of range, as the num-to-bytestring conversion failed.'
errortext += ' Value: {0!r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack_str(value: str) -> bytes:\n str_bytes = value.encode('utf-8')\n length_bytes = _pack_length(str_bytes)\n return length_bytes + str_bytes",
"def msgpack_packb(value):\n return msgpack.packb(value, default=pseud_encode, use_bin_type=True)",
"def _pack(self, _format: str, value: Any):\n self... | [
"0.79904985",
"0.77829343",
"0.73868775",
"0.70446295",
"0.6999573",
"0.69184226",
"0.6878612",
"0.6849968",
"0.6805581",
"0.67667246",
"0.67553693",
"0.6753708",
"0.6728836",
"0.672388",
"0.67206573",
"0.6650723",
"0.66414183",
"0.66268575",
"0.6622873",
"0.6571734",
"0.6510... | 0.7552182 | 2 |
Calculate the two's complement of an integer. Then also negative values can be represented by an upper range of positive values. | def _twosComplement(x, bits=16):
_checkInt(bits, minvalue=0, description='number of bits')
_checkInt(x, description='input')
upperlimit = 2 ** (bits - 1) - 1
lowerlimit = -2 ** (bits - 1)
if x > upperlimit or x < lowerlimit:
raise ValueError('The input value is out of range. Given value is {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complement(x):\n out = 1 - x\n return out",
"def __neg__(self) -> 'SInt':\r\n return self.complement()",
"def twos_complement(val, bits):\n if (val & (1 << (bits - 1))) != 0: # if sign bit is set e.g., 8bit: 128-255\n val = val - (1 << bits) # compute negative value\n retur... | [
"0.7673055",
"0.74100405",
"0.7204772",
"0.70886314",
"0.7071715",
"0.702452",
"0.7006786",
"0.6946817",
"0.6868982",
"0.68342626",
"0.6753303",
"0.6650397",
"0.66471475",
"0.6584071",
"0.65299606",
"0.6513974",
"0.6448015",
"0.64186406",
"0.63782674",
"0.637809",
"0.63744247... | 0.6432118 | 17 |
Rightshift an integer one step, and also calculate the carry bit. | def _rightshift(inputInteger):
_checkInt(inputInteger, minvalue=0)
shifted = inputInteger >> 1
carrybit = inputInteger & 1
return shifted, carrybit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rshift(val, n):\n return (val % 0x100000000) >> n",
"def rshift(val, n):\n return (val % 0x100000000) >> n",
"def rshift(val: int, n: int) -> int:\n return (val % 0x100000000) >> n",
"def _right_shift_scalar(x, y):\n return inner.bit_right_shift(x, y)",
"def lrshift(val, n) -> np.int64:... | [
"0.6881094",
"0.6881094",
"0.68734413",
"0.67862254",
"0.6782557",
"0.67665285",
"0.6626058",
"0.6525582",
"0.65225726",
"0.647796",
"0.6458773",
"0.6370935",
"0.62755233",
"0.6167496",
"0.612109",
"0.61006105",
"0.608359",
"0.60682523",
"0.60189456",
"0.60132194",
"0.594768"... | 0.7905371 | 0 |
Check that the given string is valid. | def _checkString(inputstring, description, minlength=0, maxlength=None):
# Type checking
if not isinstance(description, str):
raise TypeError('The description should be a string. Given: {0!r}'.format(description))
if not isinstance(inputstring, str):
raise TypeError('The {0} should be a str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkValidString(self, string: str) -> bool:\n @lru_cache(None)\n def dp(index, diff):\n \"\"\"\n index is the index of string\n diff the counts of '(' - counts of ')'\n \"\"\"\n\n if index == len_s:\n return diff == 0\n ... | [
"0.77626806",
"0.7622991",
"0.7488719",
"0.73656934",
"0.7357667",
"0.72978127",
"0.7295882",
"0.7288676",
"0.728027",
"0.7244556",
"0.7194718",
"0.709045",
"0.70549494",
"0.7038595",
"0.6993382",
"0.6980381",
"0.6907831",
"0.68841237",
"0.68814564",
"0.68804586",
"0.6865778"... | 0.67308336 | 26 |
Mean absolute error function. This function computes mean absolute error between two variables. The mean is taken over the minibatch. | def mean_absolute_error(x0, x1):
return MeanAbsoluteError()(x0, x1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mean_absolute_error_compute(sum_abs_error: Tensor, n_obs: int) ->Tensor:\n return sum_abs_error / n_obs",
"def report_mean_error(absolute_errors:List[float]):\n if len(absolute_errors) != 0:\n mean_absolute_error = round(sum(absolute_errors)/len(absolute_errors), 5)\n return mean_absolut... | [
"0.7518839",
"0.72117823",
"0.7206541",
"0.7180533",
"0.70980734",
"0.70864487",
"0.70370674",
"0.700519",
"0.6980781",
"0.6948474",
"0.6903865",
"0.6829158",
"0.68276733",
"0.67975",
"0.67879987",
"0.6732591",
"0.6696967",
"0.6680107",
"0.6675182",
"0.66719604",
"0.66518646"... | 0.8043939 | 0 |
Assert if the Distribution's shape is compatible with the supplied values. A distribution's shape, ``dist_shape``, is made up by the sum of the ``batch_shape`` and the ``event_shape``. A value is considered to have a consistent shape with the distribution if two conditions are met. 1) It has a greater or equal number o... | def assert_values_compatible_with_distribution(
scoped_name: str, values: Any, dist: distribution.Distribution
) -> None:
event_shape = dist.event_shape
batch_shape = dist.batch_shape
assert_values_compatible_with_distribution_shape(scoped_name, values, batch_shape, event_shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_values_compatible_with_distribution_shape(\n scoped_name: str, values: Any, batch_shape: tf.TensorShape, event_shape: tf.TensorShape\n) -> None:\n value_shape = get_observed_tensor_shape(values)\n dist_shape = batch_shape + event_shape\n value_rank = value_shape.rank\n dist_rank = dist_sh... | [
"0.8349038",
"0.68091184",
"0.6405352",
"0.63873285",
"0.62411374",
"0.622174",
"0.604756",
"0.6039485",
"0.60304874",
"0.60264164",
"0.5980516",
"0.5937609",
"0.5935989",
"0.59327763",
"0.5924742",
"0.5914814",
"0.5900258",
"0.5880172",
"0.58776116",
"0.5859543",
"0.5806068"... | 0.77673835 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.