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
Convert an image from XYZ color space to RGB color space
def xyz_to_rgb(image: tf.Tensor) -> tf.Tensor: x, y, z = tf.unstack(image, axis=-1) var_x = x / 100 var_y = y / 100 var_z = z / 100 var_r = var_x * 3.2406 + var_y * -1.5372 + var_z * -0.4986 var_g = var_x * -0.9689 + var_y * 1.8758 + var_z * 0.0415 var_b = var_x * 0.0557 + var_y * -0.2040 +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XYZ_to_RGB(XYZ,\n illuminant_XYZ,\n illuminant_RGB,\n XYZ_to_RGB_matrix,\n chromatic_adaptation_transform='CAT02',\n encoding_cctf=None):\n\n M = chromatic_adaptation_matrix_VonKries(\n xyY_to_XYZ(xy_to_xyY(illuminant_XYZ)),\n ...
[ "0.6828028", "0.68103015", "0.68066865", "0.6763418", "0.66843706", "0.66742265", "0.66261303", "0.65840024", "0.6561155", "0.6552539", "0.64690375", "0.645088", "0.63681024", "0.6365761", "0.63621247", "0.6326144", "0.6306346", "0.6306079", "0.6283632", "0.6256421", "0.62433...
0.7146014
0
Convert an image from RGB color space to XYZ color space
def rgb_to_xyz(image: tf.Tensor) -> tf.Tensor: r, g, b = tf.unstack(image, axis=-1) var_r = r / 255 var_g = g / 255 var_b = b / 255 var_r = tf.where(var_r > 0.04045, tf.pow((var_r + 0.055) / 1.055, 2.4), var_r / 12.92) var_g = tf.where(var_g > 0.04045, tf.pow((var_g + 0.055...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_to_xyz(rgb_color):\n\n r = (rgb_color[0] / 255)\n g = (rgb_color[1] / 255)\n b = (rgb_color[2] / 255)\n\n if r > 0.04045:\n r = ((r + 0.055) / 1.055) ** 2.4\n else:\n r = r / 12.92\n\n if g > 0.04045:\n g = ((g + 0.055) / 1.055) ** 2.4\n else:\n g = g / 12.9...
[ "0.6907906", "0.6867097", "0.68299574", "0.66412497", "0.66398394", "0.65136164", "0.6503859", "0.6343428", "0.6280779", "0.6266033", "0.62629265", "0.620036", "0.61658543", "0.6152105", "0.60904413", "0.6024829", "0.5986624", "0.59797454", "0.597226", "0.5968314", "0.5912936...
0.7601516
0
Checks if the given character is a number.
def is_number(c): return '0' <= c <= '9'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_num_char(x):\n return ord('0') <= ord(x) <= ord('9')", "def is_number_char(c: str) -> bool:\n return c.isdigit() or c == \".\"", "def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False", "def is_number(s):\n try:\n int(s...
[ "0.8297935", "0.80840826", "0.7704204", "0.76546836", "0.75744826", "0.7568717", "0.7393754", "0.73098946", "0.7302559", "0.7258665", "0.72420657", "0.7230359", "0.7195663", "0.71815383", "0.7179277", "0.7152408", "0.71477836", "0.71332264", "0.71325856", "0.71297145", "0.712...
0.82398206
1
Fetches the soundcloud.com main page, looks for the 'app' js file and tries to pull a client_id out of that. Returns None on failure or a string client_id on success.
def find_client_id(): stdout("Attempting to fetch a public soundcloud client ID:\n") stdout(" * Fetching main page... ") response = requests.get("http://www.soundcloud.com") stdout("HTTP %d, %d bytes\n" % (response.status_code, len(response.content))) stdout(" * Locating app.js... ") app_js_url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client", "def client_app_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"client_app_id\")", "def check_soundcloud_id(id):\n c_url = ''\n\n try:\n page = sync.get_page(SOUNDCLOUD_BASE_URL +...
[ "0.58945185", "0.5666564", "0.54652476", "0.5451408", "0.539826", "0.5342123", "0.53111964", "0.5309336", "0.528899", "0.52842605", "0.5255024", "0.5202958", "0.5173291", "0.5158253", "0.5108697", "0.5082016", "0.50815004", "0.50447154", "0.50221217", "0.49919608", "0.4989508...
0.8254922
0
Get the suffix applied to the target in order to specify the variation. May be empty.
def get_suffix(cls, raw_disable: RawDisable) -> str: variations = raw_disable.parent_test.variations maybe_variation_node = raw_disable.node.find(f'.//{cls.VARIATION_TAG}') if maybe_variation_node is None: return '' variation = maybe_variation_node.text if variation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix ( self ) :\n return self.__suffix", "def suffix ( self ) :\n return self.__suffix", "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self[\"suffix\"]", "def get_suffix_ml_model():\n suffix = ''\n \n # consider if the model uses tail ...
[ "0.76173544", "0.76173544", "0.75478005", "0.75478005", "0.74529225", "0.7412734", "0.7412734", "0.7412734", "0.7360355", "0.7269723", "0.71980673", "0.7079693", "0.6851911", "0.68245083", "0.68245083", "0.6713023", "0.67029065", "0.6577348", "0.6507357", "0.64197314", "0.634...
0.74623406
4
Verifies the input username is valid according to the regular expression.
def verify_username(username): name_reg_exp = re.compile(r"^[a-zA-Z0-9_-]{3,20}$") return username and name_reg_exp.match(username)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_is_valid(username: str) -> bool:\n pattern = re.compile(r'^[A-Za-z]+[A-Za-z0-9]*$')\n return pattern.match(username)", "def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, username)", "def verify_username(entered_username):\n retu...
[ "0.8635296", "0.85105777", "0.84749115", "0.84299684", "0.8233236", "0.8211792", "0.82028437", "0.80628586", "0.80201393", "0.8015239", "0.80012465", "0.79015553", "0.7776255", "0.7739225", "0.7723503", "0.76907295", "0.7611532", "0.7544536", "0.74407434", "0.7410977", "0.739...
0.8407929
4
Verifies the input password is valid according to the regular expression.
def verify_password(password): password_reg_exp = re.compile(r"^.{3,20}$") return password and password_reg_exp.match(password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passwordValidate(form, field):\n\n pwd_regexp = compile(r'^.*(?=.{8,})(?=.*[a-zA-Z])(?=.*?[A-Z])(?=.*\\d)[a-zA-Z0-9!@£$%^&*()_+={}?:~\\[\\]]+$')\n\n if not fullmatch(pwd_regexp, field.data):\n raise ValidationError(message='Password must match the specific pattern')", "def validate_password(pass...
[ "0.8172635", "0.80864406", "0.79701066", "0.79516107", "0.79046965", "0.78755134", "0.7869727", "0.78578925", "0.76754445", "0.7663901", "0.7564994", "0.75507975", "0.7501534", "0.7475722", "0.74369824", "0.7372461", "0.73591304", "0.72783804", "0.7235953", "0.71788555", "0.7...
0.78625745
7
Activate interact mode enabling to control the robot using keyboard. It stops automatically as soon as 'done' flag is True. One has to press a key to start the interaction. If no key is pressed, the action is not updated and the previous one keeps being sent to the robot.
def play_interactive(self, enable_travelling: Optional[bool] = None, start_paused: bool = True, enable_is_done: bool = True, verbose: bool = True, **kwargs: Any) -> None: # Enable play in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_interaction(self):\n self.__interact()", "def activate(self):\n self.robot = self.behavior_system.robot\n self.cozmo = self.robot.cozmo\n\n active_drive = self.robot.drive_system.active_drive\n\n if active_drive.name == 'solo-drive':\n # Look for a toy/bloc...
[ "0.6769111", "0.59950536", "0.5923037", "0.58485824", "0.5848065", "0.5804152", "0.5769291", "0.5753545", "0.56294817", "0.5598662", "0.5595247", "0.54722005", "0.5426522", "0.5399201", "0.5387124", "0.5344916", "0.53276813", "0.5326153", "0.5296999", "0.52966607", "0.5266821...
0.5420535
13
Returns the spawn location of the bot, using the position of the first created townhall. This will be None if the bot is run on an arcade or custom map that does not feature townhalls at game start.
def start_location(self) -> Point2: return self._game_info.player_start_location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_location(self):\r\n\r\n while True:\r\n pt = (random.uniform(self.worldbox.tl[0], self.worldbox.br[0]),\r\n random.uniform(self.worldbox.tl[1], self.worldbox.br[1]))\r\n if not self.is_wall(pt) and not self.is_target(pt):\r\n return pt", "de...
[ "0.6612017", "0.6241278", "0.6221538", "0.61222285", "0.6099413", "0.60546064", "0.6032275", "0.5985243", "0.5865068", "0.5855679", "0.5854281", "0.5794015", "0.5790127", "0.57702297", "0.57702297", "0.5757652", "0.5727618", "0.5719318", "0.5711941", "0.5711941", "0.568639", ...
0.5751474
16
Returns available abilities of one or more units. Right now only checks cooldown, energy cost, and whether the ability has been researched.
async def get_available_abilities( self, units: Union[List[Unit], Units], ignore_resource_requirements: bool = False ) -> List[List[AbilityId]]: return await self._client.query_available_abilities(units, ignore_resource_requirements)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def capabilities(self, abilities):\n capabilities = []\n for ability in abilities:\n if self.privileged_to_run(ability) and ability.find_executors(self.executors, self.platform):\n capabilities.append(ability)\n return capabilities", "def _abilities_all_units(...
[ "0.6250166", "0.60964966", "0.602298", "0.59705406", "0.59497154", "0.58937514", "0.5730924", "0.5714051", "0.5709866", "0.57032293", "0.56360984", "0.56252784", "0.5617863", "0.5564902", "0.5512842", "0.54977745", "0.54958105", "0.54682755", "0.54319596", "0.5417294", "0.541...
0.72035104
0
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate if each is smiling. We are in trouble if they are both smiling or if neither of them is smiling. Return True if we are in trouble.
def monkey_trouble(a_smile, b_smile): return a_smile == b_smile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monkey_trouble(a_smile, b_smile):\r\n if a_smile and b_smile:\r\n return True\r\n if not a_smile and not b_smile:\r\n return True\r\n return False", "def monkey_trouble(a_smile, b_smile):\n if (a_smile and b_smile) or (not(a_smile) and not(b_smile)):\n return True\n else:\...
[ "0.79823065", "0.78019583", "0.7594713", "0.5834833", "0.5834833", "0.57597196", "0.5667989", "0.5522477", "0.54367316", "0.5385709", "0.53549284", "0.5349871", "0.53201574", "0.5308919", "0.5245264", "0.51797724", "0.5175183", "0.517413", "0.51414156", "0.5138198", "0.512017...
0.77675396
2
Given a string, return a new string where the first and last chars have been exchanged.
def front_back(str): if len(str)<=1: return str mid = str[1:-1] return str[-1] + mid + str[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror(s):\n mir_str = s\n for i in range(1, len(s) + 1):\n mir_str += s[-i]\n return mir_str", "def mirror_string(the_string):\r\n return the_string + reverse_string(the_string)", "def inverse_replacer(my_str:str, a:str, b:str) -> str:\n \n my_str = list(my_str)\n\n for i in ra...
[ "0.684129", "0.68122196", "0.6695513", "0.6433872", "0.6390908", "0.63346535", "0.6311137", "0.63090163", "0.6304786", "0.6295904", "0.6265807", "0.62651616", "0.62593347", "0.61720115", "0.61687523", "0.6154329", "0.61427444", "0.61234826", "0.609927", "0.60931015", "0.60733...
0.5754931
64
Retrieve a list of all nonignored files, including untracked files, excluding deleted files.
def get_git_project_files(): cached_and_untracked_files = git_ls_files( '--cached', # All files cached in the index '--others', # Untracked files # Exclude untracked files that would be excluded by .gitignore, etc. '--exclude-standard') uncommitted_deleted_files = git_ls_files(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_untracked_files(self):\n untracked_files = set(self.retrieve_all_files()) \\\n - set(self.retrieve_tracked_files())\n\n return untracked_files", "def untracked_files():\n res = run(\n \"cd %s ; git status\" % (SOURCE_ABSOLUTE),\n stdout=PIPE, stderr=PIPE,\n ...
[ "0.7845568", "0.7812254", "0.77045214", "0.73962283", "0.7363428", "0.7302657", "0.7254765", "0.7217443", "0.70587367", "0.69560546", "0.6850955", "0.6825047", "0.6698035", "0.66879463", "0.66263133", "0.6596644", "0.65811634", "0.6567983", "0.6562467", "0.6524902", "0.652490...
0.6220324
37
Queries database to see if table_name exists in tables.
def check_table_exists(curs, table_name): return curs.execute("""SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name=?;""", (table_name,)).fetchone()[0] != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_table_exists(table_name):\n return table_name in connection.introspection.table_names()", "def db_table_exists(db, table_name):\n query = \"\"\"\n SELECT name FROM sqlite_master\n WHERE type='table' AND name='%s'\"\"\" % table_name\n cursor = db.execute(query)\n results = cursor....
[ "0.876392", "0.8616101", "0.85560894", "0.8430031", "0.8422178", "0.8337477", "0.8318655", "0.83150667", "0.83040786", "0.8292064", "0.82844245", "0.82619524", "0.8195732", "0.8178198", "0.8103807", "0.8034697", "0.8029937", "0.79777163", "0.7946561", "0.7936039", "0.7852319"...
0.82233644
12
The tempo of the song.
def tempo(self): text = self._get_menu_item_text('Edit->Tempo') return float(re.search(r'\[([0-9.,]+)\]$', text).group(1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tempo(self, tempo):\n self._tempo = tempo", "def tempo(signal,fs,hop_len = 64, **kwargs):\n tempo, beats = librosa.beat.beat_track(y=signal, sr=fs, hop_length=hop_len)\n return tempo", "def analyze_tempo(self, sample):\n # get beat from sample\n is_beat = self.tempo_analyzer(...
[ "0.69736135", "0.6595954", "0.6365309", "0.6310555", "0.61785966", "0.61531806", "0.6058358", "0.576273", "0.57180995", "0.57065964", "0.5647518", "0.56118566", "0.56033045", "0.5536001", "0.5516438", "0.5497539", "0.5480728", "0.5466305", "0.5449493", "0.5441588", "0.5440897...
0.6787653
1
Given a vector, returns a orthogonal/perpendicular vector of equal length. Returns
def _orthogonal_vector(vector): return -1 * vector[1], vector[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([0.,1.])\n v2_0 = 1.0\n v2_1 = -(vector[0]/vector[1])\n v2 = np.asarray([v2_0, v2_1])\n return v2 / np.linalg.norm(v2)", "def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n ...
[ "0.8108887", "0.8046012", "0.80115205", "0.8010986", "0.79765224", "0.77215797", "0.75200254", "0.73142374", "0.7283013", "0.7026917", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823"...
0.8325588
0
Given an image numpy array, it returns a minimum area rectangle that will contain the mask. It will not necessarily be vertically or horizontally aligned. input
def get_rectangles_from_mask(img_arr): masks_point_dict = _get_mask_points(img_arr) mar_list = list() for object_id in masks_point_dict.keys(): mask_points = masks_point_dict[object_id] mask_points = tuple(mask_points) hull_ordered = [mask_points[index] for index in ConvexHull(mask_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(img):\n rows = np.any(img, axis=1)\n cols = np.any(img, axis=0)\n rmin, rmax = np.where(rows)[0][[0, -1]]\n cmin, cmax = np.where(cols)[0][[0, -1]]\n # due to python indexing, need to add 1 to max\n # else accessing will be 1px in the box, not out\n rmax += 1\n cmax += ...
[ "0.69519705", "0.66886437", "0.643538", "0.6417303", "0.63201237", "0.62712115", "0.6126436", "0.6126436", "0.6108796", "0.609959", "0.609959", "0.60787183", "0.6067797", "0.6058804", "0.60508186", "0.60463417", "0.6030054", "0.600243", "0.5979333", "0.59788084", "0.59653753"...
0.58815217
28
checks for same repeating number in array of format [1,1,1,1,1,21,1,1] and return the same repeating number
def getSameVal(arr): currentVal = 0 for i in range(1,3): #scenario when first element is not different one if(arr[currentVal] == arr[i]): return arr[i] #scenario when first element is different one return arr[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeats(arr):\n return sum([el for el in arr if arr.count(el) == 1])", "def repeatedNTimes(self, A: List[int]) -> int:\n \"\"\" \n A = sorted(A)\n if A[0] == A[1]:\n return A[0]\n return A[int(len(A)/2)]\n \"\"\"\n res = set()\n for a in A...
[ "0.7462376", "0.68985116", "0.68213654", "0.6791498", "0.66626716", "0.6654712", "0.66019726", "0.6586871", "0.65565526", "0.6502662", "0.6475282", "0.64584553", "0.6427284", "0.6316363", "0.6316358", "0.62999094", "0.62543565", "0.61959225", "0.61065865", "0.610497", "0.6078...
0.587011
26
Return the String associated with an operating system environment variable envstring Optional. String expression containing the name of an environment variable. number Optional. Numeric expression corresponding to the numeric order of the environment string in the environmentstring table. The number argument can be any...
def Environ(envstring): try: envint = int(envstring) except ValueError: return os.environ.get(envstring, "") # Is an integer - need to get the envint'th value try: return "%s=%s" % (list(os.environ.keys())[envint], list(os.environ.values())[envint]) except IndexError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getenv_string(setting, default=''):\n return os.environ.get(setting, default)", "def test_get_environment_string(self):\n pass", "def _get_env(key: str) -> str:\n value = os.getenv(key)\n assert isinstance(value, str), (\n f\"the {key} environment variable must be set and...
[ "0.6552138", "0.62165606", "0.6127461", "0.61043334", "0.5977026", "0.5974327", "0.5880715", "0.58638054", "0.58064455", "0.57543194", "0.5713163", "0.5692808", "0.56204563", "0.5599559", "0.55874664", "0.5569792", "0.5565246", "0.5565246", "0.55345047", "0.5521654", "0.55209...
0.780673
0
Return the closest int of a value
def CInt(num): n = round(float(num)) if -32767 <= n <= 32767: return int(n) else: raise ValueError("Out of range in Int (%s)" % n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_int(num):\n return int(np.round(num))", "def getnearest(iterable, value):\n return min(enumerate(iterable), key=lambda i: abs(i[1] - value))", "def _get_index_closest_val(list, val):\n\n return min(range(len(list)), key=lambda i: abs(list[i]-val))", "def find_nearest_idx(array: np.ar...
[ "0.78813636", "0.7478715", "0.6939693", "0.6915604", "0.688788", "0.6883412", "0.6875989", "0.68616486", "0.6823435", "0.6811447", "0.6811447", "0.6807053", "0.6807053", "0.680144", "0.6783059", "0.6664683", "0.66444117", "0.6554003", "0.65234077", "0.64769626", "0.6472988", ...
0.0
-1
Return the closest long of a value
def CLng(num): return int(round(float(num)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnearest(iterable, value):\n return min(enumerate(iterable), key=lambda i: abs(i[1] - value))", "def floor(self, tuple_data, val, nearest = 1):\r\n retval = val - (val % nearest) if val != None else None\r\n return retval", "def find_absolute_value(x):\n return math.fabs(x)", "def c...
[ "0.6566261", "0.6300067", "0.6277293", "0.62159926", "0.620714", "0.6115691", "0.6098417", "0.6038472", "0.60353285", "0.6025655", "0.6025655", "0.59926397", "0.59917086", "0.5961563", "0.5934293", "0.5928968", "0.5906726", "0.5848198", "0.5812461", "0.5812461", "0.5800306", ...
0.0
-1
Determine if an object is an array
def IsArray(obj): return isinstance(obj, (list, tuple))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_arraylike(obj):\n if isinstance(obj, list):\n return True\n elif isinstance(obj, np.ndarray):\n return True\n elif isinstance(obj, pd.Series):\n return True\n elif isinstance(obj, pd.DataFrame):\n return True\n return False", "def is_array(schema_obj):\n\n if is...
[ "0.8131859", "0.78075755", "0.77648115", "0.774824", "0.76568", "0.75508946", "0.7546086", "0.74527085", "0.7409406", "0.73134905", "0.71920586", "0.7132876", "0.70407593", "0.70193404", "0.6981981", "0.68952763", "0.6841536", "0.6817918", "0.67961663", "0.67788136", "0.67067...
0.8533337
0
Return true if the string contains a valid number
def IsNumeric(text): try: _ = float(text) except ValueError: return 0 else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))", "def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)", "def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False", "d...
[ "0.85815185", "0.8289997", "0.8270631", "0.8235928", "0.81586367", "0.809362", "0.80234414", "0.8018477", "0.7955613", "0.79463774", "0.7942422", "0.7923322", "0.79207367", "0.79207367", "0.79156023", "0.7906338", "0.78547174", "0.7820686", "0.7810391", "0.7808907", "0.780890...
0.71502
68
Join a list of strings
def Join(sourcearray, delimeter=" "): s_list = list(map(str, sourcearray)) return delimeter.join(s_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_list(items: Iterable[str]) -> str:\n\n return ITEM_SEPARATOR.join(items)", "def list_join(the_list):\n return ' '.join(the_list)", "def rejoin(textList):\n return ','.join(textList)", "def list_string(join_list):\n joined_list = '[{}]'.format(join_list, join_list)\n return joined_list...
[ "0.83958447", "0.8349963", "0.7805593", "0.7734362", "0.7621587", "0.7588923", "0.74768436", "0.7426868", "0.7301969", "0.72622794", "0.725474", "0.7220788", "0.7193344", "0.7181325", "0.7089761", "0.7000197", "0.6942799", "0.69354165", "0.69297576", "0.69290656", "0.69134676...
0.67666805
31
Return a Long whole number representing an RGB color value The value for any argument to RGB that exceeds 255 is assumed to be 255. If any argument is less than zero then this results in a ValueError.
def RGB(r, g, b): rm = min(255, Int(r)) gm = min(255, Int(g)) bm = min(255, Int(b)) # if rm < 0 or gm < 0 or bm < 0: raise ValueError("RGB values must be >= 0, were (%s, %s, %s)" % (r, g, b)) # return ((bm * 256) + gm) * 256 + rm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkRGBRange(value):\n\ttry:\n\t\tv = int(value)\n\t\tif 0 <= v <= 255:\n\t\t\treturn v\n\texcept:\n\t\treturn 255", "def luminance(rgb):\n \n (r, g, b) = rgb\n return (r + g + b) // 3", "def luminance(self):\n \n return (self.r + self.g + self.b) // 3", "def GetRGB(*args):\n ...
[ "0.65882045", "0.65604985", "0.6269075", "0.6263342", "0.6221491", "0.6202926", "0.62008274", "0.61333966", "0.6085049", "0.6076616", "0.6073239", "0.60437983", "0.6026575", "0.6025366", "0.6011845", "0.59900916", "0.598508", "0.59843445", "0.5974619", "0.59649116", "0.596430...
0.631638
2
Returns a string in which a specified substring has been replaced with another substring a specified number of times The return value of the Replace function is a string, with substitutions made, that begins at the position specified by start and and concludes at the end of the expression string. It is not a copy of th...
def Replace(expression, find, replace, start=1, count=-1): if find: return expression[:start - 1] + expression[start - 1:].replace(find, replace, count) else: return expression
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def REPLACE(old_text, start_num, num_chars, new_text):\n if start_num < 1:\n raise ValueError(\"start_num invalid\")\n return old_text[:start_num - 1] + new_text + old_text[start_num - 1 + num_chars:]", "def replace_in_string(string, length, substring, idx):\n return string[:idx]+substring+string[idx+len...
[ "0.69472235", "0.6930251", "0.66695154", "0.64962995", "0.63499135", "0.6083488", "0.6069293", "0.6031655", "0.6022877", "0.598244", "0.5966292", "0.5940701", "0.5935663", "0.5875606", "0.58752525", "0.58342385", "0.57794666", "0.57153463", "0.5702825", "0.56442857", "0.56126...
0.7357595
0
Get a setting from the central setting file
def GetSetting(appname, section, key, default=None): settings = _OptionsDB(appname) try: return settings[section, key] except config.configparser.Error: if default is not None: return default raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings():\n return _get_settings()[1]", "def get_config_setting(setting: str) -> Any:\n try:\n with open('config.json') as config_file:\n data = json.load(config_file)\n return data[setting]\n except Exception as e:\n print(f'Failed get json setting. Error: {e}')", "def get_setting(self,...
[ "0.75953954", "0.7489524", "0.7417485", "0.73691297", "0.73165554", "0.7299111", "0.71707577", "0.7038714", "0.69166815", "0.6869451", "0.6869085", "0.68282914", "0.6781696", "0.6778681", "0.6777153", "0.67645085", "0.6737452", "0.6735574", "0.66980755", "0.6696956", "0.66344...
0.6653763
20
Return the sign of a number
def Sgn(num): n = float(num) if n < 0: return -1 elif n == 0: return 0 else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(num: float):\n return 1 if num >= 0 else -1", "def _sign(self, number):\n return cmp(number,0)", "def sign(x):\n if x >= 0:\n return 1\n else:\n return -1", "def sign(x):\n if x >= 0:\n return 1\n return -1", "def sign(n):\n return (n > 0) - (n < 0)", ...
[ "0.86808735", "0.8180675", "0.8142889", "0.8080412", "0.805586", "0.80516213", "0.7749056", "0.76728755", "0.76457745", "0.7544772", "0.7440243", "0.73207474", "0.719852", "0.7096866", "0.69429314", "0.65968424", "0.65949637", "0.65688556", "0.6490249", "0.6485607", "0.648235...
0.5939975
44
Return the upper bound for the index
def UBound(obj, dimension=1): try: return obj.__ubound__(dimension) except AttributeError: # # Might have been called for a list so give this a try if dimension == 1: try: return len(obj) except TypeError: pass raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upper_bound(self):\n return self._upper_bound", "def upper_bound(self) -> float:\n ...", "def getUpperBound(self) -> int:\n return self.upper_bound", "def storage_upper_bound(index):\n i = index[0]\n return storage_para[i].pmax", "def best_upper_bound(self):\n ...
[ "0.81943715", "0.79659086", "0.78783196", "0.76580983", "0.707804", "0.69440764", "0.68226254", "0.671483", "0.66756105", "0.666539", "0.66157496", "0.66157496", "0.6594715", "0.65075356", "0.64967626", "0.64928114", "0.64666486", "0.6462994", "0.6452403", "0.6446879", "0.642...
0.0
-1
Return the value of a string This function finds the longest leftmost number in the string and returns it. If there are no valid numbers then it returns 0. The method chosen here is very poor we just keep trying to convert the string to a float and just use the last successful as we increase the size of the string. A R...
def Val(text): best = 0 for idx in range(len(text)): try: best = float(text[:idx + 1]) except ValueError: pass return best
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_number(s:str):\n array = re.findall(r'[0-9]+', s)\n if array.__len__() is 0:\n return -1\n return int(array[-1])", "def _get_number_from_string(x):\n try:\n return float(x)\n except ValueError:\n raise ValueError('Unknown element')", "def float(s...
[ "0.66451454", "0.64589363", "0.63910717", "0.6363433", "0.63494194", "0.630394", "0.61770207", "0.616602", "0.6151756", "0.61081976", "0.60855013", "0.6082988", "0.60598946", "0.6020905", "0.60046595", "0.5965904", "0.5914045", "0.58885247", "0.58840555", "0.58837414", "0.584...
0.7048725
0
Set character's energy to zero which ends the game.
def game_over(char_dict: dict, family_name: str): char_dict['Energy'] = 0 print(family_name + " is persistent and painful and you lose all interest in the case.\n" "You secretly slink out the back entrance so the butler doesn't see that\n" "you've given up.\n\nGam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.change_power(0)", "def reset_hp():\n\n global character\n character['HP'] = 10", "def reset(self):\r\n pg.event.clear()\r\n self.stop_powerpellet()\r\n if not self.eaten:\r\n self.dot_counter = 0\r\n self.eaten = False\r\n self.e...
[ "0.64097255", "0.62823176", "0.6174342", "0.6149164", "0.6142883", "0.610212", "0.6058763", "0.60425085", "0.60215926", "0.5955238", "0.59329295", "0.586241", "0.58558756", "0.58372647", "0.5812641", "0.5810026", "0.5805393", "0.5804163", "0.5733548", "0.5711218", "0.56904644...
0.5333339
73
Given `src_lines`, a list of lines of a single record, this will instantiate and populate an object corresponding to the data.
def __init__(self, src_lines): self.study_id = None self.citation = None self.abstract = None self.authors = [] self.study_matrices = {} self.history_date = None self.history_time = None self.history_person = None self.history_event = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_lines(cls, lines: List[str], mode: str):\n for line in lines:\n if line.startswith('Original Input'):\n _input = line[line.find(':') + 1 :].strip()\n elif line.startswith('Predicted Str'):\n pred = line[line.find(':') + 1 :].strip()\n e...
[ "0.6313051", "0.614401", "0.60776645", "0.60666007", "0.5890082", "0.5835735", "0.57116175", "0.56871676", "0.56600964", "0.5596233", "0.5578453", "0.556857", "0.556857", "0.556857", "0.55126864", "0.5510738", "0.54882395", "0.54770136", "0.54094434", "0.5392297", "0.53723717...
0.7402475
0
Test the string representation of a Resources instance.
def test_str(self, r, rep): assert str(r) == rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str(self):\n \n # Create a Resource object\n resource = Resource(1, \"White Noise\", Name(\"Don\", \"\", \"DeLillo\"), \n \"Delillo's White Noise follows narrator Jack \"\\\n \"Gladney, a professor at a small Liberal Arts \"\\\n ...
[ "0.69858843", "0.6690042", "0.65925443", "0.65398246", "0.63936853", "0.6231223", "0.6173892", "0.61191833", "0.60786456", "0.5948287", "0.5941849", "0.588382", "0.5881345", "0.5877128", "0.5874582", "0.5856679", "0.58358604", "0.5779244", "0.577448", "0.57712156", "0.5765452...
0.5395529
63
Test the repr method of a Resources instance looks as expected.
def test_repr(self, r, rep): assert repr(r) == rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repr(self):\n \n # Create a Resource object\n resource = Resource(1, \"White Noise\", Name(\"Don\", \"\", \"DeLillo\"), \n \"Delillo's White Noise follows narrator Jack \"\\\n \"Gladney, a professor at a small Liberal Arts \"\\\n ...
[ "0.80957806", "0.79900897", "0.7360948", "0.72866344", "0.7135619", "0.71316963", "0.7114563", "0.7029921", "0.7014224", "0.6987679", "0.69360983", "0.69288915", "0.69223106", "0.6910305", "0.68883425", "0.6882751", "0.6816729", "0.6804138", "0.67528766", "0.6745733", "0.6745...
0.7317369
3
Visualize Fashion MNIST samples via pyplot
def visualize_predictions(generator, model, x_test, y_test, convolutional=False): class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] titles = {} for i in generator: if not convolutional: img_p = x_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_image(self):\n \n pixel_array = self.imageprepare(self.image_path)\n newArr = self.reshape_pixel_array(pixel_array)\n plt.imshow(newArr, interpolation='nearest')\n plt.savefig('MNIST_IMAGE.png')#save MNIST image\n plt.show()#Show / plot that image", "def display_i...
[ "0.7037436", "0.7002827", "0.6939112", "0.69223297", "0.6922288", "0.6649379", "0.6452064", "0.6440104", "0.6397068", "0.6394533", "0.6347079", "0.63302267", "0.63108045", "0.63045776", "0.6270363", "0.6266844", "0.6266804", "0.62562644", "0.62232316", "0.6215262", "0.6177606...
0.0
-1
Horizontally concatenate a list of images with a border. This is similar to numpy's hstack except that it adds a border around each image. The borders can be controlled with the optional border_width and border_value arguments. See also vstack.
def hstack(images, border_width=2, border_value=0): if border_width == 0: return np.hstack(images) T, V = border_width, border_value result = [] for image in images[:-1]: result.append(add_border(image, T, V, 'LTB')) result.append(add_border(images[-1], T, V)) return np.hstack(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vstack(images, border_width=2, border_value=0):\n if border_width == 0: return np.vstack(images)\n T, V = border_width, border_value\n result = []\n for image in images[:-1]:\n result.append(add_border(image, T, V, 'LTR'))\n result.append(add_border(images[-1], T, V))\n return np.vstac...
[ "0.7960261", "0.69222003", "0.67834777", "0.6604934", "0.6577598", "0.6484754", "0.6211543", "0.61573285", "0.6119428", "0.61114365", "0.61083424", "0.5949176", "0.5925623", "0.59040356", "0.5842073", "0.5829911", "0.581459", "0.58126813", "0.5722141", "0.56652904", "0.564144...
0.83008605
0
Enforces that all numpy arrays are 2D
def __check_2d_and_reshape(X): if len(X.shape) == 1: X = np.reshape(X, (-1, X.shape[0])) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nd_shape_checking(x, y, mvaxis, traxis):\n assert x.ndim == y.ndim\n dims = np.delete(np.arange(x.ndim), -2)\n assert all([x.shape[k] == y.shape[k] for k in dims])", "def _assert_2d(field):\n assert len(np.shape(field))==2, \"Variable fields must be a 2D array\"", "def enforce_2D(self,):\n ...
[ "0.69607204", "0.69541734", "0.685842", "0.68151885", "0.675131", "0.67469525", "0.6726605", "0.67196745", "0.6677873", "0.6656172", "0.6653277", "0.66295964", "0.66173494", "0.6605646", "0.6597243", "0.65929127", "0.65756637", "0.65693486", "0.6558567", "0.65577745", "0.6527...
0.66363525
11
Gets two positive integer numbers m and n (m > n). Returns True if they are coprime, otherwise, returns False.
def coprime(m,n): # The function uses the Euclid's algorithm for finding the greatest common divisor. The algorithm is recursive. # If the GCD is 1, when the numbers are coprime. If it is greater than 1, when the numbers aren't coprime. if n == 0 and m > 1: return False elif n == 0 and m ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coprime(a: int, b: int):\n\n return euclid(a, b) == 1", "def coprime(a, b):\n return gcd(a, b) == 1", "def coprime(self,x,y):\r\n return x == 1 or y == 1 or not bool(self.cofactors(x,y))", "def is_relatively_prime(n, m):\n result = True\n larger = n\n if m > n:\n larger = m\n...
[ "0.79076767", "0.7667604", "0.72574323", "0.6289784", "0.59262717", "0.5853223", "0.5806163", "0.5744549", "0.5737769", "0.5737769", "0.5732557", "0.5720091", "0.56966656", "0.56965023", "0.568913", "0.5660022", "0.5632094", "0.5599034", "0.5597036", "0.55894285", "0.5589392"...
0.7949466
0
Gets the range of possible integer perimeters. Generates a set of all possible perimeters of rightangled triangles with integer sides. Also generates a set of perimeters of rightangled triangles with integer sides which can be formed using more than one set of values of the sides.
def perimeters(L,counter=0): for m in range(2, int(L ** (1/2)) + 1): for n in range(1, m): limit = m * (m + n) if limit > 750000: break if coprime(m,n) and ((m - n) % 2 > 0): for k in range(1, 750000 // limit + 1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield_right_scalene_triangles(cls):\n for n in range(1, 10):\n m = n + 1\n while True:\n a, b, c = 2 * m * n, m * m - n * n, m * m + n * n\n if a <= 200 and b <= 200 and c <= 200:\n yield a, b, c\n m += 1\n ...
[ "0.593584", "0.5841993", "0.574564", "0.5671036", "0.5518445", "0.54776615", "0.54388785", "0.54362965", "0.52928966", "0.52676713", "0.5253598", "0.5241637", "0.52206737", "0.5196224", "0.51582533", "0.51150614", "0.50665206", "0.50629294", "0.49804005", "0.49755204", "0.497...
0.0
-1
Get the current user.
def get_me(self): return self._api_call('get', '/me')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_user(self):\n return self.current_user", "def get_current_user(self):\n return self.get_secure_cookie(\"user\")", "def current_user(self):\n user_dict = self.auth.get_user_by_session()\n return self.auth.store.user_model.get_by_id(user_dict['user_id'])", "def current_user(...
[ "0.8836685", "0.87018216", "0.86910814", "0.8619504", "0.85802186", "0.8505428", "0.8505428", "0.8505428", "0.8500047", "0.8500047", "0.84839404", "0.8483425", "0.84567", "0.838958", "0.8296931", "0.8281396", "0.82328916", "0.815139", "0.8126627", "0.8124535", "0.81106335", ...
0.0
-1
Get projects owned by the team.
def get_projects(self, team_id): endpoint = '/teams/{}/projects'.format(team_id) return self._api_call('get', endpoint)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n return self._gitlab.owned_projects(per_page=1000)", "def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/projects\").json()", "def get_projects(self):\n projects = []\n page = 1\n while not len(projects) % 100:\n ...
[ "0.8055631", "0.71431756", "0.6982873", "0.6950596", "0.69087213", "0.68157524", "0.6773247", "0.6765266", "0.67424154", "0.66995823", "0.66808534", "0.6675837", "0.66692793", "0.6655742", "0.66494966", "0.6611001", "0.66000354", "0.6599352", "0.6567951", "0.65166676", "0.651...
0.720342
1
Fetch a single user's data if a user_id is specified. Otherwise fetch the list of all users. Returned info contains user_id, name, group name,email, admin status, and date_created.
def get(self, user_id): if user_id: return get_from_user_id(user_id) else: # No user_id given; this is a GET all users request. if not current_user.is_admin: error(403, "Logged in user not admin ") user_db_data = user_db_util.fetchall(g.da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_user(self, id: str):\n user = await self.http.get_user(id)\n return User(state=self.http, data=user)", "def get(self, id):\n\t\ttry:\n\t\t\tflask_app.logger.debug('We are getting the user: %d', id)\n\t\t\treturn user_service.get(id)\n\t\texcept AssertionError as e:\n\t\t\tuser_space...
[ "0.72157097", "0.7131999", "0.70872533", "0.7083722", "0.7074586", "0.7070638", "0.7040221", "0.70230114", "0.6946631", "0.69372654", "0.6927964", "0.6918322", "0.69075227", "0.68962216", "0.68914783", "0.688945", "0.6877585", "0.6864886", "0.6854097", "0.68460727", "0.681894...
0.7235378
0
Given an iterator which returns (key, value) pairs, returns a new iterator of (k, value) pairs such that every list or tuplevalued key in the original sequence yields an individual pair.
def flatten(items): for k, v in items: if isinstance(k, (list, tuple)): for key in k: yield key, v else: yield k, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_pairs(iterable):\n if isinstance(iterable, Mapping):\n iterable = iterable.items()\n return iter(iterable)", "def pairs(iterable):\n previous = None\n for item in iterable:\n current = item\n if previous is not None:\n yield previous, current\n previous...
[ "0.691934", "0.64335775", "0.6234379", "0.62247425", "0.6090052", "0.6072828", "0.6056752", "0.6033201", "0.60265905", "0.59873533", "0.59600586", "0.5856685", "0.58540154", "0.5830519", "0.58234537", "0.57890534", "0.5769367", "0.57635", "0.57286495", "0.5683447", "0.5672941...
0.513164
94
Set the access key as key=your_googlemaps_key. This must be called prior to contacting the API.
def set_api_access_keys(**kwargs): API_BASE_PARAMS['key'] = kwargs['key']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._analyzer.SetAPIKey(api_key)", "def update_key(self, key):\n self._api_key = key", "def api_key(self, api_key):\n\n self._api_key...
[ "0.6702951", "0.6702951", "0.64656013", "0.63789594", "0.63458663", "0.63154477", "0.62301403", "0.62292933", "0.62059003", "0.61881185", "0.60916674", "0.60765517", "0.5990251", "0.5933332", "0.58120465", "0.5781521", "0.57431203", "0.57308316", "0.5702196", "0.56874853", "0...
0.6750033
0
Creates a millisecond based timestamp of UTC now.
def get_utc_now_timestamp() -> int: return int(datetime.datetime.now(datetime.timezone.utc).timestamp() * 1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Now():\n ut = (datetime.datetime.utcnow() - _EPOCH).total_seconds() / 86400.0\n return Time(ut)", "def now() -> datetime:\n now = datetime.now(tz=timezone.utc)\n return now.replace(microsecond=now.microsecond - now.microsecond % 1000)", "def now_timestamp(unit: TimeUnit = TimeUn...
[ "0.7358585", "0.73144686", "0.73085713", "0.7295754", "0.72463673", "0.719578", "0.71388984", "0.71132016", "0.71132016", "0.7087358", "0.70538455", "0.70202845", "0.69747436", "0.69600034", "0.6942168", "0.6916312", "0.69006324", "0.68955755", "0.68503773", "0.68242997", "0....
0.7725665
0
Loads the image from disk, returns image with axis in the natural order (deep last). Data format should be numpy.uint8. Time complexity goes square if numpy.uint16, especially for segmentation.
def load(self, path, shape=(1024, 1024, 35), dtype='uint16'): valid_dtypes = ['uint8', 'uint16'] if dtype not in valid_dtypes: raise ValueError('dtype should be either one of %s' % ', '.join(valid_dtypes)) im = io.imread(path) im = numpy.rollaxis(im, 0, 3) if im.sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loader(path):\n img = np.load(path)\n img = img[1:4]\n if np.random.choice((True, False)):\n img = img[:, :, ::-1]\n img = np.array(img)\n if np.random.choice((True, False)):\n img = img[:, ::-1, :]\n img = np.array(img)\n\n img = img.transpose((1, 2, 0)) # pytorch i...
[ "0.6431803", "0.6287837", "0.62287796", "0.619413", "0.6191195", "0.61317974", "0.6061726", "0.5990384", "0.59458464", "0.5924528", "0.58976215", "0.5853149", "0.5837823", "0.58332664", "0.58236", "0.5814487", "0.581173", "0.581148", "0.5806939", "0.5799971", "0.5781366", "...
0.65080833
0
Get arguments from CLI
def get_args(): parser = argparse.ArgumentParser( description='Arguments for talking to vCenter') parser.add_argument('-s', '--host', required=True, action='store', help='vSpehre service to connect to') parser.add_argument('-o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cli_arguments(self):\n pass", "def get_args():\n\n parser = get_argument_parser()\n args = parser.parse_args()\n\n return args", "def parse_cli_args():\r\n parser = argparse.ArgumentParser(\r\n description=\"list all installed packages\")\r\n\r\n parser.add_argument(\"-v\",...
[ "0.83995515", "0.7696954", "0.7674078", "0.7656369", "0.75491726", "0.7546294", "0.7523218", "0.7521475", "0.7514517", "0.75119865", "0.74877495", "0.74807847", "0.74693704", "0.7466727", "0.74665916", "0.74520636", "0.74513096", "0.7427955", "0.7422721", "0.74211824", "0.740...
0.700868
72
This is the main page of our website.
def index(name=None): return render_template('tree.html', name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n return render_template(\"index.html\", title=\"Home\", heading=\"Dublin Bus\")", "def main_page():\n return render_template(\"index.html\")", "def index():\n return render_template(\n 'main/index.html',\n title='Main page'\n )", "def main_page():\n return render_t...
[ "0.8140115", "0.80469155", "0.7960196", "0.7864964", "0.7812475", "0.77935606", "0.77392304", "0.7707471", "0.7697759", "0.7618798", "0.7606769", "0.76046544", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974",...
0.0
-1
R""" inequality comparison between this and another Classifier, simply checks if A B > 0
def __ne__(self,other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n return self.x ** 2 + self.y ** 2 > other.x ** 2 + other.y ** 2", "def __gt__(self, other):\n return self.weight > other.weight", "def __gt__(self, other):\n return self.eval_score < other.eval_score", "def __gt__(self, other):\n return self.weight() ...
[ "0.7323742", "0.7207339", "0.7196521", "0.717408", "0.7116371", "0.7098813", "0.70613265", "0.7005404", "0.700271", "0.69787747", "0.69742733", "0.6962742", "0.6956827", "0.6956827", "0.6939363", "0.6920388", "0.69108945", "0.69108945", "0.6898756", "0.6889111", "0.68718845",...
0.0
-1
Creates and displays a simple frame containing the RichTextPanel.
def showEditorWindow(parent, title, allowEditting = True): frame = wx.Frame(parent, -1, title, size=(630, 320), style = wx.DEFAULT_FRAME_STYLE) panel = RichTextPanel(allowEditting, frame, -1) #frame.Fit() #frame.SetMinSize(frame.GetSize()) frame.Show() return panel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MakeFrame(self, name, parent=None, pos=None, size=(900,700), style=wx.DEFAULT_FRAME_STYLE, visible = True):\n if pos is None:\n pos = self._CheckBoundaries(size)\n\n\n frame = self.mf.MainFrame(self, name, parent, pos, size, style, self.text_editor)\n self.frame_position = (pos[...
[ "0.60286325", "0.5938992", "0.59213364", "0.58199555", "0.5770706", "0.5710505", "0.5705657", "0.57053775", "0.5688911", "0.567008", "0.563585", "0.5622285", "0.5615228", "0.56087345", "0.5592374", "0.55808675", "0.55758315", "0.5544468", "0.55370015", "0.5525293", "0.5516264...
0.7123116
0
safe to call on floats and arrays get_shape(1) > None, get_shape(ones(2)) > (2,)
def get_shape(x): return None if jnp.isscalar(x) else x.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(placeholder_shape, data_shape):\n\n return True", "def validate_common(ndarray, name):\n\tvalidate_ndarray(ndarray,(np.float, np.int), (2,) , name)", "def _is_scalar(shape):\n return F.shape_mul(shape) == 1", "def _is_scalar_from_shape(shape):\n return _logical_equal(_ndims_from_shape...
[ "0.72709566", "0.67900205", "0.67742664", "0.67406166", "0.6730081", "0.6688898", "0.664606", "0.6638844", "0.66229963", "0.65788215", "0.6564183", "0.65422463", "0.6526019", "0.65226525", "0.65096045", "0.64582187", "0.6442337", "0.64415085", "0.6415565", "0.63730866", "0.63...
0.586161
76
Trains the network using back propagation, use the logistic activation function and the square loss, along with bias inputs
def fit(self, X, y, alpha, t): m = X.shape[0] # number of examples n = X.shape[1] # number of features normalized_X = normalize(X) # normalize X for accuracy K = len(np.unique(y)) # number of units in the output layer = number of classes if K == 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backprop(self, x, y):\n \n #Building an empty networks filled with empty 0 \n updated_bias = []\n for b in self.biases:\n updated_bias.append(np.zeros(b.shape)) \n \n updated_weight = []\n for w in self.weights:\n updated_weight.appe...
[ "0.70576835", "0.6613435", "0.6567604", "0.6545431", "0.65237206", "0.65193415", "0.64829934", "0.6418162", "0.64143413", "0.64051306", "0.6401433", "0.6364397", "0.6361401", "0.6345978", "0.6330163", "0.63294196", "0.6279485", "0.6272271", "0.6270294", "0.6262799", "0.625279...
0.0
-1
The derivative of the sigmoid function
def g_prime(z): return np.multiply(g(z), 1-g(z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def sigmoid_der...
[ "0.8931355", "0.88970494", "0.88970494", "0.88566244", "0.8723297", "0.8572503", "0.83397293", "0.82558525", "0.81656826", "0.7952699", "0.7922646", "0.7874329", "0.7820545", "0.77842283", "0.77320105", "0.7693423", "0.7673917", "0.767192", "0.764811", "0.760601", "0.7604099"...
0.0
-1
This function split one dataset into the training set and the test set with different standardization;
def run_train_test_split(): # Load all documents conn = sq.connect(config.DB_FILE) documents = pd.read_sql_query('select pubmed_id, review_id, included, title, abstract from article ', conn) # Identify unique review IDs review_ids = documents['review_id'].unique() # Set seed for random sampling np.rando...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.7990251", "0.7974505", "0.7581833", "0.7565025", "0.7559627", "0.7552167", "0.75416225", "0.75179213", "0.74247026", "0.7367997", "0.73663753", "0.7344645", "0.730346", "0.7287729", "0.7281219", "0.72798365", "0.72691244", "0.7258459", "0.7252591", "0.7251626", "0.71612626...
0.6987368
50
Redirect index to students page
def index() -> str: return redirect('/students')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return redirect(url_for('second_page'))", "def home_page():\n return redirect('/users')", "def idx(_request):\n return HttpResponseRedirect('/home')", "def second_page():\n return redirect(url_for('index'))", "def index_file():\n return redirect(\"/\")", "def index(reque...
[ "0.6889249", "0.685594", "0.68496305", "0.6730005", "0.6604118", "0.651976", "0.6506114", "0.6469121", "0.6458482", "0.64317304", "0.640421", "0.6387237", "0.63767403", "0.6375142", "0.6348239", "0.6342875", "0.6328945", "0.6312688", "0.630708", "0.63059723", "0.6292399", "...
0.8471828
0
returns True if `obj` is changed or deleted on the database
def is_changed(obj): revision_field = get_version_fieldname(obj) version = get_revision_of_object(obj) return not obj.__class__.objects.filter(**{obj._meta.pk.name: obj.pk, revision_field: version}).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_live(self, obj):\n most_appropriate_object = get_appropriate_object_from_model(self.model)\n if most_appropriate_object == obj:\n return True\n return False", "def has_change_permission(self, request, obj=None):\n if obj is not None:\n return False\n ...
[ "0.6930333", "0.6525286", "0.64501333", "0.64336836", "0.6431397", "0.64131296", "0.64131296", "0.6349598", "0.63452303", "0.63142246", "0.63139683", "0.6300048", "0.62984204", "0.62824523", "0.6207841", "0.616058", "0.61573696", "0.6101484", "0.60884404", "0.60836864", "0.60...
0.80351144
0
Search through a table and return the first [row, column] pair who's value is None.
def find_unassigned_table_cell(table): for row in range(len(table)): for column in range(len(table[row])): if table[row][column] is None: return row, column return row, column
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_first_element(cls, d):\n\n t = np.where(d[:, 2] > 0)[0]\n if len(t):\n return d[t[0], 0], d[t[0], 1], t[0]\n return None, None, None", "def firstEmptyCell(board):\r\n for i in range(9):\r\n for j in range(9):\r\n if board[i][j] == 0:\r\n ...
[ "0.64960337", "0.634782", "0.633694", "0.6331864", "0.6245917", "0.6233299", "0.60606706", "0.60600805", "0.5962007", "0.5913134", "0.5856047", "0.5801559", "0.57643837", "0.57631135", "0.5742628", "0.5713552", "0.56185967", "0.5603105", "0.559049", "0.55511755", "0.54848987"...
0.7773614
0
Converts colorspace vector back to RGB image. Colorspace can have extra columns
def colorspace_to_image(cspace: DataFrame, m: int, n: int) -> np.array: assert isinstance(cspace, DataFrame), "Colorspace must be a dataframe" assert len(cspace) == m * n, 'Image dimensions must match' assert all(np.isin(['R', 'G', 'B'], cspace.columns)), "Colorspace must contain RGB columns" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features_colorspace(X, colorspace):\n if colorspace == \"BGR\":\n return X\n\n X = np.array(X)\n\n if colorspace == \"HLS\":\n cs = cv2.COLOR_BGR2HLS\n elif colorspace == \"HSV\":\n cs = cv2.COLOR_BGR2HSV\n elif colorspace == \"LUV\":\n cs = cv2.COLOR_BGR2LUV\n el...
[ "0.6144378", "0.60548836", "0.6034356", "0.5993296", "0.5984861", "0.5929783", "0.58545554", "0.58436054", "0.5751462", "0.573934", "0.5706569", "0.5676334", "0.567407", "0.5654705", "0.56331134", "0.5625428", "0.5621792", "0.5558728", "0.5558652", "0.5552761", "0.5528596", ...
0.6287839
0
Tests that all signals are constructed.
def test_construct_signals_present(self): cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'), SIGNALS) assert 'completely_home_prop' in set(cbg_df.columns) assert 'full_time_work_prop' in set(cbg_df.columns) assert 'part_time_work_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_initialize(self):\n SignalHook(self.test_extension, self.signal, self._on_signal_fired)\n\n self.assertEqual(len(self._on_signal_fired.calls), 0)\n self.signal.send(self)\n self.assertEqual(len(self._on_signal_fired.calls), 1)", "def test_allows_signal_notify(self):\n ...
[ "0.7198699", "0.6961123", "0.6867601", "0.68594754", "0.67881685", "0.66899323", "0.66274303", "0.6527756", "0.65197617", "0.6457534", "0.6406589", "0.63431233", "0.6326639", "0.62745726", "0.627386", "0.62715155", "0.62302566", "0.6204464", "0.61189145", "0.60972494", "0.600...
0.627173
15
Tests that aggregation at the state level creates nonzerovalued signals.
def test_aggregate_state(self): cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'), SIGNALS) df = aggregate(cbg_df, SIGNALS, 'state') assert np.all(df[f'{SIGNALS[0]}_n'].values > 0) x = df[f'{SIGNALS[0]}_se'].values assert n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aggregate_nation(self):\n cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'),\n SIGNALS)\n df = aggregate(cbg_df, SIGNALS, 'nation')\n\n assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)\n x = df[f'{SIGNALS[0]}_se'].values\n ...
[ "0.61210126", "0.5934089", "0.589467", "0.5892433", "0.5861224", "0.5711701", "0.5653383", "0.5630056", "0.5579708", "0.5577906", "0.5550419", "0.5545783", "0.55085456", "0.5499616", "0.5489012", "0.5481875", "0.5469063", "0.5461217", "0.54575956", "0.5446156", "0.5441203", ...
0.748049
0
Tests that aggregation at the state level creates nonzerovalued signals.
def test_aggregate_msa(self): cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'), SIGNALS) df = aggregate(cbg_df, SIGNALS, 'msa') assert np.all(df[f'{SIGNALS[0]}_n'].values > 0) x = df[f'{SIGNALS[0]}_se'].values assert np.al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aggregate_state(self):\n cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'),\n SIGNALS)\n df = aggregate(cbg_df, SIGNALS, 'state')\n\n assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)\n x = df[f'{SIGNALS[0]}_se'].values\n ...
[ "0.7479666", "0.6121371", "0.5934786", "0.5891897", "0.5862976", "0.57110685", "0.56545264", "0.5631428", "0.55796295", "0.5577801", "0.55514765", "0.554494", "0.5510593", "0.5500976", "0.54901975", "0.54840297", "0.5469475", "0.54619354", "0.54598", "0.5447684", "0.54426587"...
0.58947563
3
Tests that aggregation at the state level creates nonzerovalued signals.
def test_aggregate_hrr(self): cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'), SIGNALS) df = aggregate(cbg_df, SIGNALS, 'hrr') assert np.all(df[f'{SIGNALS[0]}_n'].values > 0) x = df[f'{SIGNALS[0]}_se'].values assert np.al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aggregate_state(self):\n cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'),\n SIGNALS)\n df = aggregate(cbg_df, SIGNALS, 'state')\n\n assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)\n x = df[f'{SIGNALS[0]}_se'].values\n ...
[ "0.74809134", "0.6120178", "0.5934026", "0.58936185", "0.5890962", "0.5861368", "0.5712922", "0.5653689", "0.56298804", "0.55801994", "0.55768", "0.5550667", "0.55458176", "0.55086803", "0.549904", "0.5489132", "0.54822505", "0.5468543", "0.54612315", "0.54581416", "0.5446415...
0.53738433
29
Tests that aggregation at the state level creates nonzerovalued signals.
def test_aggregate_nation(self): cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'), SIGNALS) df = aggregate(cbg_df, SIGNALS, 'nation') assert np.all(df[f'{SIGNALS[0]}_n'].values > 0) x = df[f'{SIGNALS[0]}_se'].values assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aggregate_state(self):\n cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'),\n SIGNALS)\n df = aggregate(cbg_df, SIGNALS, 'state')\n\n assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)\n x = df[f'{SIGNALS[0]}_se'].values\n ...
[ "0.74812746", "0.59329057", "0.5895889", "0.58929867", "0.58616966", "0.5710675", "0.565309", "0.5629537", "0.557881", "0.5575357", "0.5549657", "0.55448717", "0.55095005", "0.54987305", "0.54884887", "0.54829407", "0.5467536", "0.54628205", "0.5458857", "0.5445779", "0.54409...
0.6122557
1
Tests that aggregation at the state level creates nonzerovalued signals.
def test_aggregate_hhs(self): cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'), SIGNALS) df = aggregate(cbg_df, SIGNALS, 'hhs') assert np.all(df[f'{SIGNALS[0]}_n'].values > 0) x = df[f'{SIGNALS[0]}_se'].values assert np.al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aggregate_state(self):\n cbg_df = construct_signals(pd.read_csv('raw_data/sample_raw_data.csv'),\n SIGNALS)\n df = aggregate(cbg_df, SIGNALS, 'state')\n\n assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)\n x = df[f'{SIGNALS[0]}_se'].values\n ...
[ "0.748049", "0.61210126", "0.5934089", "0.589467", "0.5892433", "0.5861224", "0.5711701", "0.5653383", "0.5630056", "0.5579708", "0.5577906", "0.5550419", "0.5545783", "0.55085456", "0.5499616", "0.5489012", "0.5481875", "0.5469063", "0.54575956", "0.5446156", "0.5441203", ...
0.5461217
18
Converts a TyDi 'entry' from `create_entry_from_json` to `TyDiExample`.
def to_tydi_example(entry, is_training): if is_training: answer = make_tydi_answer(entry["contexts"], entry["answer"]) start_byte_offset = answer.offset end_byte_offset = answer.offset + byte_len(answer.text) else: answer = None start_byte_offset = None end_byte_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_entry(entry):\n Entry.create(**entry)\n return entry", "def from_dict(cls, dikt) -> \"Todo\":\n return util.deserialize_model(dikt, cls)", "def example_json(example_json_file):\n return json.loads(example_json_file)", "def _json_to_instance(self, json_dict: JsonDict) -> Instance:\n...
[ "0.58346426", "0.5392077", "0.5235372", "0.5232819", "0.52080363", "0.51707566", "0.5161617", "0.5157883", "0.5148814", "0.51232684", "0.51134694", "0.5111602", "0.5105579", "0.51049596", "0.5095554", "0.50900686", "0.5078553", "0.5064115", "0.5054117", "0.50366974", "0.50366...
0.74971884
0
Return a list of all child elements that are instances of the given type. The returned list maintains the order in which children were added.
def _getChildrenOfType(self, elementClass): method = getattr(self.__class__, "_getChildrenOfType" + elementClass.__name__) return method(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def descendants(self, type: str):\n return list(descendants(self.type_tree, type))", "def get_element_by_tag_type(self, tag_type):\n elts = []\n if self is None:\n return elts\n if self.tag_type == tag_type:\n elts.append(self)\n\n for child in self.childr...
[ "0.7072542", "0.6878987", "0.6743088", "0.6691061", "0.6669156", "0.6660059", "0.66244364", "0.6470436", "0.64007956", "0.6340226", "0.62596714", "0.6195003", "0.61464643", "0.6143393", "0.6124976", "0.60636926", "0.6059035", "0.6055325", "0.603803", "0.6019386", "0.60062987"...
0.61959624
11
(Deprecated) Add a BindInput to this shader reference.
def _addBindInput(self, name, type = DEFAULT_TYPE_STRING): warnings.warn("This function is deprecated; shader references have been replaced with shader nodes in 1.38.", DeprecationWarning, stacklevel = 2) return self.addInput(name, type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addBindParam(self, name, type = DEFAULT_TYPE_STRING):\n warnings.warn(\"This function is deprecated; shader references have been replaced with shader nodes in 1.38.\", DeprecationWarning, stacklevel = 2)\n return self.addInput(name, type)", "def _getBindInputs(self):\n warnings.warn(\"This function...
[ "0.7632342", "0.65786767", "0.573658", "0.5379098", "0.5296212", "0.5178297", "0.5159998", "0.5151385", "0.5066717", "0.49228904", "0.4916024", "0.48976418", "0.48940352", "0.48545158", "0.47804457", "0.47647017", "0.4753692", "0.47506797", "0.4747506", "0.47449464", "0.47333...
0.84288436
0
(Deprecated) Return a vector of all BindInput elements in this shader reference.
def _getBindInputs(self): warnings.warn("This function is deprecated; shader references have been replaced with shader nodes in 1.38.", DeprecationWarning, stacklevel = 2) return self.getInputs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getBindParams(self):\n warnings.warn(\"This function is deprecated; shader references have been replaced with shader nodes in 1.38.\", DeprecationWarning, stacklevel = 2)\n return list()", "def _getBindTokens(self):\n warnings.warn(\"This function is deprecated; shader references have been replaced...
[ "0.7248788", "0.68201584", "0.61971897", "0.6057106", "0.6041571", "0.60374856", "0.60374856", "0.60374856", "0.6018457", "0.59155166", "0.5823089", "0.57687944", "0.5762386", "0.5726699", "0.5726699", "0.5726699", "0.5711171", "0.5709276", "0.5706087", "0.5700484", "0.568270...
0.83538413
0
Return the default data search path.
def getDefaultDataSearchPath(): return FileSearchPath(os.path.dirname(__file__))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_default_path(self):\n return os.path.join(cfg.DATA_DIR, 'vehicles_dataset_v{}'.format(self._version))", "def default_data_dir(self):\n return self._default_data_dir", "def _get_default_path(self):\n return os.path.join(cfg.DATA_DIR, 'visual_genome')", "def _get_default_path(self):\n...
[ "0.8129479", "0.8007878", "0.79695016", "0.79296505", "0.7858564", "0.7470226", "0.743667", "0.7417918", "0.74098426", "0.74098426", "0.7362305", "0.7316143", "0.72809714", "0.72342837", "0.72125745", "0.7184736", "0.7136621", "0.70106024", "0.69430655", "0.6912006", "0.68595...
0.8906264
0
Convert bbox representation from `camera_view_bounds_2d` to a more standard PILfriendly representation.
def convert_bbox(bbox, width, height): min_x, min_y, max_x, max_y = bbox # scale X axis min_x *= width max_x *= width # invert Y axis and scale min_y = (1 - min_y) * height max_y = (1 - max_y) * height return min_x, min_y, max_x, max_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode_bbox(self, normalized_bbox):\n #apply the inverse of transformation\n y1,x1,y2,x2 = preprocess.apply_transformation(normalized_bbox,\n np.linalg.inv(self.transformation))\n\n w,h = self.image_size\n y1,x1,y2,x2 = y1*h,x1*w,y2*h,x2*w\n return vot.Rectang...
[ "0.67457765", "0.66060835", "0.66052955", "0.6402712", "0.62045026", "0.6073645", "0.5911082", "0.5882305", "0.58592385", "0.5842651", "0.58156204", "0.5749467", "0.57198113", "0.57176834", "0.56508476", "0.56418383", "0.5637036", "0.5637036", "0.56326663", "0.5607498", "0.56...
0.6208672
4
Returns the circular velocity.
def calc_vcirc(r,menc,G=1.): if G is None: G = 1. return np.sqrt(G*menc/r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity(self):\n return self.momentum/self.mass", "def get_start_velocity(self):\n # uniform circular motion have a start velocity of omega\n # TODO generate from start position and rotation direction\n return np.array([0, self.wz, 0])", "def circumference(self):\n r...
[ "0.7257846", "0.7252623", "0.69760185", "0.6974948", "0.6948337", "0.6904478", "0.68118125", "0.6809711", "0.679329", "0.679329", "0.67710674", "0.6732156", "0.6705026", "0.66750187", "0.65806377", "0.64651424", "0.64618456", "0.64478517", "0.64435196", "0.6440419", "0.640747...
0.0
-1
Returns the density enclosed within rmax.
def calc_rhoenc(mass,r,rmax): idx = (r<rmax) return mass[idx].sum()/sphvol(rmax)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_density(self):\n max_density = str(self.density.index(min(self.density)) + 1)\n print(max_density)\n return max_density", "def get_rmax(self):\n return self.rmax", "def _get_max_rupture_projection_radius(self):\n if self.max_radius: # already computed\n ...
[ "0.7466451", "0.68567127", "0.6770987", "0.64775264", "0.64172965", "0.63328725", "0.6259476", "0.6152548", "0.6098544", "0.606421", "0.6053934", "0.60529995", "0.5983414", "0.5938681", "0.5918545", "0.5912345", "0.589474", "0.5892661", "0.5886185", "0.5880672", "0.58720237",...
0.61871815
7
Squeezes 3D positions along y and z axes while preserving volume.
def squeeze_constvol(pos,yfact=-1,zfact=-1): squfact = 1.0 if yfact > 0: squfact*=yfact pos[:,1]*=yfact if zfact > 0: squfact*=zfact pos[:,2]*=zfact pos*=(squfact**(-1./3.)) return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def planes_3d(self, quantity, xplane, yplane):\n xplane = int(xplane)\n yplane = int(yplane)\n # Get the scalar values\n # Get the data on the plane with a fixed x value. These means we'll\n # have changing (y, z) points\n xdata = self.get_plane(quantity, 'yz', xplane)\n ...
[ "0.5905184", "0.583379", "0.5720596", "0.5672659", "0.5666331", "0.5634003", "0.5627785", "0.5615881", "0.56032383", "0.5562901", "0.5532643", "0.55280274", "0.5481719", "0.54555655", "0.54548764", "0.54529595", "0.5406398", "0.5384927", "0.53750247", "0.53184706", "0.5297355...
0.57265604
2
Convert number to string, replacing punctuation.
def num2str(numval,formstr=None,decrep='p',negrep='n',nsig=3,trimzero=True): import copy from string import maketrans # Set default if formstr is None: formstr='.{}g'.format(nsig) # Round numval if within precision if trimzero and not isinstance(numval,(int,long)): precval=10.**(-(nsig-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(s):\r\n return 'digit ' + str(s)", "def convert(number):\n out = \"\"\n if number % 3 == 0:\n out = \"Pling\"\n if number % 5 == 0:\n out = out + \"Plang\"\n if number % 7 == 0:\n out = out + \"Plong\"\n if out == \"\":\n out = str(number)\n return o...
[ "0.6683302", "0.6635494", "0.6613576", "0.6592942", "0.6592942", "0.6592942", "0.6575372", "0.65695816", "0.64755034", "0.64755034", "0.6431362", "0.6401847", "0.6401584", "0.6375053", "0.63302994", "0.6309738", "0.6306367", "0.6301587", "0.62851566", "0.6232513", "0.6218883"...
0.5528809
76
Returns a double, the average number of days between the rating objects specified in the list parameter.
def get_diffs_of_ratings(l): if len(l) <= 1: return str(None) total = 0.0 for v in range(0, len(l)-1): total = total + float((l[v+1]["date"] - l[v]["date"]).days) return str(float(total / (len(l)-1)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg(list):\n return sum(list) / len(list)", "def dishlist_avg_cal(n:list)->float:\r\n all_cal = dishlist_cal(n)\r\n return sum(all_cal)/len(all_cal)", "def average_rating(business_list):\n\tratings = []\n\ttry:\n\t\tfor b in business_list:\n\t\t\tratings.append(b['rating'])\n\texcept KeyError:\n\t...
[ "0.68933636", "0.66389376", "0.6581203", "0.65615976", "0.65188193", "0.6491516", "0.64800775", "0.64580154", "0.6454823", "0.6444565", "0.6435506", "0.64231765", "0.64099354", "0.63959163", "0.6393575", "0.63914645", "0.63865495", "0.63710004", "0.6341628", "0.6338856", "0.6...
0.6772968
1
Split dataset into train and test data
def train_test_split_eopatches(patch_array, test_ratio, features_dict, labels_dict): # define EOPatches for training and testing trainIDs = list(range(len(patch_array))) testIDs = trainIDs[0::test_ratio] # take every xth patch for testing for elem in trainIDs: if elem in testIDs: t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.8715163", "0.8671336", "0.8420628", "0.8248627", "0.8183213", "0.8146104", "0.8093698", "0.8087583", "0.8075708", "0.8037415", "0.80204433", "0.8016", "0.8002609", "0.79591835", "0.79122245", "0.78805375", "0.7857199", "0.78511673", "0.78495", "0.78276145", "0.77810913", ...
0.0
-1
Split dataset into train and test data
def train_test_split_eopatch(patch_array, features_dict, labels_dict): # Set the features and the labels for train and test sets for eopatch in patch_array: features = np.array([eopatch.data[features_dict]]) for eopatch in patch_array: labels = np.array([eopatch.mask_timeless[labels_dict]])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.8715228", "0.867129", "0.8421134", "0.8248853", "0.8183687", "0.8146796", "0.8093657", "0.8088005", "0.8075957", "0.80384034", "0.80211496", "0.80177146", "0.80029935", "0.79595435", "0.7912857", "0.7880697", "0.7858649", "0.78521097", "0.7849592", "0.78286815", "0.7782076...
0.0
-1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues, ylabel='True label', xlabel='Predicted label', filename=None): np.set_printoptions(precision=2, suppress=True) if normalize: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8195649", "0.8095532", "0.803007", "0.8019817", "0.7994959", "0.7991904", "0.79818887", "0.79766536", "0.7961735", "0.7957412", "0.79385704", "0.7935568", "0.79352015", "0.7932079", "0.79270303", "0.7925357", "0.79243845", "0.7923781", "0.792341", "0.79226786", "0.7918532"...
0.0
-1
Return the first empty board space.
def ChooseAction(board, player): # list of all possible initial actions possible_actions = list(i for i in range(16) if board[i] == 0) # default action chosen_move = min(possible_actions) # Dict to keep track of searched utilities and transposed/symmetric boards utilities trans_map = {} # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty_space(board: list) -> tuple:\n board_length = len(board)\n for i in range(board_length):\n for j in range(board_length):\n if board[i][j] == 0:\n return (i,j)", "def getBlank(self):\n return self.tiles[-1]", "def firstEmptyCell(board):\r\n for i i...
[ "0.7228956", "0.72194856", "0.71157676", "0.70752555", "0.7033004", "0.7023246", "0.69070786", "0.6800406", "0.67626697", "0.67131233", "0.67107725", "0.6703432", "0.6672965", "0.6548556", "0.6537903", "0.65232265", "0.64945805", "0.64092594", "0.6404099", "0.63550234", "0.63...
0.0
-1
Test to see if profile for user1 can be edited anon and logged in
def test_edit_profile(self): LOGGER.debug("Test GET /rango/edit/ for anon user") anon_edit_response = self.client.get('/rango/edit/') # redirected to login page self.assertEquals(302, anon_edit_response.status_code) self.assertRedirects(anon_edit_response, "http://testse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_edit_by(self, user2_compare):\n if user2_compare.is_superuser:\n return True\n\n if user2_compare == self.user:\n return True\n\n if (self.creator and self.creator == user2_compare) or \\\n (self.owner and self.owner == user2_compare):\n if...
[ "0.7439114", "0.7438289", "0.71257675", "0.7101223", "0.69775563", "0.6966782", "0.6948189", "0.69078314", "0.67476374", "0.67433494", "0.67346734", "0.66897315", "0.6654319", "0.6628165", "0.66166735", "0.66134465", "0.6602346", "0.6597451", "0.6586665", "0.65701985", "0.649...
0.70152277
4
Samples bs random locations along a sphere of radius r. Uses the specified distribution.
def sample_camera_positions(device, bs=1, r=1, horizontal_stddev=1, vertical_stddev=1, horizontal_mean=math.pi * 0.5, vertical_mean=math.pi * 0.5, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randomPointOnSphere(r):\n x = np.random.normal()\n y = np.random.normal()\n z = np.random.normal()\n point = np.array([x, y, z])\n point *= r/(x**2 + y**2 + z**2)**.5\n return point", "def sample_hypersphere(n_samples, sample_shape, radius, l_norm=2, mode='sphere', sample_gen=None, seed=Non...
[ "0.7045139", "0.6714708", "0.6683562", "0.6669991", "0.65136045", "0.6468937", "0.6257552", "0.6257188", "0.62165225", "0.6169153", "0.6119341", "0.6071606", "0.6061659", "0.60455453", "0.6028003", "0.60168177", "0.60071576", "0.59225005", "0.5913367", "0.59113646", "0.586713...
0.0
-1
Initialize parameters using 6/sqrt(fanin+fanout)
def initParams(self): sizes = [self.inputDim]+self.layerSizes+[self.outputDim] scales = [np.sqrt(6)/np.sqrt(n+m) for n,m in zip(sizes[:-1],sizes[1:])] self.stack = [[np.random.rand(m,n)*2*s-s,np.zeros((m,1))] \ for n,m,s in zip(sizes[:-1],sizes[1:],scales)] se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xavier_init(fan_in, fan_out, constant=1):\n low = -constant*np.sqrt(6/(fan_in + fan_out))\n high = constant*np.sqrt(6.0/(fan_in + fan_out))\n return tf.random_uniform((fan_in, fan_out), minval=low, maxval=high, dtype=tf.float32)", "def xavier_init(fan_in, fan_out, constant=1):\n low = -constant*n...
[ "0.69680864", "0.69680864", "0.6911937", "0.6851623", "0.6725929", "0.6668688", "0.64314777", "0.63509566", "0.62880355", "0.62276816", "0.62222147", "0.6196339", "0.6129628", "0.60937446", "0.599177", "0.5940592", "0.5920254", "0.5912472", "0.5905206", "0.5896622", "0.582124...
0.0
-1
Convert Node to string
def __repr__(self): return str(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodeToString(cls, node):\n return lxml.etree.tostring(node, method='html').decode()", "def as_str(node):\n node_string = ' '.join(k for k, _ in node.leaves())\n return u' '.join(node_string.split())", "def convertXMLNodeToString(*args):\n return _libsbml.XMLNode_convertXMLNodeTo...
[ "0.8408117", "0.8214098", "0.7415175", "0.7378646", "0.7310514", "0.7247914", "0.69681686", "0.69587487", "0.6936375", "0.6902002", "0.6853445", "0.6851775", "0.67991513", "0.67764467", "0.6768847", "0.6712302", "0.6707059", "0.6660956", "0.66056967", "0.65918684", "0.6575423...
0.0
-1
Add an element to the linked list using add_last
def add(self, elem): self.add_last(elem)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_last(self, elem):\n if self.is_empty():\n self.head = self.tail = self.Node(elem, None, None)\n else:\n self.tail.nxt = self.Node(elem, self.tail, None)\n self.tail = self.tail.nxt\n\n self.size += 1", "def addLast(self, element):\n if element ...
[ "0.82564276", "0.8080936", "0.7951037", "0.794131", "0.7875399", "0.7835852", "0.77919906", "0.76805675", "0.7517425", "0.7477709", "0.68978375", "0.6834634", "0.6787018", "0.67224365", "0.67016476", "0.66619736", "0.65850174", "0.65378225", "0.6514077", "0.65035224", "0.6492...
0.7951242
2
Add element to the front of the linked list
def add_first(self, elem): if self.is_empty(): self.head = self.tail = self.Node(elem, None, None) else: self.head.prev = self.Node(elem, None, self.head) self.head = self.head.prev self.size += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_front(self, item):\n new_node = Node(item)\n # if the list is empty, make it head\n if self.head is None:\n self.head = new_node\n # else, \n else:\n new_node.next = self.head # new node points to current head\n self.head = new_node # c...
[ "0.80121136", "0.79267305", "0.7808346", "0.7732094", "0.76805055", "0.76805055", "0.7647048", "0.7646265", "0.75800365", "0.7575906", "0.7505272", "0.74870515", "0.7333277", "0.73185617", "0.7314353", "0.73134905", "0.7302316", "0.7267416", "0.724614", "0.7222592", "0.717940...
0.71153533
25
Add to the end of the Linked list by append to tail.next O(n)
def add_last(self, elem): if self.is_empty(): self.head = self.tail = self.Node(elem, None, None) else: self.tail.nxt = self.Node(elem, self.tail, None) self.tail = self.tail.nxt self.size += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAtTail(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n cur = self.head\n while cur.next != None:\n cur = cur.next\n cur.next = node", "def addAtTail(self, val):\n curr = self.head...
[ "0.80428195", "0.80340844", "0.7985346", "0.7985346", "0.79472816", "0.7919729", "0.7888224", "0.78487927", "0.784192", "0.7733067", "0.76617414", "0.7581593", "0.7545408", "0.75196856", "0.74800986", "0.74454", "0.7366315", "0.7358709", "0.7313949", "0.730378", "0.72863746",...
0.6921185
36
Convert from ParseResults to normal list.
def result2list(foo): if isinstance(foo, ParseResults): return [result2list(bar) for bar in foo] else: return foo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_result_list(self,res):\n res_list = []\n for r in res:\n res_list.append(r)\n\n return res_list", "def __to_list(__results):\n rows = []\n for row in __results:\n rows.append(row)\n \n __results.c...
[ "0.67065823", "0.6454018", "0.6392541", "0.61657304", "0.6103048", "0.60968775", "0.600516", "0.5954104", "0.58549696", "0.5853532", "0.5851375", "0.5830539", "0.5825065", "0.5800057", "0.5794257", "0.57913077", "0.57792944", "0.5751782", "0.5738138", "0.57195807", "0.5705452...
0.7606971
0
My delimited list. Allows for length zero list and uses no delimiter by default.
def List(expr, delim=""): if not delim: return Group(ZeroOrMore(expr)) else: return Group(Optional(expr + ZeroOrMore( Suppress(delim) + expr)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenlist(sep, item):\n return item + ZeroOrMore(sep + item) + Optional(sep)", "def listify(item, delimiter=\",\"):\n if not item:\n return []\n if type(item) is str:\n item = item.split(delimiter)\n if type(item) is not list:\n raise TypeError(\"'listify' must take None, str...
[ "0.7051483", "0.6357497", "0.6287068", "0.62133163", "0.6168434", "0.61420405", "0.6067352", "0.5842047", "0.57866776", "0.5777707", "0.5761801", "0.57346326", "0.5694061", "0.56513804", "0.5629008", "0.56282747", "0.5587309", "0.55792344", "0.5534608", "0.5531955", "0.551274...
0.6472422
1
Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provided, permissions for this specific object...
def has_perm(self, user, perm, obj=None): # Active superusers have all permissions. if user.is_active and user.is_superuser: return True # Otherwise we need to check the backends. return _user_has_perm(user, perm, obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_perm(self, perm, obj=None):\n\n # Active superusers have all permissions.\n if self.is_active and self.is_superuser:\n return True\n\n # Otherwise we need to check the backends.\n return _user_has_perm(self, perm, obj)", "def has_perm(self, perm, obj=None):\n\n ...
[ "0.7863119", "0.7828964", "0.7681567", "0.7681567", "0.7347684", "0.730742", "0.7284849", "0.72575694", "0.72098434", "0.7167823", "0.7167823", "0.71654195", "0.7089648", "0.70708424", "0.70448405", "0.7043486", "0.69482195", "0.6947326", "0.69120204", "0.69032484", "0.684018...
0.7860136
1
Test scenario where branch is deleted by someone.
def test_branch_deleted(local): pytest.run(local, ['git', 'checkout', 'feature']) pytest.run(local, ['git', 'push', 'origin', '--delete', 'feature']) local.join('README').write('Changed by local.') # Run. actual = commit_and_push(str(local), 'origin', Versions(REMOTES)) assert actual is True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def branch_delete(request, branch_id):\n branch = models.Branch.get_by_id(int(branch_id))\n if branch.owner != request.user:\n return HttpTextResponse('You do not own this branch', status=403)\n\n repo_key = branch.repo_key\n branch.key.delete()\n num_branches = models.Branch.query(models.Branch.repo_key =...
[ "0.70407706", "0.6978257", "0.6950403", "0.69398266", "0.69226867", "0.6910521", "0.68338317", "0.6806933", "0.67489284", "0.6737305", "0.67202115", "0.6653965", "0.65832716", "0.65230274", "0.65227497", "0.6496914", "0.64698577", "0.6468279", "0.6465555", "0.64556766", "0.64...
0.7768845
0
Test scenario where the remote repo is unavailable (e.g. repo deleted from GitHub).
def test_origin_deleted(local, remote): local.join('README').write('Changed by local.') remote.remove() with pytest.raises(GitError) as exc: commit_and_push(str(local), 'origin', Versions(REMOTES)) assert 'Could not read from remote repository' in exc.value.output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repo_no_remote(repo):\n\n with pytest.raises(ValueError):\n gitb.pull(repo.working_tree_dir)", "def test_fetch_non_github_repo(self):\n url = 'http://gitlab.com/ivacf/archi'\n with self.assertRaises(InvalidGitHubUrl):\n GitHubRepoFetcher().fetch(url)", "def test_path...
[ "0.7890153", "0.74834275", "0.73048943", "0.7264386", "0.72429395", "0.722274", "0.7192378", "0.7177005", "0.6923777", "0.6869419", "0.6749882", "0.66887414", "0.66767913", "0.666739", "0.6656174", "0.6620313", "0.6619437", "0.6606312", "0.6595402", "0.65802604", "0.65629005"...
0.6526773
21
Return true if light is on.
def is_on(self): return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light_is_on(self):\r\n return self._light == \"ON\"", "def light_is_on(self):\n return self._light == \"ON\"", "def is_on(self):\n return self._light_on", "def is_light(self) -> bool:\n return ATTRIBUTE.Light.value in self.type_data.attributes", "def is_light(self) -> bool:\...
[ "0.9035416", "0.89275813", "0.86664206", "0.8008696", "0.8008696", "0.78880787", "0.7866302", "0.7610281", "0.7565963", "0.7415077", "0.7345493", "0.7335999", "0.73116577", "0.7303292", "0.72991306", "0.7243393", "0.71792775", "0.71722543", "0.7157757", "0.7157757", "0.715775...
0.0
-1
Instruct the light to turn off.
def turn_off(self, **kwargs): #self._light.turn_off() self._brightness = 0 self._state = 'off' _LOGGER.info("turn_off() is called")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light", "def set_light_off(self):\n self._light = \"OFF\"", "def set_light_off(self):\r\n self._light = \"OFF\"", "def lightning_turnoff(self):\n self.turnOff()", "def turn_off(self, **kwargs: Any) -> None:\n ...
[ "0.9141917", "0.89695406", "0.89557284", "0.89015293", "0.8897358", "0.8873913", "0.87862444", "0.87764317", "0.86670524", "0.86476165", "0.847877", "0.8473624", "0.84669805", "0.8463841", "0.8435901", "0.8370482", "0.83494097", "0.8275936", "0.82717854", "0.82705396", "0.825...
0.8805522
6
Returns a plane going through a point at pos, oriented orthogonally to the vector norm and of width and height sx, sy.
def get_plane( self, pos=None, norm=None, plane=None, sx=None, sy=None, color="lightgray", alpha=0.25, **kwargs, ): axes_pairs = dict(sagittal=(0, 1), horizontal=(2, 0), frontal=(2, 1)) if pos is None: pos = self.ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proj_to_plane(norm, d, pts):\n a = norm[0]\n b = norm[1]\n c = norm[2]\n\n p = []\n\n for i in range(len(pts)):\n x_p = pts[i][0]\n y_p = pts[i][1]\n z_p = pts[i][2]\n\n if a != 0:\n x_0 = (b * b + c * c) * x_p - a * b * y_p - a * c * z_p - a * d\n ...
[ "0.6396546", "0.6396546", "0.6183506", "0.6174271", "0.6145053", "0.61160415", "0.6035465", "0.5979914", "0.59591293", "0.5913918", "0.59053445", "0.5904647", "0.5876737", "0.58654743", "0.58250505", "0.58204174", "0.57940704", "0.5756824", "0.57409114", "0.57186556", "0.5703...
0.68663776
0
! Get number of vertices for the entity type (pyD3VOGLModel.GLEntityType)
def _getnumver4enttype(self): if self._enttype == GLEntityType.QUAD: return 4 elif self._enttype == GLEntityType.TRIA: return 3 elif self._enttype == GLEntityType.LINE: return 2 else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertices_count(self) -> int:\n # TODO: verify the following claim:\n raise NotImplementedError", "def num_vertices(self):\n return len(self)", "def num_vertices(self):\n return len(self.vertices)", "def num_vertices(self):\n return len(self.vertices)", "def obtene...
[ "0.70886576", "0.6977656", "0.6910094", "0.6910094", "0.6875554", "0.68577117", "0.6852669", "0.6802562", "0.67703396", "0.6729522", "0.6707347", "0.6678461", "0.6672218", "0.6627881", "0.65335345", "0.6504911", "0.6445821", "0.64410627", "0.63270456", "0.6130506", "0.6094207...
0.67097986
10
Calculates and returns Y position to draw the graph or the border lines on canvas. Correct calculation is based on given sensor.
def calculate_y_pos(value, sensor): if GraphModel.check_value(value, sensor): return ((32 - int(value)) * 12.5) + 50 if sensor == 't' else 450 - (int(value) / 10 * 40) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_y_position(self):\n return self.actual_coordinates[1]", "def _get_y(self):\n return self.position.y", "def get_y_position(self): \n return self.rect.y", "def _get_y(self):\n enabled = self.num_enabled\n\n if self.heart_enabled:\n self._heart_y = 45...
[ "0.66574275", "0.6487656", "0.6412374", "0.6384742", "0.63770056", "0.63079816", "0.63051313", "0.62791324", "0.6248244", "0.6188574", "0.61683464", "0.61539483", "0.6150818", "0.6133438", "0.61187756", "0.6089482", "0.6060128", "0.605848", "0.60405856", "0.60292876", "0.6007...
0.78490245
0
This method is used internally to check if the current animation needs to be skipped or not. It also checks if the number of animations that were played correspond to the number of animations that need to be played, and raises an EndSceneEarlyException if they don't correspond.
def update_skipping_status(self): # there is always at least one section -> no out of bounds here if self.file_writer.sections[-1].skip_animations: self.skip_animations = True if ( config["from_animation_number"] and self.num_plays < config["from_animation_num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_next_animation(self):\n current_num_animations = len(self.queued_animations)\n while len(self.queued_animations) >= current_num_animations and len(self.queued_animations) > 0:\n self.update(100)", "def verify_ending(self):\n self._fast_forward_to_penultimate_play()\n ...
[ "0.5900172", "0.55246276", "0.5460398", "0.5384421", "0.53802437", "0.5294638", "0.5283734", "0.52820474", "0.52820474", "0.5280884", "0.5170907", "0.5156991", "0.5137927", "0.5131808", "0.5128726", "0.50902385", "0.50789577", "0.5078137", "0.50726855", "0.50664717", "0.50526...
0.746912
0
If graph is a dag (directional acyclic graph), returns a list of the Nodes in graph such that for each edge A > B, A appears before B. If graph is not a dag, returns a list of the keys in graph in decreasing order of their Nodes' finishTime as determined from a DFS.
def topological_sort(graph, rootKey = None): # Reset's the attribute values of all Nodes in graph to their initialization values. # Importantly, resets Node.searchStatus to "undiscovered" and Node.parent to None. graph.reset() topologicalKeyList = [] # time is declared inside a function and so must be made glob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topologicalSort(graph):\n vertexState = dict.fromkeys(graph.keys(), DFS.WHITE)\n topologicalSort = []\n def dfs(vertex):\n vertexState[vertex] = DFS.GRAY\n for neighbor in graph[vertex]:\n if vertexState[neighbor] == DFS.WHITE:\n dfs(neighbor)\n vertexSta...
[ "0.6870418", "0.6653123", "0.62808746", "0.6193029", "0.615637", "0.60633636", "0.59539557", "0.59509176", "0.59378695", "0.5868872", "0.5856139", "0.5848763", "0.5805774", "0.578109", "0.57603496", "0.5736487", "0.5732424", "0.5702125", "0.57002413", "0.5691765", "0.56834507...
0.6322051
2
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, normalize=False, title=None, cmap=plt.cm.Blues, target_names=None): if not title: if normalize: title = 'Normalized confusion matrix' else: ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Taking secp256k1's G as a seed, either in compressed or uncompressed form, append "index" as a byte, and append a second byte "counter" try to create a new NUMS base point from the sha256 of that bytestring. Loop counter and alternate compressed/uncompressed until finding a valid curve point. The first such point is co...
def getNUMS(index=0): assert index in range(256) nums_point = None for G in [getG(True), getG(False)]: seed = G + chr(index) for counter in range(256): seed_c = seed + chr(counter) hashed_seed = hashlib.sha256(seed_c).digest() #Every x-coord on the curve ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_podle(self, index=0):\n #TODO nonce could be rfc6979?\n k = os.urandom(32)\n J = getNUMS(index)\n KG = secp256k1.PrivateKey(k, ctx=ctx).pubkey\n KJ = J.tweak_mul(k)\n self.P2 = getP2(self.priv, J)\n self.get_commitment()\n self.e = hashlib.sha256...
[ "0.588711", "0.55167645", "0.5486731", "0.5389965", "0.5368635", "0.5368635", "0.5340812", "0.5231569", "0.5220929", "0.5193509", "0.51206154", "0.5085955", "0.5046237", "0.5041022", "0.502793", "0.5023869", "0.50096273", "0.49974316", "0.49673843", "0.49673653", "0.49479038"...
0.78247774
0