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
Returns the state with highest amount of deaths
def state_with_most_deaths(arr, year, cause='All causes'): # find correct list of states list_of_states = arr[(arr[:,0] == str(year)) & (arr[:,2] == cause) & (arr[:,3] != "United States")] # fint largest deaths number in a states & find state with this death number result_state = list_of_states[list_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_happiest_state(state_score):\n\tmax_happiness = -10000\n\thappiest_state = \"\"\n\tfor state in state_score.keys():\n\t\tif max_happiness<state_score[state]:\n\t\t\tmax_happiness = state_score[state]\n\t\t\thappiest_state = state\n\treturn state", "def max_value(gameState):\n if terminal_test(gameSta...
[ "0.68532634", "0.6599768", "0.65298975", "0.6410232", "0.64067876", "0.62784386", "0.62678146", "0.62666243", "0.62101847", "0.61624795", "0.6137476", "0.6104854", "0.60230225", "0.60138816", "0.6008618", "0.60007876", "0.5959591", "0.59294546", "0.59116787", "0.5869223", "0....
0.7355956
0
Test temporary_cd() context manager
def test_temporary_cd(): initial_dir = os.getcwd() temporary_dir = "/" from openforcefield.utils import temporary_cd with temporary_cd(temporary_dir): assert os.getcwd() == temporary_dir assert os.getcwd() == initial_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testContextManager(self):\n with mock.patch('tempfile.mkdtemp', lambda: self.temp_directory):\n with base.BaseRecipe('fake_recipe') as recipe:\n self.assertTrue(os.path.isdir(self.temp_directory))\n #pylint: disable=protected-access\n self.assertEqual(recipe._workdir, self.temp_dir...
[ "0.6980569", "0.6711925", "0.6459582", "0.63552225", "0.6324862", "0.62804693", "0.62800485", "0.62206185", "0.6202046", "0.6195", "0.61690104", "0.6160064", "0.6143204", "0.6129913", "0.61230826", "0.6121746", "0.61046064", "0.6104341", "0.60943174", "0.6083337", "0.60738313...
0.8061026
0
Find the node in the graph which requires the smallest magnitude of u to get to from the random state.
def nearest_neighbor(self, xRand): # TODO: Make this more efficient? #within a neighborhood of XRand, determine the lowest cost to go minCost = np.inf minNode = None for node in self.Tree: cost = self.compute_dist(node.state_time[0:6], xRand) if cost < ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findMinNode(self, s):\n\n minNode = None\n minVal = self.inf\n for vertex in s:\n if self.dist[vertex] < minVal:\n minVal = self.dist[vertex]\n minNode = vertex\n return minNode", "def find_min_node(self):\n min_energy = 10 ** 10\n ...
[ "0.6527561", "0.6435463", "0.6431374", "0.6232134", "0.6199517", "0.6179466", "0.60915333", "0.60906845", "0.6082688", "0.6071737", "0.6040509", "0.6023843", "0.6004322", "0.5960131", "0.59301215", "0.59179556", "0.5907052", "0.5876883", "0.58652204", "0.5801122", "0.5795765"...
0.5932491
14
Find the node in the graph which requires the smallest magnitude of u to get to from the random state.
def nearest_neighbor(self, xRand): # TODO: Make this more efficient? #within a neighborhood of XRand, determine the lowest cost to go minCost = np.inf minNode = None for node in self.Tree: cost = self.compute_dist(node.state_time[0:6], xRand) if cost < ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findMinNode(self, s):\n\n minNode = None\n minVal = self.inf\n for vertex in s:\n if self.dist[vertex] < minVal:\n minVal = self.dist[vertex]\n minNode = vertex\n return minNode", "def find_min_node(self):\n min_energy = 10 ** 10\n ...
[ "0.6527743", "0.6436093", "0.6432691", "0.6232609", "0.61991054", "0.6180935", "0.60923404", "0.60921085", "0.60834223", "0.6071551", "0.6042296", "0.60239965", "0.6005576", "0.59606874", "0.59308326", "0.5918277", "0.59081244", "0.5877088", "0.5865453", "0.5801121", "0.57967...
0.59344953
15
Matches the string with the pattern, caching the compiled regexp.
def match(pattern, s): # The regexp compilation caching is inlined in both Match and Search for # performance reasons; factoring it out into a separate function turns out # to be noticeably expensive. if pattern not in _regexp_compile_cache: _regexp_compile_cache[pattern] = sre_compile.compile(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(self, name, pattern):\n try:\n return self.get_pattern(name)\n except KeyError:\n return self.store_pattern(name, re.compile(pattern))", "def _compile_fnmatch(pattern: str) -> re.Pattern:\n return re.compile(translate(pattern))", "def fnmatchcase(name, pat):\r...
[ "0.71482474", "0.6756026", "0.6744813", "0.6722702", "0.6654812", "0.65595526", "0.6545594", "0.65077955", "0.6425168", "0.641809", "0.63556606", "0.6297387", "0.62467575", "0.62355703", "0.6205774", "0.61628044", "0.61571676", "0.6150092", "0.61344326", "0.6126535", "0.61137...
0.7651433
0
Generate usable time string.
def seconds_to_string(seconds): # make sure in-between values are not hidden can_hide = True # days days = int(floor(seconds / 86400)) days_text = str(days) + 'd ' if days < 1: days_text = '' else: can_hide = False remaining = fmod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenerateTime(self):\n return str(bin(int(round(time.time() * 1000))))[2:]", "def generate_time(self) -> str:\n return pulumi.get(self, \"generate_time\")", "def get_time_string(self):\n return f\"{self.year} {self.month:02} \" \\\n f\"{self.start_day:02} {self.start_hour:02...
[ "0.79932034", "0.7851666", "0.7776816", "0.7623589", "0.7615458", "0.7587137", "0.75653434", "0.7546133", "0.7488429", "0.74793303", "0.7459818", "0.7357713", "0.7330868", "0.7306385", "0.72327703", "0.7230358", "0.71383786", "0.7128545", "0.71268487", "0.7087252", "0.7051371...
0.0
-1
This method gets our order total
def get_order_total(self): order_total = 0 for item in self.cart_items: order_total += item['price'] return order_total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total(self):\n\n total = super(InternationalMelonOrder, self).get_total()\n if self.qty < 10:\n total = total + 3\n return total", "def get_total(self):\n\n subtotal = super(InternationalMelonOrder, self).get_total()\n if self.qty < 10:\n total = s...
[ "0.7931804", "0.7841695", "0.77408457", "0.7681984", "0.7676626", "0.75567734", "0.7512882", "0.74579936", "0.7405691", "0.73995197", "0.7307088", "0.72877693", "0.7261905", "0.7258633", "0.7242722", "0.72369826", "0.7155262", "0.71541977", "0.71280813", "0.71271825", "0.7125...
0.84648013
0
Hash a password using a salt. A salt is a random sequence added to the password string before using the hash function this is used to prevent dictionary and rainbow tables attacks. For IPython, the hashed passphrase should be in the format
def hash_password(password, algorithm='sha1'): # Length of the salt in number of hex chars, which implies # salt_len * 4 bits of randomness salt_len = 12 h = hashlib.new(algorithm) salt = ('%0' + str(salt_len) + 'x') % random.getrandbits(4*salt_len) h.update(password.encode('utf-8') + salt.enco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(password, salt):\n password = str(password).encode('utf-8')\n salt = str(salt).encode('utf-8')\n return hashlib.sha512(password + salt).hexdigest()", "def hash_pass(password, salt):\n return hashlib.pbkdf2_hmac('sha512', password.encode(), salt, 100000)", "def hash_password(passwo...
[ "0.8006383", "0.7934795", "0.79033065", "0.7779137", "0.769561", "0.7625197", "0.7612696", "0.7592995", "0.75869584", "0.758049", "0.7525644", "0.7525644", "0.7525644", "0.7516438", "0.75040305", "0.7502213", "0.74630284", "0.74513763", "0.74110043", "0.7409933", "0.7390822",...
0.6951533
50
Parses requirements.txt and returns arrays with `install_requires` packages and with `dependency_links` sources.
def parse_requirements_txt(): root = os.path.dirname(os.path.abspath(__file__)) requirements = [] dependencies = [] with open(os.path.join(root, 'requirements.txt'), 'r') as f: for line in f.readlines(): line = line.rstrip() if not line or line.startswith('#'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_requirements():\n with open('requirements.txt') as fd:\n lines = fd.read().splitlines()\n requires, links = [], []\n for line in lines:\n if line.startswith('git+'):\n links.append(line)\n elif line:\n requires.append(line)\n ...
[ "0.81457865", "0.8066655", "0.7832942", "0.7801418", "0.7609523", "0.7606973", "0.75887316", "0.7575572", "0.7503911", "0.75038475", "0.7491879", "0.7468125", "0.73611116", "0.7359987", "0.7353672", "0.73363036", "0.73330444", "0.73057646", "0.72224545", "0.7219688", "0.71200...
0.7923224
2
Check if the current image is transformable.
def _is_transformable(self): if not self._app.get_paths(): raise NotTransformable("No image to") elif not edit_supported(self._app.get_path()): raise NotTransformable("Filetype not supported for") # Some operations only make sense if we are allowed to save to file ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_retransform(self):\r\n return self._can_retransform", "def _check_do_transform(df, reference_im, affine_obj):\n try:\n crs = getattr(df, 'crs')\n except AttributeError:\n return False # if it doesn't have a CRS attribute\n\n if not crs:\n return False # return False for...
[ "0.67576784", "0.66709805", "0.66709805", "0.6374297", "0.6161215", "0.6148102", "0.61152226", "0.60924584", "0.6089935", "0.5935475", "0.5934404", "0.581421", "0.581421", "0.57912976", "0.5705352", "0.5696411", "0.5692357", "0.56322336", "0.56060916", "0.5574751", "0.5562395...
0.7899624
0
Returns a copy of an operation from another Graph under a specified scope. Given an `Operation` `org_instance` from one `Graph`, initializes and returns a copy of it from another `Graph`, under the specified scope (default `""`). The copying is done recursively, so any `Operation` whose output is required to evaluate t...
def copy_op_to_graph(org_instance, to_graph, variables, scope=""): #The name of the new instance if scope != '': new_name = scope + '/' + org_instance.name else: new_name = org_instance.name #Extract names of variables copied_variables = dict((x.name, x) for x in variables) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_copied_op(org_instance, graph, scope=\"\"):\n\n #The name of the copied instance\n if scope != '':\n new_name = scope + '/' + org_instance.name\n else:\n new_name = org_instance.name\n\n return graph.as_graph_element(new_name, allow_tensor=True,\n allow_operation=Tr...
[ "0.77009594", "0.7223673", "0.5707519", "0.55270463", "0.5391068", "0.5240481", "0.52279663", "0.51939565", "0.51422054", "0.5068282", "0.50412333", "0.5008318", "0.49972668", "0.49842364", "0.49809194", "0.49085328", "0.49025807", "0.48967817", "0.48869377", "0.48471335", "0...
0.769516
1
Given an `Operation` instance from some `Graph`, returns its namesake from `graph`, under the specified scope (default `""`). If a copy of `org_instance` is present in `graph` under the given `scope`, it will be returned.
def get_copied_op(org_instance, graph, scope=""): #The name of the copied instance if scope != '': new_name = scope + '/' + org_instance.name else: new_name = org_instance.name return graph.as_graph_element(new_name, allow_tensor=True, allow_operation=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shared_name_scope(name, graph, name_scopes):\n with graph.as_default():\n if name not in name_scopes:\n with tf.name_scope(name) as scope:\n name_scopes[name] = scope\n return tf.name_scope(name_scopes[name])", "def copy_op_to_graph(org_instance, to_graph, variables,\n ...
[ "0.55972886", "0.5518905", "0.52510613", "0.5225995", "0.51589733", "0.509764", "0.50343996", "0.5020464", "0.4878269", "0.48743412", "0.48486558", "0.4842584", "0.48090503", "0.47804478", "0.47511098", "0.47458586", "0.47375217", "0.4728693", "0.4690386", "0.46869633", "0.46...
0.65003526
0
Check for validity of a password.
def valid_password(form: CompleteSignupForm, field: PasswordField) -> None: from run import config min_pwd_len = int(config['MIN_PWD_LEN']) max_pwd_len = int(config['MAX_PWD_LEN']) pass_size = len(field.data) if pass_size == 0: raise ValidationError('new password cannot be empty') if pas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_password(self, password):\n if self.password_regex.search(password) is not None:\n print(\"Correct password\")\n return True\n else:\n print(\"Wrong password\")\n return False", "def password_validator(username, password):\n digits = re.sear...
[ "0.82361525", "0.81910443", "0.8176714", "0.81728435", "0.8153556", "0.81447965", "0.81328094", "0.80977815", "0.8082152", "0.8075861", "0.80493385", "0.8040423", "0.80356884", "0.8032196", "0.80199283", "0.80061185", "0.7993979", "0.79896325", "0.79846525", "0.7963109", "0.7...
0.0
-1
Check if the passed email is already in use.
def email_not_in_use(has_user_field: bool = False) -> Callable: def _email_not_in_use(form, field): user_id = -1 if not has_user_field else form.user.id user = User.query.filter(User.email == field.data).first() if user is not None and user.id != user_id and len(field.data) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_duplicate_email(self, email):\r\n request = self.req_factory.post('unused_url', data={\r\n 'new_email': email,\r\n 'password': 'test',\r\n })\r\n request.user = self.user\r\n self.assertFailedRequest(self.run_request(request), 'An account with this e-mail...
[ "0.7910521", "0.7538514", "0.7453208", "0.72637945", "0.72568357", "0.7036964", "0.70270187", "0.68022", "0.666322", "0.66546845", "0.6648498", "0.6647866", "0.66474634", "0.66336673", "0.6583613", "0.65820855", "0.64584386", "0.64489746", "0.64347625", "0.6349496", "0.632682...
0.62104756
28
Validate if the repeated password is the same as 'password'.
def validate_password_repeat(form: CompleteSignupForm, field: PasswordField) -> None: if field.data != form.password.data: raise ValidationError('The password needs to match the new password')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_password_repeat(form, field) -> None:\n if field.data != form.password.data:\n raise ValidationError('The password needs to match the new password')", "def clean_password_repeat(self):\n if 'password' in self.cleaned_data and 'password_repeat' in self.cleaned_data:\n ...
[ "0.8312043", "0.81205213", "0.81102145", "0.7868941", "0.74847686", "0.7224185", "0.721416", "0.71873873", "0.7185018", "0.6976725", "0.697177", "0.6957016", "0.69195044", "0.69021696", "0.689425", "0.6837563", "0.6816214", "0.6767813", "0.6767484", "0.67638636", "0.6759106",...
0.8040536
3
Validate current password entered with the password stored in database.
def validate_current_password(form, field) -> None: if form.user is None: raise ValidationError('User instance not passed to form validation') if not form.user.is_password_valid(field.data): raise ValidationError('Invalid password')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_current_password(self):\n if not self.user.check_password(self.cleaned_data['current_password']):\n raise forms.ValidationError('Wrong password.')\n return True", "def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]...
[ "0.79288685", "0.7620796", "0.75543356", "0.75177693", "0.7437509", "0.74217004", "0.74136174", "0.74116725", "0.7390938", "0.73856384", "0.7331894", "0.7311954", "0.728966", "0.72892106", "0.726398", "0.7241312", "0.7228408", "0.7227566", "0.7209986", "0.71687925", "0.716046...
0.76065063
2
Explores all root nodes and terminates
def check_all_roots(trial): root_nodes = trial.node_map[0].children.copy() shuffle(root_nodes) states = [] for node in root_nodes: trial_copy = copy.deepcopy(trial) states.append(trial_copy) node.observe() trial_copy = copy.deepcopy(trial) states.append(trial_cop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_tree(self):\n self.root = None\n self.action = None\n self.dist_probability = None", "def expand(self):\n # distribution = self.net.predict_distribution(self.pos)\n self.children = []\n for c in self.pos.moves():\n pos2 = self.pos.move(c)\n ...
[ "0.64291155", "0.6415831", "0.6400718", "0.633354", "0.63218606", "0.63041884", "0.61008126", "0.6015183", "0.60115045", "0.599604", "0.59802413", "0.59761983", "0.59730256", "0.593634", "0.59228206", "0.5920266", "0.5903833", "0.58932805", "0.58878696", "0.58698523", "0.5854...
0.0
-1
Returns true if numeric_string is composed by zeros
def _is_zero_sequence(self, numeric_string): for number in numeric_string: if number != '0': return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_zero(self):\n return (len(self._digits) == 1) and\\\n (self._digits[0] == self.Symbols.ZERO.value)", "def isNumeric(string, needHexPrefix):\n return (True)", "def checkifnumber(self, test_string):\r\n try:\r\n float(test_string)\r\n return(True)\r\n ...
[ "0.6928954", "0.6816665", "0.6564357", "0.6557275", "0.6508306", "0.65027934", "0.6486621", "0.6464294", "0.6450796", "0.6447824", "0.64134127", "0.639514", "0.6373436", "0.63697636", "0.63571095", "0.6325822", "0.6323705", "0.6307757", "0.62969565", "0.6285611", "0.6280963",...
0.84920955
0
Test deploy s3 backend result.
def test_deploy_s3_backend_result(deploy_s3_backend_result: Result) -> None: # currently, this is expected to fail - Terraform prompts for user confirmation assert deploy_s3_backend_result.exit_code != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_s3_backend_result(\n cli_runner: CliRunner, s3_backend: Path\n) -> Iterator[Result]:\n yield cli_runner.invoke(cli, [\"deploy\", \"--tag\", \"test\"], env={\"CI\": \"1\"})\n # cleanup files\n shutil.rmtree(CURRENT_DIR / \".runway\", ignore_errors=True)\n shutil.rmtree(CURRENT_DIR / \".ter...
[ "0.7319608", "0.70846677", "0.681071", "0.6755746", "0.66679525", "0.66224587", "0.6605111", "0.65455836", "0.65260255", "0.64875156", "0.6467467", "0.6454232", "0.6451846", "0.6424447", "0.64181495", "0.6399061", "0.6383198", "0.63712394", "0.63166744", "0.6306198", "0.62647...
0.8108288
0
Returns a 3D Tensor object representing the image as RGB.
def read_image_as_tensor(path: Path) -> tf.Tensor: img_data = tf.io.read_file(str(path)) img_tensor = tf.io.decode_jpeg(img_data, channels=3) return img_tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_image(self):\n z3 = self.z[:,:,newaxis]\n return z3 * self.c", "def xyz_to_rgb(image: tf.Tensor) -> tf.Tensor:\n x, y, z = tf.unstack(image, axis=-1)\n var_x = x / 100\n var_y = y / 100\n var_z = z / 100\n\n var_r = var_x * 3.2406 + var_y * -1.5372 + var_z * -0.4986\n var_...
[ "0.705571", "0.69729817", "0.66338193", "0.6469118", "0.6360668", "0.62437516", "0.6156353", "0.6130597", "0.6076949", "0.60362107", "0.6008963", "0.60069484", "0.59681296", "0.5915794", "0.59057957", "0.5877763", "0.58614", "0.58516264", "0.5843878", "0.58382493", "0.5775189...
0.60449916
9
Reads a yaml file and returns a dict representation of it
def __read_yaml_file(config_file_path): logger.debug('Attempting to load configuration file - ' + config_file_path) config_file = None try: with open(config_file_path, 'r') as config_file: config = yaml.safe_load(config_file) logger.info('Loaded configuration') return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_yaml_file(filepath: str) -> Dict:\n return yaml.safe_load(read_file(filepath))", "def read_yaml(yaml_file: str) -> dict:\n with open(yaml_file, 'r', encoding=\"utf8\") as _file:\n _dict = yaml.safe_load(_file)\n logging.info(f\"Yaml file {yaml_file} parsed!\")\n\n return _dict", ...
[ "0.824739", "0.8133218", "0.7990602", "0.79682404", "0.78804845", "0.7854786", "0.78105295", "0.76530236", "0.761646", "0.75974536", "0.75883496", "0.7539582", "0.74978906", "0.7462577", "0.7425986", "0.73968613", "0.7366731", "0.73637956", "0.7294568", "0.729267", "0.7276272...
0.6427831
73
r""" Given two vectors a and b, return the dot product (\hat{a}).b.
def nudot(a, b): ev = a / np.linalg.norm(a) return np.dot(ev, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))", "def dot(a, b):\n return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]", "def dot(a,b):\n return...
[ "0.89196104", "0.86572", "0.85203725", "0.8435241", "0.83679235", "0.8347663", "0.82052124", "0.8159955", "0.8116322", "0.8096167", "0.8087081", "0.8084914", "0.80606186", "0.8037773", "0.80159616", "0.7991759", "0.7959075", "0.7959013", "0.79321116", "0.7878579", "0.7854872"...
0.0
-1
r""" Given two vectors a and b, return the gradient of the norm of the dot product (\hat{a}).b w/r.t. a.
def d_nudot(a, b): return np.dot(d_unit_vector(a), b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))", "def vecDot(a, b):\n ret=0.0\n for i in range(len(a)):\n ret+=a[i]*b[i]\n ret...
[ "0.73145396", "0.6951153", "0.67704046", "0.6695468", "0.66618603", "0.6641333", "0.6615133", "0.65799725", "0.6558491", "0.6537899", "0.65082276", "0.64963293", "0.64158374", "0.64007926", "0.63591534", "0.63305676", "0.6247301", "0.624375", "0.6226108", "0.62196106", "0.621...
0.0
-1
r""" Given two vectors a and b, return the cross product (\hat{a})xb.
def ucross(a, b): ev = a / np.linalg.norm(a) return np.cross(ev, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross(a, b):\n #return np.cross(a,b)\n\n return vector(a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0])", "def cross(a, b):\n return np.array([a[1]*b[2] - a[2]*b[1],\n a[2]*b[0] - a[0]*b[2],\n ...
[ "0.8755098", "0.8478476", "0.8446517", "0.8416587", "0.8380508", "0.8119657", "0.81027275", "0.78738904", "0.7872392", "0.7715274", "0.77144223", "0.75706947", "0.7513075", "0.74758035", "0.7464408", "0.7436238", "0.7371955", "0.7364403", "0.73624307", "0.7351102", "0.7313862...
0.80847013
7
r""" Given two vectors a and b, return the norm of the cross product (\hat{a})xb.
def nucross(a, b): ev = a / np.linalg.norm(a) return np.linalg.norm(np.cross(ev, b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized_cross(a, b):\n c = np.cross(a, b)\n length = sqrt(c.dot(c))\n return c/length if length > 0 else c", "def cross(a, b):\n #return np.cross(a,b)\n\n return vector(a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0])", ...
[ "0.8134442", "0.7775754", "0.764184", "0.7555269", "0.7488114", "0.74775994", "0.74265224", "0.7247486", "0.72362244", "0.72033066", "0.714692", "0.7044095", "0.7041369", "0.70292693", "0.6954864", "0.69045866", "0.6894118", "0.6864826", "0.6839023", "0.68195075", "0.68183494...
0.76270884
3
Test that pinctrl headers are generated correctly.
def test_main(data, tmp_path): main(data, tmp_path) FILES = ( "gd32f888x(0-1)xx-pinctrl.h", "gd32f888x(2-3)xx-pinctrl.h", "gd32f888y(0-1)xx-pinctrl.h", "gd32f999x(0-1)xx-pinctrl.h", "gd32f999x(2-3)xx-pinctrl.h", "gd32f999y(0-1)xx-pinctrl.h", ) for file ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_hyperflex_capability_info(self):\n pass", "def test_prepare_mac_header(self):\n self.assertEqual(prepare_mac_header(**self.mac_plain), self.auth_plain)\n self.assertEqual(prepare_mac_header(**self.mac_body), self.auth_body)\n self.assertEqual(prepare_mac_header(**self....
[ "0.5954903", "0.580561", "0.5766719", "0.5656653", "0.5644531", "0.563073", "0.55938345", "0.5570545", "0.5544761", "0.5541444", "0.55347157", "0.5507324", "0.54649055", "0.5443585", "0.5432881", "0.54287153", "0.54147935", "0.54058355", "0.5402034", "0.53688896", "0.5355705"...
0.0
-1
Unit of measurement this thermostat expresses itself in.
def unit_of_measurement(self): return TEMP_CELCIUS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_of_measurement(self):\n return self.device.unit()", "def unit_of_measurement(self):\n return self.temperature_unit", "def unit_of_measurement(self):\n return None", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return sel...
[ "0.83797014", "0.83081", "0.829437", "0.82849425", "0.82849425", "0.82849425", "0.82849425", "0.82849425", "0.82849425", "0.82849425", "0.82849306", "0.8264458", "0.8264458", "0.8264458", "0.8264458", "0.8264458", "0.8264458", "0.8264458", "0.8264458", "0.8264458", "0.8264458...
0.77996516
49
Helper to recompute learning rate; most helpful in eagermode.
def exp_incr_lr(): maxlr_div_minlr = tf.divide(max_lr, min_lr) power_iter = tf.divide(global_step, num_iters) pow_div = tf.pow(maxlr_div_minlr, power_iter) return tf.multiply(min_lr, pow_div, name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r\n param_group['lr'] = lr", "def update_learning_rate(self):\n self.scheduler.step()\n lr = self.optimizer.par...
[ "0.7688023", "0.7537041", "0.7499854", "0.7494561", "0.7467328", "0.7441302", "0.7387377", "0.7375683", "0.7375683", "0.7252527", "0.72324973", "0.7211719", "0.7201351", "0.716078", "0.70632654", "0.7041095", "0.7006256", "0.7006177", "0.6986262", "0.6985258", "0.69581175", ...
0.0
-1
Helper to recompute learning rate; most helpful in eagermode.
def exp_decr_lr(): minlr_div_maxlr = tf.divide(min_lr, max_lr) power_iter = tf.divide(global_step, num_iters) pow_div = tf.pow(minlr_div_maxlr, power_iter) return tf.multiply(max_lr, pow_div, name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r\n param_group['lr'] = lr", "def update_learning_rate(self):\n self.scheduler.step()\n lr = self.optimizer.par...
[ "0.76880443", "0.75364", "0.7499322", "0.74952453", "0.7467178", "0.744076", "0.7387276", "0.737572", "0.737572", "0.72512084", "0.72316664", "0.7211402", "0.72014195", "0.7160985", "0.7064323", "0.70407027", "0.7007683", "0.7005778", "0.6986938", "0.6984599", "0.69577515", ...
0.0
-1
Pads the given tensor along the height and width dimensions with `num` 0s on each side
def pad(tensor, num=1): return tf.pad(tensor, [[0, 0], [num, num], [num, num], [0, 0]], "CONSTANT")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(tensor):\n paddings = tf.constant([[0, 0], [0, 10], [0, 0]])\n out = tf.pad(tensor, paddings, \"CONSTANT\", constant_values=0)\n return out", "def pad_single_tensor(tensor):\n rank = len(tensor.shape)\n assert rank > 0\n padding = array_ops.stack([[0, missing_count]] + [[0, 0]] * ...
[ "0.6779519", "0.66084576", "0.6369796", "0.6293441", "0.6105821", "0.6037869", "0.60302526", "0.6009469", "0.6005366", "0.590743", "0.59034216", "0.58852917", "0.5881324", "0.58679533", "0.58548045", "0.5791917", "0.5782444", "0.56984186", "0.569474", "0.56496835", "0.5639351...
0.77457047
0
Creates copy of sentence with leading blanks, if any, removed.
def remove_leading_blanks(self, sentence): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_clean(sentence):\n return re.sub(f\"[{PUNCT}]\", ' ', remove_stopwords(sentence).strip().lower()).replace(' ', ' ')", "def test_clear_sentence():\n questions_parser = QuestionsParser()\n assert questions_parser.remove_single_space('this is a test answer') == 'thisisatestanswer'", "def remo...
[ "0.6741744", "0.64187455", "0.64060426", "0.6366195", "0.631605", "0.6231962", "0.62179965", "0.608996", "0.5993996", "0.59798205", "0.5916025", "0.58860064", "0.5876743", "0.5866046", "0.58414435", "0.5829963", "0.5817878", "0.580323", "0.57795715", "0.57793796", "0.57610077...
0.80456704
0
Get the filter type.
def getFilter(self): return self.filter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self,\n filefilter: str) -> Tuple[str, str]:\n\n return self.types[self.filters.index(filefilter)]", "def getFilter(self, type: int) -> int:\n ...", "def event_type(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['FilterEventTypeItem']]]]:\n return pulumi....
[ "0.79032725", "0.7408463", "0.71033245", "0.6734105", "0.65543044", "0.6519243", "0.6412073", "0.6349868", "0.6349868", "0.6337962", "0.633497", "0.63286203", "0.62999064", "0.62895477", "0.6281994", "0.62812275", "0.62766963", "0.6266968", "0.61978245", "0.61978245", "0.6186...
0.69181424
3
Get the boundary of magnitude under the current filter type.
def getMagBoundary(self): # Get the boundary of magnitude based on the filter lowMagnitude = nan highMagnitude = nan if (self.filter == self.FilterU): lowMagnitude = 7.94 highMagnitude = 14.80 elif (self.filter == self.FilterG): lowMagnitude ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(self):\n return sqrt(self & self)", "def getMagFlux(self):\n return self.magflux", "def boundary(self):\n return self._boundary", "def boundary(self):\n\n\t\tif not hasattr(self,\"_hessian_boundary\"):\n\t\t\tself.maskBoundaries()\n\n\t\treturn self._hessian_boundary", "d...
[ "0.64608544", "0.6194449", "0.61099595", "0.60122204", "0.5938468", "0.5933466", "0.58856344", "0.5867662", "0.5858901", "0.5820216", "0.5798565", "0.5758791", "0.5734439", "0.572457", "0.57144994", "0.5709058", "0.56948704", "0.56791246", "0.56791246", "0.5657116", "0.564364...
0.8350745
0
All the logic to move, and the game logic goes here. Normally, you'll call update() on the sprite lists that need it.
def update(self, delta_time): self.explosions_list.update() if self.countdown > 101: self.countdown = self.countdown -1 print(len(self.ball_list)) for ball in self.ball_list: ball.x = ball.x + ball.dx ball.y = ball.y + ball.dy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_logic(self):\n if not self.game_over:\n # Move all the sprites\n self.all_sprites_list.update()", "def update(self):\n self.moving_sprites.update() \n self.static_sprites.update()\n self.camera.update(self.player)", "def update(self):\r\n if self...
[ "0.81334394", "0.7563454", "0.7412635", "0.7385562", "0.7198482", "0.71573585", "0.7144947", "0.7115579", "0.70487356", "0.7024642", "0.6959462", "0.6952431", "0.6950409", "0.68809843", "0.673952", "0.67373407", "0.6732356", "0.6701463", "0.6694559", "0.6693119", "0.6690788",...
0.0
-1
Model with only a dense layer to evaluate the different embeddings
def build_model(embedding_path="None", model_type="default", nb_classes=18, maxlen=100, vocab_size=100000): seed(0) set_random_seed(0) if embedding_path != "None": embedding = GetEmbedding(embedding_path=embedding_path) model = Sequential() if embedding_path == "None": model.add(Emb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n\n input_layer = Input(\n shape=(self.input_length,), \n dtype='int32', \n name='input'\n )\n\n if self.embedding_matrix is None:\n embedding = Embedding(\n output_dim=self.embedding_size,\n ...
[ "0.722294", "0.7194703", "0.714891", "0.7148304", "0.7055958", "0.6983941", "0.69585645", "0.6930824", "0.69198096", "0.6888874", "0.68449", "0.68420976", "0.68226284", "0.6785886", "0.6682099", "0.66688156", "0.6665962", "0.66652775", "0.66593367", "0.66578126", "0.6648026",...
0.0
-1
Returns whether the suffix/ character at index i is a leftmost Stype
def is_lms(i, t): return t[i] == S_TYPE and t[i - 1] == L_TYPE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasSuffix(self, s):\n node, off = self.followPath(s)\n if node is None:\n return False # fell off the tree\n if off is None:\n # finished on top of a node\n return '$' in node.out\n else:\n # finished at offset 'off' within an edge leading...
[ "0.5515776", "0.5472415", "0.5388456", "0.53278637", "0.52836365", "0.52449006", "0.52246815", "0.5214051", "0.52047104", "0.5159498", "0.5157829", "0.5084014", "0.50627506", "0.5054812", "0.50469124", "0.50406426", "0.5028765", "0.50171703", "0.49872115", "0.49785116", "0.49...
0.5681686
0
Finds the positions of all lms_suffixes
def find_lms_suffixes(t, n): pos = array("l") for i in range(n): if t[i] == S_TYPE and t[i - 1] == L_TYPE: pos.append(i) return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_suffixes(self):\n\n ans = self.short_sf.get_suffixes()\n\n self.assertEqual(ans, [(0, 0), (1, 1), (0, 1), (0, 2), (1, 0), (1, 2)])", "def test_get_suffixes_random(self):\n\n ans = self.random_sf.get_suffixes()\n\n # check there are the right number of suffixes\n ex...
[ "0.72249657", "0.6794337", "0.6647936", "0.6337083", "0.61419636", "0.60550034", "0.5958417", "0.58112794", "0.57781327", "0.56907856", "0.5635941", "0.5580855", "0.54999554", "0.5482387", "0.54709697", "0.5468816", "0.54662097", "0.53341466", "0.53061426", "0.52247465", "0.5...
0.75250655
0
Initialises a new 'AssetModel' instance.
def __init__(self, AssetInfo=None, ErpInventoryCounts=None, *args, **kw_args): self._AssetInfo = None self.AssetInfo = AssetInfo self._ErpInventoryCounts = [] self.ErpInventoryCounts = [] if ErpInventoryCounts is None else ErpInventoryCounts super(AssetModel, self).__init__(*ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n type_name: pulumi.Input['AssetModelTypeName'],\n attribute: Optional[pulumi.Input['AssetModelAttributeArgs']] = None,\n metric: Optional[pulumi.Input['AssetModelMetricArgs']] = None,\n transform: Optional[pulumi.Input['Asse...
[ "0.6740592", "0.6569173", "0.6345981", "0.63226545", "0.6281654", "0.62780106", "0.62679225", "0.62566185", "0.62411904", "0.61997217", "0.6188741", "0.61804986", "0.6174497", "0.6137742", "0.6137742", "0.6137742", "0.6137742", "0.6132694", "0.6094634", "0.60822076", "0.60612...
0.6673079
1
Get train and test online environment dataloaders for the given params
def get_online_dataloaders(params): # Pick environment env = EnvFactory.get_environment(**params["environment"]) # Train trainDS = EnvironmentSampler( environment=env, dataset_len=params["dataset"]["num_train_samples"], number_of_frames=params["dataset"]["rollout"]["seq_length"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_offline_dataloaders(params):\n # Train\n trainDS = EnvironmentLoader(params[\"dataset\"][\"train_data\"])\n train_data_loader = torch.utils.data.DataLoader(\n trainDS, shuffle=True, batch_size=params[\"optimization\"][\"batch_size\"])\n\n # Test\n test_DS = EnvironmentLoader(params[\"...
[ "0.8129935", "0.70242244", "0.6894393", "0.68715394", "0.6855566", "0.6817197", "0.67631644", "0.6762964", "0.6752037", "0.65683234", "0.65544677", "0.65463495", "0.65087974", "0.64979017", "0.6430376", "0.64121747", "0.64121747", "0.64121747", "0.64121747", "0.64121747", "0....
0.8401608
0
Get train and test online environment dataloaders for the given params
def get_offline_dataloaders(params): # Train trainDS = EnvironmentLoader(params["dataset"]["train_data"]) train_data_loader = torch.utils.data.DataLoader( trainDS, shuffle=True, batch_size=params["optimization"]["batch_size"]) # Test test_DS = EnvironmentLoader(params["dataset"]["test_data"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_online_dataloaders(params):\n # Pick environment\n env = EnvFactory.get_environment(**params[\"environment\"])\n\n # Train\n trainDS = EnvironmentSampler(\n environment=env,\n dataset_len=params[\"dataset\"][\"num_train_samples\"],\n number_of_frames=params[\"dataset\"][\"r...
[ "0.8401118", "0.70235455", "0.6893315", "0.686973", "0.6854565", "0.6815096", "0.6761742", "0.6760609", "0.67499745", "0.6566577", "0.65532", "0.6544684", "0.6507047", "0.6495713", "0.64295375", "0.64101946", "0.64101946", "0.64101946", "0.64101946", "0.64101946", "0.64101946...
0.81288964
1
Loads the documents used to train an encoder, either from disk or from memory (if already loaded).
def _get_docs(self, encoder, path): # Check if already loaded if path in self._encoder_docs: self._logger.debug("Loading documents from cache: " + path) return self._encoder_docs[path] else: self._logger.debug("Loading documents from disk: " + path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all(self):\n if os.path.isfile(self.vocab_path):\n self.vocab_processor = self.load_vocab()\n else:\n self.vocab_processor = self.train_vocab()\n if self.data_path:\n self.x, self.y = self.load_data(self.need_shuffle)\n print(\"Max document leng...
[ "0.7484016", "0.66754264", "0.6650122", "0.65432966", "0.6527745", "0.65002805", "0.6311801", "0.6221456", "0.6166345", "0.6144936", "0.6127881", "0.6120437", "0.6078949", "0.6042302", "0.6028145", "0.5994733", "0.59868973", "0.5975017", "0.59618336", "0.5949019", "0.59327626...
0.65124655
5
Asserts that all playback frames have a valid move id
def _test_for_valid_move_ids(self): playback_frames = self.program.simulation_result.playback_frames max_move_id = len(self.program.steps) for index, pb_frame in enumerate(playback_frames): msg = f"Frame {index} has invalid move id {pb_frame.move_id}. Move id must be between 1 and {m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_for_missing_move_ids(self):\n move_id = 0\n for s in self.program.steps:\n move_id += 1\n self.assertNotEqual(len(s.playback_frames), 0,\n f\"Step {s.name} has no playbackFrames. Move Id {move_id} is missing\")", "def _test_for_playback...
[ "0.79082274", "0.6655439", "0.6448554", "0.61946905", "0.617997", "0.6144759", "0.6050009", "0.60432184", "0.59868485", "0.59771174", "0.59502435", "0.5923309", "0.5894237", "0.58796144", "0.58442533", "0.58434385", "0.5746185", "0.57271564", "0.57242477", "0.57230914", "0.57...
0.85081476
0
converts TSA to 4digit string for lookup in a CSV table
def fourDigitTSA(pathrow): pathrow6 = sixDigitTSA(pathrow) pathrow4 = pathrow6[1:3] + pathrow6[4:] return pathrow4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sixDigitTSA(pathrow):\r\n # pass pathrow, first coerce to string if not already\r\n if type(pathrow) != str: pathrow = str(pathrow)\r\n # check length, and make TSA six digit\r\n # e.g. for 4529, --> 045029\r\n pathrow = pathrow.strip()\r\n if len(pathrow) < 4:\r\n sys.exit(\"Enter TSA...
[ "0.68188435", "0.5983041", "0.54606766", "0.54258645", "0.5421599", "0.53421855", "0.53256106", "0.53180027", "0.52802855", "0.52759165", "0.5239025", "0.5234493", "0.52235603", "0.52103114", "0.5185288", "0.51835394", "0.51824486", "0.51794976", "0.5172968", "0.514658", "0.5...
0.69214207
0
returns a list of all nonhidden files in a given directory
def read_dir(directory, hidden_files_prefixes): files = os.listdir(directory) files.sort(reverse=True) files = [x for x in files if not x.startswith(hidden_files_prefixes)] return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listdir_nohidden(path):\n\treturn glob.glob(os.path.join(path, '*'))", "def _files_without_hidden(path):\n return [name for name in os.listdir(path) if not name.startswith('.')]", "def list_dir_no_hidden(path):\n\n return glob(os.path.join(path, \"*\"))", "def mylistdir(directory):\n filelist = ...
[ "0.8347654", "0.8328161", "0.8201243", "0.7161072", "0.7161072", "0.7161072", "0.7161072", "0.68601865", "0.6836751", "0.6798408", "0.67915094", "0.65953726", "0.658303", "0.6581735", "0.65731114", "0.65152586", "0.64749", "0.64631164", "0.6457509", "0.64544386", "0.6437079",...
0.723067
3
Checks whether or not the given user or her groups has the given permission for the given object.
def has_perm(self, user_obj, perm, obj=None): # Ignore check without obj. if obj is None: return False # Ignore if user is not authenticated . if not user_obj.is_authenticated(): return False # Resolve permission. try: perm = 'can_%s'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_object_permission(self, request, view, obj):\n is_grupo_usuario_admin = request.user.grupo.name == \"Administrador\"\n is_grupo_obj_superuser = (obj.grupo.name == \"SuperUsuario\" or\n obj.grupo.name == \"Administrador\")\n if is_grupo_usuario_admin and...
[ "0.77086645", "0.75715464", "0.7551632", "0.74548435", "0.74548435", "0.742661", "0.7400372", "0.7373459", "0.735643", "0.7352607", "0.7316124", "0.7290384", "0.728106", "0.7264221", "0.7258825", "0.72262746", "0.7222477", "0.72155863", "0.72103685", "0.7197588", "0.71920514"...
0.7838363
0
Conver the lists to numpy arrays.
def convert_from_list_to_numpy(data_as_list): if len(data_as_list['points']) == 0: return {'points': None, 'evaluations': None, 'var_noise': None} data = {} n_points = len(data_as_list['points']) dim_point = len(data_as_list['points'][0]) points = np.zeros((n_point...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.ndarray]:\n assert a is not None, \"Empty result cannot be converted to numpy\"\n return [x.numpy() for x in a]", "def _listOfImagesToNumpy(self, images):\n # build image data array, y_labels\n for i in range(0, len(images)):\n ...
[ "0.7544344", "0.6927558", "0.6877729", "0.6841456", "0.68395084", "0.66200143", "0.65280706", "0.65140414", "0.6422324", "0.6362602", "0.63436204", "0.6281312", "0.62410855", "0.62399143", "0.6200664", "0.61919755", "0.6104107", "0.6103991", "0.6037161", "0.6029629", "0.60129...
0.6136823
16
Conver the numpy arrays to lists.
def convert_from_numpy_to_list(data_as_np): evaluations = list(data_as_np['evaluations']) if data_as_np['var_noise'] is not None: var_noise = list(data_as_np['var_noise']) else: var_noise = [] n_points = len(evaluations) points = [list(data_as_np['points...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array2list(input_array):\r\n return [element for element in input_array]", "def _tolist(ndarray):\n elem_list = []\n for sub_elem in ndarray:\n if isinstance(sub_elem, sio.matlab.mio5_params.mat_struct):\n elem_list.append(_todict(sub_elem))\n ...
[ "0.73682904", "0.7337199", "0.73018867", "0.70192665", "0.6939759", "0.6898504", "0.6787571", "0.6594566", "0.65127116", "0.6503407", "0.6486051", "0.64760566", "0.64542955", "0.64464897", "0.632249", "0.6313819", "0.63110757", "0.6285415", "0.62850916", "0.6277751", "0.62700...
0.6645779
7
sanitize a string for comparison. fix universal newlines, strip trailing newlines, and normalize likely random values (memory addresses and UUIDs)
def sanitize(self, s): if not isinstance(s, six.string_types): return s """ re.sub matches a regex and replaces it with another. The regex replacements are taken from a file if the option is passed when py.test is called. Otherwise, the strings are not proces...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_string(raw_string):\n if raw_string == None:\n return\n\n clean_string = raw_string.strip('\\n')\n clean_string = ' '.join(clean_string.split())\n return clean_string", "def sanitise(s, max_len=MAX_STRING_LENGTH):\n result = ''\n if len(s) > max_len:\n s = s[0: max_len /...
[ "0.69142085", "0.65796363", "0.64233685", "0.63520724", "0.6300958", "0.62753654", "0.62342876", "0.6224075", "0.62016493", "0.6117629", "0.608495", "0.60761774", "0.60543936", "0.6035738", "0.6033869", "0.59931934", "0.59805113", "0.59787613", "0.5975113", "0.59670264", "0.5...
0.57245743
78
Compute the induced velocity from a vortex ring of radius r0, located at z0,
def ring_u_polar(r,z,Gamma=-1,r0=1,z0=0,epsilon=0, reg_method='Saffman'): def ring_u_polar_singular(r,z,Gamma=-1,r0=1): # Formulation from Yoon 2004 a = np.sqrt((r+r0)**2 + (z)**2) m = 4 * r * r0 / (a ** 2) A = (z)**2 + r**2 + r0**2 B = - 2*r*r0 I1 = 4.0 / a * ell...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vel(z, c = cp.cc.c_light_cm_s/1e5):\n # return z*c/(1+z)\n return c*((1+z)**2-1)/((1+z)**2+1)", "def rv_from_r0v0(mu, R0, V0, t):\n #...Magnitudes of R0 and V0:\n r0 = norm(R0)\n v0 = norm(V0)\n #...Initial radial velocity:\n vr0 = np.dot(R0, V0)/r0\n #...Reciprocal of the semimajor a...
[ "0.69115067", "0.62729424", "0.6116766", "0.6108478", "0.6061912", "0.6059802", "0.60324866", "0.59655434", "0.58819264", "0.5875945", "0.5872899", "0.5858533", "0.58429354", "0.5804715", "0.5785914", "0.5760519", "0.5758119", "0.5734086", "0.57088566", "0.5705639", "0.569979...
0.58222115
13
Tests if the local version is not the dev one.
def test_is_not_local_dev_from_presence(self): expected = False actual = Version.is_local_dev() self.assertEqual(expected, actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_not_local_dev(self):\n\n expected = False\n actual = Version.is_local_dev()\n\n self.assertEqual(expected, actual)", "def test_is_local_dev(self):\n\n expected = True\n actual = Version.is_local_dev()\n\n self.assertEqual(expected, actual)", "def is_dev(ver...
[ "0.8591115", "0.83058125", "0.7462762", "0.69628954", "0.6770029", "0.6749504", "0.6724103", "0.6711387", "0.6704639", "0.66722286", "0.662955", "0.6587835", "0.6305156", "0.6221846", "0.61973006", "0.6160562", "0.6137554", "0.61099607", "0.6076193", "0.60631394", "0.60483307...
0.84267443
1
Tests if the local version is the not the dev one.
def test_is_not_local_dev(self): expected = False actual = Version.is_local_dev() self.assertEqual(expected, actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_local_dev(self):\n\n expected = True\n actual = Version.is_local_dev()\n\n self.assertEqual(expected, actual)", "def test_is_not_local_dev_from_presence(self):\n\n expected = False\n actual = Version.is_local_dev()\n\n self.assertEqual(expected, actual)", "...
[ "0.8396262", "0.83533067", "0.73645437", "0.7018722", "0.6913196", "0.6863444", "0.68535614", "0.6809757", "0.6784189", "0.6754467", "0.6728141", "0.64851063", "0.63094544", "0.62476826", "0.61977434", "0.6132021", "0.6119249", "0.611421", "0.611007", "0.61076903", "0.6094860...
0.8503368
0
Converts path to default form (with no slash at the end)
def default_path(path): while path[len(path) - 1] == '/' or path[len(path) - 1] == '\\': path = path[0:-1] return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizePath(path):\n if path == None or len(path) == 0 or path == '/':\n return '/'\n buff = '/' + path if path[0] != '/' else path\n return buff.replace('//', '/')", "def standardize_path(path):\n path.rstrip('/')\n if not path.startswith('.*'):\n path = '/' + ...
[ "0.7469715", "0.7436723", "0.72492105", "0.7059338", "0.7040359", "0.69737846", "0.690945", "0.6889803", "0.68541396", "0.6836067", "0.6795662", "0.6763439", "0.6721073", "0.6710526", "0.66923636", "0.6668612", "0.6655637", "0.6604171", "0.6594724", "0.6589893", "0.65788436",...
0.82352024
0
Creates an ISO 8601 string.
def date_str(year, month, day, hour=0, minute=0, second=0., microsecond=None): # Get microsecond if not provided if microsecond is None: if type(second) is float: microsecond = int((second - int(second)) * 1000000) else: microsecond = 0 # Convert types y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ISO8601(self):\n if self.timezoneNaive():\n return \"%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d\" % (\n self._year, self._month, self._day,\n self._hour, self._minute, self._second)\n tzoffset = _tzoffset2iso8601zone(_tzoffset(self._tz, self._t))\n return ...
[ "0.738748", "0.72034556", "0.71179396", "0.7015039", "0.6997366", "0.6990952", "0.6917153", "0.6874146", "0.6845186", "0.6825397", "0.6772207", "0.6724812", "0.6707795", "0.66871846", "0.66497374", "0.66053146", "0.6589852", "0.65883666", "0.65788174", "0.6572596", "0.6545017...
0.5632527
62
returns the raw trace of all data samples from this channel
def getTrace(self): trace = np.array([]) for block in self.parent.data_block_list: trace = np.append(trace, block.getTrace(self.signal_type, self.native_channel_name)) return trace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw(self) -> Optional[List[Trace]]:\n if self._raw_traces is None:\n return None\n return list(self._raw_traces)", "def traces(self):\n return self._traces[:]", "def sample(self):\n logger.info(\"%s: collect sensor data\", self.__class__.__name__)\n samples = [...
[ "0.6194536", "0.6104066", "0.601251", "0.60050976", "0.59835947", "0.596181", "0.59003425", "0.58792394", "0.582978", "0.58041245", "0.57996124", "0.5799008", "0.57725286", "0.57570016", "0.57159644", "0.56948435", "0.5689759", "0.56889516", "0.5684811", "0.56712675", "0.5661...
0.7301673
0
Set the value of the AccountNumber input for this Choreo. ((required, string) Your FedEx Account Number or Test Account Number.)
def set_AccountNumber(self, value): super(AddressValidationInputSet, self)._set_input('AccountNumber', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_number(self, account_number):\n\n self._account_number = account_number", "def funding_account_account_number(self, funding_account_account_number):\n\n self._funding_account_account_number = funding_account_account_number", "def set_account(self, account: str):\n ret = self._c...
[ "0.7494862", "0.6722283", "0.6383567", "0.6026619", "0.590429", "0.58957136", "0.58165157", "0.58165157", "0.5808072", "0.5711511", "0.5711511", "0.5711511", "0.5711511", "0.5711511", "0.5711511", "0.56486756", "0.56336063", "0.562059", "0.56119835", "0.56119835", "0.5572887"...
0.69677097
1
Set the value of the AuthenticationKey input for this Choreo. ((required, string) The Production Authentication Key or Development Test Key provided by FedEx Web Services.)
def set_AuthenticationKey(self, value): super(AddressValidationInputSet, self)._set_input('AuthenticationKey', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_key_set(self, api_key):\n self.request('/v1.1/auth_key', 'POST', body={'auth_key': api_key})", "def SetCredentials(self,\n api_key,\n ):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._analyzer.SetAPIKey(api_key)", "def a...
[ "0.62885904", "0.5474165", "0.5467669", "0.54638636", "0.545296", "0.52624184", "0.52489454", "0.51922363", "0.5185063", "0.518501", "0.51752347", "0.51752347", "0.51593846", "0.51539326", "0.5080486", "0.49515927", "0.4898207", "0.48373514", "0.48373514", "0.4770954", "0.474...
0.60825783
1
Set the value of the ClientReferenceID input for this Choreo. ((optional, string) A reference id provided by the client.)
def set_ClientReferenceID(self, value): super(AddressValidationInputSet, self)._set_input('ClientReferenceID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_reference_id(self, reference_id):\n self.reference_id = reference_id", "def reference_id(self, reference_id):\n\n self._reference_id = reference_id", "def client_id(self, client_id):\n if client_id is None:\n raise ValueError(\"Invalid value for `client_id`, must not be ...
[ "0.70510787", "0.6592393", "0.572961", "0.572961", "0.56450987", "0.5561925", "0.5542874", "0.5542874", "0.5542874", "0.5542874", "0.5368134", "0.51531297", "0.5126917", "0.50657153", "0.50643486", "0.49677926", "0.49553916", "0.4943203", "0.4943203", "0.4927404", "0.4909367"...
0.64276165
2
Set the value of the CompanyName input for this Choreo. ((optional, string) Identifies the company associated with the location.)
def set_CompanyName(self, value): super(AddressValidationInputSet, self)._set_input('CompanyName', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company_name(self, company_name):\n\n self._company_name = company_name", "def company(self, company):\n self._company = company", "def company(self, company):\n\n self._company = company", "def company(self, company):\n\n self._company = company", "def company_name(self) ->...
[ "0.79050255", "0.58283", "0.5811604", "0.5811604", "0.58108425", "0.58091545", "0.5644894", "0.5644032", "0.5541695", "0.5541695", "0.5301297", "0.5249057", "0.5198234", "0.51773447", "0.5177334", "0.51638454", "0.5083943", "0.50245047", "0.49730775", "0.48760468", "0.4876046...
0.69791114
1
Set the value of the MeterNumber input for this Choreo. ((required, string) The Production or Test Meter Number provided by FedEx Web Services.)
def set_MeterNumber(self, value): super(AddressValidationInputSet, self)._set_input('MeterNumber', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_value(self, number_value):\n\n self._number_value = number_value", "def set_number(self, number):\n self.number = number", "def setNumber(self, number):\n prevNumber = self.number\n self.number = number\n return prevNumber", "def number(self, value: float):\n ...
[ "0.5600567", "0.55819005", "0.541286", "0.52719426", "0.5212014", "0.5043343", "0.5043343", "0.49407005", "0.47774115", "0.47391132", "0.461555", "0.46114314", "0.4509081", "0.44401604", "0.44103974", "0.4402093", "0.43929273", "0.43421808", "0.43366542", "0.4331988", "0.4331...
0.72092104
0
Set the value of the Password input for this Choreo. ((required, password) The Production or Test Password provided by FedEx Web Services.)
def set_Password(self, value): super(AddressValidationInputSet, self)._set_input('Password', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_password(self, password):\n self.password = password", "def set_password(self, password):\n self.PASSWORD = password", "def set_password(self, password):\n self.PASS = password", "def password(self, password: str):\n\n self._password = password", "def set_password(self, ...
[ "0.7638883", "0.76062834", "0.754238", "0.7481274", "0.747636", "0.7438323", "0.7438323", "0.7438323", "0.7438323", "0.7434047", "0.73978597", "0.7390608", "0.7290692", "0.72720623", "0.7238837", "0.7213231", "0.71962816", "0.71838737", "0.71708965", "0.71708965", "0.71588594...
0.6509622
41
Set the value of the PostalCode input for this Choreo. ((conditional, string) The postal code associated with the address being validated.)
def set_PostalCode(self, value): super(AddressValidationInputSet, self)._set_input('PostalCode', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postal_code(self, postal_code):\n\n self._postal_code = postal_code", "def postal_code(self, postal_code):\n\n self._postal_code = postal_code", "def postal_code(self, postal_code):\n\n self._postal_code = postal_code", "def postcode(self, postcode):\n\n self._postcode = postc...
[ "0.7558557", "0.7558557", "0.7558557", "0.6944466", "0.6944466", "0.6944466", "0.6909446", "0.67534596", "0.67515236", "0.64641523", "0.64641523", "0.64641523", "0.6186219", "0.6186219", "0.6071813", "0.606421", "0.6056432", "0.5955608", "0.5908946", "0.59030753", "0.5898676"...
0.74232686
3
Retrieve the value for the "Response" output from this Choreo execution. (The response from FedEx.)
def get_Response(self): return self._output.get('Response', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response_variable(self):\n\n return self._response_variable", "def response(self):\n return self._response", "def get_response(self):\n result = self.get_response_impl()\n if self.log_dest is not None:\n is_error, response = result\n if is_error:\n ...
[ "0.70524627", "0.70520693", "0.6914014", "0.6886181", "0.6611647", "0.6568172", "0.6562059", "0.6537524", "0.6537524", "0.647294", "0.63551396", "0.6274281", "0.62555087", "0.6240821", "0.6235893", "0.62195116", "0.61403584", "0.611055", "0.60943425", "0.6079117", "0.6048903"...
0.8529691
7
Compute logistic sigmoid activation
def activation(self,z): #using the clipping function as there is no need for it because the values larger or smaller would be very close to zero return 1./(1. + np.exp(-np.clip(z,-250,250)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 +...
[ "0.838003", "0.819735", "0.819735", "0.81502354", "0.8134324", "0.8134324", "0.8134324", "0.8134324", "0.8134324", "0.8134324", "0.812058", "0.8110861", "0.8107186", "0.8099222", "0.8098866", "0.80923676", "0.80923676", "0.8088351", "0.80804044", "0.8072143", "0.80694366", ...
0.0
-1
Calculate y trajectory. No force independent of position. Periodic boundary at y = =/ ymax and reflecting at y = 0.0.
def calculate_y(y0,ey,ymax,PBC=True): y = y0 + dt*np.cumsum(ey) while (y>ymax).any() or (y<0.0).any(): idg = (y>ymax) y[idg] = 2*ymax - y[idg] if PBC else ymax idl = (y<0.0) y[idl] *= -1.0 return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ystep(self):\n\n # Update t step\n tprv = self.t\n self.t = self.momentum.update(self.var_momentum())\n\n # Update Y\n if self.opt['Monotone'] and self.k > 0:\n self.Y = self.X + (tprv / self.t) * (self.ZZ - self.X) \\\n + ((tprv - 1.) / self.t) * (s...
[ "0.69759566", "0.68533254", "0.6196896", "0.6166748", "0.6121747", "0.6081692", "0.60493684", "0.60484165", "0.59897673", "0.5972642", "0.59229565", "0.58808905", "0.5869655", "0.5858238", "0.5835728", "0.58274454", "0.5813127", "0.5811749", "0.5773907", "0.57695234", "0.5748...
0.7356498
0
Establish connection to Husqvarna Automower API.
def setup(hass, base_config): from pyhusmow import API as HUSMOW_API config = base_config.get(DOMAIN) if hass.data.get(DOMAIN) is None: hass.data[DOMAIN] = { 'devices': [] } api = HUSMOW_API() api.login(config.get(CONF_USERNAME), config.get(CONF_PASSWORD)) robots = api.list_robots() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n config.base_url = self.get_config('host')\n config.client_connection_attempts = 1\n config.assume_untrusted = False\n if self.get_config('insecure'):\n config.assume_untrusted = True\n\n config.credentials = utils.PseudoNamespace({\n 'de...
[ "0.66095656", "0.6298784", "0.62699634", "0.6076178", "0.5990469", "0.5970808", "0.57315", "0.5700846", "0.5609827", "0.5571661", "0.5540257", "0.55332017", "0.55294824", "0.5529294", "0.5525096", "0.5515013", "0.5499911", "0.54889244", "0.5478855", "0.54767376", "0.54600114"...
0.5161584
57
Return the id of the Automower.
def id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self) -> str:\n return pulumi.get(self, \"id\")", "def id(self) -> str:\n return pulumi.get(self, \"id\")", "def id(self) -> str:\n return pulumi.get(self, \"id\")", "def id(self) -> str:\n return pulumi.get(self, \"id\")", "def id(self) -> str:\n return pulumi.get...
[ "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "0.7126547", "...
0.0
-1
Return the state attributes of the automower.
def device_state_attributes(self): attributes = dict(self._state) # Parse timestamps for key in ['lastErrorCodeTimestamp', 'nextStartTimestamp', 'storedTimestamp']: if key in attributes: if isinstance(attributes[key], int): # Sometimes(tm), Husqva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def state_attributes(self):\n return self._wan", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return...
[ "0.7811739", "0.770392", "0.76935124", "0.76935124", "0.76499206", "0.76357394", "0.76357394", "0.7547552", "0.7512806", "0.7512612", "0.74631464", "0.74444985", "0.74444985", "0.74323195", "0.74300134", "0.74300134", "0.74300134", "0.74300134", "0.74300134", "0.74300134", "0...
0.0
-1
Return a list of dictionaries of all model inputs and outputs.
def to_dicts(self): dicts = [] for idx, session in enumerate(self): d = session.to_dict() d.update(dataset_index=idx) dicts.append(d) return dicts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self) -> List[Dict[str, Any]]:\n return [x.to_dict() for x in self.inputs]", "def _get_model_params(self) -> T.List[np.ndarray]:\n layers = {\n layer.name: numpy_helper.to_array(layer)\n for layer in self.onnx_model.graph.initializer\n }\n\n param_nam...
[ "0.6992733", "0.67019933", "0.6663397", "0.6651758", "0.65298784", "0.6523861", "0.6474659", "0.6449568", "0.6435706", "0.64217675", "0.64214563", "0.64214563", "0.64214563", "0.6394131", "0.6378737", "0.6372464", "0.6372464", "0.6372464", "0.6347249", "0.6332133", "0.6282717...
0.0
-1
Return a pandas DataFrame for each model and dataset.
def to_df(self, recommended_only=False, include_io=True): od = exports.df_ordered_dict(include_io) [session._add_to_to_ordered_dict(od, i, recommended_only) for i, session in enumerate(self)] return pd.DataFrame(od)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataset(self):\n # Read raw data\n data = self.read_raw_data()\n self.default_header = list(data.columns.values)\n # Fit the variables on the raw dataset\n self.fit(data.copy())\n return make_df(data, self.features), make_df(data, self.targets)", "def get_model_...
[ "0.668858", "0.6455939", "0.64197564", "0.62756926", "0.62423587", "0.6232934", "0.6215379", "0.6152462", "0.6133652", "0.6042723", "0.6042243", "0.60094357", "0.60093355", "0.60010195", "0.6001015", "0.59704983", "0.5959645", "0.595393", "0.5941078", "0.5929311", "0.5920693"...
0.0
-1
Return a CSV for each model and dataset.
def to_csv(self, filename, delimiter=",", recommended_only=False, include_io=True): df = self.to_df(recommended_only, include_io) df.to_csv(filename, index=False, sep=delimiter)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_csv(self):\n\n self.model_df.to_csv(self.model_output_file)", "def generate_dataset_csv(request):\n\n response = csv_export(request,Dataset)\n return response", "def _write_csv(self):\n\n # add the label to the header\n if self.input_data.get_value(InputType.TIME_PER...
[ "0.691726", "0.6896964", "0.6132257", "0.6119019", "0.6102318", "0.60807824", "0.6056371", "0.6046314", "0.60319996", "0.60079306", "0.5994343", "0.5994339", "0.59362835", "0.59146726", "0.586477", "0.58498687", "0.58485276", "0.5847168", "0.58147264", "0.579787", "0.5784347"...
0.0
-1
Function creating a list of Country object
def create_countries(name_countries,origin='united kingdom',beta=0.2,gamma=0.1,I0=10,Horizon=horizon): countries = [] for country in name_countries: if country == origin: c = Country(name=country,N=df_countries['population'].loc[country],beta=beta,gamma=gamma,I0=I0,H=Horizon) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_list(cls):\n return jsonify(result=[\n {'key': c.id, 'value': c.name}\n for c in current_website.countries\n ])", "def countries_from_iso_list(countriesset):\n countries = list()\n for countryiso in sorted(list(countriesset)):\n if countryiso == WORLD:...
[ "0.72143734", "0.6891215", "0.67718303", "0.6683834", "0.6680371", "0.66659725", "0.64770865", "0.64471436", "0.6440009", "0.6371902", "0.63350695", "0.6317598", "0.6309646", "0.62344265", "0.6177495", "0.6133362", "0.6079091", "0.6025811", "0.6016951", "0.60031694", "0.59860...
0.7433951
0
Return the string representation of this ResourceCounter.
def __str__(self): return str(self._num_rotations)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.counter)", "def __str__(self):\n\n return str(self.__resource);", "def resource(self):\n return str(self._resource)", "def counterToString(self, counter):\n l = [0] * self.nObjectTypes\n for i, c in counter.items():\n l[i] = c...
[ "0.75005877", "0.71447617", "0.69445306", "0.69348043", "0.68757695", "0.669743", "0.66880697", "0.6676654", "0.6648977", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", "0.65759945", ...
0.0
-1
Half studentT base distribution. A HalfStudentT is the absolute value of a StudentT.
def _base_dist(self, *args, **kwargs): return tfd.TransformedDistribution( distribution=tfd.StudentT(*args, **kwargs), bijector=tfp.bijectors.AbsoluteValue(), name="HalfStudentT", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def huber(t=1.345):\n return sm.robust.norms.HuberT(t)", "def divergence(self, t, s):\n left = np.mean(np.log(self.dists[(t, s)] / self.dists[(t, t)]))\n right = np.mean(np.log(self.dists[(s, t)] / self.dists[(s, s)]))\n return 0.5 * (left + right)", "def halton( index, base = 2 ):\r\n ...
[ "0.5822213", "0.5454788", "0.54282784", "0.53696555", "0.5353726", "0.52987075", "0.5287704", "0.5183978", "0.5175727", "0.5154686", "0.5153963", "0.5055174", "0.5047764", "0.50235087", "0.5017259", "0.5008962", "0.49884492", "0.4985667", "0.49653035", "0.4964098", "0.4938041...
0.7504949
0
Logit normal base distribution. A LogitNormal is the standard logistic (i.e. sigmoid) of a Normal.
def _base_dist(self, *args, **kwargs): return tfd.TransformedDistribution( distribution=tfd.Normal(*args, **kwargs), bijector=tfp.bijectors.Sigmoid(), name="LogitNormal", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _kl_logitnormal_logitnormal(a, b, name=None):\n return kullback_leibler.kl_divergence(\n a.distribution,\n b.distribution,\n name=(name or 'kl_logitnormal_logitnormal'))", "def stdProbabilityNorm(self):\n return 1./factorial(self.alpha-1)", "def lognormal(mu, hw, x): \n return np.e...
[ "0.6897505", "0.68737024", "0.68315256", "0.6728761", "0.67126894", "0.6696059", "0.669249", "0.66727036", "0.66015214", "0.65354604", "0.6503524", "0.6500882", "0.6496924", "0.6495575", "0.64632696", "0.64298636", "0.64223534", "0.64008516", "0.6382283", "0.6371518", "0.6369...
0.7204992
0
String representation of a user, for internal purposes.
def __str__(self): return f"{self._meta.verbose_name.title()} <{self.username}>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.user_id) + \": \" + \\\n str(self.user_name) + \": \" + str(self.user_email)", "def __str__(self):\n return str(self.user)", "def __str__(self):\n return str(self.user)", "def __str__(self):\n return str(self.user)", "def __str_...
[ "0.7885197", "0.78819275", "0.78819275", "0.78819275", "0.78819275", "0.78819275", "0.7844326", "0.7718378", "0.76201546", "0.7607364", "0.760583", "0.760583", "0.760583", "0.760583", "0.7542704", "0.752349", "0.74813193", "0.7460829", "0.7431479", "0.7385497", "0.7380902", ...
0.0
-1
Get a string showing a user's full name. Avoid doing random concatenation throughout the app and get a consistent name for our user.
def get_full_name(self): return f"{self.first_name} {self.last_name}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n full_name = '%s %s' % (self.user.first_name.strip(), self.user.last_name.strip())\n if len(full_name.strip()) == 0:\n full_name = self.user.username\n return full_name.strip()", "def get_user_name(self):\n full_name = f'{self.f_name} {self.l_name}...
[ "0.8706871", "0.86765844", "0.8668493", "0.8658107", "0.85461295", "0.8398248", "0.83136845", "0.82894355", "0.82799006", "0.8252934", "0.8220692", "0.8220692", "0.8197219", "0.8195103", "0.8178459", "0.8178459", "0.8176791", "0.81531554", "0.814468", "0.8141032", "0.81394994...
0.81144625
24
The path to the artifact's output data.
def output_dir(self): return os.path.join(self._sandbox, 'output' + os.path.sep)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_path(self):\r\n return '%s/%s' % (os.path.abspath(os.path.dirname(__file__) + 'outputs'),\r\n self.identifier)", "def output_path(self):\n return self._event.output_path", "def output_abspath(self):\n return os.path.join(self.queue.data_abspath, self.id)", ...
[ "0.8049666", "0.7996136", "0.78829163", "0.7689978", "0.7558554", "0.7530734", "0.7491344", "0.7432051", "0.738997", "0.7349866", "0.72963864", "0.7191997", "0.7151246", "0.71416366", "0.6991851", "0.69853747", "0.6890405", "0.6889659", "0.68765384", "0.686697", "0.686697", ...
0.65094537
46
Return a filtered queryset of approved exams.
def get_approved(self): return self.filter(verified=True, blacklisted=False, flags__lte=ExamFlag.LIMIT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approved_jobs(self):\n\n return Job.objects.filter(\n house=self.house,\n approved=True,\n )", "def get_queryset(self, request):\n qs = super().get_queryset(request)\n if not request.user.is_superuser and request.user.approved_organisations.exists():\n ...
[ "0.5975536", "0.59272766", "0.57324284", "0.5665981", "0.5613183", "0.5574131", "0.54571897", "0.5424945", "0.541518", "0.540266", "0.5370942", "0.5370942", "0.53670067", "0.53657037", "0.5352938", "0.53108144", "0.53029007", "0.5285532", "0.52773744", "0.5270182", "0.5266833...
0.7666953
0
Return the relative path of the exam file from inside the media root.
def get_relative_pathname(self): return os.path.join(Exam.EXAM_FILES_LOCATION, str(self.unique_id)[0:2], str(self.unique_id) + self.file_ext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_to_media_root(filepath, media_root=settings.MEDIA_ROOT):\n relative_path = os.path.relpath(filepath, media_root)\n return relative_path", "def media_path(self):\n return self._path", "def _get_path(): # THIS IS JUST FOR GETTING THE FILE\n return os.path.dirname(os.path.abspath(__f...
[ "0.7084054", "0.67861694", "0.6639991", "0.6554625", "0.654", "0.6504675", "0.6481501", "0.64682615", "0.64373404", "0.64343196", "0.64266986", "0.64078075", "0.6378572", "0.6372947", "0.63657284", "0.63565034", "0.63546705", "0.63388", "0.63195527", "0.6304031", "0.62831795"...
0.7195906
0
checks if data is a valid utf8
def validUTF8(data): for start_byte in data: ones = count_ones(start_byte) if ones in (1, 7, 8): return False for i in range(ones - 1): end_byte = data[i] if end_byte is None or end_byte >> 6 != 0b10: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_unicode(data, err=\"Input not valid unicode\"):\n try:\n if not isinstance(data, str) and not isinstance(data, str):\n raise UnicodeError(err)\n # In some cases we pass the above, but it's still inappropriate utf-8.\n str(data)\n except UnicodeError:\n rai...
[ "0.7506815", "0.741345", "0.7328074", "0.7017084", "0.6932292", "0.68139154", "0.6799195", "0.6747536", "0.6659043", "0.66026866", "0.65893435", "0.65627855", "0.64627725", "0.64623725", "0.64583963", "0.6328345", "0.6286717", "0.6241355", "0.6232374", "0.61827576", "0.616730...
0.79154724
0
This is the property getter function for the interval attribute.
def interval(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interval(self):\n return self.__interval", "def interval(self):\n return self._interval", "def interval(self):\n return self._interval", "def interval(self):\n return self._base_interval", "def interval(self) -> int:\n return pulumi.get(self, \"interval\")", "def in...
[ "0.84457177", "0.8375238", "0.8375238", "0.8083278", "0.7913586", "0.7866113", "0.77943707", "0.7606129", "0.75930816", "0.7489256", "0.7407826", "0.73319227", "0.7330711", "0.68145853", "0.68055433", "0.6750766", "0.65407836", "0.65367264", "0.65367264", "0.6510422", "0.6493...
0.79259795
4
This is the getter method of the interval. The interval is a numeric value, that states the amount of seconds supposed to be between the individual poll calls. The function checks if the keep_interval flag is still set and returns the ild value in case it is, but updates the internal attribute with the new value of the...
def interval(self): if self.keep_interval: return self._interval else: # Updating the interval and then returning the new value self._update_interval() # Setting the flag to keep the new interval until it is exceeded the next time self.keep_int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poll_interval(self):\n return self.opts.poll_interval", "def interval(self):\n return self._interval", "def interval(self):\n return self._interval", "def interval(self):\n return self.__interval", "def get_interval(self):\n return self.interval * 1000", "def _next_...
[ "0.7069184", "0.70124817", "0.70124817", "0.70109975", "0.69630235", "0.6715261", "0.66860104", "0.659472", "0.6480293", "0.64450896", "0.63610065", "0.62147546", "0.6206308", "0.6158649", "0.60910255", "0.60504186", "0.60322213", "0.6016508", "0.5938451", "0.5931195", "0.593...
0.7682498
0
Overriding the get_queryset method
def get_queryset(self, *args, **kwargs): return Product.objects.featured()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return None", "def get_queryset(self):\n return None", "def get_queryset(self, request, queryset):\n\n return queryset", "def get_queryset(self):\r\n return self.model.objects.all()", "def get_queryset(self) -> QuerySet:\n raise NotImplementedErr...
[ "0.834625", "0.834625", "0.82596415", "0.8062471", "0.8057827", "0.7953172", "0.78141594", "0.77389127", "0.74829775", "0.74411374", "0.74318916", "0.7347242", "0.732872", "0.7315388", "0.7300111", "0.7233902", "0.72322077", "0.7228018", "0.7203291", "0.71932507", "0.715636",...
0.0
-1
Returns the score of the game (int)
def get_score(self): return self._score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self) -> int:\n return self.rstate.score()", "def game_score(self):\n score = self.score.quantize(Decimal('0.001'))\n return score if score > 0 else 0", "def score(self) -> int:\n return self._score", "def score(self) -> int:\n return self.__state.score()", ...
[ "0.8099498", "0.8037411", "0.7876181", "0.77995104", "0.77651644", "0.77364767", "0.76647973", "0.76647973", "0.76647973", "0.7647928", "0.76014405", "0.75491035", "0.7536076", "0.74917895", "0.7486581", "0.74539965", "0.7451855", "0.7428595", "0.72968525", "0.7286702", "0.72...
0.7598435
12
Sets the direction .
def set_direct(self, direct): self._direct = direct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_direction(self, dir):\n if dir == 0:\n self.direction = [0, -1]\n elif dir == 1:\n self.direction = [1, 0]\n elif dir == 2:\n self.direction = [0, 1]\n elif dir == 3:\n self.direction = [-1, 0]", "def setDirection(self,stepDir = 2):\...
[ "0.8579024", "0.83851117", "0.83169", "0.80384606", "0.7990125", "0.7846229", "0.76734173", "0.750635", "0.748717", "0.7468697", "0.7468697", "0.743139", "0.73967785", "0.7391938", "0.7323124", "0.72788084", "0.72788084", "0.7265908", "0.7155536", "0.70482415", "0.70235556", ...
0.0
-1
Deletes the bolt in the list if it goes outside the game heights
def deleteBolts(self): a = self.get_bolts() for i in self.get_bolts(): if i.y>GAME_HEIGHT: a.remove(i) self.set_plyrbolts(0) elif i.y<=-BOLT_HEIGHT: a.remove(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _removeBolt(self):\n for bolt in self._bolts:\n if (bolt.y-BOLT_HEIGHT/2)>GAME_HEIGHT:\n self._bolts.remove(bolt)\n self._key = False\n elif bolt.y + BOLT_HEIGHT < 0:\n self._bolts.remove(bolt)", "def drop(self):\n if (pyxel.fra...
[ "0.77061796", "0.63262725", "0.6138227", "0.6107835", "0.60689366", "0.5936481", "0.5934939", "0.587539", "0.58620894", "0.5860783", "0.57325244", "0.5729399", "0.5705338", "0.569005", "0.56722784", "0.5664569", "0.5650705", "0.5637029", "0.5636223", "0.5614233", "0.5613228",...
0.7672821
1
Retrieve colony to which belongs Cell instance with identifier 'cid'
def get_colony(self, cid): found = False for colony in self.trees: if colony.contains(cid): found = True break if found: return colony else: msg = "There's no colony corresponding to {}".format(cid) msg += " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cid(self):\n results = self.database.findall(text(\"select cid from cid_minter\"))\n if results:\n return results[0]\n else:\n err_msg = \"Database error: No CID was found in the cid_minter table.\"\n logging.error(err_msg)\n raise ValueError...
[ "0.6108341", "0.5846092", "0.5753813", "0.57134336", "0.55493855", "0.55475724", "0.54867554", "0.54703194", "0.54285115", "0.5417686", "0.5406066", "0.53856134", "0.53768426", "0.53108335", "0.52670926", "0.52639467", "0.5225461", "0.5162494", "0.5151897", "0.51465046", "0.5...
0.718982
0
Check if the credit card number is a valid.
def verify(n): # Take the sum of all digits. sum_of_digits = sum(luhn_digits(n)) # The number is valid iff the sum of digits modulo 10 is equal to 0 return sum_of_digits % 10 == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_luhn_valid(card_number):\n is_valid = luhn_checksum(card_number) == 0\n return is_valid", "def validate(self):\n try:\n num = map(int, self.card_number)\n except ValueError:\n raise AuthorizeInvalidError('Credit card number is not valid.')\n if sum(num[::-2...
[ "0.777877", "0.7708181", "0.729873", "0.7231169", "0.7231169", "0.7231169", "0.7231169", "0.7231169", "0.7231169", "0.7224119", "0.7148391", "0.71457696", "0.7123973", "0.70890385", "0.70834035", "0.7002407", "0.6982196", "0.6959245", "0.6943644", "0.6928551", "0.6890659", ...
0.7197937
10
Pads vector 1 up to size n, with the value val
def _pad_trunc_vector(self, vec1, n, val): if len(vec1) < n: vec1 = np.pad(vec1, (0, n-len(vec1)), 'constant', constant_values=val) else: vec1 = vec1[0:n] return np.array(vec1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dense_vector (n, init_val=0.0):\n return [init_val] * n", "def fill_last(params, n=1, val=0):\n val = jnp.full((n,) + params.shape[1:] , val)\n return jnp.concatenate([params, val], axis=0)", "def prepend_1d_nb(a, n, value):\n out = np.empty(a.shape[0] + n, dtype=np.float_)\n out[:n] = value...
[ "0.66970176", "0.6407956", "0.62794185", "0.62085414", "0.61494535", "0.601938", "0.598485", "0.594154", "0.5891604", "0.585811", "0.5815687", "0.57030565", "0.56637466", "0.5592547", "0.5585172", "0.55488724", "0.5509341", "0.5502468", "0.54687667", "0.5464518", "0.54223704"...
0.7783556
0
Returns True if the file type is in the supported languages or no language is specified for the linting rule and False otherwise. The file type is determined based upon the file extension.
def is_valid_language(self, file): if not self.languages or get_file_type(file["path"]) in self.languages: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_file_type(fname):\n ext = path.splitext(fname)[1]\n return ext in allowed_extensions", "def is_valid_language(args, skip=False):\n if (is_valid_file_and_directory(args) and is_valid_comments(args)) or skip:\n if args.language is not None:\n return True\n return False", "...
[ "0.6794162", "0.6676702", "0.66753393", "0.66525245", "0.662058", "0.6559167", "0.65226805", "0.6507326", "0.63927895", "0.6389078", "0.63548726", "0.63548726", "0.6342597", "0.6324626", "0.63147753", "0.629082", "0.629082", "0.62877965", "0.62421244", "0.62134165", "0.620342...
0.8022905
0
If the variable has been assigned a value, retrieve it. Returns None if the variable hasn't been assigned yet
def get_assigned_value(self, var) : return self.assigned_values.get(var, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_unassigned_variable(self, assignment, csp):\n for var in csp.get_variables():\n if not assignment.has_assignment_for(var):\n return var\n\n return None", "def get_assignment(self, var):\n return self.variable_to_value.get(var)", "def get_variable_objec...
[ "0.67984724", "0.6676857", "0.66513926", "0.65910417", "0.6577111", "0.65009785", "0.64410925", "0.64085674", "0.63712054", "0.6322651", "0.6232617", "0.6223635", "0.6163608", "0.61594456", "0.6154384", "0.6147226", "0.6125914", "0.61167973", "0.60655224", "0.60066867", "0.59...
0.72336644
0
Create a default `lmfit.Parameters` instance, which can be used to fit DNA force extension data with lmfit. The default parameters calculated are the contour length (L_0), the persistence length (L_p) and the temperature (T). The contour length is calculated from the number of basepairs (bps) and the pitch (pitch) of t...
def get_DNA_fit_params(bps, pitch=None, L_p=None, T=None, vary=None, **kwargs): pitch = pitch or 0.338e-9 L_p = L_p or 50e-9 T = T or 298 # Calculate the contour length of the DNA L_0 = bps * pitch # m contour length vary = vary or {} vary_L_0_default = vary.get('bps', True) params = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_parameters():\n prm = Parameters('lvad_model')\n\n prm.add('lvad_volume', 66.0)\n\n prm.add('alpha_slope', 0.0091)\n prm.add('alpha_intercept', 1.4)\n\n prm.add('beta_slope', -0.19)\n prm.add('beta_intercept', -1.9)\n\n prm.add('frequency', float())\n\n ...
[ "0.6835969", "0.6272214", "0.6184853", "0.59712154", "0.5957968", "0.59085506", "0.58692825", "0.5817008", "0.5799932", "0.57943106", "0.5778758", "0.57549995", "0.5752405", "0.5744929", "0.572709", "0.5689335", "0.564958", "0.5627402", "0.5626087", "0.56133604", "0.55986154"...
0.71071064
0
Return whether this color is cue's color.
def is_cue_color(color, tolerance = 100): return col_diff(color, CUE_COLOR) <= tolerance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isColor(self,color):\n return self.color==color", "def is_red(self):\n return self.color == Color.RED", "def is_red(self):\n return \"red\" == self.color", "def IsColor(self, *args):\n return _XCAFDoc.XCAFDoc_ColorTool_IsColor(self, *args)", "def is_black(self):\n ret...
[ "0.7156366", "0.69561297", "0.6955254", "0.6843813", "0.679817", "0.65913254", "0.6505436", "0.6502803", "0.6444754", "0.6427036", "0.6417671", "0.63754535", "0.6355578", "0.6274695", "0.62434286", "0.6180503", "0.608339", "0.6067604", "0.60409385", "0.6038667", "0.59640723",...
0.7655248
0
Return whether the segment connect point1, point2 is a cue line.
def is_cue_line(point1, point2, image): if point1[0] <= point2[0]: pointL, pointR = point1, point2 else: pointL, pointR = point2, point1 deltaY = pointR[1] - pointL[1] deltaX = pointR[0] - pointL[0] if deltaX != 0: for x in range(pointL[0], pointR[0] + 1): dx = x ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOnLine(self, point):\n if((point < self.start and point < self.end) or (\n point > self.start and point > self.end)):\n return False #point is not between the start and end of self\n \n if(self.getArea(self.start, self.end, point) > c.EPSILON):\n return F...
[ "0.6962338", "0.6753144", "0.6658903", "0.66405946", "0.6613546", "0.6551926", "0.6544258", "0.64450705", "0.64279497", "0.6373599", "0.6356946", "0.63556725", "0.6342672", "0.627818", "0.6253513", "0.62485945", "0.6238712", "0.62382734", "0.6210221", "0.62070554", "0.6183308...
0.81268615
0
given a list of lists, returns all the possible combinations taking one element from each list The list does not have to be of equal length
def cartesianproduct(lists): return reduce(appendEs2Sequences,lists,[])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combinations(*args: List[Any]) -> List[List]:\n return list([list(el) for el in list(product(*args))])", "def __get_all_combinations(self, list_of_items):\r\n return [itertools.combinations(list_of_items, index+1)\r\n for index in range(len(list_of_items))]", "def representative_co...
[ "0.77020794", "0.741914", "0.72532415", "0.71915007", "0.7056734", "0.70454365", "0.70370454", "0.6988426", "0.6977084", "0.6933962", "0.68215847", "0.68174875", "0.68147933", "0.6706153", "0.6658565", "0.66468805", "0.66265106", "0.6620485", "0.65778834", "0.6502949", "0.647...
0.6840305
10
Create an Nbin discrete colormap from the specified input map
def discrete_cmap(N, base_cmap=None): # Note that if base_cmap is a string or None, you can simply do # return plt.cm.get_cmap(base_cmap, N) # The following works for string, None, or a colormap instance: base = plt.cm.get_cmap(base_cmap) color_list = base(np.linspace(0, 1, N)) cmap_name = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_cmap(N, base_cmap=None):\n base = plt.get_cmap(base_cmap)\n color_list = base(np.linspace(0, 1, N))\n cmap_name = base.name + str(N)\n return base.from_list(cmap_name, color_list, N)", "def discrete_cmap(N, base_cmap=None):\n # see https://gist.github.com/jakevdp/91077b0cae40f8f8244a\...
[ "0.7242805", "0.71656674", "0.6901114", "0.68781185", "0.68781185", "0.68781185", "0.6861682", "0.6854892", "0.684856", "0.67342144", "0.66580445", "0.6597808", "0.65941465", "0.65885794", "0.6582792", "0.6508348", "0.64398456", "0.64053196", "0.63276744", "0.6316793", "0.628...
0.6861819
9
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL.\n' 'You have to login with proper credentials', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.776624
27
Compute ricci curvature for all nodes and edges in G. Node ricci curvature is defined as the average of all it's adjacency edge.
def ricciCurvature(G, alpha=0.5, weight=None): # Construct the all pair shortest path lookup t0 = time.time() length = dict(nx.all_pairs_dijkstra_path_length(G, weight=weight)) if time.time() - t0 > 5: print(time.time() - t0, " sec for all pair") # compute ricci curvature for s, t in G....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(self):\n return self.circle().curvature(self.o, self.r, p = self.a)", "def calculate_curvature(P):\n y = P[:,1].copy()\n x = P[:,0].copy()\n dx = np.gradient(x)\n yd = np.gradient(y, dx)\n ydd = np.gradient(yd, dx)\n return np.sum(ydd**2)", "def _curvature(self):\n ...
[ "0.65307355", "0.62947464", "0.628898", "0.6148709", "0.6146022", "0.60335684", "0.601647", "0.6016419", "0.59686583", "0.59591705", "0.59580296", "0.5783392", "0.56206346", "0.5454164", "0.5451209", "0.54046565", "0.53753686", "0.53608567", "0.5320454", "0.53164357", "0.5294...
0.76373357
0
Function that calculates the magnitude of the given vector
def get_magnitude_vector(given_vector): # Note: given vector is a dictionary of the form: # {term : score} magnitude = 0 for item in given_vector.values(): magnitude += item ** 2 return magnitude ** 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(vector):\n return math.sqrt(sum_of_squares(vector))", "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v)) #math.sqrt() is a square root function", "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v))", "def magnitude_of_vector(v):\n return ...
[ "0.8889121", "0.8727219", "0.8703709", "0.86457086", "0.84638685", "0.8353756", "0.8321988", "0.82970536", "0.82789177", "0.8265785", "0.82312655", "0.81229854", "0.8055713", "0.78811353", "0.78140724", "0.7760445", "0.77123815", "0.76013935", "0.74516785", "0.71060884", "0.7...
0.77635497
15
Check case if input has wrong shape.
def test_wrong_shape(self): scores = np.column_stack((np.ones(10), np.ones(10))) with self.assertRaises(ValueError): calc_disc(scores)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(placeholder_shape, data_shape):\n\n return True", "def check_input_shape(self, op, block):\n\n ipt_name = op.input(op.input_names[0])\n ipt_shape = block.var(ipt_name).shape\n for i in ipt_shape:\n if i < 0:\n warning_msg = (\n ...
[ "0.77478", "0.7627686", "0.75921834", "0.75702965", "0.75427914", "0.7507562", "0.7440126", "0.7437663", "0.7397914", "0.7355922", "0.731435", "0.7276764", "0.7259658", "0.7200504", "0.7155421", "0.71542364", "0.71168107", "0.7111445", "0.70359635", "0.6983382", "0.6968996", ...
0.65060616
51