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 |
|---|---|---|---|---|---|---|
Set the querystring for this query | def set_query(self, query):
return self.set_param("query", query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_query_string(self):\n\n if self.search_by == 'by-postal-code':\n self.querystring = {'postalCode': self.search_input, 'countryCode': \"US\"}\n else :\n self.querystring = {'city': self.search_input}",
"def set_query_parameter(url, param_name, param_value):\n scheme,... | [
"0.7069244",
"0.63677895",
"0.6338271",
"0.630879",
"0.6301944",
"0.6274575",
"0.6196228",
"0.6181019",
"0.61202955",
"0.60866344",
"0.60465926",
"0.60445064",
"0.59915936",
"0.59330064",
"0.5908653",
"0.5881391",
"0.58460206",
"0.579809",
"0.5794021",
"0.5791899",
"0.5666475... | 0.6850091 | 1 |
Update_all metadata of this snapshot. | def update_all_metadata(self, metadata):
return self.manager.update_all_metadata(self, metadata) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_all(self):\n self.update_head_node_ip()\n self.get_database_info()\n self.update_users()",
"def refresh(self):\n\n # The timestamp role does not have signed metadata about it; otherwise we\n # would need an infinite regress of metadata. Therefore, we use some\n # default, sane metada... | [
"0.6868728",
"0.6319508",
"0.6261929",
"0.622208",
"0.6167493",
"0.6163127",
"0.61615056",
"0.6157004",
"0.60849595",
"0.60840976",
"0.6017378",
"0.5946436",
"0.5910082",
"0.5863472",
"0.5857743",
"0.5834939",
"0.5809947",
"0.5766356",
"0.5738539",
"0.5737868",
"0.57173395",
... | 0.7930917 | 0 |
Zero pad to numpy array. | def zero_pad_features(features: List[np.ndarray],
target_shape: tuple) -> List[np.ndarray]:
pad_features = []
for feature in features:
feature_shape = feature.shape
if len(feature_shape) < len(target_shape): # add extra dimensions
for i in range(len(target_shap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_pad(data):\n N = len(data)\n pow_2 = np.ceil(np.log2(N))\n return np.pad(data,(0,int((2**pow_2)-N)),'constant')",
"def zero_pad(arrayin, shape = (1024, 1024), fillvalue = 0):\r\n if len(arrayin.shape) > 2 :\r\n shape_out = list(arrayin.shape)\r\n shape_out[-1] = shape[1]\r\... | [
"0.7998153",
"0.7387653",
"0.73454505",
"0.73405844",
"0.72548026",
"0.7242509",
"0.70905924",
"0.7005037",
"0.67003804",
"0.66725624",
"0.65684724",
"0.65642804",
"0.65267915",
"0.64349526",
"0.6415267",
"0.6409547",
"0.6373104",
"0.63685095",
"0.63581",
"0.63202703",
"0.630... | 0.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!\n')
# ref https://stackabuse.com/getting-user-input-in-python/
# Get user input for city (chicago, new york city, washington).
cities = ['Chicago', 'New York city', 'Washington']
city = get_user_input(cities,"city")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66718096",
"0.6536446",
"0.64608175",
"0.63732874",
"0.6349621",
"0.6310782",
"0.62876326",
"0.6260145",
"0.6230216",
"0.62113076",
"0.62061083",
"0.61823773",
"0.61707395",
"0.6170415",
"0.6160548",
"0.6158978",
"0.6154724",
"0.61454946",
"0.6130887",
"0.61055917",
"0.610... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# Make sure the city name is correct
city_name = city.lower()
if debug_flag:
print(city_name)
try:
print('getting data from: ', CITY_DATA[city_name])
df = pd.read_csv(CITY_DATA[city_name])
except OSError as e:
print("E... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.75334424 | 87 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
# ref: https://stackoverflow.com/questions/48590268/pandas-get-the-most-frequent-values-of-a-column
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# Display the most popular month
most_popular_month = df['Month'].mode()[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80234534",
"0.80220866",
"0.7914726",
"0.7826028",
"0.7821531",
"0.7813864",
"0.7765123",
"0.7739495",
"0.7735815",
"0.773377",
"0.76860726",
"0.7667975",
"0.7651258",
"0.7644125",
"0.76395637",
"0.763636",
"0.7624526",
"0.76224995",
"0.7612101",
"0.7599869",
"0.7583085",
... | 0.71190524 | 82 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station
start_station = df['Start Station'].value_counts().idxmax()
print('Most Commonly used start station:\n', start_station)
# display ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.7248859 | 36 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
total_trip_duration = sum(df['Trip Duration'])
print("Total of trip duration is:")
ConvertSectoDay(total_trip_duration)
# display mean travel time
mea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.77180123 | 66 |
Construct a StanModel instance from a ``.stan`` file, compiling if necessary. | def from_stan_file(
cls,
stan_file: str,
model_data: Optional[str] = None,
*,
stanc_args: List[str] = [],
make_args: List[str] = [],
seed: int = 1234,
capture_stan_prints: bool = True,
):
result = compile_model(stan_file, stanc_args=stanc_args,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_model(\n stan_file: str, *, stanc_args: List[str] = [], make_args: List[str] = []\n) -> Path:\n verify_bridgestan_path(get_bridgestan_path())\n file_path = Path(stan_file).resolve()\n validate_readable(str(file_path))\n if file_path.suffix != \".stan\":\n raise ValueError(f\"File ... | [
"0.6995783",
"0.6872816",
"0.6239374",
"0.62104636",
"0.61302114",
"0.591248",
"0.58029556",
"0.5776385",
"0.5688892",
"0.5659147",
"0.56055087",
"0.55270445",
"0.5511881",
"0.5499894",
"0.54569024",
"0.5448554",
"0.5443375",
"0.54289037",
"0.54172283",
"0.5381617",
"0.531048... | 0.8602972 | 0 |
Retorna la pagina about. | def about():
return 'about Python Flask' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n\n\treturn render_template(\"about.html\")",
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n\treturn render_template('about.html', title='About',\n\t\t\t\t\t\t year=datetime.now().year,\n\t\t\t\t\t\t message='Your application description page.')"... | [
"0.81096554",
"0.8085279",
"0.80593985",
"0.80501866",
"0.80427057",
"0.79795784",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7971144",
"0.7960417",
"0.7956225"... | 0.0 | -1 |
Get the versioned client implementation corresponding to the current profile. | def _get_client_impl(self):
api_version = self._get_api_version(None)
if api_version not in self._client_impls:
self._create_client_impl(api_version)
return self._client_impls[api_version] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client(profile_name, region_name, svc, boto_client_params={}):\n session = get_session(profile_name, region_name)\n client = session.client(svc, **boto_client_params)\n return client",
"def get_auth_client(self, profile: str):\n flow = self.hass.data[DATA_FLOW_IMPL]\n client_id = f... | [
"0.6323861",
"0.61060524",
"0.5968721",
"0.59572214",
"0.59455395",
"0.59148544",
"0.5796345",
"0.57577384",
"0.5755577",
"0.57547855",
"0.5727445",
"0.5711889",
"0.5696628",
"0.56956995",
"0.5681377",
"0.56442153",
"0.5604289",
"0.56028265",
"0.55928457",
"0.5545612",
"0.553... | 0.6911792 | 0 |
Calls __enter__ on all client implementations which support it | def __enter__(self, *args, **kwargs):
for _, impl in self._client_impls.items():
if hasattr(impl, '__enter__'):
impl.__enter__(*args, **kwargs)
# mark the current KeyVaultClient as _entered so that client implementations instantiated
# subsequently will also have __en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def __aenter__(self):\n if self._closed:\n # httpx.AsyncClient does not allow reuse so we will not either.\n raise RuntimeError(\n \"The client cannot be started again after closing. \"\n \"Retrieve a new client with `get_client()` instead.\"\n ... | [
"0.69587845",
"0.68039227",
"0.6670977",
"0.6559515",
"0.65116143",
"0.6491946",
"0.6491946",
"0.63118905",
"0.6193657",
"0.61641634",
"0.614035",
"0.61303926",
"0.61303926",
"0.6099078",
"0.6055862",
"0.6009713",
"0.5942098",
"0.5940076",
"0.59198815",
"0.5909059",
"0.590875... | 0.7726076 | 0 |
Update the parameters with learning rate lr | def update_param(self, lr):
self.W=self.W-lr*self.W_grad
self.b = self.b - lr*self.b_grad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r\n param_group['lr'] = lr",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / se... | [
"0.8386066",
"0.82096964",
"0.8102654",
"0.801989",
"0.799177",
"0.7950852",
"0.7886401",
"0.7846111",
"0.78382576",
"0.7830275",
"0.7826277",
"0.7826277",
"0.7810395",
"0.7810395",
"0.7810395",
"0.77781767",
"0.77379185",
"0.7728301",
"0.77279466",
"0.77225894",
"0.76930004"... | 0.80124676 | 4 |
Enable propertyaccess style access to registered services, i.e., registry.MyClass. | def __getattr__(self, type_or_name):
return self._retrieve_registered_value(type_or_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_property(cls):\n\n def decorator(func):\n func.enable = lambda: _property_enable(\n cls, [_plugin_funcname(func)], func\n )\n func.disable = lambda: _property_disable(\n cls, [_plugin_funcname(func)], func\n )\n return func\n\n return decorato... | [
"0.589596",
"0.5747291",
"0.53648424",
"0.52845883",
"0.509775",
"0.49864194",
"0.49589944",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
"0.4913165",
... | 0.0 | -1 |
Return a Playbook object. | def playbook(self) -> 'Playbook':
return self.app.playbook | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_playbook(resource):\n try:\n playbook_file = open(resource, 'r')\n except (IOError, OSError) as e:\n logger.error('Could not load workflow from {0}. Reason: {1}'.format(resource, format_exception_message(e)))\n return None\n else:\n with pla... | [
"0.6649455",
"0.61967385",
"0.5653815",
"0.557339",
"0.5398821",
"0.536496",
"0.5301132",
"0.5204363",
"0.51931626",
"0.5162674",
"0.51115096",
"0.5109811",
"0.5097064",
"0.50876683",
"0.5086429",
"0.5076074",
"0.5076074",
"0.5076074",
"0.5054297",
"0.5046929",
"0.5030425",
... | 0.8063025 | 0 |
String for representing the Model object (in Admin site etc.) | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.7801624",
"0.77112937",
"0.767426",
"0.767426",
"0.7524702",
"0.74020135",
"0.7398639",
"0.7378346",
"0.7328583",
"0.7270028",
"0.7244434",
"0.7233179",
"0.7205981",
"0.7174358",
"0.7165676",
"0.7108926",
"0.70379156",
"0.70379156",
"0.7012156",
"0.69865996",
"0.6968002",
... | 0.0 | -1 |
String for representing the Model object (in Admin site etc.) | def __str__(self):
return self.regions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.7801624",
"0.77112937",
"0.767426",
"0.767426",
"0.7524702",
"0.74020135",
"0.7398639",
"0.7378346",
"0.7328583",
"0.7270028",
"0.7244434",
"0.7233179",
"0.7205981",
"0.7174358",
"0.7165676",
"0.7108926",
"0.70379156",
"0.70379156",
"0.7012156",
"0.69865996",
"0.6968002",
... | 0.0 | -1 |
String for representing the Model object (in Admin site etc.) | def __str__(self):
# LookupRajon.objects.filter(region_id=5)
return '{0} ({1})'.format(self.rajons, self.region_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.7801624",
"0.77112937",
"0.767426",
"0.767426",
"0.7524702",
"0.74020135",
"0.7398639",
"0.7378346",
"0.7328583",
"0.7270028",
"0.7244434",
"0.7233179",
"0.7205981",
"0.7174358",
"0.7165676",
"0.7108926",
"0.70379156",
"0.70379156",
"0.7012156",
"0.69865996",
"0.6968002",
... | 0.0 | -1 |
String for representing the Model object (in Admin site etc.) | def __str__(self):
# rajon_id = LookupRajon.objects.filter(region_id__regions__contains='Киевская')
return '%s, %s, %s' % (self.last_name, self.first_name, self.patron_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str_... | [
"0.78016543",
"0.7712146",
"0.7675692",
"0.7675692",
"0.7525264",
"0.740416",
"0.7396687",
"0.73751175",
"0.732573",
"0.72692174",
"0.7241136",
"0.7235689",
"0.72075593",
"0.7174236",
"0.71677464",
"0.710979",
"0.70352644",
"0.70352644",
"0.70127875",
"0.6987778",
"0.6966356"... | 0.0 | -1 |
Normalize file names from file URL to local file names. | def normalize_filename(url):
fname = url.replace('file://', '')
if os.sep != '/' and not os.path.exists(fname):
fname = fname.lstrip('/')
return fname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardized_filename(self, url, fname):\n #TODO:apply filename standardization logic\n # non-result pages/files use default urllib name conventions\n # result files need standardization logic (TBD)\n if fname:\n filename = join(self.cache_dir, fname)\n else:\n ... | [
"0.68801403",
"0.6818065",
"0.6798775",
"0.66266495",
"0.6521036",
"0.6470824",
"0.64068335",
"0.6389993",
"0.6358907",
"0.63168097",
"0.6216324",
"0.6215801",
"0.62091863",
"0.6144447",
"0.6135389",
"0.6124519",
"0.61192256",
"0.6061179",
"0.60269904",
"0.60117525",
"0.59759... | 0.77696913 | 0 |
Apply a workaround for CSSUtils, which replaces `\0` tokens in the code with actual 0bytes. `\0` is used as a IE hack, e.g. by Twitter's Bootstrap. | def fixup_css(text):
return text.replace('\x00', '\\0') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strip_nul(text):\n return text.replace('\\x00', '<NUL>')",
"def condense_zero_units(css):\n log.debug(\"Condensing all zeroes on values.\")\n return re.sub(r\"([\\s:])(0)(px|em|%|in|q|ch|cm|mm|pc|pt|ex|rem|s|ms|\"\n r\"deg|grad|rad|turn|vw|vh|vmin|vmax|fr)\", r\"\\1\\2\", css)",
... | [
"0.6808445",
"0.641989",
"0.58655035",
"0.5839831",
"0.58389693",
"0.5788328",
"0.57769346",
"0.57070446",
"0.56950766",
"0.5682172",
"0.56806463",
"0.567098",
"0.56177825",
"0.55880415",
"0.5579823",
"0.5536991",
"0.5493856",
"0.5452998",
"0.545274",
"0.54504776",
"0.5438553... | 0.8189479 | 0 |
Return a logistic map function with fixed mu. Logistic map f(x) = 4 mu x (1x), which folds the unit interval (0,1) into itself. | def logistic(mu):
mu4 = 4*mu
def f(x):
return mu4*x*(1.-x)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def M(f):\n return 1127 * numpy.log(1 + f/700.0)",
"def logistic(mu, hw, x): \n n = np.exp(- ((x-mu)/(.477*hw))**2)\n return (2. * n)/( 1 + n)",
"def logistic_map(x, r=1):\n def _map(x):\n return r * x * (1 - x)\n output = _map(x)\n while True:\n yield output\n out... | [
"0.65187085",
"0.6192753",
"0.60016406",
"0.57829744",
"0.57829744",
"0.5699263",
"0.56904465",
"0.56516844",
"0.56114656",
"0.5568615",
"0.55212724",
"0.5497562",
"0.5486157",
"0.5486157",
"0.5486157",
"0.5486157",
"0.54477966",
"0.54423857",
"0.54328924",
"0.54153717",
"0.5... | 0.7953905 | 0 |
Initialize the derived quantities from the inputs that must be compute one time only. | def __initialize__(self):
self.initialized = True
if self.ids_to_consider is None:
self.V_tot = np.sum(self.V[self.p_ids-1])
else:
self.V_tot = np.sum(self.V[self.ids_to_consider-1])
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(ExponentialInputs, self).__init__()\n self.init_pop_size = pd.Series([], dtype=\"float\")\n self.growth_rate = pd.Series([], dtype=\"float\")\n self.time_steps = pd.Series([], dtype=\"float\")",
"def initialize_inputs(self) -> None:\n self.inputs.lif... | [
"0.65032315",
"0.638384",
"0.6367897",
"0.62992376",
"0.6211577",
"0.61994267",
"0.61531717",
"0.6152471",
"0.6133698",
"0.61155415",
"0.60800415",
"0.6013803",
"0.6004064",
"0.5986231",
"0.59809536",
"0.59678334",
"0.596487",
"0.5950653",
"0.59262246",
"0.59189475",
"0.58956... | 0.6454027 | 1 |
Checks if a theme is installed. | def validate_theme(theme):
try:
get_theme(theme)
except KeyError:
raise FlaskBBCLIError("Theme {} not found.".format(theme), fg="red") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_theme(theme: str) -> bool:\n themes = [\"dark\", \"light\"]\n\n return theme in themes",
"def theme_exists(theme_name, themes_dir=None):\n for theme in get_themes(themes_dir=themes_dir):\n if theme.theme_dir_name == theme_name:\n return True\n return False",
"def has_the... | [
"0.77949214",
"0.7444488",
"0.6910317",
"0.67785037",
"0.6739074",
"0.6561798",
"0.6532176",
"0.64617276",
"0.64524174",
"0.6302741",
"0.62921214",
"0.624466",
"0.6232153",
"0.62213564",
"0.62017083",
"0.6197273",
"0.6175501",
"0.61491346",
"0.61464965",
"0.6139323",
"0.60790... | 0.68968505 | 3 |
Generate a random string of fixed length | def generate_random_string(stringLength=4):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.8680464",
"0.8573714",
"0.85486245",
"0.85297275",
"0.85209286",
"0.84331024",
"0.8432044",
"0.84157014",
"0.84120053",
"0.8389201",
"0.8345882",
"0.8343962",
"0.83406156",
"0.83348686",
"0.83240855",
"0.82986933",
"0.82911193",
"0.8281826",
"0.82818025",
"0.82811046",
"0.... | 0.8137093 | 30 |
returns start time of the pulse. This is typically set by the sequence element at the time the pulse is added to the element. | def t0(self):
return self._t0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self):\n return RPR.GetAudioAccessorStartTime(self.id)",
"def startTime(self) -> float:\n try: return self.times[0]\n except IndexError: return 0.0",
"def start_time(self) -> float:\n return self._start_time",
"def start_time(self) -> pulumi.Output[Optional[int]]:\n... | [
"0.7604898",
"0.7364986",
"0.72931373",
"0.72430485",
"0.718628",
"0.71772695",
"0.7154747",
"0.7154747",
"0.708563",
"0.7068199",
"0.7068199",
"0.70155215",
"0.70155215",
"0.70155215",
"0.70155215",
"0.70155215",
"0.70155215",
"0.70155215",
"0.70155215",
"0.69938636",
"0.698... | 0.0 | -1 |
returns the end time of the pulse. | def end(self):
return self._t0 + self.length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endTime(self) -> float:\n try: return self.times[-1]\n except IndexError: return 0.0",
"def end_time(self):\n return RPR.GetAudioAccessorEndTime(self.id)",
"def end_time(self) -> float:\r\n ...",
"def end_time(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(s... | [
"0.773276",
"0.76763105",
"0.76053137",
"0.7577121",
"0.7404534",
"0.7400363",
"0.73741764",
"0.73741764",
"0.7276144",
"0.7276144",
"0.7276144",
"0.7276144",
"0.7276144",
"0.7276144",
"0.72444224",
"0.7241606",
"0.7210781",
"0.71499836",
"0.71275824",
"0.7079189",
"0.6996447... | 0.6442744 | 54 |
In order to be flexible regarding comparison, the equality rules for a record permit comparison with any other Sequence or Mapping. | def __eq__(self, other: object) -> bool:
compare_as_sequence = isinstance(other, Sequence)
compare_as_mapping = isinstance(other, Mapping)
if compare_as_sequence and compare_as_mapping:
other = t.cast(t.Mapping, other)
return list(self) == list(other) and dict(self) == di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equality(self):\n self.assertTrue(Record(1, 2) == Record(1, 2))\n self.assertFalse(Record(1, 2) == Record(1, 3))\n self.assertFalse(Record(1, 2) == Record(2, 2))\n self.assertFalse(Record(1, 2) == Record(3, 4))",
"def test_record_eq_record_different_values_order(self):\n ... | [
"0.7252796",
"0.71938896",
"0.71783465",
"0.71072346",
"0.6887125",
"0.67846924",
"0.671754",
"0.6609199",
"0.6596293",
"0.65892416",
"0.6579389",
"0.65446275",
"0.6495156",
"0.6469961",
"0.6469961",
"0.6439405",
"0.64190996",
"0.6409007",
"0.6408959",
"0.64071876",
"0.634609... | 0.70394677 | 4 |
Return the fields of the record as a list of key and value tuples | def items(self, *keys):
if keys:
d = []
for key in keys:
try:
i = self.index(key)
except KeyError:
d.append((key, None))
else:
d.append((self.__keys[i], self[i]))
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fields(self):\n return [f[1] for f in sorted(self.dd.fields.items())]",
"def fields(self):\n return {k:getattr(self, k, None) for k in self.schema.fields}",
"def fields(self):\r\n return self._by_name.iteritems()",
"def get_fields_list(self):\n return self.description[\"fields... | [
"0.67695063",
"0.6748261",
"0.6744186",
"0.67139703",
"0.67065036",
"0.6686762",
"0.6618695",
"0.6567906",
"0.65404093",
"0.6536849",
"0.65270287",
"0.64849865",
"0.64679915",
"0.6450809",
"0.6448236",
"0.63870263",
"0.6347598",
"0.63242847",
"0.6276803",
"0.62702715",
"0.626... | 0.0 | -1 |
calculate the function F(x,y)=exp((xx_0)2(yy_0)2) x x value y y value | def sfunc(self,x,y):
return np.exp(-(x-self.x_0)**2.0-(y-self.y_0)**2.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def F(x):\n return math.exp(-0.5 * (x ** 2))",
"def get_fy(self):\n\n def fy(p):\n p0, p1 = p\n e = anp.exp(-(p0 + p1) * self.ts)\n x = (\n 1\n / (-p0 - p1)\n * anp.array(\n [\n [-p1 ... | [
"0.71134853",
"0.7094464",
"0.7051571",
"0.6987379",
"0.68706274",
"0.68641293",
"0.68641293",
"0.67642224",
"0.6753491",
"0.6740192",
"0.6723798",
"0.6723798",
"0.66501915",
"0.66483563",
"0.6629544",
"0.6610866",
"0.65891457",
"0.65567136",
"0.6539632",
"0.6508368",
"0.6504... | 0.7207828 | 0 |
calculate the function F(x,y)=exp((xx_0)2(yy_0)2) x_vec list containint the x and y value | def func(self,x_vec):
x=x_vec[0]
y=x_vec[1]
return np.exp(-(x-self.x_0)**2.0-(y-self.y_0)**2.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derFunc(self,x_vec):\n x=x_vec[0]\n y=x_vec[1]\n z=np.array([2*(self.x_0-x),2*(self.y_0-y)])\n return z*self.sfunc(x,y)",
"def f(x):\n return -math.exp(x[0]**3/-3 + x[0] - x[1]**2)",
"def f(x):\n return -math.exp(x[0]**3/-3 + x[0] - x[1]**2)",
"def funcv(x):\n f0 = x[... | [
"0.68436044",
"0.67586005",
"0.67586005",
"0.67331713",
"0.6510066",
"0.6494334",
"0.64943016",
"0.64839154",
"0.6428267",
"0.6421599",
"0.6421599",
"0.64144254",
"0.6411929",
"0.6356152",
"0.6329997",
"0.6321216",
"0.62545985",
"0.6244694",
"0.61959976",
"0.61943984",
"0.616... | 0.81820416 | 0 |
! Compute the proximal operator of the \f$\ell_1\f$norm \f$ prox_{\lambda \|.\|_1} = {arg\min_x}\left\{\|.\|_1^2 + \frac{1}{2\lambda}\|x w\|^2\right\} \f$ | def prox_l1_norm(w, lamb):
return np.sign(w) * np.maximum( np.abs(w) - lamb, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prox(self, x):\n if self.regularize:\n x[:self.offset(x)] /= (1 + 2 * self.tau * self.lambda_)\n return x",
"def prox(self, x):\n if self.regularize:\n x[:self.offset(x)] /= (1 + 2 * self.tau * self.lambda_)\n return x",
"def prox(self, x):\n if self... | [
"0.70907074",
"0.70907074",
"0.70907074",
"0.6738347",
"0.66969883",
"0.66456556",
"0.6434906",
"0.6348603",
"0.6244805",
"0.6243417",
"0.6214859",
"0.6150981",
"0.6128996",
"0.6062726",
"0.6054258",
"0.6032138",
"0.60086906",
"0.5869223",
"0.5868149",
"0.58659613",
"0.586596... | 0.6361919 | 7 |
Returns the User model that is active in this project. | def get_user_model(self):
try:
return django_apps.get_model('clientArea.CustomUser')
except ValueError:
raise ImproperlyConfigured("AUTH_USER_MODEL must be of the form 'app_label.model_name'")
except LookupError:
raise ImproperlyConfigured(
"AU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(self):\n\n return self.user_model",
"def user(self):\n u = self.user_info\n return self.user_model.get_by_id(u['user_id']) if u else None",
"def user(self):\r\n return users.User(self)",
"def current_user(self):\n user_dict = self.auth.get_user_by_session()\n ... | [
"0.7897438",
"0.74299675",
"0.7307265",
"0.71993166",
"0.7174365",
"0.7168708",
"0.71579576",
"0.71151614",
"0.70262516",
"0.69746816",
"0.6940687",
"0.6889999",
"0.68655735",
"0.68325156",
"0.68325156",
"0.67975175",
"0.6794607",
"0.67897165",
"0.6764167",
"0.67618823",
"0.6... | 0.67863804 | 18 |
Transport the incoming target samples `x` under condition `condition` to the gauss distribution. This is referred to as the normalizing flow direction. Notes Whether normalizing is the forward pass or the inverse pass through the flow architecture is defined in the parameter `normalize_forward`. | def normalizing_flow(
self, target: torch.Tensor, condition: Optional[torch.Tensor] = None,
):
return self(target, condition=condition, reverse=not self.normalize_forward) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generating_flow(\n self, normals: torch.Tensor, condition: Optional[torch.Tensor] = None,\n ):\n return self(normals, condition=condition, reverse=self.normalize_forward)",
"def forward(self, input, condition):\n scale, bias = self.mlp(condition).chunk(2, dim=-1)\n scale = (F.t... | [
"0.58286285",
"0.57342637",
"0.5553101",
"0.55244946",
"0.538692",
"0.5337871",
"0.5253329",
"0.52393633",
"0.51728386",
"0.5171997",
"0.51601815",
"0.51430124",
"0.5092782",
"0.5084006",
"0.5072118",
"0.50681967",
"0.5064389",
"0.5046059",
"0.5018628",
"0.5012299",
"0.501229... | 0.6771285 | 0 |
Transport the incoming gaussian samples `x` under condition `condition` to the target distribution. This is referred to as the generating flow direction. Notes Whether normalizing is the forward pass or the inverse pass through the flow architecture is defined in the parameter `normalize_forward`. | def generating_flow(
self, normals: torch.Tensor, condition: Optional[torch.Tensor] = None,
):
return self(normals, condition=condition, reverse=self.normalize_forward) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalizing_flow(\n self, target: torch.Tensor, condition: Optional[torch.Tensor] = None,\n ):\n return self(target, condition=condition, reverse=not self.normalize_forward)",
"def forward(self, input, condition):\n scale, bias = self.mlp(condition).chunk(2, dim=-1)\n scale = (... | [
"0.6617518",
"0.5749227",
"0.53497016",
"0.53390455",
"0.51415384",
"0.50822854",
"0.50691295",
"0.5045852",
"0.50381243",
"0.50260586",
"0.50260586",
"0.5013777",
"0.4998375",
"0.4998375",
"0.49836564",
"0.49763075",
"0.49717024",
"0.4937533",
"0.4930079",
"0.49256432",
"0.4... | 0.61870396 | 1 |
modelPropertiesDictionary(sql_row_list) transforms a row gotten via SQL request (list), to a dictionary affects .get_models_list.py | def modelPropertiesDictionary(sql_row_list):
properties_dictionary = \
{
"id": sql_row_list[0],
"name": sql_row_list[1],
"last_deploy_timestamp": sql_row_list[2],
"active_version": sql_row_list[3],
"build_id": sql_row_list[4]
};
return properties_dictionary; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(model):\n # first we get the names of all the columns on your model\n columns = [c.key for c in class_mapper(model.__class__).columns]\n # then we return their values in a dict\n return dict((c, getattr(model, c)) for c in columns)",
"def serialize(model):\n # first we get the names ... | [
"0.61147195",
"0.61147195",
"0.61147195",
"0.61054325",
"0.60919845",
"0.5964863",
"0.5924218",
"0.58927095",
"0.587125",
"0.5767751",
"0.57551026",
"0.57421476",
"0.5709395",
"0.5651531",
"0.56401426",
"0.5628836",
"0.5603076",
"0.55090725",
"0.54904616",
"0.54904616",
"0.54... | 0.8361938 | 0 |
Rotation about the yaxis. | def roty(t):
c = np.cos(t)
s = np.sin(t)
return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot_y_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_y_rad)",
"def rot_y_rad(self):\n return self._rot_y_rad",
"def rotation_center_y(self, *args, **kwargs) -> Any:\n pass",
"def rotate_y(self, angle):\n angle *= np.pi / 180\n ret... | [
"0.75396633",
"0.7354722",
"0.7102622",
"0.7064357",
"0.7036538",
"0.6986756",
"0.6895528",
"0.6895528",
"0.68484044",
"0.68028474",
"0.6717387",
"0.66640604",
"0.66279566",
"0.6614649",
"0.658053",
"0.6575346",
"0.6554816",
"0.6505504",
"0.63935125",
"0.6393029",
"0.63855916... | 0.0 | -1 |
Compute 3D bounding box IoU. | def iou3d(corners1, corners2):
# corner points are in counter clockwise order
rect1 = [(corners1[i, 0], corners1[i, 2]) for i in range(3, -1, -1)]
rect2 = [(corners2[i, 0], corners2[i, 2]) for i in range(3, -1, -1)]
area1 = poly_area(np.array(rect1)[:, 0], np.array(rect1)[:, 1])
area2 = poly_area(np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IoUs(box, boxes):\n box_area = (box[2] - box[0]) * (box[3] - box[1])\n area = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])\n xx1 = np.maximum(box[0], boxes[:, 0])\n yy1 = np.maximum(box[1], boxes[:, 1])\n xx2 = np.minimum(box[2], boxes[:, 2])\n yy2 = np.minimum(box[3], boxes[:, 3... | [
"0.6807879",
"0.6628364",
"0.6574111",
"0.64615715",
"0.6447401",
"0.6393963",
"0.6388835",
"0.63740015",
"0.63392276",
"0.63392276",
"0.6334302",
"0.6305478",
"0.6278959",
"0.6204237",
"0.6183429",
"0.6178647",
"0.6178647",
"0.6178647",
"0.6162913",
"0.6159242",
"0.61493546"... | 0.5763203 | 54 |
the function of sorting the heap | def heap_sort(arr):
if not isinstance(arr, list) or len(arr) == 0:
return
for i in range(len(arr) // 2 - 1, -1, -1):
heapify(arr, i, len(arr))
for i in range(len(arr) - 1, 0, -1):
arr[0], arr[i] = arr[i], arr[0]
heapify(arr, 0, i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heap_sort(list):\n pass",
"def heap_sort(self, A):\n pass",
"def heap_sort(self, A):\n pass",
"def heapsort(heap):\n aux = heap.tamanio\n for i in range(0, heap.tamanio-1):\n quitar(heap)\n heap.tamanio = aux",
"def heap_sort(A):\n build_max_heap(A)\n for i in ran... | [
"0.8365011",
"0.8087424",
"0.8087424",
"0.7874067",
"0.7869051",
"0.77728605",
"0.7690831",
"0.7642304",
"0.76183164",
"0.7606037",
"0.75127214",
"0.7480076",
"0.745218",
"0.7442317",
"0.7392429",
"0.7375208",
"0.73326707",
"0.73326707",
"0.73134375",
"0.72971314",
"0.7265115... | 0.7769539 | 6 |
Return the cumulative sum. >>> cumulative_sum([1,2,3]) [1, 3, 6] >>> cumulative_sum([2,3,4]) [2, 5, 9] >>> cumulative_sum([1,3,5,7]) [1, 4, 9, 16] >>> cumulative_sum([2,4,6,8]) [2, 6, 12, 20] >>> cumulative_sum([3,6,9,12]) [3, 9, 18, 30] | def cumulative_sum(x):
total = 0
sum = []
for num in x:
total += num
sum.append(total)
return sum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_sum(self, lis):\n new_list = []\n for i in range(len(lis)):\n if i == 0:\n new_list.append(lis[i])\n else:\n new_list.append(new_list[i-1] + lis[i])\n return new_list",
"def _cumulative_sum(xs):\r\n cumsum = 0\r\n for x in xs:\r\n cumsum += x\r\n ... | [
"0.73092616",
"0.7289155",
"0.7164371",
"0.7145016",
"0.7107696",
"0.68762434",
"0.67078376",
"0.659947",
"0.65752566",
"0.64420354",
"0.6387023",
"0.6387023",
"0.6387023",
"0.63601846",
"0.62622476",
"0.62622476",
"0.62622476",
"0.62274414",
"0.62189204",
"0.6063389",
"0.606... | 0.7361421 | 0 |
Return True if the list is sorted in ascending order and False otherwise. >>> is_sorted([1,2,2]) True >>> is_sorted([3,2,1]) False >>> is_sorted([1,2,3]) True >>> is_sorted(['a','b','c','d','e']) True >>> is_sorted(['a','a','c','b','c','d']) False | def is_sorted(x):
l = len(x)
for i in range(l-1):
if x[i+1] < x[i]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted_list(list_):\n prev = -1\n for item in list_:\n if item < prev:\n return False\n prev = item\n return True",
"def is_sorted(a_list):\n sorted_list = sorted(a_list)\n if sorted_list == a_list:\n return True\n else:\n return False",
"def is_s... | [
"0.7908684",
"0.7807076",
"0.74725604",
"0.7448854",
"0.7348423",
"0.7291354",
"0.72348017",
"0.7209357",
"0.7070187",
"0.7012517",
"0.7000839",
"0.6808817",
"0.680441",
"0.6709827",
"0.6693405",
"0.6687246",
"0.66658926",
"0.6639185",
"0.65513176",
"0.6390741",
"0.611132",
... | 0.6752697 | 13 |
Return the mean average of a list of numbers. >>> average([1,2,3,4]) 2.5 >>> average([2,4,6,8]) 5.0 >>> average([1,3,5,7,9]) 5.0 >>> average([2,3,4,5,6]) 4.0 >>> average([1,4,7,2,5,6,1,8]) 4.25 | def average(num):
return sum(num) / len(num) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_list_average(numbers):\n return sum(numbers)/len(numbers)",
"def avg(list):\n return sum(list) / len(list)",
"def average(lst):\n return sum(lst)/len(lst)",
"def average(self, num_list):\n try:\n total = 0\n accumulator = 0\n\n for number in num_lis... | [
"0.8373265",
"0.8305487",
"0.8218591",
"0.8124167",
"0.8065615",
"0.8042003",
"0.803353",
"0.8024007",
"0.8004564",
"0.7992938",
"0.7979272",
"0.79767454",
"0.79683584",
"0.7947543",
"0.7920081",
"0.7887312",
"0.7823136",
"0.78204495",
"0.77918065",
"0.7729199",
"0.7724063",
... | 0.73175114 | 52 |
Return the reverse pair of the input sentence. >>> reverse_pair('I love my dog') 'dog my love I' >>> reverse_pair('You are so cute') 'cute so are You' >>> reverse_pair('i and you') 'you and i' >>> reverse_pair('cooking is mom my') 'my mom is cooking' >>> reverse_pair('you for best is exercise') 'exercise is best for yo... | def reverse_pair(text):
newtext = text.split(' ')
newtext = newtext[-1::-1]
return ' '.join(newtext) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_pair(some_text):\n #This function will return the reverse pair of input sentence.\n list_text = some_text.split(\" \")\n list_text.reverse()\n return \" \".join(list_text)",
"def revSentence(sentence):\n\n try:\n \n reversedSentence = \"\"\n \n words = sentence.... | [
"0.822284",
"0.5707565",
"0.5681943",
"0.56458193",
"0.5633633",
"0.56239855",
"0.55746955",
"0.5542935",
"0.5538515",
"0.5495714",
"0.54940957",
"0.5479357",
"0.54656786",
"0.5446815",
"0.54374003",
"0.5412716",
"0.54062796",
"0.5405488",
"0.5379989",
"0.535588",
"0.53486055... | 0.7500032 | 1 |
Given an array of characters with spaces, expands those spaces into %20. Size is the length of the array, after this expansion. Runs in linear time, constant space consumption. | def urlify(target, size):
seen_index = size - 1
copy_index = size - 1
# Find the beginning of the string to expand
for i in range(size):
if target[size - 1 - i] != ' ':
seen_index = size - 1 - i
break
expanded_space = "%20"
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlify(char_array: list or str, true_length: int) -> list:\n if type(char_array) is str:\n char_array = list(char_array)\n\n # Index of new end\n new_end = (count_spaces(char_array, true_length) * 2) + true_length - 1\n if new_end < len(char_array) - 1:\n char_array = char_array[:new_... | [
"0.58216846",
"0.56283873",
"0.5576782",
"0.55301964",
"0.5525383",
"0.5410249",
"0.5292325",
"0.5282109",
"0.5206234",
"0.52056396",
"0.51980877",
"0.5188956",
"0.51611125",
"0.515688",
"0.51556945",
"0.51408786",
"0.51385635",
"0.51234424",
"0.50713104",
"0.50430036",
"0.50... | 0.6343691 | 0 |
Check that for each round the quantities exchanged are below the dataset specific limit. | def check_exchange_compliance(tensors_list, max_bytes, units="bytes"):
assert units in ["bytes", "bits", "megabytes", "gigabytes"]
assert isinstance(tensors_list, list), "You should provide a list of tensors."
assert all(
[
(isinstance(t, np.ndarray) or isinstance(t, torch.Tensor))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_to_exceeding(self) -> bool:\n mean = self.current / self.num_cuts\n if self.max_frames is not None:\n return self.current + mean > self.max_frames\n if self.max_samples is not None:\n return self.current + mean > self.max_samples\n if self.max_duration is... | [
"0.62934023",
"0.6217444",
"0.6157898",
"0.6111242",
"0.60851705",
"0.6080632",
"0.6041288",
"0.6027621",
"0.6008189",
"0.6006377",
"0.59716",
"0.59412503",
"0.59119004",
"0.5908256",
"0.5894076",
"0.58465946",
"0.58308846",
"0.5819678",
"0.5819678",
"0.5819678",
"0.5792459",... | 0.0 | -1 |
Sending an incorrect (or missing) API key returns a 401 response. | def test_incorrect_api_key(self):
with self.subTest("Missing API key"):
response = self.client.get(
self.url, HTTP_AUTHORIZATION=f"ApiKey {self.web_user.username}:"
)
self.assertEqual(response.status_code, 401)
with self.subTest("Missing username"):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_api_key(x_api_key: str = Security(api_key_header_auth)):\n\n if x_api_key != API_KEY:\n raise HTTPException(\n status_code=status.HTTP_401_UNAUTHORIZED,\n detail=\"Invalid API Key\",\n )",
"def _invalid_transport_key_id():\n pecan.abort(404, u._('Not Found. Pro... | [
"0.81268555",
"0.68491673",
"0.6840191",
"0.6803841",
"0.6788906",
"0.67644507",
"0.67117035",
"0.6709757",
"0.6702719",
"0.66960347",
"0.6691066",
"0.668381",
"0.6678785",
"0.666984",
"0.6633901",
"0.6632781",
"0.65885884",
"0.65647525",
"0.65426606",
"0.65273446",
"0.651127... | 0.7776993 | 1 |
Test sending requests by unsupported HTTP methods to the view. | def test_unsupported_request_methods(self):
unsupported_methods = ["POST", "PUT", "PATCH", "DELETE"]
for method_name in unsupported_methods:
with self.subTest(method_name=method_name):
request_method = getattr(self.client, method_name.lower())
response = reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unsupported_requests_fail(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, 405)\n\n response = self.client.put(self.url)\n self.assertEqual(response.status_code, 405)\n\n response = self.client.patch(self.url)\n self.assertEqu... | [
"0.7945279",
"0.76810914",
"0.7637595",
"0.7497539",
"0.74799687",
"0.74295086",
"0.74111307",
"0.7278926",
"0.7148101",
"0.71479183",
"0.7146442",
"0.71168035",
"0.7060972",
"0.7023295",
"0.69648427",
"0.69576424",
"0.69309413",
"0.6897298",
"0.68926686",
"0.68536603",
"0.68... | 0.8171519 | 0 |
Rightaddition, e.g. G(x) = 3.0 + F(x) | def __radd__(self,that):
return self.__opExpand2(that,np.add) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __radd__(self, left):\n return self.value() + left",
"def _right(node):\n return 2 * node + 2",
"def increase_right_boundary(self):\n self.R = self.R + 1.0\n self.Ne = self.Ne + 1",
"def reduce_right(self, func, init=None):\n return self.reverse().reduce(func, init)",
"d... | [
"0.69091254",
"0.6221106",
"0.61848044",
"0.5959027",
"0.59278053",
"0.5909182",
"0.58639485",
"0.58628154",
"0.58122766",
"0.58077633",
"0.57911164",
"0.5786499",
"0.57331365",
"0.5727222",
"0.56799936",
"0.56660634",
"0.56653994",
"0.56514305",
"0.562768",
"0.56243634",
"0.... | 0.59544605 | 4 |
Rightsubtraction, e.g. G(x) = 3.0 F(x) | def __rsub__(self,that):
B = that if isinstance(that,Factor) else Factor([],that)
return B.__opExpand2(self, np.subtract) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __rsub__(self, left):\n return left - self.value()",
"def __rsub__(self, other):\n\t\treturn (-self).__add__(float(other))",
"def right (x):\n\n return Sinary(side(x.v,0))",
"def right(t):\r\n return t(2)",
"def __rsub__(self, other):\n if type(other) == int:\n other ... | [
"0.6686299",
"0.63346964",
"0.61410016",
"0.61263365",
"0.6067482",
"0.6052178",
"0.602366",
"0.5976862",
"0.5968889",
"0.59320855",
"0.5930968",
"0.5874837",
"0.58520085",
"0.58507216",
"0.58236057",
"0.5812895",
"0.57986474",
"0.5778816",
"0.576851",
"0.57638204",
"0.575193... | 0.5546807 | 45 |
Rightdivide, e.g. G(x) = 3.0 / F(x) | def __rdiv__(self,that):
B = that if isinstance(that,Factor) else Factor([],that)
return B.__opExpand2(self, np.divide) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __rfloordiv__(self, other):\n return self.__rtruediv__(other)",
"def __rdiv__(self, _scalar):\n\t\treturn self / _scalar",
"def div1(left: float, right: float) -> float:\n return left / right",
"def trunc_divide(lhs, rhs):\n return _make.trunc_divide(lhs, rhs)",
"def div2(left: float, righ... | [
"0.6240735",
"0.61607087",
"0.6153503",
"0.6148325",
"0.6148228",
"0.6146565",
"0.60842264",
"0.60826284",
"0.6074625",
"0.59847254",
"0.5973192",
"0.5964287",
"0.5913716",
"0.58533293",
"0.58533293",
"0.5840758",
"0.5840515",
"0.5828072",
"0.5813278",
"0.58076805",
"0.580578... | 0.63304573 | 0 |
Eliminate via powered sum, e.g., f(x_2) = \\root^{1/p}{ sum_{x_1} F(x_1,x_2)^p } = F.sumPower(x[1],p) | def sumPower(self, elim=None, power=1.0, out=None):
if (elim is None):
elim = self.v
#return (self ** power).sum(elim).powerIP(1.0/power) # fails if elim = self.v?
tmp = (self ** power).sum(elim)
tmp **= (1.0/power)
return tmp
#return (self ** power).sum(elim)**(1.0/power) # TODO: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def free_energy_function(self, x):\n \n wx_b = T.dot(x, self.W) + self.bhid\n \n return -T.sum(T.log(1 + T.exp(wx_b)), axis=1) -T.dot(x, self.b)",
"def neg(self):\n\n for k, f in self.fs.items():\n\n if len(f.edges) == 1:\n pass\n elif len(f... | [
"0.5904637",
"0.57738376",
"0.5554831",
"0.5510145",
"0.54901695",
"0.5440214",
"0.5413614",
"0.54016566",
"0.538343",
"0.53741807",
"0.53630435",
"0.53037375",
"0.53037375",
"0.53030276",
"0.5300678",
"0.5289527",
"0.5289527",
"0.5279551",
"0.52718353",
"0.52614033",
"0.5252... | 0.5366928 | 10 |
Find the argmax of the factor, with partial conditioning (as var list + value list) if desired. Returns a maximizing configuration of f(x|xc=Xc) as a tuple of states | def argmax2(self, cvars=None, ctuple=None):
if (cvars is None):
return self.v.ind2sub(self.t.argmax())
ax = tuple(map(lambda x:ctuple[cvars.index(x)] if x in cvars else slice(None) ,self.v))
return self.v.ind2sub(self.t[ax].argmax()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_discrete(func: Callable[[Tuple], np.ndarray], over: Iterable[Tuple],\\\n state: Tuple[Union[int, float]]) -> Tuple[float, Tuple[Union[int, float]], None]:\n vals = [func(np.asarray((*state, *action)).reshape(1, -1))[0, 0] for action in over]\n maximum = max(vals)\n return (maximum, over[vals.in... | [
"0.6689191",
"0.65820867",
"0.6492417",
"0.6163992",
"0.6096673",
"0.6096673",
"0.6068535",
"0.60282433",
"0.600794",
"0.5991795",
"0.59668076",
"0.5946501",
"0.59321004",
"0.59265363",
"0.59069014",
"0.5888452",
"0.58845335",
"0.58637625",
"0.5861456",
"0.5846718",
"0.583741... | 0.5679655 | 36 |
Find the argmax of the factor, with partial conditioning (as dict evidence[v]) if desired Returns a maximizing configuration of f(x|xc=Xc) as a tuple of states | def argmax(self, evidence={}):
if len(evidence)==0:
return self.v.ind2sub(self.t.argmax())
ax = tuple([ evidence[v] if v in evidence else slice(None) for v in self.v ])
return self.v.ind2sub( self.t[ax].argmax() ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_value(self, state, max_alpha, max_beta, max_depth):\r\n if state.terminal_test():\r\n return state.utility(0)\r\n if max_depth <=0 :\r\n return self.score(state)\r\n\r\n v = float(\"-inf\")\r\n for a in state.actions():\r\n v = max(v, self.min_va... | [
"0.6500263",
"0.63943756",
"0.62971264",
"0.61945826",
"0.61632526",
"0.60480374",
"0.59705585",
"0.5968373",
"0.59409153",
"0.5935895",
"0.5935895",
"0.59261817",
"0.5923711",
"0.5883495",
"0.5882632",
"0.58768344",
"0.5861613",
"0.5843548",
"0.5797955",
"0.5786985",
"0.5750... | 0.6707185 | 0 |
Draw a random sample (as a tuple of states) from the factor (assumes positive) If option Z= set, the function will assume normalization factor Z | def sample(self, Z=None):
Z = Z if Z is not None else self.sum() # normalize if desired / by default
assert (Z > 0), 'Non-normalizable factor (perhaps log factor?)' # also check for positivity?
pSoFar = 0.0
pDraw = Z * np.random.random_sample()
it = np.nditer(self.t, op_flags=['readonly'], flags=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self, state):\n\n def sample(s):\n return self._rng.choice(\n self.transition_matrix.shape[1], p=self.transition_matrix[s, :]\n )\n\n array_sample = np.frompyfunc(sample, 1, 1)\n\n return array_sample(state)",
"def sample(self):\n x = self... | [
"0.64751554",
"0.6366395",
"0.6327836",
"0.62230915",
"0.6215435",
"0.6215435",
"0.6215435",
"0.6215435",
"0.6215435",
"0.6201173",
"0.61641943",
"0.61022377",
"0.6094658",
"0.6076678",
"0.60046065",
"0.59643483",
"0.585948",
"0.5824711",
"0.58066237",
"0.58066237",
"0.578953... | 0.7170954 | 0 |
Compute the entropy of the factor (normalizes, assumes positive) | def entropy(self):
Z = self.sum()
assert (Z > 0), 'Non-normalizable factor (perhaps log factor?)' # also check for positivity?
H = 0.0
for x in np.nditer(self.t, op_flags=['readonly']):
p = x/Z
H += 0.0 if p==0 else -p*np.log(p)
return H | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(self):\n ent = 0.0\n for f in self.byte_freq:\n if f > 0:\n freq = float(f) / self.byte_total\n ent = ent + freq * math.log(freq, 2)\n return -ent",
"def entropy(img):\n # by calculating\n histogram = img.histogram()\n histogram_s... | [
"0.80674815",
"0.7990321",
"0.7982297",
"0.7978052",
"0.7883377",
"0.7861225",
"0.78607386",
"0.7805381",
"0.7802631",
"0.77277195",
"0.7715365",
"0.7694677",
"0.7688067",
"0.7687217",
"0.76785034",
"0.7661731",
"0.76324254",
"0.7621125",
"0.7605698",
"0.758206",
"0.7523188",... | 0.8400203 | 0 |
Convert a scipy sparse matrix to a torch sparse tensor. | def _sparse_mx_to_torch_sparse_tensor(sparse_mx):
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8300125",
"0.8148143",
"0.80456305",
"0.8032249",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80297565",
"0.80130917",
"0.79970765",
"0.79970765",
... | 0.79767966 | 23 |
Return all the attributes as a dictionary. This may be useful for caching purposes. The dictionary is mutable, unlike this object's attributes. | def as_dict(self):
return dict(self._d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def attributes(self):\n return... | [
"0.8891561",
"0.8891561",
"0.8891561",
"0.87858796",
"0.8734159",
"0.8606031",
"0.8510128",
"0.84829414",
"0.8404565",
"0.8395117",
"0.81567943",
"0.8133866",
"0.81195474",
"0.8111543",
"0.8063337",
"0.7994951",
"0.79841113",
"0.79776764",
"0.7911372",
"0.7898794",
"0.7896333... | 0.0 | -1 |
Check if we have any more jumps in this space | def is_lmtp_over(self):
if self._c >= self._C:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isJump(self) -> bool:\n ...",
"def jump_gap(self, last):\n a_gap = last.a - self.a_cursor\n b_gap = last.b - self.b_cursor\n return (a_gap <= self.gap_length and\n b_gap <= self.gap_length)",
"def canjump(self,jumpSpace):\n for space in jumpSpace.touching:\... | [
"0.70401275",
"0.68786925",
"0.6684202",
"0.66491807",
"0.63142025",
"0.6243326",
"0.6199923",
"0.61586815",
"0.61583394",
"0.6154761",
"0.6108435",
"0.6082089",
"0.6072242",
"0.60702604",
"0.6046645",
"0.60016304",
"0.5991472",
"0.5987496",
"0.59555167",
"0.5922997",
"0.5912... | 0.0 | -1 |
checks if the neuron is in tabu list | def is_tabu(self, index):
if abs(self._k - self._tabu_list[index]) <= self.__l:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_tabu_list(self):\n\t\treturn len(self._tabu_list) > 0 and len(self._tabu_list) == self._size",
"def e_tabuleiro (x):\n \n if not isinstance(x, list) or len(x) != 5 or not isinstance(tabuleiro_pontuacao(x), int):\n return False\n for l in range(len(x)-1):\n for c in range(len(x[l]... | [
"0.7216161",
"0.5996803",
"0.597985",
"0.5777033",
"0.5738896",
"0.5730707",
"0.5662886",
"0.55287546",
"0.55183595",
"0.5502102",
"0.5478067",
"0.54759586",
"0.54146636",
"0.53840506",
"0.53650284",
"0.5339329",
"0.53287363",
"0.52933294",
"0.5280032",
"0.52773154",
"0.52772... | 0.68748516 | 1 |
Checks if the given list contains only 0 | def isAllZeros(self, currentState):
isZeros = True
for i in currentState:
if i != 0:
isZeros = False
break
return isZeros | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonzero(list_):\n for a in list_:\n if a!=0:\n return True\n return False",
"def isVecZero(vec):\n trues = [isZero(e) for e in vec]\n return all(trues)",
"def has_positive(l):\n return any([p > 0 for p in l])",
"def __nonzero__(self):\n for e in self:\n ... | [
"0.83467907",
"0.706947",
"0.70507485",
"0.68978894",
"0.6760666",
"0.67068",
"0.6683227",
"0.6645245",
"0.6636877",
"0.6597197",
"0.658791",
"0.6571269",
"0.6456779",
"0.6440866",
"0.63938373",
"0.63810587",
"0.63762647",
"0.6368606",
"0.6308632",
"0.62846214",
"0.6235762",
... | 0.6224715 | 22 |
The constructor for CounterCalls class. | def __init__(self, how="city"):
self.how = how
self.X = None
self.y = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n self.num_calls = 0",
"def __init__(self, counter):\n self.counter: Counter = counter",
"def __init__(self, *args, **kwargs) -> None:\n super().__init__(*args, **kwargs)\n self._counter = _ComplexityCounter()",
"def __init__(self):\n self.counts = Co... | [
"0.7434541",
"0.7187601",
"0.7142184",
"0.69054747",
"0.6825243",
"0.66586745",
"0.65800947",
"0.6453831",
"0.64171165",
"0.63743865",
"0.6368835",
"0.6351189",
"0.6307314",
"0.6299756",
"0.6293485",
"0.62909025",
"0.6268675",
"0.61792445",
"0.6170651",
"0.61396104",
"0.61168... | 0.0 | -1 |
Iterate through the given sequence n at a time, consuming only one each iteration. | def iter_n(sequence: Sequence[T], n: int) -> List[T]:
for i in range(len(sequence) - (n-1)):
yield sequence[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat(seq, n):\n for e in seq:\n for _ in range(n):\n yield e",
"def takeNGenerator(seq, n):\n\tindex = 0\n\twhile index + n <= len(seq):\n\t\tyield seq[index:index + n]\n\t\tindex = index + 1",
"def take(n, seq):\n seq = iter(seq)\n result = []\n try:\n for i in range... | [
"0.7660409",
"0.76409584",
"0.7470258",
"0.7090508",
"0.70472777",
"0.6971245",
"0.6952211",
"0.6764021",
"0.67500675",
"0.67159224",
"0.6697274",
"0.66913295",
"0.6671169",
"0.6670856",
"0.6625391",
"0.6613651",
"0.66029435",
"0.6566227",
"0.6521684",
"0.6510899",
"0.6488458... | 0.7321573 | 3 |
Return the distance in meters between the two given coordinates (in the New York area). | def calc_dist(c1: Coordinates, c2: Coordinates = None) -> float:
# Get distances for each dimension in a common unit, meters.
lat_dist = (c1.lat - c2.lat) * LAT_RATIO
long_dist = (c1.lon - c2.lon) * LONG_RATIO
return math.sqrt(lat_dist**2 + long_dist**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_in_meters(coord1, coord2):\n return vincenty(coord1, coord2).meters",
"def get_distance_meters(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5",
"def get_distance_me... | [
"0.76660734",
"0.75017685",
"0.7493413",
"0.7457614",
"0.7310704",
"0.73079336",
"0.73029757",
"0.7300426",
"0.73001254",
"0.7280035",
"0.7274717",
"0.72648305",
"0.7234587",
"0.72293293",
"0.7191838",
"0.7176526",
"0.7127137",
"0.7127137",
"0.7127137",
"0.7127137",
"0.712713... | 0.6983037 | 41 |
Return the total distance traveled by the coordinate path, in meters. | def calc_total_dist(path: Path) -> float:
return sum(
calc_dist(*cs)
for cs in iter_n(path, 2)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTotalDistanceTraveled(self):\n return self.totalDistance",
"def total_distance(self) -> float:\n if len(self) < 2:\n raise ValueError(\"Need at least 2 points in the route to calculate a\"\n \"distance.\")\n\n total = 0.0\n other = Fals... | [
"0.75343287",
"0.7511744",
"0.75041777",
"0.74047446",
"0.7182328",
"0.7127821",
"0.7095384",
"0.6986745",
"0.69609094",
"0.6888761",
"0.687757",
"0.68732846",
"0.6868973",
"0.6859147",
"0.6837931",
"0.6829699",
"0.6812627",
"0.6780055",
"0.6754843",
"0.66988504",
"0.66839653... | 0.72663015 | 4 |
Return the average of the items of the given iterable. | def avg(iterable: Iterable[Num]) -> float:
sum_nums = 0
nums = 0
for num in iterable:
sum_nums += num
nums += 1
return sum_nums / nums | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mean(iterable):\n return sum(iterable) / len(iterable)",
"def avg():\n\n # call sum method to add up the values in the collection & div by the num of items\n # call len method to compute the # of vals in collection which is divided by sum total \n mean = sum(inlist) / len(inlist)\n return ... | [
"0.829116",
"0.737815",
"0.73306614",
"0.73205376",
"0.7273613",
"0.72509784",
"0.72010463",
"0.7200777",
"0.7124966",
"0.7073672",
"0.70215756",
"0.6910773",
"0.6747254",
"0.6725859",
"0.6688164",
"0.667409",
"0.6662498",
"0.6656647",
"0.66358584",
"0.6635419",
"0.66180164",... | 0.8306279 | 0 |
Returns project root folder | def get_project_root():
return Path(__file__).parent.parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_root() -> Path:\n return PROJECT_ROOT",
"def getProjectRootDir():\n return ROOT_DIR",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() -> Path:\n return Pa... | [
"0.8921447",
"0.86931896",
"0.85417926",
"0.85417926",
"0.85417926",
"0.85417926",
"0.8528684",
"0.8528684",
"0.84760284",
"0.84725773",
"0.84698427",
"0.8427023",
"0.8359873",
"0.83151823",
"0.8282492",
"0.8273041",
"0.8225639",
"0.82116413",
"0.8178799",
"0.817541",
"0.8102... | 0.85720927 | 2 |
Implement the step of equation \dot(u) = u u^3 v | def step_u(u_old, v_old, dt, dx2):
return u_old + dt*(u_old - u_old**3 - v_old + laplacian(u_old, dx2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euler_forward(self, u, v, I):\n # The constants 0.04, 5, 140 are the one fits all parameters from Simple Model of Spiking Neurons E. Izhikevich.\n # These constants are justified when simulating large networks of neurons.\n # TODO: Parameterise the four constants 0.04, 5, 140.\n _v ... | [
"0.70422417",
"0.67478263",
"0.6614003",
"0.6244449",
"0.6228861",
"0.61208874",
"0.60831577",
"0.6067274",
"0.6064658",
"0.60515594",
"0.60435903",
"0.597949",
"0.5918871",
"0.590761",
"0.58739454",
"0.5867638",
"0.5854488",
"0.5849085",
"0.58423597",
"0.58064985",
"0.579931... | 0.7109581 | 0 |
Implement the step of equation \dot(v) = e(u + a) | def step_v(u_old, v_old, dt, dx2):
return v_old + dt*(e*(u_old + a0) + delta*laplacian(v_old,dx2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euler_forward(self, u, v, I):\n # The constants 0.04, 5, 140 are the one fits all parameters from Simple Model of Spiking Neurons E. Izhikevich.\n # These constants are justified when simulating large networks of neurons.\n # TODO: Parameterise the four constants 0.04, 5, 140.\n _v ... | [
"0.6853443",
"0.6633423",
"0.65036654",
"0.64710236",
"0.627423",
"0.6252341",
"0.61948675",
"0.61440885",
"0.6094799",
"0.6069599",
"0.5988743",
"0.5900063",
"0.5892302",
"0.58811086",
"0.58667785",
"0.5866512",
"0.58549136",
"0.5800178",
"0.57693774",
"0.5764226",
"0.573180... | 0.6905849 | 0 |
Gets the filter_enable_safe_user_agents of this ComAdobeGraniteCsrfImplCSRFFilterProperties. | def filter_enable_safe_user_agents(self) -> ConfigNodePropertyBoolean:
return self._filter_enable_safe_user_agents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_enable_safe_user_agents(self, filter_enable_safe_user_agents: ConfigNodePropertyBoolean):\n\n self._filter_enable_safe_user_agents = filter_enable_safe_user_agents",
"def filter_safe_user_agents(self) -> ConfigNodePropertyArray:\n return self._filter_safe_user_agents",
"def filter_safe... | [
"0.76933867",
"0.7510559",
"0.71527714",
"0.5910388",
"0.5211892",
"0.4999339",
"0.49708423",
"0.48400402",
"0.47660205",
"0.47466105",
"0.46761164",
"0.45882198",
"0.4581342",
"0.45596823",
"0.45588526",
"0.44854364",
"0.44695738",
"0.4464841",
"0.44624287",
"0.44194758",
"0... | 0.8127575 | 0 |
Gets the filter_safe_user_agents of this ComAdobeGraniteCsrfImplCSRFFilterProperties. | def filter_safe_user_agents(self) -> ConfigNodePropertyArray:
return self._filter_safe_user_agents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_enable_safe_user_agents(self) -> ConfigNodePropertyBoolean:\n return self._filter_enable_safe_user_agents",
"def filter_safe_user_agents(self, filter_safe_user_agents: ConfigNodePropertyArray):\n\n self._filter_safe_user_agents = filter_safe_user_agents",
"def filter_enable_safe_user_a... | [
"0.7643321",
"0.7358117",
"0.71622956",
"0.62809354",
"0.5066206",
"0.5007971",
"0.4974434",
"0.49650303",
"0.4933795",
"0.4916978",
"0.49080795",
"0.4896216",
"0.47388366",
"0.46265602",
"0.46050337",
"0.46005735",
"0.46005735",
"0.45527127",
"0.45247063",
"0.4522474",
"0.45... | 0.79454964 | 0 |
Sets the filter_safe_user_agents of this ComAdobeGraniteCsrfImplCSRFFilterProperties. | def filter_safe_user_agents(self, filter_safe_user_agents: ConfigNodePropertyArray):
self._filter_safe_user_agents = filter_safe_user_agents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_enable_safe_user_agents(self, filter_enable_safe_user_agents: ConfigNodePropertyBoolean):\n\n self._filter_enable_safe_user_agents = filter_enable_safe_user_agents",
"def filter_enable_safe_user_agents(self) -> ConfigNodePropertyBoolean:\n return self._filter_enable_safe_user_agents",
... | [
"0.83087236",
"0.7382046",
"0.6873159",
"0.5212695",
"0.50199115",
"0.493303",
"0.4623475",
"0.45591816",
"0.45438543",
"0.4517408",
"0.44958052",
"0.44913065",
"0.44911823",
"0.44717",
"0.44650334",
"0.44569734",
"0.44501454",
"0.44369078",
"0.43446073",
"0.42930415",
"0.424... | 0.84417343 | 0 |
Gets the filter_excluded_paths of this ComAdobeGraniteCsrfImplCSRFFilterProperties. | def filter_excluded_paths(self) -> ConfigNodePropertyArray:
return self._filter_excluded_paths | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_apache_felix_jetty_gzip_excluded_paths(self) -> ConfigNodePropertyArray:\n return self._org_apache_felix_jetty_gzip_excluded_paths",
"def org_apache_felix_http_path_exclusions(self) -> ConfigNodePropertyArray:\n return self._org_apache_felix_http_path_exclusions",
"def filter_excluded_pat... | [
"0.6920902",
"0.68333584",
"0.682466",
"0.5935741",
"0.5776294",
"0.565493",
"0.5638689",
"0.5630091",
"0.5506123",
"0.5504244",
"0.5489355",
"0.54808366",
"0.5479383",
"0.54620594",
"0.54569167",
"0.5445827",
"0.54218125",
"0.5386669",
"0.53649026",
"0.52905107",
"0.5272563"... | 0.7737465 | 0 |
Returns True if x is zero. | def _iszero(x):
return getattr(x, 'is_zero', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self):\n return self._express.is_zero()",
"def is_zero(self) -> bool:\n return self.field.zero == self",
"def _is_zero(x):\r\n if not hasattr(x, 'type'):\r\n return np.all(x == 0.)\r\n if isinstance(x.type, NullType):\r\n return 'no'\r\n if isinstance(x.type, Di... | [
"0.7721805",
"0.7717134",
"0.77024066",
"0.76980704",
"0.7679771",
"0.76286954",
"0.76187515",
"0.755145",
"0.753478",
"0.7440336",
"0.7337006",
"0.7325177",
"0.72701687",
"0.7248809",
"0.72391427",
"0.7227053",
"0.7205203",
"0.7197679",
"0.7191518",
"0.7188681",
"0.718545",
... | 0.8065645 | 0 |
Combine lists. >>> concat_lists([1, 2], [3, 4]) [1, 2, 3, 4] >> > concat_lists([], [1, 2]) [1, 2] >>> concat_lists([1, 2], []) [1, 2] >>> concat_lists([], []) [] | def concat_lists(list1, list2):
# return list1 + list2
for item in list2:
list1.append(item)
return list1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat(list_of_lists):\n return reduce(lambda a,b : a+b,list_of_lists,[])",
"def concatenateList(list1, list2):\n outputList = []\n\n ## list1\n # if it's an empty list\n if len(list1) == 0:\n outputList.append(list1)\n # if it's already ... | [
"0.7550362",
"0.73840106",
"0.7038871",
"0.66273177",
"0.662588",
"0.6451714",
"0.63251",
"0.63130045",
"0.6269502",
"0.6255573",
"0.61849356",
"0.615213",
"0.61327803",
"0.6131909",
"0.6092731",
"0.59225786",
"0.5881282",
"0.5880444",
"0.5766092",
"0.5762399",
"0.57535046",
... | 0.7221829 | 2 |
Set up the Bitcoin sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
currency = config[CONF_CURRENCY]
if currency not in exchangerates.get_ticker():
_LOGGER.warning("Currency %s is not available. Using USD", currency)
currency = DEFAULT_CURRENCY
data = BitcoinData()
dev = []
for v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n import protolibs.ics_servers as ics_servers\n from point import Point\n from configobj import ConfigObj\n\n # Get config file\n configfile = '/'.join(['sims', 'rtutank', 'config'])\n config=ConfigObj(infile=configfile, unrepr=True)\n self.config =... | [
"0.6420655",
"0.63682836",
"0.6331749",
"0.62936944",
"0.62344927",
"0.6220634",
"0.6179077",
"0.6101424",
"0.6028544",
"0.60281724",
"0.60234445",
"0.60139316",
"0.59621227",
"0.5935511",
"0.59276354",
"0.591465",
"0.59119093",
"0.59100586",
"0.5866999",
"0.5866698",
"0.5860... | 0.57191217 | 32 |
Retrieve current Ensembl or EnsemblGenomes release version. | def get_release(self, is_vertebrate: bool) -> int:
ext = "/info/data/?" if is_vertebrate else "/info/eg_version?"
ret = retry(request_json, 3, self._url, ext)
return int(ret["releases"][0] if is_vertebrate else ret["version"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_version(self):\n try:\n return self.release_set.order_by('-created')[0].version\n except IndexError:\n return \"0.0.0\"",
"def get_release_version(self):\n return self.get_property(ADB.VERSION_RELEASE_PROPERTY)",
"def get_version():\n click.echo(get_cur... | [
"0.73196614",
"0.7051302",
"0.7008202",
"0.6952404",
"0.6939467",
"0.69044435",
"0.6854368",
"0.6844711",
"0.6842973",
"0.6839751",
"0.6813325",
"0.68121374",
"0.681192",
"0.67914706",
"0.67801565",
"0.6750511",
"0.6750511",
"0.6750511",
"0.6750511",
"0.6750511",
"0.6749468",... | 0.6504694 | 65 |
Compare sorted function with true sorted array | def pass_test(sort_func, arr):
sort_array = sorted(arr[:])
# Print accordingly
if sort_func(arr[:]) == sort_array:
print("Test Passed")
else:
print("Error: Test not passed") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sorter_functions(func, array_to_sort, expected_sorted_array):\n assert func(array_to_sort) == expected_sorted_array",
"def custom_sort(arr):\n pass",
"def check_sorted(self):\n last_count = np.inf\n for count in self.Nx:\n if count > last_count:\n self.sor... | [
"0.69240177",
"0.686875",
"0.6835802",
"0.6794516",
"0.66428745",
"0.6623882",
"0.6598583",
"0.6597872",
"0.65877247",
"0.6526115",
"0.65189993",
"0.6503774",
"0.6478704",
"0.6442569",
"0.643328",
"0.64310294",
"0.63715136",
"0.6255671",
"0.62050265",
"0.6158009",
"0.6152472"... | 0.6920494 | 1 |
Retrieve a value previously set with `set_user_attribute`. | def get_user_attribute(self, key, default=None):
return self._user_attributes.get(key, default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userattr(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"userattr\")",
"def userattr(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"userattr\")",
"def get_user_value(name: str, user: User):\n return Config.get_system_value(name)",
"def userattr(se... | [
"0.72331965",
"0.72331965",
"0.71271604",
"0.6960585",
"0.6624007",
"0.6527188",
"0.6329833",
"0.63145614",
"0.62933725",
"0.6279518",
"0.62319076",
"0.62137157",
"0.620829",
"0.6197883",
"0.6197883",
"0.6197883",
"0.6177166",
"0.6159512",
"0.6157236",
"0.61345583",
"0.611433... | 0.7555947 | 0 |
Converts roll, yaw, pitch to a quaternion. | def convert_euler_to_quaternion(roll, yaw, pitch):
# roll (z), yaw (y), pitch (x)
cy = math.cos(math.radians(roll) * 0.5)
sy = math.sin(math.radians(roll) * 0.5)
cp = math.cos(math.radians(yaw) * 0.5)
sp = math.sin(math.radians(yaw) * 0.5)
cr = math.cos(math.radians(pitch) * 0.5)
sr = ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_quaternion(self, roll=0.0, pitch=0.0, yaw=0.0):\n t0 = math.cos(math.radians(yaw * 0.5))\n t1 = math.sin(math.radians(yaw * 0.5))\n t2 = math.cos(math.radians(roll * 0.5))\n t3 = math.sin(math.radians(roll * 0.5))\n t4 = math.cos(math.radians(pitch * 0.5))\n t5 = ma... | [
"0.8035221",
"0.78544",
"0.7854085",
"0.7843692",
"0.7771143",
"0.7728366",
"0.7728366",
"0.7719018",
"0.7616216",
"0.7499768",
"0.7301791",
"0.7250658",
"0.7218019",
"0.7099127",
"0.69965523",
"0.69716936",
"0.69629115",
"0.69288945",
"0.6884879",
"0.6879215",
"0.6839856",
... | 0.75951743 | 9 |
Returns project root folder. | def get_project_root():
return str(Path(__file__).parent.parent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_root() -> Path:\n return PROJECT_ROOT",
"def getProjectRootDir():\n return ROOT_DIR",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def get_project_root() -> Path:\n return Pa... | [
"0.8855307",
"0.8816829",
"0.8488286",
"0.8488286",
"0.8488286",
"0.8488286",
"0.847031",
"0.8462203",
"0.8425219",
"0.8419815",
"0.83712715",
"0.8356894",
"0.83145547",
"0.8294601",
"0.828788",
"0.8250647",
"0.82296336",
"0.8205302",
"0.81644493",
"0.8087945",
"0.8083112",
... | 0.84460264 | 9 |
Convert a datetime to a timestamp string | def adapt_timestamp(data):
return str(time.mktime(data.timetuple())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_stamp(datetime_):\r\n try:\r\n return datetime_.timestamp()\r\n except AttributeError:\r\n return time.mktime(datetime_.timetuple()) + datetime_.microsecond / 1e6",
"def get_timestamp_from_datetime(dt: datetime.datetime) -> str:\n return dt.strftime(DateFormat)",
"def timestamp():... | [
"0.77440983",
"0.75256854",
"0.7340884",
"0.7339002",
"0.72939825",
"0.7286755",
"0.7220415",
"0.71823347",
"0.71823347",
"0.7143056",
"0.71386886",
"0.71142983",
"0.70903033",
"0.70748335",
"0.70722795",
"0.7065951",
"0.702819",
"0.69846857",
"0.6983898",
"0.6979848",
"0.694... | 0.7307548 | 4 |
Convert a timestamp to a datetime object | def convert_timestamp(data):
try:
return datetime.datetime.fromtimestamp(float(data))
except ValueError:
return datetime.datetime.fromisoformat(data.decode("utf-8")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _timestamp_to_datetime(timestamp):\n return datetime.fromtimestamp(timestamp * 0.001, tz=timezone.utc)",
"def timestamp_to_datetime(timestamp: int) -> datetime:\n return datetime.fromtimestamp(timestamp, tz=timezone.utc)",
"def fromtimestamp(cls, timestamp, tz=None):\n return datetime()",
... | [
"0.82815135",
"0.8021166",
"0.765658",
"0.74902123",
"0.7401416",
"0.7386257",
"0.7384789",
"0.7380946",
"0.737658",
"0.737345",
"0.7298191",
"0.72845083",
"0.7276975",
"0.71696174",
"0.7134575",
"0.71150595",
"0.710896",
"0.70817333",
"0.7064934",
"0.70348823",
"0.70065016",... | 0.7410249 | 4 |
Close and remove the database from disk. | def teardown(self):
try:
self._close(True)
except:
pass
try:
os.unlink(os.path.join(self.home_dir, DB_FILE))
except FileNotFoundError as _:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_db(self):\n import os.path\n os.remove(self.filepath)",
"def cleanup(self):\n if os.path.exists(self._db):\n os.remove(self._db)",
"def close(self):\n self.db.remove()\n self.engine.dispose()",
"def tearDown(self):\n os.close(self.db_fd)\n ... | [
"0.8282476",
"0.8071048",
"0.80617005",
"0.78800195",
"0.78357464",
"0.7827832",
"0.77825093",
"0.7766468",
"0.7750411",
"0.77248734",
"0.7707664",
"0.7663666",
"0.7629601",
"0.7629601",
"0.7629601",
"0.75946754",
"0.75798786",
"0.7570094",
"0.75438446",
"0.75124466",
"0.7488... | 0.777051 | 7 |
Static method to close the database and remove it from disk. | def destroy(cls):
try:
MockConnection.__instance.close()
MockConnection.__instance = None
MockConnection.__refcount = 0
except:
pass
try:
os.unlink(os.path.join(cls.home_dir, DB_FILE))
except:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_db(self):\n import os.path\n os.remove(self.filepath)",
"def close(self):\n self.db.remove()\n self.engine.dispose()",
"def cleanup(self):\n if os.path.exists(self._db):\n os.remove(self._db)",
"def tearDown(self):\n os.close(self.db_fd)\n ... | [
"0.8155037",
"0.79321796",
"0.7914927",
"0.7891795",
"0.7842873",
"0.782811",
"0.77808005",
"0.7748151",
"0.7716098",
"0.76745987",
"0.7667488",
"0.765487",
"0.76497185",
"0.75757074",
"0.75757074",
"0.75757074",
"0.75685126",
"0.75030243",
"0.7497834",
"0.74779767",
"0.74688... | 0.7452762 | 22 |
Return the display name of the template. | def get_display_name(self):
return self._display_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect_template_name(self) -> str:\n return pulumi.get(self, \"inspect_template_name\")",
"def arm_template_display_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"arm_template_display_name\")",
"def arm_template_display_name(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.83380896",
"0.8207735",
"0.7993113",
"0.79663354",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.79220074",
"0.788991",
"0.76624733",
"0.76624733",
"0.76624733",
... | 0.72165805 | 69 |
Converts 'under_score_string' > 'underScoreString' | def camelcase(value):
rest = value.split("_")
return rest[0] + "".join(word.title() for word in rest[1:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_underscores(string):\n s = capwords(string.replace(\"_\", \" \"))\n return s",
"def filter_underscores(self, string):\n newstring = string.replace('_', '-')\n return newstring",
"def _mapToRestClass(self, rest_class):\n # Don't parse words that already have an underscore or... | [
"0.633552",
"0.61862546",
"0.57923436",
"0.5747389",
"0.55415684",
"0.55218595",
"0.5417373",
"0.53867453",
"0.526234",
"0.52477044",
"0.5197041",
"0.5152706",
"0.5152649",
"0.5139977",
"0.5139977",
"0.5139977",
"0.5139977",
"0.5139975",
"0.51082957",
"0.5088655",
"0.50882125... | 0.0 | -1 |
Inherit all parent settings that the current config does not define. | def inherit(self, parent):
return self.__class__(Cfg._mergedicts(self, parent, False)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def override(self, parent):\n return self.__class__(Cfg._mergedicts(self, parent, True))",
"def inherit_config(child, parent, keys):\n for key in keys:\n if key not in child.keys():\n child[key] = parent[key]\n print(\n \"{} not found in io.yaml file, falling... | [
"0.7187587",
"0.6955679",
"0.6364189",
"0.6303008",
"0.62866473",
"0.62807673",
"0.61913365",
"0.6125954",
"0.5891813",
"0.5826386",
"0.57407653",
"0.5734138",
"0.5713583",
"0.5695681",
"0.56921166",
"0.56659466",
"0.5665835",
"0.56089467",
"0.5593219",
"0.5591946",
"0.556341... | 0.7394419 | 0 |
Set the logging level | def setLevel(self, level):
self.lvl = level | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if level == 'debug':\n level = logging.DEBUG\n if level == 'error':\n level = logging.ERROR\n self._log.setLevel(level)",
"def set_level(self, level: str):\n self... | [
"0.84037143",
"0.83317757",
"0.83228004",
"0.83176285",
"0.8308071",
"0.82121253",
"0.81788355",
"0.8134428",
"0.8041248",
"0.8018885",
"0.79927987",
"0.791394",
"0.78645366",
"0.7787451",
"0.77767855",
"0.77482855",
"0.7738889",
"0.77361447",
"0.77008474",
"0.7683267",
"0.76... | 0.72255605 | 37 |
Find project root path from specified file/directory path, based on common project root file pattern. | def detect(current_path = None, pattern = None):
current_path = current_path or os.getcwd()
current_path = path.abspath(path.normpath(path.expanduser(current_path)))
pattern = pattern or DEFAULT_ROOT_FILENAME_MATCH_PATTERN
if not path.isdir(current_path):
current_path = path.dirname(current_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_root() -> pathlib.Path:\n cwd = pathlib.Path.cwd()\n while not (\n pathlib.Path(cwd, \"pyproject.toml\").exists() or\n pathlib.Path(cwd, \"poetry.lock\").exists() or\n pathlib.Path(\"/\") == cwd\n ):\n cwd = cwd.parent\n return cwd",
"def project_root() -> Path:\... | [
"0.70532906",
"0.6910879",
"0.68903977",
"0.68903977",
"0.68903977",
"0.68903977",
"0.6866365",
"0.6816584",
"0.68093336",
"0.67833585",
"0.67828333",
"0.6778225",
"0.6734109",
"0.671775",
"0.65446144",
"0.65446144",
"0.6493771",
"0.6414587",
"0.63842404",
"0.63672185",
"0.62... | 0.6444914 | 17 |
Split from the right side >>> rsplit('', None, 1) [] >>> rsplit('', '.', 1) [''] >>> rsplit('abc', '.', 1) ['abc'] >>> rsplit('a.b.c.d.e.f.g', '.', 1) ['a.b.c.d.e.f', 'g'] >>> rsplit('a.b.c.d.e.f.g', '.', 2) ['a.b.c.d.e', 'f', 'g'] | def _rsplit(value, sep, maxsplit=None):
str_parts = value.split(sep)
if (maxsplit is not None) and (len(str_parts) > 1):
return [str.join(sep, str_parts[:-maxsplit])] + str_parts[-maxsplit:]
return str_parts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsplit(self) -> List[String]:\n pass",
"def rsplit(s, sep, maxsplits=0):\n L = s.split(sep)\n if not 0 < maxsplits <= len(L):\n return L\n return [sep.join(L[0:-maxsplits])] + L[-maxsplits:]",
"def rsplit(self, sep=None, maxsplit=None):\n return rsplit(self, sep, maxsplit)",
"de... | [
"0.6834162",
"0.6382411",
"0.62000066",
"0.6112162",
"0.6087543",
"0.6048714",
"0.6048714",
"0.60298634",
"0.5903098",
"0.5897892",
"0.5674078",
"0.559032",
"0.558471",
"0.5579754",
"0.5538265",
"0.5537575",
"0.5443441",
"0.5394327",
"0.5384527",
"0.5380799",
"0.53627264",
... | 0.63941896 | 1 |
Create an empty timeline slot and sets its segment to a new, empty `aaf2.components.Sequence` component. Timeline slots are for continuous, monotonicallychanging media, like picture and sound. | def create_empty_sequence_slot(self, edit_rate, slot_id=None, media_kind=None):
slot = self.create_timeline_slot(edit_rate, slot_id)
sequence = self.root.create.Sequence(media_kind=media_kind)
sequence['Components'].value = []
slot.segment = sequence
return slot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sound_slot(self, edit_rate=25):\n return self.create_empty_sequence_slot(edit_rate, media_kind=\"sound\")",
"def __init__(self):\n super().__init__()\n self._points = 0\n self._segments = []\n self.fill_list()\n # i = random.randint(0, len(self._segments) - 1)... | [
"0.5516654",
"0.5348298",
"0.52002007",
"0.5134494",
"0.5134494",
"0.50891614",
"0.49253228",
"0.4921563",
"0.4913621",
"0.49094787",
"0.49060673",
"0.4816216",
"0.48095387",
"0.4795349",
"0.4763048",
"0.47387367",
"0.47359204",
"0.4734855",
"0.473055",
"0.47220668",
"0.46820... | 0.8448822 | 0 |
Create an empty timeline slot, with the 'sound' media kind, and sets its segment to a new, empty `aaf2.components.Sequence` component. | def create_sound_slot(self, edit_rate=25):
return self.create_empty_sequence_slot(edit_rate, media_kind="sound") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_empty_sequence_slot(self, edit_rate, slot_id=None, media_kind=None):\n slot = self.create_timeline_slot(edit_rate, slot_id)\n sequence = self.root.create.Sequence(media_kind=media_kind)\n sequence['Components'].value = []\n slot.segment = sequence\n return slot",
"d... | [
"0.78113693",
"0.48640096",
"0.4783314",
"0.4722068",
"0.47105065",
"0.46823877",
"0.46748075",
"0.46200013",
"0.46146122",
"0.46091688",
"0.45786828",
"0.45253932",
"0.4496662",
"0.44885072",
"0.44663453",
"0.4460587",
"0.4444967",
"0.4425024",
"0.4396923",
"0.4382409",
"0.4... | 0.6981341 | 1 |
computes a gumbel softmax sample | def __call__(self,logits):
#sample from Gumbel(0, 1)
uniform = self._srng.uniform(logits.shape,low=0,high=1)
gumbel = -T.log(-T.log(uniform + self.eps) + self.eps)
#draw a sample from the Gumbel-Softmax distribution
return T.nnet.softmax((logits + gumbel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gumbel_softmax_sample(self, logits, temperature):\r\n y = logits + self._sample_gumbel(tf.shape(logits))\r\n return tf.nn.softmax(y / temperature, axis=-1)",
"def gumbel_softmax_sample(logits, temperature):\n y = logits + sample_gumbel(tf.shape(logits))\n return tf.nn.softmax( y / temperatur... | [
"0.7603841",
"0.756124",
"0.756124",
"0.75271124",
"0.74172735",
"0.72264516",
"0.7056274",
"0.70431995",
"0.7041923",
"0.70368147",
"0.70283055",
"0.69943583",
"0.6993845",
"0.6993845",
"0.69925344",
"0.6985711",
"0.6985711",
"0.6952511",
"0.6938342",
"0.69357854",
"0.693462... | 0.7100669 | 6 |
computes a hard onehot vector encoding maximum | def onehot_argmax(logits):
return T.extra_ops.to_one_hot(T.argmax(logits,-1),logits.shape[-1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unhot(one_hot_labels):\n return np.argmax(one_hot_labels, axis=1)",
"def reverse_one_hot(image):\r\n # w = image.shape[0]\r\n # h = image.shape[1]\r\n # x = np.zeros([w,h,1])\r\n\r\n # for i in range(0, w):\r\n # for j in range(0, h):\r\n # index, value = max(enumerate(image[... | [
"0.77916473",
"0.7714328",
"0.7474593",
"0.7424082",
"0.7412359",
"0.73833036",
"0.7357814",
"0.7140046",
"0.70794755",
"0.7046214",
"0.7037539",
"0.703162",
"0.70090854",
"0.693742",
"0.6935294",
"0.6920711",
"0.6873614",
"0.68454146",
"0.6828821",
"0.67562354",
"0.6753241",... | 0.7894884 | 0 |
Get the val out of the _cache dict object, or None if it doesn't exist. | def getCache(self, key):
return self._cache.get(key, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key):\n if key:\n return self.cache_data.get(key)\n else:\n return None",
"def get(self, key):\n if key and key in self.cache_data.keys():\n return self.cache_data[key]\n else:\n return None",
"def get(self, key):\n if... | [
"0.7864897",
"0.7863922",
"0.7863922",
"0.78314173",
"0.7738695",
"0.7485548",
"0.7355947",
"0.730668",
"0.73027575",
"0.7170514",
"0.71698326",
"0.7143345",
"0.7127229",
"0.7091024",
"0.70304585",
"0.6929117",
"0.6828941",
"0.67976004",
"0.676879",
"0.67623097",
"0.67537737"... | 0.6473062 | 31 |
Get the chute's configuration object. | def getConfiguration(self):
# TODO: Split metadata (e.g. name and version) from configuration data.
# Currently, we do this by selectively copying from __dict__. A
# cleaner separation would require refactoring all the way through how
# we create update objects.
config = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_configuration(self) -> dict:\n return self.config",
"def get_config(self):\n return self.config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n ... | [
"0.77727985",
"0.7751714",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",
"0.76845586",... | 0.0 | -1 |
Get the chute's host_config options for Docker. Returns an empty dictionary if there is no host_config setting. | def getHostConfig(self):
config = getattr(self, 'host_config', None)
if config is None:
config = {}
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_host_config(self, hostid, **kwargs):\n return {}",
"def host_config(self) -> Optional['outputs.RuleRuleConditionHostConfig']:\n return pulumi.get(self, \"host_config\")",
"def host(self, host):\n for p, c in self.configs_:\n if host in c.hosts_:\n return c... | [
"0.71173173",
"0.69000447",
"0.6485871",
"0.6391189",
"0.6383279",
"0.62348825",
"0.623061",
"0.60981375",
"0.6098008",
"0.603031",
"0.60087997",
"0.6002737",
"0.5935141",
"0.5923315",
"0.58907",
"0.58178556",
"0.58160335",
"0.58108926",
"0.58108926",
"0.5806871",
"0.57947445... | 0.7622666 | 0 |
Returns a random color with full alpha. | def randcol():
col = [randint(0,255) for _ in range(3)]
return gfx.Color(tuple(col)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_color():\n return random.randint(0, 255)",
"def random_color():\n colormode(255)\n return randint(0, 255), randint(0, 255), randint(0, 255)",
"def random_color():\n r = lambda: random.randint(0, 255)\n color = ('%02X%02X%02X' % (r(), r(), r()))\n return color",
"def generate_col... | [
"0.7846053",
"0.7743438",
"0.77175266",
"0.75389934",
"0.7484088",
"0.7468291",
"0.7452694",
"0.7440028",
"0.7379802",
"0.73493963",
"0.7336826",
"0.7328525",
"0.72962385",
"0.7233501",
"0.7225034",
"0.7183882",
"0.71625113",
"0.7161208",
"0.7136256",
"0.70487565",
"0.7027125... | 0.66425306 | 28 |
Returns a random color that is guaranteed to be fully saturated. Min brightness clamped to 40. | def saturated_randcol(value=255):
# one channel is zero, one is random and one is max
channels = [0,randint(0,255),255]
col = [0,0,0]
value = clamp(value,40,255)
for i in range(3):
channel = choice(channels)
col[i] = channel*value//255
channels.remove(channel)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_color():\n return random.randint(0, 255)",
"def random_color():\n colormode(255)\n return randint(0, 255), randint(0, 255), randint(0, 255)",
"def _get_random_color(self):\r\n random_number = random.random()\r\n if random_number <= 1 / 3.0:\r\n return Color.RED\r\n... | [
"0.75250447",
"0.72310495",
"0.71573436",
"0.69791514",
"0.6915051",
"0.6911662",
"0.68701315",
"0.6855806",
"0.6852881",
"0.68140125",
"0.6748551",
"0.674631",
"0.673296",
"0.6703766",
"0.6657214",
"0.6590976",
"0.65833795",
"0.65768826",
"0.65442944",
"0.6543563",
"0.654240... | 0.69938666 | 3 |
Returns a random color that is guaranteed to have low saturation and high brightness like a pastel color. | def pastel_randcol():
# begin with saturated then desaturate
col = saturated_randcol()
offset = 175
for i in range(3):
if col[i] == 255:
continue
elif col[i] != 0:
col[i] = min(col[i]+offset,255)
else:
col[i] += offset
return gfx.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_color():\n return random.randint(0, 255)",
"def random_color():\n colormode(255)\n return randint(0, 255), randint(0, 255), randint(0, 255)",
"def randcolor():\n return (randint(0,255), randint(0,255), randint(0,255))",
"def get_random_color():\n r=random.randint(0,255)\n g=random... | [
"0.79295254",
"0.7750443",
"0.7505849",
"0.75024605",
"0.7443906",
"0.7428781",
"0.74055505",
"0.73909706",
"0.73689026",
"0.73467857",
"0.72735995",
"0.72468287",
"0.7231096",
"0.72151077",
"0.72074807",
"0.7155639",
"0.7128901",
"0.7087909",
"0.70793265",
"0.7034686",
"0.70... | 0.72404534 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.