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
The distance modulus as a `~astropy.units.Quantity`.
def distmod(self): val = 5.0 * np.log10(self.to_value(u.pc)) - 5.0 return u.Quantity(val, u.mag, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modulus(self):\n return math.sqrt(self._reNum ** 2 + self._imNum ** 2)", "def modulus(self):\n return self._n", "def distmod(self):\n val = 5. * np.log10(self.to(u.pc).value) - 5.\n return u.Quantity(val, u.mag)", "def distance_modulus(d):\n dmag = 5 * log(d) - 5\n retur...
[ "0.6967479", "0.6890933", "0.6822472", "0.66861945", "0.628211", "0.6278667", "0.6238641", "0.6117812", "0.6001015", "0.59590673", "0.5954799", "0.5933193", "0.5691264", "0.5667276", "0.5663461", "0.5610293", "0.5577817", "0.55631757", "0.55054903", "0.5500057", "0.5459053", ...
0.7012214
0
The course key for the course run specified by the `course_id` URL parameter.
def course_key(self): return CourseKey.from_string(self.kwargs['course_id'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_course_id(course_data):\r\n return SlashSeparatedCourseKey(course_data['org'], course_data['number'], course_data['run'])", "def _course_key(self):\r\n return \"slashes:{org}+{number}+{run}\".format(**self._course_dict)", "def id(self):\r\n return self.location.course_key", "def _co...
[ "0.77056575", "0.7534554", "0.73276055", "0.7309002", "0.6935706", "0.6742928", "0.66907364", "0.66848546", "0.66302496", "0.6626322", "0.6610215", "0.65467787", "0.65173256", "0.6447613", "0.63972616", "0.63955164", "0.63500065", "0.63294667", "0.6283714", "0.62059945", "0.6...
0.83766115
0
Get a user's active enrollments for course runs with the given program. Note that this is distinct from the user's program course enrollments, which refers to courses that were enrollmed in through a program. In the case of this function, the course runs themselves must be part of the program, but the enrollments do no...
def get_enrollments_for_courses_in_program(user, program): course_keys = [ CourseKey.from_string(key) for key in course_run_keys_for_program(program) ] return CourseEnrollment.objects.filter( user=user, course_id__in=course_keys, mode__in=[CourseMode.VERIFIED, CourseM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_program_run_enrollments(user):\n programs = ProgramFactory.create_batch(2)\n program = programs[0]\n course_run_enrollments = CourseRunEnrollmentFactory.create_batch(\n 2,\n user=user,\n run__course__program=factory.Iterator([program, program, programs[1]]),\n )\n e...
[ "0.64152026", "0.6310521", "0.6158255", "0.5903346", "0.55708414", "0.54200584", "0.5367279", "0.53273", "0.53085923", "0.5270201", "0.52193844", "0.51915306", "0.518297", "0.5141759", "0.50550276", "0.5031513", "0.50242436", "0.5013921", "0.49886763", "0.49721298", "0.496655...
0.83051485
0
Constructor with the node json structure
def __init__(self, node: Dict): self._node = node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, node: Dict):\n super().__init__(node)", "def __init__(self):\n\n self.root = Node(name='root',children=set())\n\n self.map = {}\n self.map['root'] = self.root\n\n self.jsonStr = \"\"", "def __init__(self, data, node):\n self.data = data\n self...
[ "0.75076544", "0.7123279", "0.707431", "0.6953227", "0.68839633", "0.68485516", "0.6766973", "0.67617595", "0.6680327", "0.6629041", "0.66282135", "0.66065013", "0.6596839", "0.65092784", "0.6507626", "0.64644897", "0.6421913", "0.64162755", "0.6400729", "0.63939524", "0.6393...
0.7747541
0
The runtime configuration associated with the pipeline.
def runtime_config(self) -> str: return self._node["app_data"].get("runtime_config")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self) -> PipelineConfiguration:\n return self._config", "def innerPipelineConfig(self):\n return dict(self._innerPipelineConfig)", "def config(self):\n annotations = IAnnotations(self.context)\n return annotations.get(CONFIGURATION_KEY, {})", "def configuration(self):\n...
[ "0.7518023", "0.67369664", "0.6621342", "0.6556233", "0.6555307", "0.6540788", "0.6540788", "0.6525782", "0.647302", "0.647302", "0.647302", "0.64662683", "0.6409715", "0.6406797", "0.64001775", "0.63710177", "0.63615733", "0.63263434", "0.63192797", "0.63192797", "0.6317034"...
0.7307384
1
The Super Node pipeline reference. Only available when type is a super node.
def subflow_pipeline_id(self) -> Pipeline: if self._node["type"] != "super_node": raise ValueError("Node must be a super_node in order to retrieve a subflow pipeline id") if "subflow_ref" in self._node: return self._node["subflow_ref"].get("pipeline_id_ref") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_supernodes(self) -> List[Node]:\n supernode_list = []\n for pipeline in self._pipelines:\n for node in pipeline.nodes:\n if node.type == \"super_node\":\n supernode_list.append(node)\n return supernode_list", "def base_ref(self):\n ...
[ "0.6242354", "0.56260866", "0.56260866", "0.5548047", "0.5548047", "0.54894626", "0.5467385", "0.54409677", "0.54385734", "0.528914", "0.528808", "0.5205098", "0.5201895", "0.5167995", "0.5162703", "0.5161916", "0.515078", "0.5147947", "0.51302814", "0.511484", "0.5075585", ...
0.6418597
0
In the case of a matching key between env vars and kubernetes secrets, prefer the Kubernetes Secret and remove the matching env var.
def remove_env_vars_with_matching_secrets(self): env_vars = self.get_component_parameter(ENV_VARIABLES) secrets = self.get_component_parameter(KUBERNETES_SECRETS) if isinstance(env_vars, ElyraPropertyList) and isinstance(secrets, ElyraPropertyList): new_list = ElyraPropertyList.diffe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_secrets():\n for name, value in Secrets.__dict__.items():\n if name[0] != '_':\n os.environ[name] = value", "def use_k8s_secret(secret_name: str = 'k8s-secret', k8s_secret_key_to_env: Dict = {}):\n\n def _use_k8s_secret(task):\n from kubernetes import client as k8s_client...
[ "0.6295571", "0.5839537", "0.5767886", "0.5548547", "0.55168307", "0.53834206", "0.53712296", "0.53285867", "0.5325718", "0.52447146", "0.52092665", "0.51759136", "0.51740175", "0.5128935", "0.51246715", "0.5108413", "0.51034707", "0.50956804", "0.50828403", "0.50702286", "0....
0.6709287
0
Return list of plotly Scatter objects, i.e., return the lines to graph for the extent anomaly and trend. Arguments
def _get_scatter_plots(df_in): df = df_in.copy() anomalies = go.Scatter( name='Extent Anomaly', x=df.index.year, y=df.anomaly, connectgaps=True, mode='lines+markers', line=dict( color='black', width=1.5 ), marker=dict( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getScatterers(self):\n raise NotImplementedError(\"The must be overloaded\")", "def plot_scatter_points_lines(self):\n self.plot(2)", "def getScatterers(self):\n return self.scatterers", "def scatters(self):\n\t\treturn self._scatter", "def _generate_scatter_plots(self):\n\n ...
[ "0.6566025", "0.6165536", "0.61388814", "0.6096375", "0.6056573", "0.6001214", "0.5978807", "0.58931255", "0.5863839", "0.5795581", "0.57907605", "0.57603204", "0.5710044", "0.5654198", "0.56456757", "0.56456757", "0.5606425", "0.56053805", "0.55822027", "0.55690074", "0.5564...
0.7144919
0
Remove duplicates and zero values
def clean_file(df): df_clean = df.drop_duplicates() df_no_zeros = df_clean[df_clean[2] != 0] df_sorted = df_no_zeros.sort() return df_sorted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicateZeros(self, arr) -> None:\n tmp = list()\n for i,v in enumerate(arr):\n if v==0:\n tmp.append(0)\n tmp.append(0)\n else:\n tmp.append(v)\n\n arr[i] = tmp[i]", "def nozero(arr):\n vals=sorted(list(set(np.ar...
[ "0.6666325", "0.63794065", "0.6309396", "0.6286219", "0.6233191", "0.6223735", "0.62234706", "0.6211011", "0.62052983", "0.6199306", "0.61980623", "0.6185845", "0.6164007", "0.61620754", "0.61540157", "0.6147241", "0.6119854", "0.6103321", "0.6030267", "0.6014741", "0.5987868...
0.6052584
18
Retrieve an Order Retrieves the details of an existing order. Supply the unique identifier for the order and if one exists this API will return the corresponding order. Each order will have all the information you need to fulfill it.
def retrieve(self, **kwargs): return self.client.execute("order", "GET", kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetOrder(order_id): \n\t\"\"\"Method to get order\"\"\"\n\trequest = OrdersGetRequest(order_id)\n\tresponse = client.execute(request)\n\treturn response.result.__dict__[\"_dict\"]", "def get_order(self, order_id):\n request = OrdersGetRequest(order_id)\n response = self.client.execute(request...
[ "0.80573905", "0.7695813", "0.75509804", "0.7477926", "0.7427395", "0.74228543", "0.7369563", "0.7213348", "0.7203487", "0.71813434", "0.71447855", "0.70545423", "0.70322794", "0.69711804", "0.6970191", "0.6892771", "0.68900007", "0.6864881", "0.6853469", "0.68489033", "0.684...
0.7215428
7
Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platformspecific modules, i.e. any module from a nonpurePython module distribution; otherwise, return the platformshared library directory. If 'standard_lib' is true, return the d...
def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): if prefix is None: prefix = PREFIX if standard_lib: return os.path.join(prefix, "lib-python", sys.version[0]) return os.path.join(prefix, 'site-packages')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_lib_arch_dir(self):\n return get_python_lib(plat_specific=True)", "def python_lib_non_arch_dir(self):\n return get_python_lib()", "def find_lib_directory(self):\n lib_directory = None\n if self.lib_micro_version in self.lib_directories:\n lib_directory = self.l...
[ "0.7312334", "0.66817313", "0.630215", "0.59675217", "0.58582366", "0.5813752", "0.5754164", "0.5743071", "0.5668374", "0.5655986", "0.56501794", "0.55640066", "0.551005", "0.55023414", "0.54566056", "0.54521173", "0.5451939", "0.533567", "0.5327337", "0.5323269", "0.5289803"...
0.78620577
0
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
def get_config_var(name): return get_config_vars().get(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvar(self, varname):\n try:\n val = self.get(MAIN_SECTION, varname)\n except ConfigParser.NoOptionError:\n val = VARS_OPT[varname]\n \n return val", "def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]", "def g...
[ "0.76904035", "0.7560492", "0.7208872", "0.7009819", "0.7002421", "0.69382244", "0.6855192", "0.68550855", "0.67913646", "0.67908436", "0.6762321", "0.6751952", "0.67219937", "0.66833436", "0.66670865", "0.6604859", "0.6594985", "0.65858495", "0.6583223", "0.6543417", "0.6533...
0.8394908
0
This method adds two fraction objects and returns a third object. It finds the lcm of the two denominators and uses this to find a factor to make equivalent fractions of the same denominator. The numerators are then added Finally the fraction is simplified if possible
def __add__ (self, other): if (self.debug): print(f'enter fraction.__add__ with {other}') lcm = find_lcm(self.value[1], other.value[1]) if (self.debug): print(f'{int(lcm/self.value[1])} {self.value}') f1 = self.equivalent(int(lcm/self.value[1])) f2 = other.equivalent(int(lcm/other.value[1])) f3 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self, otherfraction):\n\n newnum = self.num * otherfraction.num\n newden = self.den * otherfraction.den\n\n #reduce new num over lcm den\n common = gcd(sub_num, new_lcm)\n newnum = sub_num//common\n newden = new_lcm//common\n\n ...
[ "0.7306007", "0.69250506", "0.69048226", "0.69034964", "0.6896354", "0.6817376", "0.6767664", "0.67384344", "0.6715691", "0.6680277", "0.66627336", "0.66574484", "0.66509414", "0.66509414", "0.66509414", "0.66452706", "0.66452706", "0.66452706", "0.66452706", "0.66452706", "0...
0.7543935
0
Write json and yaml file
def write_serialized(data, file_path: Path): assert file_path is not None if file_path.name.endswith(".json"): with open(file_path, "w") as f: json.dump(data, f, indent=4) elif file_path.name.endswith('.yml'): with open(file_path, "w") as f: yaml.safe_dump(data, f, in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filepath):\n writer = json.dump if Config.isjson(filepath) else yaml.dump\n with open(filepath, 'w') as f:\n writer(dict(self), f)", "def write_to_file(file_name, json_data):\r\n in_tests.test_write_to_file_file_name(file_name)\r\n in_tests.test_var_type(json_data, \...
[ "0.70887333", "0.69494104", "0.6936627", "0.688222", "0.67458385", "0.67158186", "0.66921395", "0.6651492", "0.66452515", "0.66279036", "0.6571671", "0.6568605", "0.6564732", "0.6554644", "0.65061736", "0.650022", "0.6471649", "0.641715", "0.6367133", "0.6354554", "0.6337689"...
0.0
-1
Write a function to convert a letter into an integer in the range [025] to index into the list We can do this with the ord() function and ASCII codes...
def convert_letter_to_int(letter): return ord(letter.lower())-ord('a')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A", "def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A", "def to_index(self, char):\n return ord(char) - ord(\"A\") - 32", "def prefer_alphabet(i):\n if 0 <= i <= 25:\n return chr(i + 65)\n if 26 <...
[ "0.7344977", "0.7344977", "0.69325674", "0.6916834", "0.691188", "0.6882179", "0.6863152", "0.6860294", "0.6860294", "0.6785766", "0.675267", "0.6724266", "0.6724266", "0.6667047", "0.66609037", "0.6580204", "0.65535253", "0.65481615", "0.65318793", "0.65318793", "0.65005505"...
0.68007165
9
Create Horovod compatible optimizer. State of optimizer will be distributed on specified `rank`. Should be used after `torchtraining.accelerators.Horovod` object was created.
def optimizer( optimizer, named_parameters, reduction: str = "sum", compression: str = "none", accumulate: int = 1, rank: int = 0, ): optimizer = hvd.DistributedOptimizer( optimizer, named_parameters, _compression(compression), backward_passes_per_step=accumu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_optimizer(self, optimizer: Any) -> Any:\n if not self.env.managed_training:\n return optimizer\n\n self.optimizer_initialized = True\n if self.distributed.size == 1:\n return optimizer\n\n check.check_false(\n isinstance(optimizer, str),\n ...
[ "0.57443446", "0.5688", "0.55298567", "0.54260266", "0.5237072", "0.50890285", "0.5074523", "0.50310373", "0.503053", "0.5023268", "0.5021287", "0.50207007", "0.4996128", "0.49860355", "0.49741444", "0.49682435", "0.4965094", "0.4965094", "0.4947391", "0.4935192", "0.49305865...
0.584377
0
Load object saved with `torch.save` in a single process and distribute to all other processes. Useful when loading saved `torch.nn.Module` (or other `torch` objects like `optimizer`), which is saved on a single machine. It can be easily distributed to other processes this way. If you wish to `torch.save` on a single pr...
def load(f, rank: int = 0, map_location=None, pickle_module=pickle, **pickle_load_args): data = None if hvd.rank() == rank: data = torch.load(f, map_location, pickle_module, **pickle_load_args) return hvd.broadcast(data, rank)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(obj, f):\n if PartialState().distributed_type == DistributedType.TPU:\n xm.save(obj, f)\n elif PartialState().local_process_index == 0:\n torch.save(obj, f)", "def pickleSave(object, filename):\n #Todo: Handle exceptions from pickle\n filehandler = open(\"obj/\" + filename + \"...
[ "0.7155004", "0.61534864", "0.6146742", "0.614646", "0.60964334", "0.5989194", "0.5989194", "0.5959552", "0.59421694", "0.59391224", "0.5927149", "0.5909119", "0.59055686", "0.59055686", "0.5904597", "0.5880489", "0.5879899", "0.58722126", "0.58634627", "0.58622044", "0.58608...
0.0
-1
Calculate the probability of being in the ith state
def calc_probabilities_one(states, T): return np.exp(-beta(T) * states) / calc_partition_function_one(states, T)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state):\n\n fitness = 0\n\n for i in range(1, len(state)):\n if state[i] != state[i - 1]:\n fitness += 1\n\n return fitness", "def evaluate(self) :\n for inp in self.inStates :\n if inp.getState() == 1 : return 1\n return ...
[ "0.7373783", "0.70101905", "0.70092624", "0.68375176", "0.6820807", "0.6715079", "0.67095524", "0.67039686", "0.670067", "0.6659887", "0.6627217", "0.6576533", "0.65501374", "0.6507712", "0.6493952", "0.64803356", "0.6451697", "0.6449182", "0.6440246", "0.64320594", "0.642704...
0.62848365
32
Returned method is synchronized on the object's UUID.
def _synchronize(wrp_or_spec, *a1, **k1): @lock.synchronized(wrp_or_spec.uuid) def _locked_resolve_wrapper(wos, *a2, **k2): try: # The synchronized decorator will hold off other threads # we just have to hold off lock attempts by methods further ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uuid(self):\n raise NotImplementedError", "def uuid(self):\n raise NotImplementedError", "def uuid(self):\n raise NotImplementedError", "def __hash__(self):\n return hash(self.__uuid)", "def __hash__(self):\n return hash(self.__uuid)", "def uuid(self):\n retu...
[ "0.68888944", "0.68888944", "0.68888944", "0.68185663", "0.68185663", "0.6754504", "0.6754504", "0.66887474", "0.66065156", "0.66065156", "0.6581454", "0.6566709", "0.6566709", "0.6507751", "0.6491661", "0.64915544", "0.6486834", "0.6448032", "0.63752925", "0.62685", "0.62685...
0.0
-1
Test that we strip the trailing period off of any host lookups.
def test_stripping_trailing_period(self, mocker): test_host_with_period = 'www.apple.com.' test_host_without_period = 'www.apple.com' packet = UDP() / DNS(rd=1, qd=DNSQR(qname=test_host_with_period)) mock_time = mocker.patch('time.time', return_value=1234567890) chef = DNSLooku...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sanitized_hostname(self):\n value = \" ../ ../some/dubious/hostname \"\n response = clean.hostname(value)\n assert response == \"somedubioushostname\"", "def test_parse_url_lowercase_host() -> None:\n assert indieauth._parse_url(\"http://ex.com/hello\").path == \"/hello\"\...
[ "0.68553686", "0.6599286", "0.658324", "0.6445391", "0.64428693", "0.6386055", "0.6373601", "0.628827", "0.6260748", "0.62061894", "0.6181044", "0.61214125", "0.60782653", "0.6044453", "0.60381293", "0.5987929", "0.59816396", "0.59760976", "0.59690386", "0.5966959", "0.596379...
0.6974191
0
Haversine formula for finding distance between two GPS points
def measure_gps(lat1, lon1, lat2, lon2): R = 6378.137; # Radius of earth in KM dLat = radians(lat2) - radians(lat1) dLon = radians(lon2) - radians(lon1) a = sin(dLat/2) * sin(dLat/2) + cos(radians(lat1)) * cos(radians(lat2)) * sin(dLon/2) * sin(dLon/2) c = 2 * atan2(sqrt(a), sqrt(1-a)) d = R * c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(gps1, gps2):\n return haversine(gps1.lng, gps1.lat, gps2.lng, gps2.lat)", "def haversine(lon1, lat1, lon2, lat2): \r\n lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) \r\n #print 34\r\n dlon = lon2 - lon1 \r\n dlat = lat2 - lat1 \r\n a = sin(dlat/2)**2 + cos(...
[ "0.8252473", "0.81534", "0.79827875", "0.7940698", "0.7802571", "0.7776994", "0.7769362", "0.77508646", "0.7735453", "0.76931393", "0.7687241", "0.7686546", "0.7682207", "0.7680675", "0.76785505", "0.76684964", "0.76591825", "0.76539737", "0.7625914", "0.76224506", "0.7622368...
0.0
-1
Get a random element from the set.
def getRandom(self) -> int: some_item = self.container.pop() self.container.add(some_item) return some_item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.639...
0.6400411
20
Prove that the humanreadable string representation of a Log object is as expected.
def test_log_str(self) -> None: log_str = ( "Log: [log_id: 1, username: andy, first: Andrew, last: Jarombek, " "name: Van Cortlandt NYRR XC 5K, location: Bronx, NY, date: 2019-11-17 00:00:00, type: run, " "distance: 5, metric: kilometers, miles: 3.11, time: 17:35, " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str(self):\n log = self.log\n\n self.assertEqual(str(log), self.log_raw['name'])", "def test_log_repr(self) -> None:\n self.assertEqual(repr(self.log1), \"<Log 1>\")\n\n # pylint: disable=unnecessary-dunder-call\n self.assertEqual(self.log1.__repr__(), \"<Log 1>\")", ...
[ "0.77255714", "0.68752515", "0.63184583", "0.630524", "0.61734915", "0.61235505", "0.6093468", "0.6023594", "0.5989674", "0.59769464", "0.5903261", "0.58163244", "0.57990086", "0.5787505", "0.57760155", "0.5744274", "0.5700987", "0.5670961", "0.5665902", "0.56631553", "0.5653...
0.72703946
1
Prove that the machinereadable string representation of a Log object is as expected.
def test_log_repr(self) -> None: self.assertEqual(repr(self.log1), "<Log 1>") # pylint: disable=unnecessary-dunder-call self.assertEqual(self.log1.__repr__(), "<Log 1>")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str(self):\n log = self.log\n\n self.assertEqual(str(log), self.log_raw['name'])", "def test_log_str(self) -> None:\n log_str = (\n \"Log: [log_id: 1, username: andy, first: Andrew, last: Jarombek, \"\n \"name: Van Cortlandt NYRR XC 5K, location: Bronx, NY, dat...
[ "0.7619969", "0.7029662", "0.61988664", "0.61073816", "0.6028868", "0.59957576", "0.5959325", "0.59241104", "0.5823959", "0.5792476", "0.57866126", "0.570806", "0.5679372", "0.5625438", "0.55862457", "0.555471", "0.55272245", "0.54808885", "0.5477741", "0.5471495", "0.5464707...
0.6687905
2
Prove that two Log objects with the same property values test positive for value equality.
def test_log_eq(self) -> None: self.assertTrue(self.log1 == self.log1copy) # pylint: disable=unnecessary-dunder-call self.assertTrue(self.log1.__eq__(self.log1copy))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_ne(self) -> None:\n self.assertTrue(self.log1 != self.log2)\n\n # pylint: disable=unnecessary-dunder-call\n self.assertTrue(self.log1.__ne__(self.log2))", "def testEquality(self):\n pass", "def __eq__(self, other):\n if type(self) != type(other):\n ret...
[ "0.70025134", "0.6785025", "0.6775223", "0.67416793", "0.6668785", "0.6558078", "0.6510136", "0.6509483", "0.6460883", "0.64383066", "0.63955766", "0.6357424", "0.63458985", "0.63063765", "0.6263577", "0.62454", "0.6243837", "0.6196197", "0.618561", "0.6163515", "0.61543256",...
0.77075636
0
Prove that two Log objects with different property values test negative for value equality.
def test_log_ne(self) -> None: self.assertTrue(self.log1 != self.log2) # pylint: disable=unnecessary-dunder-call self.assertTrue(self.log1.__ne__(self.log2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_eq(self) -> None:\n self.assertTrue(self.log1 == self.log1copy)\n\n # pylint: disable=unnecessary-dunder-call\n self.assertTrue(self.log1.__eq__(self.log1copy))", "def test_not_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.N...
[ "0.6787385", "0.6651196", "0.6644411", "0.6595412", "0.6564899", "0.6559415", "0.6556815", "0.6545934", "0.6526806", "0.6521459", "0.6515049", "0.6484513", "0.6483301", "0.645561", "0.64358604", "0.6427697", "0.6424267", "0.63971186", "0.6379973", "0.6373903", "0.63375664", ...
0.7412432
0
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7537881
25
Index page of webapp.
def index(): return render_template('index.html', username=session['username'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('index.html'), 200", "def index():\n\n return render_template(\"index.html\"), 200", "def index():\r\n return render_template('index.html')", "def index():\n\treturn render_template(\"index.html\", title=\"Home\")", "def index():\n\n\treturn(render_tem...
[ "0.8451287", "0.8438175", "0.83854216", "0.83611673", "0.83596146", "0.8349691", "0.83185416", "0.83185416", "0.8298845", "0.8298845", "0.8240067", "0.8218526", "0.8209362", "0.8209362", "0.8209362", "0.8196181", "0.81809473", "0.81724435", "0.81713253", "0.81713253", "0.8171...
0.0
-1
User selected time zone name.
def time_zone_name(self): return icemac.addressbook.preferences.utils.get_time_zone_name()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_tzname(self):\n return settings.TIME_ZONES_BY_LANG.get(self.language, settings.TIME_ZONE)", "def time_zone(self) -> str:\n return pulumi.get(self, \"time_zone\")", "def time_zone(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"time_zone\")", "def time_zone(s...
[ "0.74000305", "0.71502084", "0.7095838", "0.6800838", "0.6791206", "0.66160285", "0.65709746", "0.65694994", "0.6551744", "0.65436554", "0.6415454", "0.64104503", "0.6381434", "0.6381434", "0.6331052", "0.62924546", "0.6255292", "0.6220565", "0.62151015", "0.6185237", "0.6164...
0.78968835
0
Convert a list of entitiy fields to a list of data.
def _get_info_from_fields(self, fields): info = [] for field in fields: if field is icemac.ab.calendar.interfaces.IEvent['persons']: value = self.persons else: schema_field = ( icemac.addressbook.entities.get_bound_schema_field(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_field_list(entities: List[Entity], features: List[Feature]) -> List[Field]:\n fields: List[Field] = []\n\n for entity in entities:\n if isinstance(entity, Field):\n fields.append(entity)\n\n for feature in features:\n if isinstance(feature, Field):\n fields....
[ "0.6796255", "0.6444412", "0.6269632", "0.59424204", "0.59386796", "0.5928176", "0.59231544", "0.59113413", "0.5903238", "0.58895963", "0.58644235", "0.5858017", "0.58470684", "0.5836994", "0.5799421", "0.57786864", "0.5775199", "0.57401514", "0.5712433", "0.5703511", "0.5702...
0.5811287
14
Sorts the cards in ascending order.
def sort(self): self.cards.sort()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_cards(self):\n self.cards.sort(key=operator.attrgetter('persona', 'rank'))\n self.update_position()", "def sort(self):\n self.deckcards.sort()", "def sort(self):\n # Sort here actually uses the tuple comparison we defined in the Card class\n self.cards.sort()", "de...
[ "0.86655414", "0.8632108", "0.8423478", "0.8188975", "0.7611681", "0.7386321", "0.68842304", "0.68652517", "0.6864982", "0.68619686", "0.67764884", "0.6644683", "0.661076", "0.6431668", "0.6364552", "0.6356382", "0.63495404", "0.6342746", "0.6306951", "0.6305267", "0.6258513"...
0.8970656
0
Changes the name field of the targetgroup with the specified id.
def update_targetgroup(self, group_id, **kwargs): result = False if self._db(self._db.targetgroup.id==group_id).select(): result = True self._db(self._db.targetgroup.id==group_id).update(**kwargs) self._db.commit() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_group_name(self, name):\n self.groupname = name", "def set_group_name(self, name):\n params = [('groupname', name, 'cdata')]\n\n self.get(COMMAND_UIC, 'SetGroupName', params)", "def _set_group_name(self):\n self._scene_gen.group_name = self._group_name_le.text()\n sel...
[ "0.71644324", "0.6965469", "0.6852993", "0.6843706", "0.6661945", "0.63125485", "0.6262834", "0.6229789", "0.620979", "0.61604285", "0.61576307", "0.61424655", "0.61424655", "0.61415017", "0.61098427", "0.6072748", "0.6037419", "0.6034796", "0.60078686", "0.60078686", "0.5974...
0.0
-1
Constructor. The first three arguments are NodeGenerators with their appropriate restrictions. The 'path_restrict' is a PathRestrictionList
def __init__(self, entry_gen, mid_gen, exit_gen, path_restrict): self.entry_gen = entry_gen self.mid_gen = mid_gen self.exit_gen = exit_gen self.path_restrict = path_restrict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, path_list):\n self.path_list = path_list", "def __init__(self, *args, **kwargs):\n\n # Construct the base instance.\n super(FilterPathList, self).__init__(*args, **kwargs)\n\n # Construct a regular expression tag evaluator.\n regextag = self.thistag.find('Pat...
[ "0.6099256", "0.5825511", "0.5741414", "0.56687963", "0.5619531", "0.55693537", "0.5517076", "0.55155754", "0.5503684", "0.5442326", "0.5440774", "0.53529274", "0.5330655", "0.5324643", "0.532326", "0.52806765", "0.52139574", "0.5193026", "0.5191039", "0.5152518", "0.5152276"...
0.58378917
1
Set the Python logger to use with plog() by name. Useful when TorCtl is integrated with an application using logging. The logger specified by name must be set up before the first call to plog()!
def plog_use_logger(name): global logger, loglevels logger = logging.getLogger(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_logger(logger):\n global __log__\n __log__ = logger", "def rename(self, name):\n self._name = name\n self._logger = logging.getLogger(name)\n self._logger.setLevel(self._level)", "def set_logger(self, logger): \n self.logger = logger", "def logger(name=None):\r\n\r\n...
[ "0.7237039", "0.6961915", "0.68224883", "0.6801666", "0.67771137", "0.67389965", "0.6680576", "0.6677319", "0.66302794", "0.662152", "0.6598704", "0.6583392", "0.6569413", "0.6569413", "0.6566251", "0.6545959", "0.65116715", "0.64775103", "0.643406", "0.64336777", "0.6395406"...
0.83387196
0
Returns the area under the normal curve 'to the left of' the given z value. Thus, for z0, 1.0zprob(z) = 1tail probability for any z, 2.0(1.0zprob(abs(z))) = 2tail probability Adapted from z.c in Gary Perlman's |Stat.
def zprob(z): Z_MAX = 6.0 # maximum meaningful z-value if z == 0.0: x = 0.0 else: y = 0.5 * math.fabs(z) if y >= (Z_MAX*0.5): x = 1.0 elif (y < 1.0): w = y*y x = ((((((((0.000124818987 * w -0.0010752040...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def azprob(z):\r\n def yfunc(y):\r\n x = (((((((((((((-0.000045255659 * y\r\n +0.000152529290) * y -0.000019538132) * y\r\n -0.000676904986) * y +0.001390604284) * y\r\n -0.000794620820) * y -0.002034254874) * y\r\n +0.00...
[ "0.68731636", "0.668195", "0.6588225", "0.65000075", "0.64163035", "0.63080686", "0.6297511", "0.6264844", "0.6259878", "0.6256331", "0.6217454", "0.62063754", "0.61476123", "0.60272056", "0.600064", "0.59707224", "0.5947554", "0.5947554", "0.5947554", "0.5947554", "0.5947554...
0.683976
1
Return the user id of the player to move in game. Accesses database. Return None if game is finished.
def user_to_move_in_game(game): if game.finished: return None black_or_white = go.next_color(game.sgf) next_in_game = {go.Color.black: game.black, go.Color.white: game.white}[black_or_white] return next_in_game
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_id(self):\n return self.game.get_player_id()", "def get_current_player(self):\r\n\r\n return self.players[(self.turn_number) % len(self.players)].get_id()", "def get_player_id(self):\n\n return self.player_id", "def get_player(self, user_id):\n players = [p for p in sel...
[ "0.7318509", "0.7275143", "0.6832679", "0.677774", "0.6685889", "0.6615867", "0.648197", "0.6476051", "0.6448189", "0.6440917", "0.6360773", "0.63495255", "0.63349646", "0.6295892", "0.626745", "0.625307", "0.6187804", "0.6185797", "0.6165908", "0.6161641", "0.6161641", "0....
0.0
-1
A wrapper for `app.route`, that disables the route outside testing
def test_only_route(self, rule, **options): def decorator(f): # we can't just check at compile time whether testing mode is on, # because it's not set until after this file is imported (until then, # the importing module has no app object to set the testing flag on). # # Ther...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_route(arg=None):\n def wrapper(fn):\n setattr(fn, NO_ROUTES_ATTR, True)\n return fn\n\n if callable(arg):\n return wrapper(arg)\n return wrapper", "def route_also_test_sys_env(route_path, method='GET', **route_kwargs):\n test_path_prefix = '/test'\n ext_path = list()\n ...
[ "0.6854874", "0.6495884", "0.60720855", "0.6026355", "0.6006545", "0.5935088", "0.5899339", "0.5820933", "0.5815216", "0.5812453", "0.57857376", "0.5751036", "0.5745304", "0.5711689", "0.5700296", "0.5671911", "0.5670761", "0.56504667", "0.55983025", "0.5593829", "0.5591711",...
0.71084267
0
True if a user is logged in.
def is_logged_in(): return 'user' in session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_logged_in(self) -> bool:\n return self.id is not None and self.username is not None", "def logged_in(self):\n return self.auth.get_user_by_session() is not None", "def isLoggedIn(self):\n session = self.getSession()\n if session is not None:\n return True\n retu...
[ "0.85124874", "0.8436817", "0.8355959", "0.8352134", "0.8344579", "0.82926536", "0.8281127", "0.82039493", "0.8115738", "0.8099193", "0.80379194", "0.79288423", "0.77662414", "0.77311116", "0.7723196", "0.7722527", "0.76241875", "0.76006323", "0.7576333", "0.7564395", "0.7540...
0.84373856
1
Return user id of logged in player, or raise NoLoggedInPlayerException. Accesses the session.
def logged_in_user(): try: return session['user'] except KeyError: raise NoLoggedInPlayerException()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_id(self):\n return self.game.get_player_id()", "def get_player_id(self):\n\n return self.player_id", "def get_user_id():\n user_id = session.get(\"user_id\")\n return user_id if user_id else None", "def player(self) -> ba.SessionPlayer:\n if not self._sessionplayer:\...
[ "0.69973165", "0.67422014", "0.6620075", "0.659854", "0.65428144", "0.6535855", "0.65328354", "0.6425493", "0.64095396", "0.64027333", "0.63756883", "0.6293833", "0.62712175", "0.626917", "0.6244076", "0.6208488", "0.6201813", "0.61867636", "0.6177927", "0.61625826", "0.61180...
0.8314717
0
Takes a character and returns true if it is a member of
def isHangulSyllable(ch): #Java's Regex had an easy way to do this. No Python equivalent. #Had to invent this if len(ch) != 1: #if it isn't 1 character long return None #it's not true nor false #convert to an ordinal number chOrd = ord(ch) if (chOrd < HAN_SYL_START) or (chOrd > HAN_SY...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def character(x):\n if (x==\"a\"or x==\"A\"or x==\"e\"or x==\"E\"or x==\"i\"or x==\"I\"or x==\"o\"or x==\"O\"or x==\"u\"or x==\"U\"):\n return('True')\n else:\n return('False')", "def contains_only_char(s, char):\n for c in s:\n if c != char:\n return False\n return Tr...
[ "0.77714634", "0.7473062", "0.7186228", "0.7002365", "0.6916763", "0.69089603", "0.68920016", "0.6884352", "0.686451", "0.6825574", "0.6806338", "0.67775756", "0.66572624", "0.6602854", "0.65993917", "0.65711564", "0.64836055", "0.64712775", "0.6466193", "0.6457934", "0.64124...
0.0
-1
searches for target in int_list[low..high] and returns index if found If target is not found returns None. If list is None, raises ValueError
def bin_search(target, low, high, int_list): # must use recursion if int_list == None: raise ValueError if high < low: # returns None if target is not found return None midpoint = (high + low) // 2 if int_list[midpoint] == target: return midpoint elif target < int_list[midpoi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_search(target, low, high, int_list): # must use recursion\n if int_list == None:\n raise ValueError\n if len(int_list) == 0:\n return None\n middle = (low + high) // 2\n if low > high or low < 0 or high > len(int_list):\n return None\n elif int_list[middle] == target:\n retur...
[ "0.7804412", "0.7720198", "0.76289344", "0.76268727", "0.7502324", "0.7130288", "0.70608455", "0.7028544", "0.7006331", "0.6906328", "0.6849275", "0.68209505", "0.6819892", "0.67845833", "0.6729195", "0.66912365", "0.66909313", "0.6690363", "0.6678533", "0.6622248", "0.661946...
0.76156706
4
Returns true if the provided coordinates are within the bounding box.
def contains_point(self, lat: float, lon: float) -> bool: return self.min_lat <= lat <= self.max_lat and self.min_lon <= lon <= self.max_lon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_inside(self, coordinates: tuple) -> bool:\n if len(coordinates) != 2:\n raise IndexError(\"Coordinates consist of x and y\")\n x, y = coordinates\n if (self.MIN_X <= x <= self.MAX_X) and (self.MIN_Y <= y <= self.MAX_Y):\n return True\n else:\n ret...
[ "0.80211234", "0.7779522", "0.76931393", "0.7441385", "0.743026", "0.7398471", "0.7348784", "0.7188164", "0.6998334", "0.699473", "0.6924071", "0.69202334", "0.6863342", "0.6839943", "0.68306124", "0.6825502", "0.6803321", "0.6795264", "0.6791611", "0.67864364", "0.67564714",...
0.65755284
34
Tests the from_json and to_json methods.
def test_json_decode_error(self): with self.assertRaises(json.JSONDecodeError): int_t.Ind.from_json('') with self.assertRaises(ValueError): int_t.Ind.from_json('{}') with self.assertRaises(ValueError): int_t.Ind.from_json('[{}]')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_json(self):\n\t\tdecoded = json.loads(json.dumps(self.filter.to_js_obj()))\n\t\tself.assertIsNotNone(decoded, \"JSON conversion failed!\")\n\t\tself.assertEqual(self.filter.to_js_obj(), decoded, \"JSON conversion mismatch!\")", "def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\",...
[ "0.76710236", "0.7576657", "0.7565882", "0.7563129", "0.7324304", "0.7088804", "0.7041937", "0.70374084", "0.7008344", "0.6976768", "0.6945547", "0.69317913", "0.68881863", "0.6828878", "0.6789783", "0.67472816", "0.67433286", "0.67284566", "0.6717227", "0.67057693", "0.66640...
0.0
-1
Returns the last block in the blockchain.
def get_previous_block(self): return self.chain[-1] # Return the previous block
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_block(self) -> Block:\n return self.blockchain[-1]", "def get_last_block():\n if namoto_length < 1:\n return None\n\n return namoto_blockchain[-1]", "def get_last_block(self):\n cmd = \"\"\" SELECT * FROM %s WHERE %s = (SELECT MAX(%s) FROM %s); \"\"\" %(\n ...
[ "0.9420144", "0.8898903", "0.87243974", "0.85830927", "0.8565772", "0.84670174", "0.84227484", "0.84227484", "0.81859076", "0.8148457", "0.8101499", "0.80762583", "0.80687", "0.7963367", "0.77858853", "0.77858853", "0.77858853", "0.77858853", "0.77858853", "0.7744404", "0.764...
0.7188496
24
Validates a new block by calculating a nonce that helps meeting the condition on the current_hash.
def proof_of_work(self, block, previous_hash): # Start WIth Nonce = 1 nonce = 1 # Loop Till You Find A Valid Nonce check_proof = False while check_proof is False: block['nonce'] = nonce hash_operation = self.hash(block) if hash_operat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_block(block_data, block_hash, block_nonce):\n hashing_value = block_data + str(block_nonce)\n new_hash = hashlib.sha256(hashing_value.encode()).hexdigest()\n if new_hash == block_hash:\n return True\n else:\n return False", "def test_validate_chain_wit...
[ "0.70581895", "0.70419157", "0.6828849", "0.66830283", "0.6541484", "0.6394716", "0.6358686", "0.6330687", "0.6299188", "0.6294337", "0.62555134", "0.62304306", "0.6188883", "0.6169669", "0.61071706", "0.6085057", "0.6075192", "0.605347", "0.60467035", "0.6000649", "0.5989893...
0.7016765
2
Calculates if the chain is consistent. checks if previous_hash of current block is equal to current_hash of previous_block checks if current_hash of each block matches the required condition on hashes
def is_chain_valid(self, chain): previous_block = chain[0] block_index = 1 while block_index < len(chain): block = chain[block_index] if block['previous_hash'] != self.hash(previous_block): return False previous_proof = previous_block['p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chainIsValid(self):\n for i in range(1, len(self.blocks)):\n prev_block = self.blocks[i-1]\n cur_block = self.blocks[i]\n if cur_block.header['prevBlockH'] != getHashBlock(prev_block):\n return False\n return True", "def valid_chain(self, chain):\...
[ "0.7236664", "0.71145827", "0.7054852", "0.6712324", "0.6658719", "0.66484797", "0.66271937", "0.6616752", "0.65944225", "0.6594395", "0.65580916", "0.6554838", "0.6509063", "0.64771366", "0.6446145", "0.62013686", "0.61214393", "0.6096919", "0.609681", "0.6094894", "0.607979...
0.6351599
15
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
58
Return path of file1 when expressed relative to file0. For instance, if file0 is "/path/to/file0" and file1 is "../for/file1" then what is returned is "/path/for/file1".
def lpath(file0, file1): return os.path.abspath(os.path.join(os.path.dirname(file0), file1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relative_path(self, file_path):\n file_path = os.path.abspath(file_path)\n if self.base_dir is not None:\n file_path = file_path.replace(os.path.abspath(self.base_dir), \"\")\n assert file_path[0] == \"/\"\n file_path = file_path[1:]\n return file_path", "def...
[ "0.76406187", "0.73087406", "0.7261331", "0.71288586", "0.70470864", "0.7014023", "0.69516146", "0.68772894", "0.6867992", "0.6851884", "0.6837841", "0.68361247", "0.68306667", "0.68061984", "0.6803794", "0.6787071", "0.67814815", "0.6777495", "0.67661697", "0.6759782", "0.67...
0.7623629
1
Pad the dataset. This could be optimized by defining a Dataset class and padding at the batch level, but this is simpler.
def pad_dataset(dataset, padding=0): max_l = max(len(x) for x in dataset["input_ids"]) for name in PADDED_INPUTS: dataset[name] = [x + [padding if name != "lm_labels" else -100] * (max_l - len(x)) for x in dataset[name]] return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pad_data(data, pad_length, padding_type='same'):\n\n # get the sampling period (or distance between sampling points, for PLUX devices this is always 1)\n # it is assumed that the signals are equidistantly sampled therefore only the distance between to sampling points\n # is needed to calculate the sa...
[ "0.6750966", "0.65961164", "0.6389406", "0.6370313", "0.62408537", "0.6177124", "0.61012834", "0.6080198", "0.6012321", "0.60089046", "0.60048467", "0.59631014", "0.5960703", "0.59591854", "0.59249216", "0.5874922", "0.585626", "0.5854407", "0.5846775", "0.58382046", "0.58143...
0.7159551
0
This function takes a data array and sums nxn pixels along the row and column data
def sumpxp(data, num_pixels): dat_shape = np.array(np.shape(data)) dat_shape[-2] = int(dat_shape[-2] / num_pixels) # Reduce size by num_pixels in the row and column directions dat_shape[-1] = int(dat_shape[-1] / num_pixels) ndata = np.zeros(dat_shape) n = num_pixels for row in np.arange(dat_sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gu_sum(a, **kwds):\n return np.sum(np.ascontiguousarray(a), axis=-1, **kwds)", "def Sum2d(a):\n return(np.sum(np.sum(a,-1),-1))", "def sumModelIntoImage(x, y, nx, ny, modelData, imageData):\r\n imageData[y:y+ny,x:x+nx] += modelData", "def total2d(arr: List[List[int]]) -> int: # _8 [✅]\n # **...
[ "0.6675652", "0.66498816", "0.6345683", "0.6291936", "0.62697345", "0.62216854", "0.6163321", "0.6089529", "0.60623467", "0.6058033", "0.60481656", "0.60384005", "0.60260755", "0.60223114", "0.60081375", "0.59613144", "0.5917837", "0.58990484", "0.58897966", "0.58834064", "0....
0.7301502
0
Get the address associated with a network interface.
def get_address(ifname='ib0'): # https://stackoverflow.com/a/24196955/1889400 ifname = ifname.encode() s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]) )[20:24])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ip_address(interface):\n try:\n import netifaces\n detail = netifaces.ifaddresses(interface)\n if netifaces.AF_INET in detail:\n ip = detail[netifaces.AF_INET][0]['addr']\n else:\n ip = 'unavailable'\n if netifaces.AF_LINK in detail:\n ...
[ "0.74830973", "0.7452326", "0.699928", "0.69339585", "0.6895378", "0.68832433", "0.68155605", "0.68155164", "0.6748981", "0.67116565", "0.6679073", "0.6654406", "0.66462445", "0.6605317", "0.6567548", "0.6513248", "0.6513248", "0.65109855", "0.6500422", "0.6500422", "0.649995...
0.781674
0
Total number of cells in the mesh.
def nC(self): return int(self._n.prod())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Ncells(self):\n return len(self.cells)", "def cells_total(self):\n return self._inv.get(\"cells\", len(self))", "def ncells(self):\n return self.izone.size", "def num_cells(self):\n if hasattr(self, '__num_cells__'):\n return self.__num_cells__\n if self.x is...
[ "0.7968279", "0.7946945", "0.7878516", "0.78045446", "0.7584841", "0.7583262", "0.7577394", "0.73872674", "0.7274862", "0.7221469", "0.72176516", "0.72013706", "0.71804786", "0.71333545", "0.7033338", "0.6943171", "0.69077104", "0.6903873", "0.6898129", "0.68915254", "0.68276...
0.0
-1
Total number of edges in each direction
def vnE(self): return np.array( [x for x in [self.nEx, self.nEy, self.nEz] if x is not None], dtype=int )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_count(self):\r\n return int(sum(self.degree(node) for node in range(self.size))/2)", "def num_edges(self):\n return sum(1 for _ in self.iteredges())", "def num_edges(self):\r\n return len(self.__generate_edges())", "def return_num_edges(self):\n return sum(map(lambda x: l...
[ "0.82478994", "0.8132558", "0.8074316", "0.80260277", "0.8012327", "0.78834563", "0.78735197", "0.786722", "0.7837752", "0.7825469", "0.7749021", "0.7700225", "0.7568558", "0.75618064", "0.75071615", "0.7491844", "0.74794656", "0.7471305", "0.7465161", "0.74591136", "0.741877...
0.0
-1
Total number of edges.
def nE(self): return int(self.vnE.sum())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_edges(self):\n return sum(1 for _ in self.iteredges())", "def edge_count(self):\r\n return int(sum(self.degree(node) for node in range(self.size))/2)", "def num_edges(self):\r\n return len(self.__generate_edges())", "def num_edges(self):\n return sum(len(v.adj) for v in se...
[ "0.88591576", "0.8758475", "0.8695986", "0.8637306", "0.86284786", "0.85971624", "0.8595605", "0.8575558", "0.8528135", "0.8518833", "0.84606576", "0.84228784", "0.83217335", "0.830935", "0.8253994", "0.8229075", "0.8219974", "0.821725", "0.82130784", "0.81804043", "0.8169467...
0.0
-1
Number of zedges in each direction
def vnEz(self): if self.dim < 3: return None return np.array( [x for x in [self.nNx, self.nNy, self.nCz] if x is not None], dtype=int )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_edges(self):\n return (self.n * (self.L.size() - 1) - self.num_loop_vertices()) // (1 + int(not self.variant.is_bipartite()))", "def num_edges(self):\r\n return len(self.__generate_edges())", "def Nedges(self):\n return len(self.edges)", "def _number_of_edges(self):\n if s...
[ "0.7016195", "0.69788545", "0.6948818", "0.68809575", "0.6860335", "0.6689955", "0.6594211", "0.65476155", "0.64935917", "0.64744234", "0.64734334", "0.64658767", "0.6424113", "0.64205396", "0.64181125", "0.6404706", "0.6392793", "0.63423246", "0.63381714", "0.63374144", "0.6...
0.0
-1
`r` is a quick reshape command that will do the best it can at giving you what you want. For example, you have a face variable, and you want the x component of it reshaped to a 3D matrix.
def r(self, x, xType='CC', outType='CC', format='V'): allowed_xType = [ 'CC', 'N', 'F', 'Fx', 'Fy', 'Fz', 'E', 'Ex', 'Ey', 'Ez' ] assert ( type(x) == list or isinstance(x, np.ndarray) ), "x must be either a list or a ndarray" assert xType in allowed_xType...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape_tensor3d(self, x):\n if self.dim_ordering == 'th':\n tx = K.reshape(x, (-1, self.nb_filter, self.cols * self.rows))\n else:\n tx = K.reshape(x, (-1, self.cols * self.rows, self.nb_filter))\n tx = K.transpose(tx, (0,2,1))\n if self.cov_mode == 'chann...
[ "0.5992309", "0.5895396", "0.5892568", "0.58714", "0.5836171", "0.5660246", "0.56011456", "0.5587338", "0.5520164", "0.5497206", "0.53877044", "0.5345982", "0.5274938", "0.52632314", "0.5262629", "0.52526605", "0.52453005", "0.5235259", "0.5228808", "0.5213761", "0.5212695", ...
0.0
-1
Test subscription to topics.
async def test_subscribe_topics( hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator, caplog: pytest.LogCaptureFixture, ) -> None: await mqtt_mock_entry() calls1 = [] @callback def record_calls1(*args): """Record calls.""" calls1.append(args) calls2 = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_subscribe(self):\n self.service.clientConnected()\n self.service.subscribe(u'url', None)\n pubsubClient = self.service.pubsubClient\n self.assertIn(u'url', pubsubClient.subscriptions)", "def test_get_subscriptions(self):\n pass", "def test_topic_check(self):\n ...
[ "0.7485724", "0.7253316", "0.72522086", "0.71548617", "0.7128559", "0.7040438", "0.6937439", "0.69305605", "0.6927451", "0.69194883", "0.68859816", "0.6884272", "0.68834466", "0.6810721", "0.6789662", "0.67592996", "0.67377913", "0.6734734", "0.6703352", "0.66881335", "0.6682...
0.6724264
18
Sets the name of this Sales.
def name(self, name): if name is None: raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n self._name = name", "def SetName(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n ...
[ "0.7656196", "0.765202", "0.762534", "0.762534", "0.762534", "0.762534", "0.762534", "0.75409526", "0.7523773", "0.7523773", "0.7519635", "0.75093937", "0.7472127", "0.7463317", "0.7463317", "0.7434818", "0.7434818", "0.73974895", "0.7396507", "0.7366752", "0.7339238", "0.7...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Sales): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.80885184", "0.80885184", "0.805514", "0.7983044", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8457167", "0.8393036", "0.81455255", "0.8139734", "0.81333447", "0.8094964", "0.8093362", "0.8093362", "0.8093362", "0.80863476", "0.80863476", "0.8077286", "0.8077286", "0.806682" ]
0.0
-1
Check if p1 is on a straight line between p0 and p2.
def should_skip(p0, p1, p2): if p0 is None: return False if p1 is None: return False if p2 is None: return False indices = range(len(p1)) # Calculate vectors for p1 and p2 relative to p0. v1 = [p1[i] - p0[i] for i in indices] v2 = [p2[i] - p0[i] for i in indices] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on_line(p0, p1, p2, threshold = 0.01):\n p0, p1, p2 = map(lambda tup : np.array(tup[:2]), [p0, p1, p2])\n p1 -= p0\n p2 -= p0\n return abs((p1[0] / p1[1]) - (p2[0] / p2[1])) < threshold", "def isPointOnLine(node1, node2, point):\n m, b, d = geometry.lineSpec(node1, node2)\n if d ...
[ "0.8139698", "0.7441799", "0.7357194", "0.7341654", "0.7293016", "0.72180444", "0.7157781", "0.7011034", "0.6996131", "0.69865733", "0.6985416", "0.69676125", "0.69424564", "0.6941352", "0.67800075", "0.67494786", "0.6689061", "0.66684765", "0.6667154", "0.6662735", "0.663003...
0.70717645
7
Get a list of all possible pairs (as tuples) of the values in the lists 'a' and 'b', where the first component comes from list 'a' and the second component comes from list 'b'.
def get_all_possible_pairs(self, a, b): return itertools.product(a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_pairs(elements):\n if len(elements) < 2:\n return []\n elif len(elements) == 2:\n return [(elements[0], elements[1])]\n else:\n new_pairs = []\n for elt in elements[1:]:\n new_pairs.append((elements[0], elt))\n return all_pairs(elements[1:]) + new_pair...
[ "0.70486933", "0.68660367", "0.6829348", "0.68201494", "0.6729476", "0.66995496", "0.665841", "0.65015954", "0.64830375", "0.6433741", "0.6413892", "0.6355396", "0.6344595", "0.63429976", "0.6339451", "0.62937254", "0.6275663", "0.62590724", "0.62525123", "0.62457293", "0.621...
0.803272
0
Get a list of all arcs/constraints going to/from variable 'var'. The arcs/constraints are represented as in get_all_arcs().
def get_all_neighboring_arcs(self, var): return [ (i, var) for i in self.constraints[var] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self, var):\n # This is just to make this method technically correct in all contexts we want to support (i.e., we need to\n # account for the possibility that there will be unary constraints).\n arcs = [key for key in self.__constraints.keys() if type(key) is not Variable]\n ...
[ "0.6604165", "0.6552702", "0.64517665", "0.62111574", "0.55840194", "0.5542132", "0.5225651", "0.51451266", "0.51275593", "0.50245434", "0.49859697", "0.49558312", "0.49255255", "0.4912133", "0.49105635", "0.48816848", "0.48699403", "0.48699403", "0.4843426", "0.48347345", "0...
0.7036358
0
Retrieve ids of wrf_v3 stations, for each station name
def get_wrf_stations(pool): wrfv3_stations = {} connection = pool.connection() try: with connection.cursor() as cursor: sql_statement = "SELECT `id`, `name` FROM `station` WHERE `id` like %s" row_count = cursor.execute(sql_statement, "11_____") if row_count > 0:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n return station_list", "def stations():\n\n # Query all Stations\n station_results = session.query(Station.station).all()\n\n # Convert list of tuples into normal list\n all_station_names = list(np.ravel(station_results))\n\n return jsonify(all_station_names)", "def station...
[ "0.7010976", "0.6608144", "0.65884876", "0.6508025", "0.641941", "0.6408975", "0.63677365", "0.6330345", "0.6285517", "0.6240199", "0.62001663", "0.61584425", "0.61482376", "0.61459655", "0.61434114", "0.6095072", "0.60893315", "0.60610336", "0.60571307", "0.6049387", "0.6037...
0.65545374
3
Retrieve ids of wrf_v3 stations, for each station name
def get_flo2d_output_stations(pool, flo2d_model): flo2d_output_stations = {} id_pattern = '{}_____'.format((str(flo2d_model.value)).split('0')[0]) connection = pool.connection() try: with connection.cursor() as cursor: sql_statement = "SELECT * FROM `station` WHERE `id` like %s" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n return station_list", "def stations():\n\n # Query all Stations\n station_results = session.query(Station.station).all()\n\n # Convert list of tuples into normal list\n all_station_names = list(np.ravel(station_results))\n\n return jsonify(all_station_names)", "def station...
[ "0.7011841", "0.6609385", "0.6589842", "0.6553159", "0.6508176", "0.64205176", "0.6409771", "0.6367892", "0.6330549", "0.6287591", "0.6239866", "0.6199599", "0.6159755", "0.61481607", "0.6146039", "0.6143359", "0.60946196", "0.6089036", "0.6060081", "0.6056984", "0.6048686", ...
0.54241747
70
Given a set of examples (mappings from variables to values) for the root context, produce a set of examples that include all variables in this context.
def instantiate_examples(self, examples : [dict]) -> [dict]: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_words(self, examples):\n\n def _insert(iterable):\n for w in iterable:\n w = TokenDictionary.normalize(w)\n if valid_words and w not in valid_words:\n continue\n words.add(w)\n\n if self.restrict_vocab and self.embedd...
[ "0.5601533", "0.529861", "0.51142555", "0.50601894", "0.5011787", "0.50093734", "0.50048053", "0.49980906", "0.49904972", "0.49619225", "0.4940317", "0.49190584", "0.49134195", "0.48841107", "0.48675543", "0.48489857", "0.4816264", "0.48139927", "0.48135144", "0.4810642", "0....
0.4350998
98
Repeat a string to a certain length.
def repeat_str(str_to_repeat, repeat_length): quotient, remainder = divmod(repeat_length, len(str_to_repeat)) return str_to_repeat * quotient + str_to_repeat[:remainder]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repeat_to_length(string_to_expand: str, length: int) -> str:\n return (string_to_expand * (int(length / len(string_to_expand)) + 1))[:length]", "def expand_repeat(string, size):\n return_string = ''\n i = 0\n while len(return_string) < size:\n return_string += string[i]\n i += 1\n...
[ "0.86184907", "0.8092073", "0.7757371", "0.7460892", "0.7029109", "0.70176107", "0.70083284", "0.6998174", "0.67973435", "0.6776801", "0.67380875", "0.6730819", "0.6726489", "0.66409695", "0.6567197", "0.6459822", "0.64488477", "0.6437846", "0.6424288", "0.640857", "0.6379663...
0.8141581
1
This finds the unique elements of the list listinput.
def uniq(listinput): """ This will be provided for the student. """ output = [] for x in listinput: if x not in output: output.append(x) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(input_list):\n output = []\n for item in input_list:\n if item not in output:\n output.append(item)\n return output", "def unique(input_list): \n try:\n # intilize a null list \n unique_list = [] \n # traverse for all elements \n for x in inpu...
[ "0.8092806", "0.80685073", "0.77702373", "0.76451296", "0.75863427", "0.75239235", "0.7414543", "0.7356349", "0.7351221", "0.7134931", "0.71053547", "0.71051925", "0.70781964", "0.7061258", "0.70586836", "0.70357156", "0.70247406", "0.69345015", "0.6919746", "0.6888033", "0.6...
0.8458101
0
Returns true if the coordinates are located in the box.
def within(self, lon: np.ndarray, lat: np.ndarray) -> np.ndarray: lon = normalize_longitude(lon, lon_min=self.min_corner.lon) lon_is_in_range = (lon >= self.min_corner.lon) | ( lon <= self.max_corner.lon ) if self.max_corner.lon < self.min_corner.lon else ( lon >= self.mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_inside(self, x: int, y: int) -> bool:\n pass", "def in_box(coords, box):\n\tif box[0][0] < coords[0] < box[1][0] and box[1][1] < coords[1] < box[0][1]:\n\t\treturn True\n\treturn False", "def in_box(coords, box):\n if box[0][0] < coords[0] < box[1][0] and box[1][1] < coords[1] < box[0][1]:\n ...
[ "0.8101981", "0.7973212", "0.7939156", "0.78314674", "0.77601695", "0.7561605", "0.7449169", "0.73730767", "0.73394024", "0.7331787", "0.7312731", "0.73022693", "0.7288159", "0.7229022", "0.71910954", "0.71238005", "0.71143645", "0.71143645", "0.7107716", "0.71042746", "0.706...
0.0
-1
Randomly initalize weights in range [randInitRange, randInitRange]. If randInitRange is not defined it will default to 0.1.
def initializeWeights(mlModel): randInitRange = mlModel.randInitRange numFeatures = mlModel.features.shape[1] mlModel.weights = np.random.rand(numFeatures+1) * 2 * randInitRange - randInitRange return mlModel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_weight_initialization(self, mean=0, stddev=1):\n self.slp_weights = np.random.normal(mean, stddev, size=(self.n_rbfs, self.n_targets))", "def WeightInitializer():\n return np.random.uniform(-1, 1)", "def init_weights(self, init_w=3e-3):\n self.mean_linear.weight.data.uniform_(-init...
[ "0.7418166", "0.7382161", "0.72869277", "0.72549444", "0.72549444", "0.723176", "0.7184201", "0.71087354", "0.70758444", "0.70436406", "0.6980032", "0.69411737", "0.692962", "0.692323", "0.6883192", "0.685763", "0.6852807", "0.6852106", "0.6823921", "0.68182164", "0.6771583",...
0.7183141
7
Initialize weights of the neural network based on the netArchitechture and the randInitRange. If randInitRange is not defined it will default to 0.1.
def neuralNetInitializeWeights(mlModel): randInitRange = mlModel.randInitRange netArchitecture = mlModel.netArchitecture weights = [] if netArchitecture[0] != mlModel.features.shape[1]: raise WeightsError("Number of features does not match the input layer") for i in range(len(netArchitect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self, init_w=3e-3):\n self.mean_linear.weight.data.uniform_(-init_w, init_w)\n self.mean_linear.bias.data.uniform_(-init_w, init_w)\n self.log_std_linear.weight.data.uniform_(-init_w, init_w)\n self.log_std_linear.bias.data.uniform_(-init_w, init_w)", "def init_weight...
[ "0.7537786", "0.7433792", "0.7433792", "0.74195653", "0.73342377", "0.7327501", "0.73236305", "0.73209804", "0.7309168", "0.7306507", "0.724695", "0.72423273", "0.7234658", "0.720123", "0.71851385", "0.7152099", "0.71298426", "0.7109339", "0.7101656", "0.71015656", "0.7094713...
0.73702073
4
It makes an excel with a comparative table of each model for any dataset and forecast horizon
def save_comparative_tables(result_best_models, metric): models = result_best_models['MODEL'].unique() datasets = result_best_models['DATASET'].unique() forecast_horizons = result_best_models['FORECAST_HORIZON'].unique() if not os.path.exists('../results_best/tables/'): os.mkdir('../results_bes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_modelisation(X,y,test_size,model_function_list) :\n models = model_function_list\n\n output = pd.DataFrame()\n model = []\n RMSE = []\n MAPE = []\n tenth_perc = []\n ninetieth_perc = []\n\n for i in models:\n output_row = pd.DataFrame()\n\n model.append(i)\n\n ...
[ "0.6050912", "0.593428", "0.59274155", "0.59148824", "0.5844537", "0.58373886", "0.58305365", "0.5757386", "0.57527596", "0.5735878", "0.5709148", "0.56830776", "0.5680424", "0.56781507", "0.56567675", "0.5641308", "0.5639103", "0.56383204", "0.5632169", "0.56293184", "0.5623...
0.71319866
0
Check if given file pattern is valid
def check_filepat_valid(config, filepat, modname, objname, indent=''): cnts = [0] * NUMCNTS if pfwdefs.SW_FILEPATSECT not in config: error(indent, "Missing filename pattern definition section (%s)" % (pfwdefs.SW_FILEPATSECT)) cnts[ERRCNT_POS] += 1 elif filepat not in config[pfwdefs.SW_FILE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_string_match(self, pattern, file):\r\n try:\r\n file_open = open(file, 'r')\r\n except:\r\n logging.info(\"file not found\")\r\n return -1\r\n file_data = file_open.read()\r\n ret_out = re.match(pattern, file_data)\r\n if ret_out:\r\n return True, ret_out\r\n...
[ "0.72279024", "0.71820563", "0.69444174", "0.6918655", "0.6857224", "0.68462795", "0.6835265", "0.67865103", "0.6761029", "0.6757765", "0.6702175", "0.66769767", "0.66655153", "0.66565704", "0.66336876", "0.65698004", "0.6517217", "0.6470402", "0.6398867", "0.6390496", "0.635...
0.66748327
12
Validates the URL input
def _is_valid_url(url): regex = re.compile( r'^(?:http|ftp)s?://' # http:// or https:// r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?' r'|[A-Z0-9-]{2,}\.?)|' # domain... r'localhost|' # localhost... r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_url(self):\n pass", "def validate_url(url_in):\n if url_in == \"\":\n error = \"[ERROR] Input is empty\"\n return False\n elif not url_in.startswith(\"https://\"):\n error = \"[ERROR] Input doesn't start with https://\"\n return False\n elif not url_in.sta...
[ "0.8793243", "0.811195", "0.8102895", "0.8016993", "0.8008038", "0.7915512", "0.7911427", "0.7855819", "0.7802123", "0.7778259", "0.77605855", "0.7726275", "0.7595214", "0.75879514", "0.75626284", "0.7533611", "0.7530312", "0.74644804", "0.74334794", "0.7401526", "0.7399682",...
0.6774921
70
Returns all known reports, organized by category. The result is returned as a dict of category strings to lists of report classes.
def get_reports_by_category(): categories = defaultdict(list) for report in ReportMeta.report_catalog: if hasattr(report, 'category'): categories[report.category].append(report) return categories
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_categories():\n return list(sorted(set([rt.category for rt in report_types()])))", "def avail_categories(self):\n # retrieve categories\n categories = self.show_all_categories()\n # for each category, retrieve packages\n output = {}\n for category in categories:\n...
[ "0.6922695", "0.6669009", "0.6354864", "0.6326878", "0.6175287", "0.590381", "0.5897803", "0.5884618", "0.58681256", "0.5866249", "0.5852833", "0.5848685", "0.57954174", "0.57633495", "0.56183666", "0.5611318", "0.55940384", "0.5565866", "0.5547676", "0.5540679", "0.55024534"...
0.85170805
0
Set up view matrix to look from eye to at including perspective
def __init__(self, at=(0, 0, 0), eye=(0, 0, -0.1), lens=None, is_3d=True, scale=1.0): super(Camera, self).__init__() self.at = at self.start_eye = eye # for reset with different lens settings self.eye = [eye[0], eye[1], eye[2]] if lens == None: from pi3d.Display import D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, eye, look_at, up, near, far,\n view_angle_h=45, view_angle_v=45):\n self.near = float(near)\n self.far = float(far)\n # The internally-stored view angles are in radians away from the\n # look vector.\n self.view_angle_h = math.pi*(view_angle_h/2.0)/180\n self.view...
[ "0.68115664", "0.65983886", "0.65658504", "0.6467446", "0.64436364", "0.62924194", "0.62149954", "0.612029", "0.61050147", "0.6036318", "0.6010526", "0.59995294", "0.59935963", "0.59903306", "0.5977555", "0.59671336", "0.5943305", "0.5918184", "0.5880492", "0.5877239", "0.585...
0.6794913
1
point the camera at a point also return the tilt and rotation values
def point_at(self, target=[0.0, 0.0, 10000.0]): if target[0] == self.eye[0] and target[1] == self.eye[1] and target[2] == self.eye[2]: return dx, dy, dz = target[0] - self.eye[0], target[1] - self.eye[1], target[2] - self.eye[2] rot = -degrees(arctan2(dx, dz)) horiz = sqrt(dot([dx,dz], [dx, d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_viewpoint(self, box):\n x, y, z = self.compute_ray(box)\n theta = math.degrees(math.atan2(z, x))\n phi = math.degrees(math.atan2(y, math.hypot(x, z)))\n return theta, phi", "def project_point(self, point: Point3D) -> Point3D:\n x, y, z = point\n cam_x, cam_y, cam_z = self._p...
[ "0.6606755", "0.65296865", "0.6494286", "0.64486533", "0.64089406", "0.64081496", "0.63915175", "0.63787025", "0.6335116", "0.63080686", "0.6288636", "0.6240331", "0.620019", "0.6124981", "0.6059725", "0.6046181", "0.60009855", "0.5992119", "0.5990131", "0.5986032", "0.597655...
0.6192402
13
Rotate camera z axis
def rotateZ(self, angle): if angle: c = cos(radians(angle)) s = sin(radians(angle)) self.mtrx = dot([[c, s, 0, 0], [-s, c, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], self.mtrx) self.rtn[2] = angle ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotateZ(self, *args, **kwargs):\n ...", "def setCameraRotation3D(ang):\n dislin.vup3d(ang)", "def rotateZ(self, ang):\n if ang != 0.0:\n x = self.getX() * cos(ang) - self.getY() * sin(ang)\n y = self.getX() * sin(ang) + self.getY() * cos(ang)\n z = self.get...
[ "0.71595246", "0.71476984", "0.6981467", "0.67711216", "0.67696726", "0.669289", "0.66845125", "0.66845125", "0.66845125", "0.66845125", "0.6670447", "0.6655944", "0.66190344", "0.66025686", "0.65794665", "0.65690136", "0.65438724", "0.6473449", "0.64270407", "0.6419272", "0....
0.6519055
17
Returns the x,y coordinates for a joystick or left gamepad analogue stick. index is the device index and defaults to 0 the first joystick device The values are returned as a tuple. All values are 1.0 to +1.0 with 0.0 being centred.
def get_joystick(self, index=0): return (self.handler.absx[index], self.handler.absy[index])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_joystickR(self, index=0):\r\n #return (self.handler.absz2[index], self.handler.absz[index])\r\n return (self.handler.absx2[index], self.handler.absz2[index])", "def get_joystick3d(self, index=0):\r\n return (self.handler.absx[index], self.handler.absy[index], self.handler.absz[index])", "def g...
[ "0.6382704", "0.62094563", "0.61539036", "0.6078585", "0.5962114", "0.5446253", "0.5430691", "0.5425712", "0.54168797", "0.540159", "0.53612673", "0.5342636", "0.5342636", "0.5239055", "0.5218583", "0.5213948", "0.51964027", "0.5139941", "0.5134856", "0.51334983", "0.5113646"...
0.75071704
0
Returns the x,y,z coordinates for a joystick or left gamepad analogue stick index is the device index and defaults to 0 the first joystick device The values are returned as a tuple. All values are 1.0 to +1.0 with 0.0 being centred.
def get_joystick3d(self, index=0): return (self.handler.absx[index], self.handler.absy[index], self.handler.absz[index])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_joystick(self, index=0):\r\n return (self.handler.absx[index], self.handler.absy[index])", "def get_joystickB3d(self, index=0):\r\n return (self.handler.absx2[index], self.handler.absy2[index], self.handler.absz2[index])", "def get_joystickR(self, index=0):\r\n #return (self.handler.absz2[inde...
[ "0.733097", "0.6926539", "0.67267525", "0.6412484", "0.60119444", "0.5938673", "0.5808197", "0.5796476", "0.5791763", "0.5772281", "0.57579064", "0.5679211", "0.56649256", "0.56605333", "0.5619771", "0.5618774", "0.55241567", "0.552058", "0.55110335", "0.55110335", "0.5479232...
0.71450144
1
Returns the x,y coordinates for a joystick hat or gamepad direction pad index is the device index and defaults to 0 the first joystick device The values are returned as a tuple. All values are 1.0 to +1.0 with 0.0 being centred.
def get_hat(self, index=0): return (self.handler.abshatx[index], self.handler.abshaty[index])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_joystick(self, index=0):\r\n return (self.handler.absx[index], self.handler.absy[index])", "def get_joystick_axis_values(joystick):\n\n pygame.event.pump() # this has to be called in order to get most recent input from joystick\n axis0 = joystick.get_axis(0)\n axis1 = joystick.get_axis(1)\n ...
[ "0.7395278", "0.63431215", "0.6201393", "0.6164982", "0.61054176", "0.60588855", "0.6023117", "0.599978", "0.5937999", "0.5934032", "0.59101266", "0.59101266", "0.58969724", "0.5859743", "0.5859631", "0.5817194", "0.5798631", "0.5790912", "0.57577944", "0.5744002", "0.5741098...
0.0
-1
Returns the y coordinate of the top of this object
def top_y(self): return self.position.y + self.size.y + self.bulk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(self):\n return self.top", "def top(self):\n return self.points['topRight'].y", "def top(self):\n return self.points['topRight'].y", "def _rect_top(self):\n\treturn max(self.y, self.y + self.h)", "def getAbsoluteTop(self):\n return self.canvas.getAbsoluteTop()", "def top...
[ "0.86444277", "0.835272", "0.835272", "0.8070652", "0.7988595", "0.7924237", "0.791616", "0.78804255", "0.77704275", "0.7710924", "0.760396", "0.7578028", "0.7550815", "0.7537608", "0.7535775", "0.74888664", "0.74401265", "0.74147296", "0.74147296", "0.74139225", "0.74079454"...
0.88236994
0
Returns the y coordinate of the top of this object
def bottom_y(self): return self.position.y - self.size.y - self.bulk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_y(self):\r\n return self.position.y + self.size.y + self.bulk", "def y(self):\n return self.top", "def top(self):\n return self.points['topRight'].y", "def top(self):\n return self.points['topRight'].y", "def _rect_top(self):\n\treturn max(self.y, self.y + self.h)", "def...
[ "0.88236994", "0.86444277", "0.835272", "0.835272", "0.8070652", "0.7988595", "0.7924237", "0.791616", "0.78804255", "0.77704275", "0.7710924", "0.760396", "0.7578028", "0.7550815", "0.7537608", "0.7535775", "0.74888664", "0.74401265", "0.74147296", "0.74147296", "0.74139225"...
0.7390034
22
Returns size of this object along the x axis its width
def w(self): return self.size.x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(self) -> int:\n return self._obj[self.x_dim].size", "def width(self):\n return self.x.max() - self.x.min()", "def xsize(self):\n bbox = self.bbox\n return bbox[1][0] - bbox[0][0]", "def width(self):\n return self.maxx - self.minx", "def width(self):\n ret...
[ "0.84661037", "0.79602766", "0.7873952", "0.7802111", "0.77964836", "0.77902585", "0.77818394", "0.77640986", "0.77640986", "0.77640986", "0.77640986", "0.77640986", "0.77640986", "0.77640986", "0.7755631", "0.76492596", "0.762933", "0.7616778", "0.7581193", "0.7579164", "0.7...
0.7489819
37
Returns size of this object along the z axis its depth
def d(self): return self.size.z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_zdim(self):\n return self.decoder.get_input_info_dict()['latent_vector'].get_shape()[1]", "def get_size(self):\n return self._surf.get_size()", "def n_z(self, level):\n resolution = self.resolution(level)\n return (self.z_extent // resolution + 63) // 64", "def getDepth(se...
[ "0.72195715", "0.717912", "0.7148249", "0.707201", "0.69629616", "0.6953267", "0.69461256", "0.69129324", "0.68154395", "0.679373", "0.67700297", "0.6717509", "0.6633299", "0.65712196", "0.65712196", "0.65369344", "0.6510876", "0.6441936", "0.64334875", "0.64195246", "0.64052...
0.76166177
0
Returns true if the current ObjectCuboid overlaps the given ObjectCuboid. If the pos argument is specified then it is used as the position of the given ObjectCuboid instead of its actual position. Clear as mud?
def Overlaps(self, o, pos=None): if pos == None: pos = o.position return _overlap(self.position.x-self.bulk, self.size.x+2*self.bulk, pos.x-o.bulk, o.size.x+o.bulk*2) and \ _overlap(self.position.y-self.bulk, self.size.y+2*self.bulk, pos.y-o.bulk, o.size.y+o.bulk*2) and \ _overlap(self.po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_collision_point(self, pos):\n x, y = pos\n return sqrt((self.x - x)**2 + (self.y - y)**2) < self.r", "def contains ( self, pos ):\n # make sure xmin is minimum etc\n xmin = min(self.x_min,self.x_max)\n xmax = max(self.x_min,self.x_max)\n ymin = min(self.y_min,s...
[ "0.6247113", "0.62427634", "0.6214551", "0.6194165", "0.61687857", "0.61655825", "0.61655825", "0.6108191", "0.6026513", "0.6025086", "0.5973817", "0.5951547", "0.59384465", "0.593181", "0.5931385", "0.59180003", "0.58754355", "0.58574116", "0.5849639", "0.5847656", "0.581632...
0.68430316
0
Returns a list of the objects that would overlap with the current oject, if the current object was at the given position. (With the exception of the current oject of course.) This can be used for any moving object to ensure that its proposed new position is available, or maybe to determine when a missile should explode...
def CollisionList(self, p): if not isinstance(p, Position): raise TypeError r = list(filter(lambda x: x.Overlaps(self,p), type(self).objectlist)) try: r.remove(self) except ValueError: pass return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Overlaps(self, o, pos=None):\r\n if pos == None:\r\n pos = o.position\r\n return _overlap(self.position.x-self.bulk, self.size.x+2*self.bulk, pos.x-o.bulk, o.size.x+o.bulk*2) and \\\r\n _overlap(self.position.y-self.bulk, self.size.y+2*self.bulk, pos.y-o.bulk, o.size.y+o.bulk*2) and \\\r\n ...
[ "0.6450959", "0.59854996", "0.5985028", "0.58667994", "0.5841319", "0.58152544", "0.5758559", "0.57408977", "0.5638831", "0.56336987", "0.5615778", "0.56134063", "0.56134063", "0.55797374", "0.555257", "0.5547501", "0.5545152", "0.5542544", "0.54738975", "0.54651654", "0.5451...
0.6432514
1
Set the shader, textures, ntiles and reflection strength
def set_draw_details(self, details): for x in range(len(self.model)): self.model[x].set_draw_details(details[x][0], details[x][1], details[x][2], details[x][3], details[x][4], details[x][5])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_draw_details(self, shader, textures, ntiles=0.0, shiny=0.0,\r\n umult=1.0, vmult=1.0):\r\n self.shader = shader\r\n self.textures = textures # array of Textures\r\n self.unib[0] = ntiles\r\n self.unib[1] = shiny\r\n self.unib[6] = umult\r\n self.unib[7] = vmult", "...
[ "0.63463765", "0.6016541", "0.5822438", "0.58025545", "0.5705022", "0.5656385", "0.56423855", "0.5615826", "0.55935204", "0.5559648", "0.5545586", "0.5525513", "0.5523702", "0.55001163", "0.54442716", "0.54426306", "0.5410915", "0.5366988", "0.53337467", "0.5324956", "0.53226...
0.0
-1
Set alpha for this Shape only
def set_alpha(self, alpha=1.0): self.unif[17] = alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_alpha(self, alpha):\n if alpha < 0 or alpha > 255:\n raise ValueError(\"alpha must be betweeen 0 and 255\")\n\n self.alpha = alpha\n self.draw_alpha()", "def set_alpha(self, value: Optional[int], flags: int = 0) -> 'BaseImage':\n if value is None:\n self....
[ "0.7785805", "0.7527636", "0.73664", "0.72577935", "0.7209225", "0.7077412", "0.7074581", "0.6936673", "0.68783706", "0.6808748", "0.6795584", "0.6794185", "0.6718499", "0.6704875", "0.66129816", "0.66094005", "0.65802604", "0.65102905", "0.64902186", "0.6401874", "0.6375831"...
0.7335106
3
Get value of alpha
def alpha(self): return self.unif[17]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha(self) -> float:\n return self._alpha", "def alpha(self):\n return self._alpha", "def alpha(self):\n return self._alpha", "def alpha(self):\n return self._alpha", "def pvalue_alpha(self):\n return self._pvalue_alpha", "def Alpha(self):\r\n return self._a...
[ "0.81163657", "0.8060889", "0.8060889", "0.8060889", "0.79178137", "0.78687865", "0.77970356", "0.768784", "0.761837", "0.759089", "0.7519703", "0.7138057", "0.7074408", "0.70429134", "0.70365644", "0.7017391", "0.6931069", "0.69097304", "0.6893535", "0.68860793", "0.68855804...
0.75813633
10
Return a tuple of c_char, converted from a list of Python variables.
def c_chars(x): return (c_char * len(x))(*x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cast_strlist_to_C(py_strlist):\n c_strarr = (str_t * len(py_strlist))()\n c_strarr[:] = py_strlist\n return c_strarr", "def list_of_strings_to_c_string_array(l):\n c_strings = (ctypes.c_char_p*(len(l)))()\n for i, s in enumerate(l):\n if s == None:\n c_strings[i] = None\n ...
[ "0.63724476", "0.6066065", "0.5874403", "0.5874403", "0.5737967", "0.56486034", "0.5514752", "0.5414978", "0.53613776", "0.52976644", "0.51583934", "0.5154112", "0.5140265", "0.5135997", "0.5132653", "0.5046778", "0.50133514", "0.50018656", "0.49449435", "0.49062797", "0.4897...
0.6160993
1
Return a tuple of c_int, converted from a list of Python variables.
def c_ints(x): return (c_int * len(x))(*x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_comute_argtype(num_nd, num_nd_write):\n ret = [_xc_func_p, ctypes.c_size_t]\n ret += [_ndptr] * num_nd\n ret += [_ndptr_w] * num_nd_write\n return tuple(ret)", "def data_to_ctypes(data: Any) -> Tuple[int, Any]:\n if isinstance(data, bytes):\n return len(data), data\n else:\n ...
[ "0.57238466", "0.5699896", "0.5677215", "0.5648148", "0.5554329", "0.5514703", "0.5500538", "0.54758656", "0.54752374", "0.54094934", "0.53709894", "0.53329355", "0.5324861", "0.5317093", "0.53086394", "0.53008527", "0.5277854", "0.5249387", "0.5230646", "0.5201809", "0.51981...
0.6533995
0
Return the magnitude (root mean square) of the vector.
def magnitude(*args): return sqrt(dot(args, args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v))", "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_of_vector(v):\n return ...
[ "0.8770935", "0.87542593", "0.8718599", "0.8690986", "0.85098773", "0.8480837", "0.8422488", "0.83830833", "0.802506", "0.7958457", "0.79426295", "0.7931806", "0.7804219", "0.7776085", "0.77506346", "0.736271", "0.7287717", "0.7280344", "0.72139025", "0.7174469", "0.71651584"...
0.71341777
22
Return the dot product of two vectors.
def vec_dot(x, y): return sum(a * b for a, b in zip(x, y))
{ "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(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", ...
[ "0.8790232", "0.8786078", "0.8654043", "0.86296654", "0.8616804", "0.8597666", "0.8593395", "0.85411805", "0.8515717", "0.8456173", "0.84488493", "0.8437437", "0.84085125", "0.8294503", "0.8294015", "0.8289304", "0.8270298", "0.82441705", "0.8219888", "0.8182346", "0.8161642"...
0.85162663
8
Return the cross product of two vectors.
def vec_cross(a,b): return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )", "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...
[ "0.8555987", "0.85268533", "0.846273", "0.8381159", "0.8260147", "0.81527233", "0.8107148", "0.8061532", "0.8039487", "0.7984614", "0.79521835", "0.7940565", "0.7864021", "0.7729805", "0.7685737", "0.7579557", "0.7570199", "0.75389117", "0.7487571", "0.744949", "0.7351979", ...
0.8517238
2
Return a vector normalized to unit length for a vector of nonzero length, otherwise returns the original vector.
def vec_normal(vec): n = sqrt(sum(x ** 2 for x in vec)) or 1 return [x / n for x in vec]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_vector(vector):\n if not np.all((vector == 0)):\n return vector / np.linalg.norm(vector)\n else:\n return vector", "def unit_vec(v):\n vlen = np.linalg.norm(v)\n if np.isclose(vlen, 0):\n raise ValueError('Cannot make unit vector from zero vector.')\n else:\n r...
[ "0.8011253", "0.7919985", "0.78952485", "0.76934624", "0.7687897", "0.76397055", "0.75623107", "0.7555012", "0.7555012", "0.7555012", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0.75549144", "0...
0.6258166
98
Return an iterator over the values of a dictionary.
def itervalues(d, **kw): return iter(getattr(d, _itervalues)(**kw))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itervalues(d):\n return iter(getattr(d, _itervalues)())", "def itervalues(d):\r\n return iter(getattr(d, _itervalues)())", "def itervalues(self):\n return DictValuesIterator(self)", "def itervalues(self):\n return iter(kvp.value for kvp in self.keyvaluepair_set.all())", "def iterval...
[ "0.7602083", "0.75927967", "0.7578933", "0.74965346", "0.7470549", "0.74183595", "0.73312634", "0.72119063", "0.7151209", "0.7124532", "0.7066721", "0.70006996", "0.69980365", "0.6906296", "0.6892397", "0.68839747", "0.6881547", "0.6873325", "0.68536156", "0.68310565", "0.682...
0.7330311
7
Return an iterator over the (key, value) pairs of a dictionary.
def iteritems(d, **kw): return iter(getattr(d, _iteritems)(**kw))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> iter:\n return iter(self._dict)", "def iteritems(self):\n return iter((kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all())", "def iter_over_pairs(pairs):\r\n if isinstance(pairs, dict):\r\n return pairs.iteritems()\r\n else:\r\n return pairs", "...
[ "0.6965512", "0.69597715", "0.68688107", "0.6743542", "0.67273575", "0.67252356", "0.6723754", "0.67168796", "0.6704215", "0.6695571", "0.6670943", "0.66572595", "0.6634663", "0.65975106", "0.6596159", "0.65798914", "0.65755135", "0.6569469", "0.6556892", "0.655147", "0.65486...
0.609936
50
Return an iterator over the (key, [values]) pairs of a dictionary.
def iterlists(d, **kw): return iter(getattr(d, _iterlists)(**kw))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iteritems(self):\n return iter((kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all())", "def iter_over_pairs(pairs):\r\n if isinstance(pairs, dict):\r\n return pairs.iteritems()\r\n else:\r\n return pairs", "def itervalues(self):\n return iter(kvp.value for kvp in se...
[ "0.70918435", "0.7013898", "0.7001213", "0.6921324", "0.69101477", "0.69045234", "0.6885047", "0.6883928", "0.6776061", "0.6701578", "0.6691715", "0.6685732", "0.66644245", "0.66560227", "0.66560227", "0.66383785", "0.662541", "0.66215485", "0.6587313", "0.6573886", "0.657118...
0.0
-1
Numpy einsum with default greedy optimization.
def np_esum(spec, *arrays, optimize='greedy'): return numpy.einsum(spec, *arrays, optimize=optimize)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mean_post_einsum(g: to.Tensor, lpj: to.Tensor) -> to.Tensor:\n return to.einsum(\"ns...,ns->n...\", (g, lpj2pjc(lpj)))", "def einsum(subscripts, *operands):\n raise NotImplementedError", "def _cumsum_einsum(x, precision=jax.lax.Precision.DEFAULT):\n mask = jnp.triu(jnp.ones(x.shape, dtype=jnp.b...
[ "0.6437677", "0.6137363", "0.6051833", "0.6039472", "0.597072", "0.5801062", "0.57912683", "0.574584", "0.5725255", "0.55663264", "0.5491478", "0.5479256", "0.5443277", "0.54245305", "0.541684", "0.5408196", "0.538172", "0.5377433", "0.53504837", "0.5343091", "0.5330061", "...
0.67960477
0