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 |
|---|---|---|---|---|---|---|
Instantiate a new api.serializers.Account object. | def __init__(self, userdata):
self.fullname = userdata['name']
self.href = "/%s" % (userdata['screen_name'])
self.id = userdata['id'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account(self, account_id):\r\n return Account(self, account_id)",
"def account(self):\r\n return Account(self)",
"def account(self):\n return Account(self)",
"def create(self, account):\n model = models.load('Account', account)\n\n return self.client.create_account(mode... | [
"0.7129819",
"0.7120673",
"0.70413244",
"0.69281614",
"0.68859255",
"0.687654",
"0.6723808",
"0.66466886",
"0.66342103",
"0.65874034",
"0.65601504",
"0.65165794",
"0.6486574",
"0.628928",
"0.6268148",
"0.6268137",
"0.6263541",
"0.62603444",
"0.6249259",
"0.6232276",
"0.621863... | 0.0 | -1 |
Instantiate a new api.serializers.Tweet object. | def __init__(self, tweet_data):
_hashtags = tweet_data['entities']['hashtags']
_str_date = tweet_data['created_at']
self.account = Account(tweet_data['user'])
self.date = self.format_date(_str_date)
self.hashtags = ["#%s" % (tag['text']) for tag in _hashtags]
self.likes =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, validated_data):\n return Tweet.objects.create(**validated_data)",
"def __init__(self):\n auth = tweepy.OAuthHandler(consumer_key, consumer_secret)\n auth.set_access_token(access_token, access_token_secret)\n self.api = tweepy.API(auth)",
"def __init__(self, topics=... | [
"0.64852065",
"0.62838906",
"0.62375265",
"0.62353617",
"0.61628425",
"0.6124323",
"0.60262257",
"0.6009463",
"0.59995705",
"0.599747",
"0.59638244",
"0.59638244",
"0.59638244",
"0.59638244",
"0.59551936",
"0.5955186",
"0.5950777",
"0.58785814",
"0.5856882",
"0.5818042",
"0.5... | 0.6329346 | 1 |
Convert string Date to python datetime object. | def parse_twitter_date(self, date):
return time.strptime(date, '%a %b %d %H:%M:%S +0000 %Y') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_datetime(date_string):\n return dt.strptime(date_string, '%Y-%m-%d')",
"def str_to_date(date_as_str):\n date_time_obj = datetime.datetime.strptime(date_as_str, '%Y-%m-%d').date()\n return date_time_obj",
"def str_to_datetime(datestr):\n\n from dateutil import parser\n from datetime import... | [
"0.77857846",
"0.7769158",
"0.77088344",
"0.7685639",
"0.7609546",
"0.7557099",
"0.7539634",
"0.7508778",
"0.7483374",
"0.73845315",
"0.73582846",
"0.73469955",
"0.7340292",
"0.7313919",
"0.7313025",
"0.73010904",
"0.7232685",
"0.7195694",
"0.71573496",
"0.71435106",
"0.71361... | 0.0 | -1 |
Representation of the error. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_string(self):\n return self._error_string",
"def error(self):\n return self['error']",
"def __str__(self):\n return \"Error: %s\"%self.__message",
"def __str__(self):\n return \"ERROR: \" + self.error_message",
"def error(self):\n return self._error",
"def err... | [
"0.7980459",
"0.7963723",
"0.76769084",
"0.7674156",
"0.757487",
"0.757487",
"0.757487",
"0.75340724",
"0.75090754",
"0.74780583",
"0.7463856",
"0.74593246",
"0.7457132",
"0.74009943",
"0.73618555",
"0.7268847",
"0.7266974",
"0.7266974",
"0.7266974",
"0.7243593",
"0.7241866",... | 0.0 | -1 |
Estimate MUF from the GS power | def build_oblique_foF2_observed_by_radar(rad="cvw", dates=[dt.datetime(2017,8,21), dt.datetime(2017,8,21)], bmnum=11, scan_num=1,
remove_first_range=800, remove_last_range=2500, power_drop=10., plot=True):
csv_fname = "data/{rad}_{start}_{end}.csv".format(rad=rad, start=dates... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def U_MP9301(ps, **kw) -> MAG:\n g, i = kw.get(\"g\", \"g\"), kw.get(\"i\", \"i\")\n gmi = kw.get(\"gmi\", \"g-i\")\n\n c = data.loc[\"U_MP9301\"]\n\n if gmi in ps.colnames:\n gmi = ps[gmi]\n else:\n gmi = ps[g] - ps[i]\n\n ind = (c[\"lb\"] < gmi) & (gmi < c[\"ub\"])\n if not all... | [
"0.6330928",
"0.61385334",
"0.61268765",
"0.6048672",
"0.60202134",
"0.59456927",
"0.5941877",
"0.5867873",
"0.58605474",
"0.5851818",
"0.5846602",
"0.584423",
"0.58225936",
"0.58222187",
"0.5801292",
"0.5796336",
"0.5782683",
"0.57677734",
"0.5765257",
"0.5743596",
"0.574197... | 0.0 | -1 |
Takes a phrase and a dictionary, and returns a subdictionary consisting of all the elements that DO NOT contain that phrase in their key. | def get_anti_subdict(indict, phrase):
subdict = {}
for key in indict:
if phrase not in key:
subdict[key] = indict[key]
return subdict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subdict(indict, phrase):\n\tsubdict = {}\n\tfor key in indict:\n\t\tif phrase in key:\n\t\t\tsubdict[key] = indict[key]\n\treturn subdict",
"def clean_dict(dictionary):\n return {k: v for k, v in dictionary.items() if v}",
"def remove_empty_list(dictionary):\n\n return {k: v for k, v in dictionar... | [
"0.6905596",
"0.63059944",
"0.61427444",
"0.60887814",
"0.59054095",
"0.5884054",
"0.58834535",
"0.5876888",
"0.5870512",
"0.5845844",
"0.5817986",
"0.58132833",
"0.5811627",
"0.58009493",
"0.5751034",
"0.57462114",
"0.57440335",
"0.57005185",
"0.56912816",
"0.56638306",
"0.5... | 0.84988296 | 0 |
Plots the two provided dictionaries against each other, in the provided colour. | def plot_dicts(dict1, dict2, color):
plotlists = prep_for_plot(dict1, dict2)
list1 = plotlists[0]
list2 = plotlists[1]
plt.scatter(list1, list2, marker='.', color=color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __plot( dict1, title):\n plt.title(title)\n plt.xlabel(\"Run Time (microsecondsS)\")\n plt.ylabel(\"Number of Items Retreived\")\n plt.ylim(0, max(dict1.values()))\n plt.xlim(min(dict1.keys()), max(dict1.keys()) )\n x1, y1 = zip(*dict1.items())\n\n plt.scatter(x1, y1)\n plt.show()",
"... | [
"0.5937558",
"0.56340605",
"0.55935115",
"0.5562637",
"0.5476127",
"0.5470518",
"0.54627484",
"0.54590285",
"0.544606",
"0.54000765",
"0.5369702",
"0.5346851",
"0.53439206",
"0.53327817",
"0.53198993",
"0.5310756",
"0.5292382",
"0.528532",
"0.5283027",
"0.52695",
"0.5256896",... | 0.78293514 | 0 |
This plots the data using the provided feature; all points where at least one of the two strains being compared is part of that feature (e.g a place, or year) will be displayed in green. The others will be displayed in red. | def plot_feature(dict1, dict2, feature, savepath):
subdict1a = get_subdict(dict1, feature)
subdict1b = get_anti_subdict(dict1, feature)
print("Plotting for %s" %feature)
plot_dicts(subdict1b, dict2, 'g')
plot_dicts(subdict1a, dict2, 'r')
plt.savefig(savepath)
plt.clf() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_plots_for_outliers(feature_1, feature_2):\n data = featureFormat(data_dict, [feature_1, feature_2, 'poi'])\n for point in data:\n x = point[0]\n y = point[1]\n poi = point[2]\n if poi:\n color = 'red'\n else:\n color = 'blue'\n plt.sc... | [
"0.6622246",
"0.65627354",
"0.6547146",
"0.6486694",
"0.5760859",
"0.57475567",
"0.5730598",
"0.5602955",
"0.55885595",
"0.5583763",
"0.55469733",
"0.5544332",
"0.5544332",
"0.5501696",
"0.54448825",
"0.54375064",
"0.54311013",
"0.54204947",
"0.54009414",
"0.5379181",
"0.5364... | 0.6243718 | 4 |
Returns parent directory to save to. | def dirpath(self) -> str:
return self._dirpath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_parent_path(self):\n return os.path.join(os.getcwd(), \"src\", \"data\", \"genes\")",
"def parent_dir(self):\n parent = os.path.dirname(self.dirn)\n if self.is_subdir:\n parent = os.path.basename(parent)\n else:\n if self.platform is not None and parent.... | [
"0.76852804",
"0.75052273",
"0.7367186",
"0.73137295",
"0.7266839",
"0.724427",
"0.71395165",
"0.7036465",
"0.70105845",
"0.68040764",
"0.6792708",
"0.6776758",
"0.67437494",
"0.67365164",
"0.6723034",
"0.669397",
"0.6590135",
"0.6561304",
"0.65356183",
"0.6528309",
"0.652610... | 0.0 | -1 |
Utility method to restore snapshot state from a path. There are additional flags offered should the user want to skip loading the train and eval progress. By default, the train and eval progress are restored, if applicable. | def restore(
path: str,
unit: AppStateMixin,
*,
train_dataloader: Optional[_TStateful] = None,
restore_train_progress: bool = True,
restore_eval_progress: bool = True,
storage_options: Optional[Dict[str, Any]] = None,
) -> None:
_validate_snapshot_ava... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, checkpoint_path: str):\r\n raise NotImplementedError",
"def restore(self, PATH):\n self._saver.restore(self._sess, PATH)",
"def restore(self, checkpoint):\n raise NotImplementedError",
"def _restore(self, a_path):\n super(RDPAnalyzer, self)._restore(a_path)\n ... | [
"0.72185844",
"0.69395244",
"0.68994504",
"0.68377215",
"0.6719659",
"0.6663465",
"0.6639518",
"0.66114426",
"0.6531987",
"0.65199894",
"0.64938486",
"0.64707524",
"0.64351845",
"0.64336735",
"0.64250517",
"0.641816",
"0.6349913",
"0.6336661",
"0.62916756",
"0.6271611",
"0.62... | 0.7335076 | 0 |
Given a parent directory where checkpoints are saved, restore the snapshot state from the latest checkpoint in the directory. There are additional flags offered should the user want to skip loading the train and eval progress. By default, the train and eval progress are restored, if applicable. | def restore_from_latest(
dirpath: str,
unit: AppStateMixin,
*,
train_dataloader: Optional[_TStateful] = None,
restore_train_progress: bool = True,
restore_eval_progress: bool = True,
storage_options: Optional[Dict[str, Any]] = None,
) -> bool:
path = g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, checkpoint):\n raise NotImplementedError",
"def restore(self, checkpoint_path: str):\r\n raise NotImplementedError",
"def restore(\n path: str,\n unit: AppStateMixin,\n *,\n train_dataloader: Optional[_TStateful] = None,\n restore_train_progress: b... | [
"0.71218187",
"0.69503665",
"0.6909365",
"0.68729573",
"0.6821146",
"0.6787668",
"0.6728591",
"0.66943836",
"0.6680792",
"0.66569215",
"0.66518706",
"0.6617083",
"0.6593576",
"0.65641516",
"0.6502604",
"0.6482757",
"0.6436529",
"0.6422844",
"0.6396245",
"0.63591015",
"0.63407... | 0.71597016 | 0 |
Given a parent directory where checkpoints are saved, return the latest checkpoint subdirectory. | def get_latest_checkpoint_path(dirpath: str) -> Optional[str]:
ret = None
rank = get_global_rank()
# Do all filesystem reads from rank 0 only
if rank == 0:
ret = _latest_checkpoint_path(dirpath)
# If not running in a distributed setting, return as is
if not (dist.is_available() and dis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_checkpoint(cls, experiment_path):\n checkpoints_path = os.path.join(experiment_path, cls.CHECKPOINT_DIR_NAME)\n all_times = sorted(os.listdir(checkpoints_path), reverse=True)\n return os.path.join(checkpoints_path, all_times[0])",
"def _find_last_checkpoint(self):\n highest... | [
"0.67151845",
"0.66823584",
"0.66503376",
"0.6645899",
"0.65957093",
"0.64984596",
"0.6484237",
"0.64686537",
"0.6444815",
"0.6429546",
"0.63951665",
"0.63920695",
"0.63710576",
"0.63550854",
"0.6339537",
"0.62403166",
"0.62357825",
"0.62290454",
"0.6226599",
"0.6225803",
"0.... | 0.68156004 | 0 |
Returns path in normalized and absolute format. On caseinsensitive file systems the path is also casenormalized (if normcase is True). | def normpath(path, normcase=True):
path = _abspath(path)
if normcase and _CASE_INSENSITIVE_FILESYSTEM:
path = path.lower()
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalized_path(path):\n return os.path.abspath(os.path.expanduser(path))",
"def normalize(path):\n return os.path.normcase(os.path.realpath(path))",
"def pathnormalize(p):\n return os.path.normcase(os.path.normpath(p))",
"def norm_safe(path):\n if not os.path.isabs(path):\n raise... | [
"0.7951069",
"0.7603288",
"0.7376182",
"0.7247635",
"0.7143562",
"0.7071156",
"0.7035381",
"0.7018155",
"0.70174485",
"0.683217",
"0.6773758",
"0.67527366",
"0.67432654",
"0.6732466",
"0.6700591",
"0.6677241",
"0.66222084",
"0.66188216",
"0.65943336",
"0.6583638",
"0.65769076... | 0.7677145 | 1 |
Return True when val is in the multiset, else returns False. | def __contains__(self, val):
if self.lookup.get(val, 0) > 0:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, value):\n return value in self.values",
"def __contains__(self, val):\n return val in self.ids or super().__contains__(val)",
"def contains(self, val):\n\t\treturn Contains(self, val)",
"def contains(self, val):\n return False if not self.search(val) else True",
"def... | [
"0.70745957",
"0.706346",
"0.69948304",
"0.69559747",
"0.69066423",
"0.6899891",
"0.68818796",
"0.68729544",
"0.6849723",
"0.6776209",
"0.67183614",
"0.66915715",
"0.6675331",
"0.66722995",
"0.6642035",
"0.6642035",
"0.6626828",
"0.6626828",
"0.66121286",
"0.6589583",
"0.6531... | 0.6826375 | 9 |
Complete the 'getMinCost' function below. The function is expected to return a LONG_INTEGER. | def getMinCost(crew_id, job_id):
crew_id.sort()
job_id.sort() # Write your code here
min_dist = 0
for i in range(len(crew_id)):
min_dist = min_dist + abs(crew_id[i] - job_id[i])
return min_dist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cost_min(self) -> float:\n\n return min(cost for position, cost in self.memory)",
"def _find_lowest_cost_node(self) -> str:\n lowest_cost = float(\"inf\")\n lowest_cost_node = None\n for node in self.costs:\n cost = self.costs[node]\n if cost < lowest_cos... | [
"0.74714136",
"0.6795318",
"0.6624224",
"0.6539767",
"0.65155643",
"0.63606054",
"0.6299463",
"0.6299463",
"0.62786925",
"0.6273203",
"0.6273203",
"0.6193373",
"0.6177268",
"0.6156828",
"0.6156828",
"0.6156828",
"0.6156828",
"0.6156828",
"0.6156828",
"0.6156828",
"0.6156828",... | 0.5764501 | 85 |
Get elapsed time in a human readable format. | def get_elapsed_time(start, end):
return "%s days, %s hours, %s minutes, %s seconds" % dhms_from_seconds(date_diff_in_seconds(start, end)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_elapsed_timestamp(self) -> str:\n t = self.elapsed_time\n minutes = int(t / 60)\n seconds = int(t - (60 * minutes))\n millis = int(100 * (t - int(t)))\n return '{:>02d}:{:>02d}.{:<02d}'.format(minutes, seconds, millis)",
"def __str__(self):\n return str(self.elap... | [
"0.77896374",
"0.775949",
"0.7755884",
"0.77435213",
"0.7591802",
"0.7381449",
"0.73197234",
"0.72835505",
"0.72633636",
"0.724167",
"0.72050494",
"0.7024043",
"0.68694",
"0.68560123",
"0.68392515",
"0.6818798",
"0.6754776",
"0.6730866",
"0.66703916",
"0.6652115",
"0.65841484... | 0.73001826 | 7 |
Store some attributes as columns | def create_schema(db_name, schema_name):
# 1. Connect to database
conn = connect()
cur = conn.cursor()
conn.autocommit = True
command_drop = """DROP SCHEMA IF EXISTS {} CASCADE""".format(schema_name)
command_create = """
CREATE SCHEMA {}
CREATE TABLE cityjson (
id s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_cols_to_attr(self):\n ## this is from the base class:\n ## for attr, label in zip(self.attr_names, self.labels):\n ## col_ind = self.col_inds[label]\n ## if len(self.data) > 0:\n ## setattr(self, attr, self.data[:,col_ind])\n #\n # hard codin... | [
"0.678142",
"0.6487212",
"0.64283144",
"0.634461",
"0.63413703",
"0.6324673",
"0.6322255",
"0.63014346",
"0.6256963",
"0.62242544",
"0.62208295",
"0.6216599",
"0.6155519",
"0.61322474",
"0.61203516",
"0.6103984",
"0.61038697",
"0.6098797",
"0.6079082",
"0.6068713",
"0.6066178... | 0.0 | -1 |
Fetches three random articles from the content API that excludes the headline article | def get_randomized_content(content, headline_uuid):
randomized_content = []
content = [article for article in content['results'] if article['uuid'] != headline_uuid]
article_index = random.sample(range(1, len(content)), 3)
for i in article_index:
randomized_content.append(content[i])
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_articles(self):\n\t\tarticles = Blog.objects.all()\\\n\t\t\t.filter(publication_date__lte=datetime.date.today())\\\n\t\t\t.order_by('publication_date')\n\t\ti = random.randint(0, articles.count()-1)\n\t\treturn articles, articles[i]",
"def article_list(request):\n try:\n logger.info('Calling th... | [
"0.71695834",
"0.69608015",
"0.6622241",
"0.6480178",
"0.62823653",
"0.6278844",
"0.6213635",
"0.619577",
"0.61692",
"0.61566114",
"0.60969245",
"0.6079843",
"0.6069496",
"0.60498786",
"0.6034135",
"0.6011486",
"0.5986521",
"0.59803724",
"0.59592634",
"0.58767325",
"0.5864757... | 0.7504662 | 0 |
Creates the CSV file with the headers (must be a list) | def create_csv(csv_path, headers):
with open(csv_path, 'w') as csv_file:
writer = DictWriter(csv_file, fieldnames=headers)
writer.writeheader() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_csv(self):\n with open(self.__csv_file_name, 'w', newline='', encoding='utf-8') as csv_file:\n writer = csv.DictWriter(csv_file, fieldnames=self.__csv_fields, delimiter=';')\n writer.writeheader()",
"def make_csv(file_of_data):\n with open(file_of_data, 'w') as f:\n ... | [
"0.77573276",
"0.7456056",
"0.7362417",
"0.7359233",
"0.7347985",
"0.7096889",
"0.7058831",
"0.6999446",
"0.6997971",
"0.69880706",
"0.69781995",
"0.6936459",
"0.69364303",
"0.6926873",
"0.69236565",
"0.6917279",
"0.6876909",
"0.6862527",
"0.679819",
"0.67968464",
"0.6783206"... | 0.76000017 | 1 |
Return word entropy for document | def word_entropy(self, doc, lemmatized=False):
# filter out words
words = [token for token in doc if not token.is_punct and "'" not in token.text and not token.is_space]
# create bag of words
if lemmatized:
list_words = [w.lemma_ for w in words]
else:
list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(self, text):\n\n# text = self.myReplacer.replace(text)\n# text = self.tokenizer.tokenize(text)\n new_text = []\n for word in text:\n if word.count('\\'') > 0:\n words = word.split('\\'')\n for w in words:\n new_text... | [
"0.7691277",
"0.76579785",
"0.7231158",
"0.7163968",
"0.7152152",
"0.70281184",
"0.700163",
"0.69830483",
"0.6961347",
"0.6926183",
"0.6925044",
"0.6878381",
"0.68775845",
"0.6811499",
"0.67525357",
"0.6751141",
"0.672871",
"0.6721895",
"0.66237664",
"0.66036505",
"0.6583655"... | 0.80883604 | 0 |
Computing L2 distances using memoryefficient vectorization. | def L2_dists(x, y):
#print(x.shape)
#print(y.shape)
dists = -2 * np.matmul(x, y.T)
dists += np.sum(x**2)[np.newaxis]
dists += np.sum(y**2)
return np.sqrt(dists) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2_distance(v1, v2):\n\treturn np.linalg.norm(np.array(v1) - np.array(v2))",
"def compute_l2_distance_matrix(features_queries, features_dataset):\n sx = np.sum(features_queries ** 2, axis=1, keepdims=True)\n sy = np.sum(features_dataset ** 2, axis=1, keepdims=True)\n\n return np.sqrt(-2 * features_q... | [
"0.718103",
"0.7163577",
"0.70736265",
"0.70114845",
"0.66769636",
"0.6591618",
"0.6569047",
"0.6492791",
"0.64301825",
"0.64203715",
"0.641906",
"0.6405026",
"0.6366927",
"0.6365083",
"0.633851",
"0.6320419",
"0.62901765",
"0.62345135",
"0.6222619",
"0.6196466",
"0.61927265"... | 0.6701428 | 4 |
Get ratio of the song's entropy to the entropy of the Uniform distribution | def get_shannon_rel_entropy(file_name, down_sample=1):
wr = wave.open(file_name, 'r')
song = _time_data(wr)
print("ffting")
song_fft = fft(song)
return _shannon_rel_entropy(song_fft) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def div(self):\n freqList = [i / sum(self.has.values()) for i in self.has.values()]\n entropies = [i * math.log(i, 2) for i in freqList]\n entropy = -sum(entropies)\n return entropy",
"def entropy( freq ):\n N = 0.0\n entropy = 0.0\n for x, v in freq.items( ):\n N += v... | [
"0.7020625",
"0.69932663",
"0.697428",
"0.69058746",
"0.6876123",
"0.68373543",
"0.68011063",
"0.6777638",
"0.67514676",
"0.6731315",
"0.67174757",
"0.67142075",
"0.67081034",
"0.6695756",
"0.6665529",
"0.6611507",
"0.6597427",
"0.65968794",
"0.65754455",
"0.65703994",
"0.653... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return f'{self.first_name} {self.last_name}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return f'{self.first_name} {self.last_name}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return f'{self.first_name} {self.last_name}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return f'{self.name}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Generate random colors. To get visually distinct colors, generate them in HSV space then convert to RGB. | def random_colors(n, bright=True):
brightness = 1.0 if bright else 0.7
hsv = [(i / n, 1, brightness) for i in range(n)]
colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv))
random.shuffle(colors)
return colors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]",
"def _genRandomColor():\n b = random.randint(0, 255)\n g = random.randint(0, 255)\n r = random.randint(0, 255)\n return (b, g, r)",
"def random_color():\n colormode(255)\n ... | [
"0.8126833",
"0.7871604",
"0.7784197",
"0.77294874",
"0.763218",
"0.7618976",
"0.7483389",
"0.74785185",
"0.74539584",
"0.7442938",
"0.7442356",
"0.74267954",
"0.7409319",
"0.7371833",
"0.7363195",
"0.7352881",
"0.7338552",
"0.732136",
"0.732136",
"0.732136",
"0.7309498",
"... | 0.72230244 | 26 |
Test if archives don't fool us with forged file extensions | def test_archive_wrong_extension(self):
testfile = 'wrongextension.eml'
try:
tmpfile = tempfile.NamedTemporaryFile(
suffix='wrongext', prefix='fuglu-unittest', dir='/tmp')
shutil.copy("%s/%s" % (TESTDATADIR, testfile), tmpfile.name)
user = 'recipient-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_archive_ext(filepath):\n file_extension = os.path.splitext(filepath)[1].lower()\n if file_extension in get_archive_extensions():\n return True\n else:\n return False",
"def is_archive(afile):\n return file_ext(os.path.basename(afile)) in ARCHIVE_COMPRESS_FORMATS",
"def _IsIgnor... | [
"0.7462732",
"0.701024",
"0.6905199",
"0.6905199",
"0.689474",
"0.67615944",
"0.6748277",
"0.6729013",
"0.6723435",
"0.67020565",
"0.66600144",
"0.6632761",
"0.6580519",
"0.65445215",
"0.65077806",
"0.64013416",
"0.6375738",
"0.63331014",
"0.62975365",
"0.62896734",
"0.628967... | 0.69844484 | 2 |
read mgb binary files as numpy.array | def le_binario_mgb(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def load_idx(path: str) -> np.ndarray:\n open_fcn = gzip.open if path.endswith('.gz') else open\n with open_fcn(path, 'rb') as f:\n return _load_uint8(f)",
"def le_binario_mgbp(filebin,nt,nc):\n ... | [
"0.67449707",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.5894728",
"0.58280396",
"0.5821723",
"0.5812153",
"0.57997... | 0.65494823 | 4 |
read mgb binary files as numpy.array | def le_binario_mgbp(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_b... | [
"0.67449707",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.6459185",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.58... | 0.64191544 | 8 |
read mgb binary files as numpy.array | def le_binario_mgbq(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_bi... | [
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59... | 0.67449707 | 0 |
read mgb binary files as numpy.array | def le_binario_mgb(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def load_idx(path: str) -> np.ndarray:\n open_fcn = gzip.open if path.endswith('.gz') else open\n with open_fcn(path, 'rb') as f:\n return _load_uint8(f)",
"def le_binario_mgbp(filebin,nt,nc):\n ... | [
"0.67449707",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.5894728",
"0.58280396",
"0.5821723",
"0.5812153",
"0.57997... | 0.65494823 | 5 |
read mgb binary files as numpy.array | def le_binario_mgb(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def load_idx(path: str) -> np.ndarray:\n open_fcn = gzip.open if path.endswith('.gz') else open\n with open_fcn(path, 'rb') as f:\n return _load_uint8(f)",
"def le_binario_mgbp(filebin,nt,nc):\n ... | [
"0.67449707",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.5894728",
"0.58280396",
"0.5821723",
"0.5812153",
"0.57997... | 0.65494823 | 1 |
read mgb binary files as numpy.array | def le_binario_mgb(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def load_idx(path: str) -> np.ndarray:\n open_fcn = gzip.open if path.endswith('.gz') else open\n with open_fcn(path, 'rb') as f:\n return _load_uint8(f)",
"def le_binario_mgbp(filebin,nt,nc):\n ... | [
"0.67449707",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.5894728",
"0.58280396",
"0.5821723",
"0.5812153",
"0.57997... | 0.65494823 | 3 |
read mgb binary files as numpy.array | def le_binario_mgb(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def load_idx(path: str) -> np.ndarray:\n open_fcn = gzip.open if path.endswith('.gz') else open\n with open_fcn(path, 'rb') as f:\n return _load_uint8(f)",
"def le_binario_mgbp(filebin,nt,nc):\n ... | [
"0.67449707",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.5894728",
"0.58280396",
"0.5821723",
"0.5812153",
"0.57997... | 0.65494823 | 2 |
read mgb binary files as numpy.array | def le_binario_mgb(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def load_idx(path: str) -> np.ndarray:\n open_fcn = gzip.open if path.endswith('.gz') else open\n with open_fcn(path, 'rb') as f:\n return _load_uint8(f)",
"def le_binario_mgbp(filebin,nt,nc):\n ... | [
"0.67449707",
"0.6459185",
"0.64191544",
"0.64191544",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.5894728",
"0.58280396",
"0.5821723",
"0.5812153",
"0.57997... | 0.65494823 | 6 |
read mgb binary files as numpy.array | def le_binario_mgbp(filebin,nt,nc):
return np.fromfile(filebin,'<f4').reshape(nt,nc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le_binario_mgbq(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_binario_mgb(filebin,nt,nc):\n return np.fromfile(filebin,'<f4').reshape(nt,nc)",
"def le_b... | [
"0.67449707",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.65494823",
"0.6459185",
"0.6371179",
"0.6258018",
"0.62455314",
"0.6143813",
"0.60736954",
"0.6046889",
"0.6034021",
"0.6014195",
"0.60095745",
"0.5965065",
"0.5949777",
"0.59111184",
"0.58... | 0.64191544 | 9 |
Shows a plot of the given label image with a random color map. | def plot_labels(lbl: scipy.ndarray, lbl_count: int) -> None:
color_map = scipy.rand(lbl_count, 3)
color_map = matplotlib.colors.ListedColormap(color_map)
plt.imshow(lbl, cmap=color_map)
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_image(img, label=\"\"): \n if img.shape[0] == 3:\n img = img.transpose(1,2,0)\n fig,ax = plt.subplots(1)\n sns.set_style('white')\n ax.imshow(np.asarray(img))\n if label!=\"\":\n plt.title(number_label[label])\n return fig,ax",
"def show(image,label,pred):\n from matpl... | [
"0.67311853",
"0.66656446",
"0.66342837",
"0.6449493",
"0.6206528",
"0.60299385",
"0.60244864",
"0.59908414",
"0.59900945",
"0.59841573",
"0.59841573",
"0.59841573",
"0.597169",
"0.59543794",
"0.58938384",
"0.58778524",
"0.5877042",
"0.58320683",
"0.58295435",
"0.58215886",
"... | 0.77357554 | 0 |
Returns the location of the end effector as a length 2 Numpy array. | def get_ee_location(self, thetas):
return self.get_links(thetas)[-1].end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_point(self) -> Vec3:\n v = list(self.vertices([self.dxf.end_angle]))\n return v[0]",
"def end_effectors_pos(self):\n def relative_pos_in_egocentric_frame(physics):\n end_effector = physics.bind(self._entity.end_effectors).xpos\n torso = physics.bind(self._entity.root_body).xpos... | [
"0.68066984",
"0.67295134",
"0.640706",
"0.6356637",
"0.6319778",
"0.6213467",
"0.6074607",
"0.60388774",
"0.60220045",
"0.5999834",
"0.5960032",
"0.5874577",
"0.5862271",
"0.5852263",
"0.5830407",
"0.58295417",
"0.58164275",
"0.58105147",
"0.5808651",
"0.5775462",
"0.5769154... | 0.0 | -1 |
Return a list of Actions. | def formulate_plan(self):
return NotImplemented | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_of_actions(self):\n return self.actions",
"def actions(self):\n return self._action_list",
"def get_actions(self):\n return []",
"def getActions(self):\n actions = self.actions[:]\n return actions",
"def actions(self):\n actions = []\n\n for nam... | [
"0.8678855",
"0.85032225",
"0.8430901",
"0.821376",
"0.82005453",
"0.80663896",
"0.8027451",
"0.8027451",
"0.80229527",
"0.794102",
"0.79399943",
"0.7920647",
"0.78709936",
"0.7867487",
"0.7749914",
"0.7743198",
"0.7710848",
"0.7691045",
"0.7691045",
"0.7691045",
"0.7654838",... | 0.0 | -1 |
Return the current size of internal memory. | def __len__(self):
return len(self.memory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8573752",
"0.82169205",
"0.8200361",
"0.8087402",
"0.8021614",
"0.7890747",
"0.78219426",
"0.78017354",
"0.77905464",
"0.7758844",
"0.77559924",
"0.77559924",
"0.775519",
"0.77544576",
"0.7733221",
"0.7732168",
"0.7720068",
"0.77145016",
"0.77092093",
"0.77077913",
"0.7697... | 0.75415504 | 37 |
Save names correctly in the database. Before installing the module, field ``name`` contains all full names. When installing it, this method parses those names and saves them correctly into the database. This can be called later too if needed. | def _install_partner_firstname(self):
# Find records with empty firstname and lastname
records = self.search([("firstname", "=", False),
("lastname", "=", False)])
# Force calculations there
records._inverse_name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_names(self):\n # clear the text buffer, or create new buffer\n try:\n namestxt = bpy.data.texts[\"FullNames\"]\n namestxt.clear()\n except KeyError:\n namestxt = bpy.data.texts.new(\"FullNames\")\n \n # write the names to the text bu... | [
"0.62898153",
"0.5645342",
"0.5613307",
"0.547682",
"0.54635286",
"0.5425455",
"0.54156786",
"0.5389575",
"0.5388417",
"0.5387162",
"0.5365983",
"0.53571147",
"0.53571147",
"0.535187",
"0.5345164",
"0.53372204",
"0.53163487",
"0.53011626",
"0.5280762",
"0.5280683",
"0.5270853... | 0.51096374 | 34 |
Return the most appropriate Response class for the given mimetype | def from_mimetype(self, mimetype):
if mimetype is None:
return Response
elif mimetype in self.classes:
return self.classes[mimetype]
else:
basetype = "%s/*" % mimetype.split('/')[0]
return self.classes.get(basetype, Response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_mimetype():\n # find out what the client accepts\n return request.accept_mimetypes.best_match(\n current_app.blueprints[request.blueprint].response_mimetypes.keys()\n )",
"def mimetype(self) -> 'Mimetype':\n if self._mimetype:\n # We take the mimetype reported in th... | [
"0.7199525",
"0.6706519",
"0.6582483",
"0.648075",
"0.6369672",
"0.63091964",
"0.62746924",
"0.62227786",
"0.6222642",
"0.6213883",
"0.61944735",
"0.6191931",
"0.61559623",
"0.615348",
"0.6099941",
"0.5998811",
"0.5997408",
"0.5987132",
"0.5944116",
"0.5942813",
"0.5938457",
... | 0.86203396 | 0 |
Return True if the queue is empty | def is_empty(self):
return self._size == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def empty(self) -> bool:\n if self.queue.empty():\n return True\n else:\n return False",
"def i... | [
"0.9218732",
"0.91471225",
"0.91471225",
"0.9147039",
"0.9138383",
"0.91163224",
"0.9107635",
"0.90714633",
"0.90672743",
"0.9047789",
"0.89825934",
"0.89106774",
"0.8893489",
"0.88892585",
"0.88892585",
"0.88794816",
"0.88741475",
"0.8829304",
"0.87676036",
"0.8752946",
"0.8... | 0.76173496 | 93 |
Render website's home page. | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n return render_template('homepage.html')",
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"... | [
"0.8724249",
"0.85791856",
"0.850329",
"0.84860355",
"0.84612614",
"0.84362435",
"0.8429879",
"0.8419578",
"0.8396612",
"0.8396612",
"0.8374868",
"0.8356488",
"0.8350785",
"0.8340763",
"0.8340763",
"0.8336323",
"0.8330013",
"0.8329599",
"0.8325031",
"0.8317146",
"0.8293699",
... | 0.83374727 | 28 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to tell the browser not to cache the rendered page. | def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=0'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\r\n # response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\r\n response.headers['Cache-Control'] = 'no-cache, no-store'\r\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Pragma'] = 'no-cache... | [
"0.8256065",
"0.8247911",
"0.8231433",
"0.8231415",
"0.8231415",
"0.8231415",
"0.8231415",
"0.8220232",
"0.81607693",
"0.79636997",
"0.7733797",
"0.74179614",
"0.73097855",
"0.73097855",
"0.7301907",
"0.72321117",
"0.72305924",
"0.72305924",
"0.7228844",
"0.7210472",
"0.71932... | 0.820046 | 33 |
Homepage of personal app and website | def index(request):
return render(
request,
'core/index.html',
{
'current_view': 'index',
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def home():\r\n return render_template(\r\n 'index.html',\r\n ... | [
"0.77078253",
"0.7648724",
"0.754449",
"0.74916923",
"0.7467236",
"0.7465018",
"0.7460562",
"0.7455623",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7453074",
"0.7430417",
"0.74235475",
"0.74092853",
... | 0.0 | -1 |
Simple contact page for website | def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
subject = form.cleaned_data['subject']
message = form.cleaned_data['message']
from_email = form.cleaned_data['email']
name = form.cleaned_data['name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n\n\treturn render_template('contact.html', title='Contact',\n\t\t\t\t\t\t year=datetime.now().year,\n\t\t\t\t\t\t message='Your contact page.')",
"def contact():\n return render_template(\n 'contact.html',\n nav=nav,\n title='Contact me',\n year=datetime.now().y... | [
"0.8269839",
"0.82331055",
"0.8146663",
"0.8146663",
"0.8122323",
"0.8119702",
"0.8097315",
"0.8077627",
"0.8077627",
"0.8077627",
"0.8077627",
"0.8077627",
"0.8077627",
"0.8077627",
"0.8077627",
"0.8057708",
"0.79862374",
"0.7949245",
"0.7890789",
"0.7855528",
"0.77475655",
... | 0.664621 | 56 |
Simple thank you for contact page | def thank_you(request):
return render(request, 'core/thank_you.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n if request.method == \"POST\":\n flash(\"{}, Thank you for getting in touch! We appreciate you contacting us, one of our colleagues will get back in touch with you soon! Have a great day!\".format(\n request.form[\"name\"]))\n\n return render_template('pages/contact.html', ... | [
"0.7518009",
"0.73603237",
"0.7316459",
"0.73041236",
"0.7283041",
"0.72169226",
"0.71006787",
"0.71006787",
"0.70806766",
"0.7070961",
"0.70675373",
"0.7027119",
"0.7014193",
"0.7014193",
"0.7014193",
"0.7014193",
"0.7014193",
"0.7014193",
"0.7014193",
"0.7014193",
"0.700819... | 0.79214245 | 0 |
Load the json file to a json object | def load_json(file_name):
return json.load(open(file_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(filename):\n with open(filename) as file:\n obj = json.load(file)\n return obj",
"def import_json(self) -> dict:\n with open(self.path, encoding=\"utf8\") as json_file:\n return json.load(json_file)",
"def load_from_json_file(filename):\n with open(filename, 'r')... | [
"0.81586736",
"0.81064856",
"0.8090447",
"0.80842066",
"0.8010735",
"0.7989357",
"0.79680324",
"0.7965415",
"0.7937107",
"0.79190546",
"0.79091257",
"0.79091257",
"0.79002625",
"0.7896888",
"0.7871265",
"0.78664064",
"0.7865762",
"0.7809384",
"0.77847886",
"0.777386",
"0.7762... | 0.8058003 | 4 |
Return energy of signal. | def energy(data):
return sum(pow(data, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy(self):\n return self._energy",
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=self.outl[0].T.val_SI)) / 2\n\n return (i[0] * (o[2] - i[2]) -\n ... | [
"0.77729106",
"0.771155",
"0.76765996",
"0.764852",
"0.764852",
"0.76336426",
"0.7633294",
"0.75685275",
"0.7495391",
"0.7481408",
"0.74180037",
"0.7328215",
"0.7326915",
"0.73228365",
"0.7295186",
"0.7217504",
"0.7202202",
"0.70057815",
"0.69821024",
"0.6958815",
"0.694847",... | 0.7509337 | 8 |
Creates, saves, and returns a post | def create_a_post():
subj = create_subject()
post = Post.create(subject=subj, title="A great title", body="Just a great day!")
post.save()
return post | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n data = request.json\n return save_new_post(data=data)",
"def post(self):\r\n data = request.form\r\n return create(data=data)",
"def post(self, body):\n return self.objects.create(body)",
"def post(self, request, *args, **kwargs):\n return self.crea... | [
"0.7684037",
"0.7671129",
"0.7552395",
"0.745601",
"0.745601",
"0.745601",
"0.73547417",
"0.7294574",
"0.70962614",
"0.7095655",
"0.7090442",
"0.70553267",
"0.70172554",
"0.69698554",
"0.685439",
"0.68350273",
"0.68152404",
"0.67953295",
"0.6771923",
"0.67284334",
"0.6717596"... | 0.72732294 | 8 |
Creates, saves, and returns a comment without a parent, i.e., a comment responding directly to a post | def create_comment_immediately_below_post():
post = create_a_post()
comment = Comment.create(post=post, body="I'm a comment right below a post")
comment.save()
return comment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_comment(request, course_key, thread_id=None, parent_id=None):\r\n assert isinstance(course_key, CourseKey)\r\n post = request.POST\r\n\r\n if 'body' not in post or not post['body'].strip():\r\n return JsonError(_(\"Body can't be empty\"))\r\n\r\n course = get_course_with_access(reque... | [
"0.707511",
"0.6969029",
"0.69438565",
"0.69163835",
"0.68802357",
"0.68706775",
"0.6789664",
"0.677803",
"0.67638016",
"0.6734283",
"0.669603",
"0.6687828",
"0.6683801",
"0.66821706",
"0.65897274",
"0.65803486",
"0.6549741",
"0.65313923",
"0.65297973",
"0.65206665",
"0.65134... | 0.72097266 | 0 |
A new upvote on a comment being instantiated should increase the corresponding comment's score attribute by one | def test_upvote_modifies_comment_score(self):
comment = Comment.objects.get(body="987XYZ")
self.assertEqual(comment.score, DEFAULT_SCORE)
vote = Vote.create(comment=comment, value=1, voter=self.user)
comment = Comment.objects.get(body="987XYZ")
self.assertEqual(comment.score, DEF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_upvote_then_downvote_same_user_leaves_comment_score_one_less(self):\n comment = Comment.objects.get(body=\"987XYZ\")\n # self.assertEqual(len(post_qs), 1)\n self.assertEqual(comment.score, DEFAULT_SCORE)\n comment = Comment.objects.get(body=\"987XYZ\")\n\n vote1 = Vote.c... | [
"0.74770945",
"0.7392678",
"0.71860576",
"0.71653676",
"0.69685334",
"0.6937598",
"0.6924154",
"0.685333",
"0.6847979",
"0.6776612",
"0.6709578",
"0.66815567",
"0.6651747",
"0.65662664",
"0.65608007",
"0.6545981",
"0.6515756",
"0.6481932",
"0.6470362",
"0.64485306",
"0.63832"... | 0.82085484 | 0 |
Plots accuracies and losses per epoch from 'trn_hist' 'val_hist'. | def plot_acc_and_loss(trn_hist, val_hist):
assert isinstance(trn_hist, np.ndarray) and isinstance(val_hist, np.ndarray)
fig, (ax_acc, ax_loss) = plt.subplots(1, 2, figsize=(10, 4))
plot_on_ax(ax_acc, trn_hist[:,0], val_hist[:,0], "Accuracy")
plot_on_ax(ax_loss, trn_hist[:,1], val_hist[:,1], "Loss")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_history(hist):\n # Losses and metrics\n mse = hist.history['loss']\n val_mse = hist.history['val_loss']\n rmse = hist.history['root_mean_squared_error']\n val_rmse = hist.history['val_root_mean_squared_error']\n\n # Epochs to plot along x axis\n x_axis = range(1, len(mse) + 1)\n\n ... | [
"0.72366345",
"0.689892",
"0.6894208",
"0.6835726",
"0.67094165",
"0.6695074",
"0.6651971",
"0.6644589",
"0.66364473",
"0.6623416",
"0.66206175",
"0.6595503",
"0.65918463",
"0.6525905",
"0.65179545",
"0.6506838",
"0.64999235",
"0.6499865",
"0.64981705",
"0.6476678",
"0.646432... | 0.7998763 | 0 |
_get_data_months returns data months for run start date in prev yr | def test_get_data_months_run_start_date_prev_year(self, climate_processor):
with patch('bloomcast.utils.datetime') as mock_datetime:
mock_datetime.date.today.return_value = datetime.date(2012, 2, 1)
mock_datetime.date.side_effect = datetime.date
data_months = climate_processo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_data_months_run_start_date_same_year(self, climate_processor):\n with patch('bloomcast.utils.datetime') as mock_datetime:\n mock_datetime.date.today.return_value = datetime.date(2011, 9, 1)\n mock_datetime.date.side_effect = datetime.date\n data_months = climate... | [
"0.694926",
"0.66048545",
"0.64366436",
"0.63848346",
"0.63698965",
"0.6343565",
"0.6314401",
"0.62835145",
"0.624218",
"0.61742926",
"0.61465174",
"0.61423355",
"0.6039287",
"0.6028456",
"0.6014557",
"0.6014557",
"0.60128987",
"0.6011895",
"0.6009133",
"0.5998732",
"0.598950... | 0.74646664 | 0 |
Authorization and XUserinfo headers are added based on the serverside session. Be sure to remove them from the original request if present. | def sanitize_headers(headers):
auth_header = headers.pop("Authorization", None)
if auth_header:
_logger.warning(
f"Possible fraud: Authorization header was set to {auth_header}"
)
userinfo_header = headers.pop("X-Userinfo", None)
if userinfo_header:
_logger.warning(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['Authorization'] = response\n return response",
"def _addAuthenticationToRequestHeader(request, client):\n request.addAuthorization(client.id, client.secret)",
"def add_headers():\n # the actual access token -\n g.x_tapis_token = request.heade... | [
"0.683264",
"0.6820418",
"0.68035114",
"0.6626463",
"0.65944195",
"0.65882164",
"0.64646953",
"0.6421513",
"0.6391214",
"0.638924",
"0.63111466",
"0.62981254",
"0.62954533",
"0.6282546",
"0.6274052",
"0.6265427",
"0.62347317",
"0.6194286",
"0.6182571",
"0.61480856",
"0.614388... | 0.0 | -1 |
Convert snakecase string to pascalcase. | def snake_to_pascal(string):
return string[0].upper() + re.sub('_([a-z])', lambda match: match.group(1).upper(), string[1:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pascal_case(st) -> str:\n if st.find('-') != -1 or st.find('_') != -1:\n st = ''.join(a.capitalize() for a in re.split('-|_', st))\n return st[:1].upper() + st[1: len(st)]",
"def pascal_to_snake(string):\n return string[0].lower() + re.sub('[A-Z]', lambda match: '_' + match.group(0).lower(), ... | [
"0.8225991",
"0.81763136",
"0.8149153",
"0.7836066",
"0.7580616",
"0.7545742",
"0.74916124",
"0.7456245",
"0.74500644",
"0.74418604",
"0.7435123",
"0.74233466",
"0.74214333",
"0.73802257",
"0.73677266",
"0.7352956",
"0.7303298",
"0.721925",
"0.71742797",
"0.71243525",
"0.7117... | 0.8502011 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.76458347",
"0.76458347",
"0.76458347",
"0.7... | 0.7655856 | 18 |
Normalize the x direction for the right stick. Negative is moving left, positive is moving right. | def r_x_normalized(self):
return (self.r_x_axis - 128) / 127 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_right(self):\n if self.change_valid(dx=1):\n self.x += 1",
"def pos_right(self, x=1):\n\n self.x += x\n return self.pos(self.x, self.y)",
"def move_right(self):\n\t\tself.set_x_vector(constants.DONKEY_SPEED)",
"def go_right(self):\n self.rect.centerx += self.__... | [
"0.6659367",
"0.6548952",
"0.63845164",
"0.6384502",
"0.6377137",
"0.6253729",
"0.6222407",
"0.62220293",
"0.61884093",
"0.6117621",
"0.6117621",
"0.60718614",
"0.600915",
"0.600118",
"0.5995879",
"0.5976897",
"0.5934757",
"0.59284824",
"0.5864863",
"0.5847124",
"0.5835295",
... | 0.59123695 | 18 |
For Python <3.5 Given two dicts., merge them into a new dict as a shallow copy. | def merge_dicts(x, y):
z = x.copy()
z.update(y)
return z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergedict(x, y):\n z = x.copy()\n z.update(y)\n return z",
"def merge_dicts(dict_a, dict_b):\n dict_c = dict_a.copy()\n dict_c.update(dict_b)\n return dict_c",
"def merge_dict(dict1, dict2):\n merged_dict = dict1.copy()\n merged_dict.update(dict2)\n return... | [
"0.853939",
"0.8441165",
"0.83187866",
"0.8313428",
"0.83112806",
"0.8288306",
"0.82658565",
"0.82658565",
"0.82658565",
"0.82658565",
"0.82658565",
"0.82658565",
"0.82658565",
"0.82658565",
"0.82626706",
"0.82626706",
"0.82175374",
"0.8210658",
"0.8196136",
"0.797256",
"0.79... | 0.8253994 | 18 |
Attempt to fetch a key out of the local cache. If the key exists, but is beyond expiration, we only return it if grace=True. This forces the key to be returned in a disaster scenario as long as we're still holding onto it. This allows the OptionStore to pave over potential network hiccups by returning a stale value. | def get_local_cache(self, key, force_grace=False):
try:
value, expires, grace = self._local_cache[key.cache_key]
except KeyError:
return None
now = int(time())
# Key is within normal expiry window, so just return it
if now < expires:
return v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key, silent=False):\n result = self.get_cache(key, silent=silent)\n if result is not None:\n return result\n\n result = self.get_store(key, silent=silent)\n if result is not None:\n return result\n\n # As a last ditch effort, let's hope we have... | [
"0.675022",
"0.6610107",
"0.6333841",
"0.61386096",
"0.60981345",
"0.6046304",
"0.60332733",
"0.5997504",
"0.5996648",
"0.59928554",
"0.5990588",
"0.59609544",
"0.59059554",
"0.59059554",
"0.5877632",
"0.584825",
"0.57938594",
"0.5779892",
"0.57651126",
"0.57555056",
"0.57129... | 0.76495713 | 0 |
Add headers to both force latest IE rendering engine or Chrome Frame and also to cache the rendered page for 10 minutes | def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=0'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=600'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, ... | [
"0.8223849",
"0.8223849",
"0.8223849",
"0.8223849",
"0.8221154",
"0.8214651",
"0.8142414",
"0.8141759",
"0.8011308",
"0.7927063",
"0.76777214",
"0.7223466",
"0.7190107",
"0.7161787",
"0.71588194",
"0.71588194",
"0.71344733",
"0.71147615",
"0.71147615",
"0.71147615",
"0.711476... | 0.8164608 | 25 |
Return the interval of the ergodic region for the system | def get_ergodic_region(self):
return [self.f1(self.rho),self.f0(self.rho)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interval(self) -> int:\n return pulumi.get(self, \"interval\")",
"def _calc_range(self) -> np.ndarray:\n if self._is_ct25k():\n range_resolution = 30\n n_gates = 256\n else:\n n_gates = int(self.metadata[\"number_of_gates\"])\n range_resolution... | [
"0.6470001",
"0.64467",
"0.64031833",
"0.63608754",
"0.6344944",
"0.6134383",
"0.6075144",
"0.6022389",
"0.5941052",
"0.59048",
"0.5898797",
"0.58983",
"0.5845308",
"0.5785733",
"0.5785733",
"0.5777949",
"0.57705784",
"0.5759422",
"0.5739861",
"0.5739736",
"0.56957316",
"0.... | 0.616537 | 5 |
Return the dynamcial system which is symmetric to this one. | def get_symmetric_system(self):
W = DynamicalSystem(lambda x:1.0-self.f1(1.0-x),
lambda x:1.0-self.f0(1.0-x))
W.set_rho(1.0-self.rho)
return W | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sym(self) -> np.ndarray:\n if self._sym is None:\n self._sym = symmetrize_discrete_vector_field(self.F, mode=\"sym\")\n return self._sym",
"def _symbolic_system(self):\n system = sym.Matrix(self._symbolic_equations)\n return system.subs(self._symbolic_change_of_vars)",
... | [
"0.6499206",
"0.63021946",
"0.61918026",
"0.6158085",
"0.61299354",
"0.6031494",
"0.59628993",
"0.59372985",
"0.58566403",
"0.58549523",
"0.58549523",
"0.58413047",
"0.5822326",
"0.58068055",
"0.5793699",
"0.5729639",
"0.5618204",
"0.5599437",
"0.55910176",
"0.5556652",
"0.55... | 0.8114879 | 0 |
Do not return anything, modify head inplace instead. | def reorderList(self, head: ListNode) -> None:
if not head or not head.next or not head.next.next:
return
def helper(first_node, last_last_node=None):
if not last_last_node:
last_last_node = head
while last_last_node.next and last_last_node.nex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self, head):\n\n self._head = head",
"def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)",
"def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no... | [
"0.7218526",
"0.6802109",
"0.6732775",
"0.6622557",
"0.65217346",
"0.6466963",
"0.64551795",
"0.63585746",
"0.63523316",
"0.63093",
"0.62923217",
"0.6231313",
"0.622523",
"0.62005043",
"0.62005043",
"0.62005043",
"0.62005043",
"0.6198878",
"0.6193791",
"0.61740905",
"0.614918... | 0.5907423 | 46 |
Gated recurrent unit (GRU) with nunits cells. | def call(self, inputs, state, att_score=None):
if self._gate_linear is None:
bias_ones = self._bias_initializer
if self._bias_initializer is None:
bias_ones = init_ops.constant_initializer(1.0, dtype=inputs.dtype)
with vs.variable_scope("gates"): # Reset gate and update gate.
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_gru_cell(num_units, dropout):\n cell = tf.nn.rnn_cell.GRUCell(num_units)\n if dropout:\n result = tf.nn.rnn_cell.DropoutWrapper(cell,\n output_keep_prob=1-dropout)\n return result",
"def _initialize_gru_cell(self, num_units):\n return gru_cell.Laye... | [
"0.7217025",
"0.6654688",
"0.6297134",
"0.62698615",
"0.58967686",
"0.5840164",
"0.570657",
"0.56824994",
"0.5670167",
"0.56192416",
"0.56141967",
"0.560903",
"0.55835325",
"0.5581533",
"0.55483365",
"0.55423665",
"0.5536661",
"0.55100894",
"0.54998815",
"0.54421973",
"0.5382... | 0.0 | -1 |
Load a yaml file located at 'path' and return the content as a dictionary. If the yaml file does not exist an empty dictionary will be returned. | def load_yaml(path):
if os.path.exists(path):
f = open(path)
data = yaml.load(f)
f.close()
return data
else:
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(path: str) -> dict:\n with open(path, 'r') as f:\n yaml_file = yaml.load(f, Loader=yaml.FullLoader)\n return yaml_file",
"def read_yaml(path: PathLike) -> Dict:\n with open(path, \"r\") as read_file:\n return yaml.load(read_file, Loader=yaml.UnsafeLoader)",
"def load_yaml(p... | [
"0.8825298",
"0.8766501",
"0.8682355",
"0.8667271",
"0.85481656",
"0.8144326",
"0.8006745",
"0.79311943",
"0.79210323",
"0.7866852",
"0.7814947",
"0.7727382",
"0.77231264",
"0.7701946",
"0.763188",
"0.7624458",
"0.75740004",
"0.7554799",
"0.75214595",
"0.7506331",
"0.7404752"... | 0.89151716 | 0 |
Load an environment aware yaml configuration file into a dictionary. If a configuration depends on the target of the deployment it is possible to pass the name of the environment to this function (env). In such a case | def load_yaml_config(path, env = ''):
config = load_yaml(path)
if config:
if 'all' in config:
all = config['all']
else:
return {}
if env != '':
if env in config:
all.update(config[env])
return all
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_env():\n global api_key\n\n # Load the config file\n env_file = path.join(path.dirname(path.abspath(__file__)), 'env.yml')\n try:\n stream = open(env_file, 'r')\n y = yaml.safe_load(stream)\n except IOError:\n print(\"ERROR: Environment file {} not found\".format(env_fi... | [
"0.73397475",
"0.724708",
"0.7114326",
"0.6869409",
"0.6824845",
"0.6765012",
"0.66690683",
"0.6633101",
"0.66101325",
"0.6602983",
"0.66008955",
"0.65983796",
"0.6538155",
"0.6531328",
"0.6526037",
"0.64967567",
"0.6493746",
"0.6463301",
"0.6429241",
"0.642644",
"0.64079624"... | 0.72177577 | 3 |
Determine if the current working copy is dirty have files been modified or are there untracked files. | def is_git_dirty():
dirty_status = local('git diff --quiet || echo "*"', capture=True)
if dirty_status == '*':
return True
untracked_count = int(local('git status --porcelain 2>/dev/null| grep "^??" | wc -l', capture=True))
if untracked_count > 0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty(self) -> bool:\n return len(self.detect_changed_files()) != 0",
"def has_unsaved_changes(self):\n return self._file_content != self.buffer.text",
"def check_dirty(args):\n man = load_manifest()\n any_dirty = False\n for (name, project) in man.projects.iteritems():\n repo = GitRepo... | [
"0.80560684",
"0.717797",
"0.7110329",
"0.7013441",
"0.69311774",
"0.68997777",
"0.6879061",
"0.6865079",
"0.6829696",
"0.68033934",
"0.67982525",
"0.6748646",
"0.6745282",
"0.6738691",
"0.6720259",
"0.66958",
"0.66886085",
"0.6677213",
"0.6656335",
"0.6634593",
"0.6617035",
... | 0.75518215 | 1 |
Return the sourceplayer if one exists and is the provided type. | def get_source_player(
self, playertype: Type[PlayerType]) -> Optional[PlayerType]:
player: Any = self._source_player
return (player if isinstance(player, playertype) and player.exists()
else None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getplayer(self,\n playertype: Type[PlayerType],\n doraise: bool = False) -> Optional[PlayerType]:\n player: Any = self._player\n assert isinstance(player, playertype)\n if not player.exists() and doraise:\n raise ba.PlayerNotFoundError()\n ... | [
"0.6938721",
"0.66626674",
"0.6551613",
"0.6490575",
"0.6153007",
"0.606061",
"0.5776696",
"0.5689607",
"0.56340533",
"0.56126827",
"0.56091577",
"0.560092",
"0.5592937",
"0.55924714",
"0.55398786",
"0.5529331",
"0.55160487",
"0.5509441",
"0.5488892",
"0.5482802",
"0.5468028"... | 0.8818346 | 0 |
Blows up the bomb if it has not yet done so. | def explode(self) -> None:
if self._exploded:
return
self._exploded = True
if self.node:
blast = Blast(position=self.node.position,
velocity=self.node.velocity,
blast_radius=self.blast_radius,
b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explode(self):\n\t\tself.player.currentBomb += 1",
"def put_bomb(self, x, y, delay, power, bomber):\n nodes = self.map.get_cell_nodes(x, y)\n for n in nodes:\n if is_bomb(n):\n # There is already a bomb in the cell\n return False\n\n # Create the ... | [
"0.6584319",
"0.6580796",
"0.65141165",
"0.6199105",
"0.60663307",
"0.58532834",
"0.58368653",
"0.5795012",
"0.5763053",
"0.57244307",
"0.57191336",
"0.5664932",
"0.56445366",
"0.5638154",
"0.56204695",
"0.5617571",
"0.5614609",
"0.5606818",
"0.55797946",
"0.55266345",
"0.549... | 0.6244408 | 3 |
Draw an ellipse with a given position and covariance | def draw_ellipse(position, covariance, ax=None, **kwargs):
ax = ax or plt.gca()
# Convert covariance to principal axes
if covariance.shape == (2, 2):
U, s, Vt = np.linalg.svd(covariance)
angle = np.degrees(np.arctan2(U[1, 0], U[0, 0]))
width, height = 2 * np.sqrt(s)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_ellipse(position, covariance, ax=None, **kwargs):\r\n # Convert covariance to principal axes\r\n if covariance.shape == (2, 2):\r\n U, s, Vt = np.linalg.svd(covariance)\r\n angle = np.degrees(np.arctan2(U[1, 0], U[0, 0]))\r\n width, height = 2 * np.sqrt(s)\r\n else:\r\n ... | [
"0.840408",
"0.83872885",
"0.8376353",
"0.8117954",
"0.7819908",
"0.7780715",
"0.7749703",
"0.7740195",
"0.77339417",
"0.7724917",
"0.771405",
"0.7710944",
"0.7593914",
"0.7255161",
"0.7168584",
"0.71576935",
"0.7078389",
"0.6957663",
"0.69198805",
"0.69095415",
"0.69095415",... | 0.83385664 | 3 |
Test TypeError for width in Rectangle | def test_check_width_TypeError_01(self):
self.assertRaisesRegex(
TypeError,
'width must be an integer',
Rectangle,
'string', 2, 0, 0, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_width(self):\n r1 = Rectangle(10, 2)\n self.assertEqual(r1.width, 10)\n\n r2 = Rectangle(2, 10)\n self.assertEqual(r2.width, 2)\n\n r3 = Rectangle(5, 2, 0, 0, 12)\n self.assertEqual(r3.width, 5)",
"def test_check_width_ValueError(self):\n self.asser... | [
"0.80672306",
"0.78524446",
"0.7850882",
"0.7752786",
"0.76595443",
"0.76540315",
"0.76535726",
"0.74869347",
"0.74828964",
"0.7327642",
"0.7311634",
"0.7308669",
"0.7219755",
"0.7205327",
"0.7160774",
"0.71106476",
"0.7054937",
"0.7000642",
"0.6970338",
"0.6970144",
"0.69606... | 0.7724608 | 4 |
Test TypeError for width in Rectangle | def test_check_width_TypeError_02(self):
self.assertRaisesRegex(
TypeError,
'width must be an integer',
Rectangle,
[6, 4, 9, 9], 2, 0, 0, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_width(self):\n r1 = Rectangle(10, 2)\n self.assertEqual(r1.width, 10)\n\n r2 = Rectangle(2, 10)\n self.assertEqual(r2.width, 2)\n\n r3 = Rectangle(5, 2, 0, 0, 12)\n self.assertEqual(r3.width, 5)",
"def test_check_width_ValueError(self):\n self.asser... | [
"0.80672306",
"0.78524446",
"0.7752786",
"0.7724608",
"0.76595443",
"0.76540315",
"0.76535726",
"0.74869347",
"0.74828964",
"0.7327642",
"0.7311634",
"0.7308669",
"0.7219755",
"0.7205327",
"0.7160774",
"0.71106476",
"0.7054937",
"0.7000642",
"0.6970338",
"0.6970144",
"0.69606... | 0.7850882 | 2 |
Test TypeError for width in Rectangle | def test_check_width_ValueError(self):
self.assertRaisesRegex(
ValueError,
'width must be > 0',
Rectangle,
-1, 2, 0, 0, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_width(self):\n r1 = Rectangle(10, 2)\n self.assertEqual(r1.width, 10)\n\n r2 = Rectangle(2, 10)\n self.assertEqual(r2.width, 2)\n\n r3 = Rectangle(5, 2, 0, 0, 12)\n self.assertEqual(r3.width, 5)",
"def test_check_width_TypeError_02(self):\n self.ass... | [
"0.80672306",
"0.7850882",
"0.7752786",
"0.7724608",
"0.76595443",
"0.76540315",
"0.76535726",
"0.74869347",
"0.74828964",
"0.7327642",
"0.7311634",
"0.7308669",
"0.7219755",
"0.7205327",
"0.7160774",
"0.71106476",
"0.7054937",
"0.7000642",
"0.6970338",
"0.6970144",
"0.696062... | 0.78524446 | 1 |
Test TypeError for x in Rectangle | def test_check_x_TypeError_01(self):
self.assertRaisesRegex(
TypeError,
'x must be an integer',
Rectangle,
4, 2, 'string''', 0, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_x_TypeError_02(self):\n self.assertRaisesRegex(\n TypeError,\n 'x must be an integer',\n Rectangle,\n 4, 2, [1, 2, 3, 4], 0, 12\n )",
"def test_badxvaluewithtuple(self):\n Rectangle.reset_objects()\n with self.assertRaises(Typ... | [
"0.7414799",
"0.72326446",
"0.7215619",
"0.71450454",
"0.70685226",
"0.7040373",
"0.7035119",
"0.6921739",
"0.6907827",
"0.6889362",
"0.68753093",
"0.6868359",
"0.68564636",
"0.68518674",
"0.68516207",
"0.6811195",
"0.68082947",
"0.6796233",
"0.67552644",
"0.67239803",
"0.672... | 0.70067286 | 7 |
Test TypeError for x in Rectangle | def test_check_x_TypeError_02(self):
self.assertRaisesRegex(
TypeError,
'x must be an integer',
Rectangle,
4, 2, [1, 2, 3, 4], 0, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_badxvaluewithtuple(self):\n Rectangle.reset_objects()\n with self.assertRaises(TypeError) as e:\n r1 = Square(1, (1, 2), 2, 3)\n self.assertEqual(str(e.exception), 'x must be an integer')",
"def test_raising_exceptions(self):\n with self.assertRaises(TypeError):\n ... | [
"0.72326446",
"0.7215619",
"0.71450454",
"0.70685226",
"0.7040373",
"0.7035119",
"0.70067286",
"0.6921739",
"0.6907827",
"0.6889362",
"0.68753093",
"0.6868359",
"0.68564636",
"0.68518674",
"0.68516207",
"0.6811195",
"0.68082947",
"0.6796233",
"0.67552644",
"0.67239803",
"0.67... | 0.7414799 | 0 |
Test ValueError for x in Rectangle | def test_check_x_ValueError(self):
self.assertRaisesRegex(
ValueError,
'x must be >= 0',
Rectangle,
4, 2, -1, 0, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rectangle_validation_x_pts(self):\n for bad_x_pts in (1.2, Decimal(3), -1, 'hello'):\n self.assertRaises(\n ValueError,\n Rectangle,\n x_pts=bad_x_pts,\n y_pts=40,\n width_pts=100,\n height_pts=120,... | [
"0.7257687",
"0.7169048",
"0.71056324",
"0.7050892",
"0.70118165",
"0.6951953",
"0.69319713",
"0.6899924",
"0.6887044",
"0.6851681",
"0.6824194",
"0.6813191",
"0.6765473",
"0.67380536",
"0.6700593",
"0.66946596",
"0.66851765",
"0.6681908",
"0.6646198",
"0.6642717",
"0.6615817... | 0.72439015 | 1 |
Test TypeError for y in Rectangle | def test_check_y_TypeError_01(self):
self.assertRaisesRegex(
TypeError,
'y must be an integer',
Rectangle,
4, 2, 0, 'string', 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_y_TypeError_(self):\n self.assertRaisesRegex(\n ValueError,\n 'y must be >= 0',\n Rectangle,\n 4, 2, 0, -6, 12\n )",
"def test_check_y_TypeError_02(self):\n self.assertRaisesRegex(\n TypeError,\n 'y must be an i... | [
"0.77468276",
"0.7542236",
"0.73070174",
"0.7150264",
"0.7125569",
"0.7060905",
"0.7048451",
"0.7033537",
"0.702166",
"0.70203775",
"0.6982661",
"0.6935026",
"0.69249964",
"0.6881714",
"0.6876161",
"0.68669915",
"0.6866349",
"0.68504226",
"0.68446755",
"0.67979693",
"0.675400... | 0.71647006 | 3 |
Test TypeError for y in Rectangle | def test_check_y_TypeError_02(self):
self.assertRaisesRegex(
TypeError,
'y must be an integer',
Rectangle,
4, 2, 0, [1, 2, 3, 4], 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_y_TypeError_(self):\n self.assertRaisesRegex(\n ValueError,\n 'y must be >= 0',\n Rectangle,\n 4, 2, 0, -6, 12\n )",
"def test_rectangle_validation_y_pts(self):\n for bad_y_pts in (1.2, Decimal(3), -1, 'hello'):\n self.ass... | [
"0.77468276",
"0.73070174",
"0.71647006",
"0.7150264",
"0.7125569",
"0.7060905",
"0.7048451",
"0.7033537",
"0.702166",
"0.70203775",
"0.6982661",
"0.6935026",
"0.69249964",
"0.6881714",
"0.6876161",
"0.68669915",
"0.6866349",
"0.68504226",
"0.68446755",
"0.67979693",
"0.67540... | 0.7542236 | 1 |
Test TypeError for y in Rectangle | def test_check_y_TypeError_(self):
self.assertRaisesRegex(
ValueError,
'y must be >= 0',
Rectangle,
4, 2, 0, -6, 12
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_y_TypeError_02(self):\n self.assertRaisesRegex(\n TypeError,\n 'y must be an integer',\n Rectangle,\n 4, 2, 0, [1, 2, 3, 4], 12\n )",
"def test_rectangle_validation_y_pts(self):\n for bad_y_pts in (1.2, Decimal(3), -1, 'hello'):\n ... | [
"0.7542236",
"0.73070174",
"0.71647006",
"0.7150264",
"0.7125569",
"0.7060905",
"0.7048451",
"0.7033537",
"0.702166",
"0.70203775",
"0.6982661",
"0.6935026",
"0.69249964",
"0.6881714",
"0.6876161",
"0.68669915",
"0.6866349",
"0.68504226",
"0.68446755",
"0.67979693",
"0.675400... | 0.77468276 | 0 |
Sets the redirect_on_exit_url of this LaunchLinkRequestSchema. | def redirect_on_exit_url(self, redirect_on_exit_url):
self._redirect_on_exit_url = redirect_on_exit_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_url(self, redirect_url):\n\n self._redirect_url = redirect_url",
"def redirect_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"redirect_url\")",
"def redirect_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"redirect_url\")",
"def ... | [
"0.59666544",
"0.54096955",
"0.5383127",
"0.5383127",
"0.5262",
"0.51902395",
"0.5185219",
"0.50391024",
"0.49664503",
"0.4935108",
"0.4903764",
"0.49030373",
"0.48972008",
"0.48972008",
"0.48887157",
"0.4847177",
"0.48417988",
"0.48377764",
"0.4835847",
"0.4830262",
"0.48302... | 0.78896606 | 0 |
Sets the tracking of this LaunchLinkRequestSchema. | def tracking(self, tracking):
self._tracking = tracking | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tracking(self, tracking):\n if tracking is None:\n raise ValueError(\"Invalid value for `tracking`, must not be `None`\") # noqa: E501\n\n self._tracking = tracking",
"def tracking_id(self, tracking_id):\n\n self._tracking_id = tracking_id",
"def tracker(self, tracker):\n ... | [
"0.59175193",
"0.5772658",
"0.5355647",
"0.5299613",
"0.51542395",
"0.5004666",
"0.49467146",
"0.49467146",
"0.49467146",
"0.49467146",
"0.49467146",
"0.49467146",
"0.49467146",
"0.49312222",
"0.4912141",
"0.4911507",
"0.4911249",
"0.4901042",
"0.4901042",
"0.4901042",
"0.486... | 0.65480053 | 0 |
Sets the start_sco of this LaunchLinkRequestSchema. | def start_sco(self, start_sco):
self._start_sco = start_sco | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n if start is None:\n raise Value... | [
"0.6258909",
"0.6258909",
"0.6258909",
"0.6258909",
"0.6224466",
"0.61895645",
"0.60527277",
"0.59323496",
"0.56503206",
"0.56323624",
"0.5628752",
"0.5581056",
"0.5557751",
"0.5557751",
"0.5557751",
"0.5557751",
"0.5557751",
"0.5557751",
"0.5557751",
"0.5557751",
"0.5557751"... | 0.8036127 | 0 |
Sets the additional_values of this LaunchLinkRequestSchema. | def additional_values(self, additional_values):
self._additional_values = additional_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additional_fields(self, additional_fields):\n\n self._additional_fields = additional_fields",
"def custom_attributes(self, custom_attributes):\n\n self._custom_attributes = custom_attributes",
"def additional_data(self, additional_data):\n\n self._additional_data = additional_data",
... | [
"0.5886193",
"0.5731288",
"0.5674471",
"0.539386",
"0.5291862",
"0.5211797",
"0.5208004",
"0.50078374",
"0.50078374",
"0.49795458",
"0.49361882",
"0.47930282",
"0.4745399",
"0.47424018",
"0.47392476",
"0.47378352",
"0.47128993",
"0.4712008",
"0.46817243",
"0.4671242",
"0.4649... | 0.6502141 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, LaunchLinkRequestSchema):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Set mask for image, check if it has proper shape. | def set_mask(self, mask: typing.Optional[np.ndarray], axes: typing.Optional[str] = None):
if mask is None:
self._mask_array = None
elif axes is not None:
self._mask_array = self.fit_mask_to_image(self.reorder_axes(mask, axes))
else:
self._mask_array = self.fit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMask(self, mask):\n try:\n self.mask = mask\n self.inds = na.nonzero(self.mask.flat)[0]\n #print \"length of self.inds\",len(self.inds)\n #print self.inds\n self.dim = self.mask.shape[::-1]\n #print self.mask.shape\n return ... | [
"0.7456848",
"0.7209562",
"0.71374065",
"0.69263035",
"0.69238365",
"0.6874762",
"0.67294157",
"0.66603255",
"0.66157866",
"0.66105103",
"0.65640175",
"0.65620863",
"0.6505579",
"0.6505579",
"0.649812",
"0.6476543",
"0.64660496",
"0.6455875",
"0.6450074",
"0.6445786",
"0.6429... | 0.6789482 | 6 |
check if image contain 3d data | def is_stack(self) -> bool:
return self.layers > 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is3DImage(self):\n\t\treturn self.is3D",
"def is3D(data):\n return data.find(\"x3\") != -1 and data.find(\"y3\") != -1 and data.find(\"z3\") != -1",
"def check_niimg_3d(niimg, dtype=None):\n return check_niimg(niimg, ensure_ndim=3, dtype=dtype)",
"def is3_d(self):\n return self.container... | [
"0.788779",
"0.76187",
"0.7339193",
"0.7010311",
"0.66377795",
"0.6598727",
"0.648691",
"0.64804816",
"0.645356",
"0.6433747",
"0.63308525",
"0.6320817",
"0.6296994",
"0.6258236",
"0.62339085",
"0.62220126",
"0.6207532",
"0.6201058",
"0.61708087",
"0.61632895",
"0.6154266",
... | 0.0 | -1 |
Check if image z and time dimension are equal to 1. | def is_2d(self) -> bool:
return self.layers == 1 and self.times == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_1DNN(self):\n if not self.dims == 1:\n return False\n if not set(self.__m__.keys()) <= set(((0,),(1,),(-1,))):\n return False\n\n return True",
"def _validate_dimensionality(self):\r\n\r\n if self.time.ndim != 1:\r\n raise ValueError(\"time arra... | [
"0.60923123",
"0.60502875",
"0.6011569",
"0.5914427",
"0.5894437",
"0.5867954",
"0.58549035",
"0.5821524",
"0.5814034",
"0.5776267",
"0.5771633",
"0.5757691",
"0.57223374",
"0.57163125",
"0.57066995",
"0.57018405",
"0.5672114",
"0.56714684",
"0.5646048",
"0.5646048",
"0.56400... | 0.63412416 | 0 |
image brightness ranges for each channel | def get_ranges(self) -> typing.List[typing.Tuple[float, float]]:
return self.ranges[:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_brightness(image):\n target = image.copy()\n for y in range(len(image)):\n for x in range(len(image[y])):\n rgb = image[y, x]\n target[y, x] = brightness(rgb)\n\n return target",
"def brightness(rgb):\n # return (min(rgb) + max(rgb)) / 2\n return rgb_to_hls(r... | [
"0.6722771",
"0.6645357",
"0.6618545",
"0.6590246",
"0.6558283",
"0.64326197",
"0.6419491",
"0.6393754",
"0.637683",
"0.6370576",
"0.63438654",
"0.6341083",
"0.6318059",
"0.6310838",
"0.6300534",
"0.62946635",
"0.62715054",
"0.6238039",
"0.6216199",
"0.6212534",
"0.6206258",
... | 0.0 | -1 |
getter for the reviewer property | def reviewer(self):
return self._reviewer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewer_id(self) -> int:\n return self._reviewer_id",
"def review(self):\n return self._review",
"def review(self) -> object:\n return self._review",
"def page_reviser(self):\n return self.run_query(\"/mediawiki/page[id=150096]/revision/contributor/username/text()\")",
"def... | [
"0.64900196",
"0.64685637",
"0.6261104",
"0.61663646",
"0.6149771",
"0.6019309",
"0.59023607",
"0.58832324",
"0.5807215",
"0.5710127",
"0.56872386",
"0.56792307",
"0.56792307",
"0.5667835",
"0.5596576",
"0.55597293",
"0.55259037",
"0.5525145",
"0.55058557",
"0.54926324",
"0.5... | 0.82460725 | 0 |
setter for the reviewer property | def reviewer(self, reviewer):
if not reviewer:
return
from stalker import User
if not isinstance(reviewer, User):
raise TypeError(
"%s.reviewer should be a stalker.User instance, not %s"
% (self.__class__.__name__, reviewer.__class__.__na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_reviewer(self):\n review = self.review[0]\n self.assertEqual(\"\", review.get_reviewer())\n review.set_reviewer_name(\"Name\")\n self.assertEqual(\"Name\", review.get_reviewer())",
"def reviewer(self):\n return self._reviewer",
"def set_ReviewerName(self, value):... | [
"0.7777137",
"0.6935411",
"0.6892932",
"0.6738285",
"0.6676668",
"0.62369233",
"0.6195277",
"0.6062505",
"0.5971514",
"0.59271866",
"0.5808089",
"0.57289004",
"0.57239294",
"0.5662929",
"0.5622263",
"0.56065816",
"0.5572978",
"0.55614746",
"0.5557909",
"0.5553399",
"0.5548729... | 0.753554 | 1 |
returns the current review type | def get_review_type(self):
return self.currentText() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewers_type(self) -> str:\n return pulumi.get(self, \"reviewers_type\")",
"def type(self):\n\t\treturn self.type_",
"def _type(self):\n return self._id[1]",
"def get_type(self):\n return self.type",
"def get_type(self):\n return self.type",
"def test_review_type(self):\... | [
"0.79443854",
"0.67666376",
"0.66087264",
"0.65152806",
"0.65152806",
"0.64789104",
"0.64433926",
"0.64374006",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665",
"0.64350665"... | 0.8877703 | 0 |
The connection string to the local memcached instance. | def memcached_connection(run_services, memcached_socket):
if run_services:
return 'unix:{0}'.format(memcached_socket) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_string(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connection_string\")",
"def connection_string(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connection_string\")",
"def connection_string(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(sel... | [
"0.66777015",
"0.66777015",
"0.63861734",
"0.63513947",
"0.6216885",
"0.6019109",
"0.5977813",
"0.59556156",
"0.594971",
"0.59489715",
"0.5938586",
"0.5938586",
"0.5892395",
"0.587028",
"0.58145326",
"0.58013505",
"0.5772892",
"0.5733896",
"0.5721898",
"0.56970584",
"0.569705... | 0.6850515 | 0 |
Tokenize text and return a set and list of vocab words | def extract_text_vocab(text, re_pattern):
text_tokens = re.findall(re_pattern, text)
lower_tokens = [t.lower() for t in text_tokens]
return set(lower_tokens), lower_tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text: str):\n # Create list of word tokens\n token_list = []\n # nlp = init_nlp(TaggingMethod.SPACY, Lang.ES, size=DictionarySize.MEDIUM)\n doc = nlp(text)\n token_list = [token.text for token in doc]\n # for token in doc:\n # token_list.append(token.text)\n return token_li... | [
"0.7602246",
"0.73358357",
"0.7330931",
"0.7317778",
"0.728563",
"0.72594345",
"0.71964025",
"0.7182197",
"0.71779567",
"0.7158854",
"0.71478915",
"0.71367276",
"0.71290606",
"0.71226174",
"0.71220493",
"0.71183705",
"0.7114274",
"0.71099365",
"0.7017783",
"0.70131016",
"0.70... | 0.6870773 | 40 |
Renders the index page. | def index(request):
# if 'login_cas' in request.session and request.session['login_cas']:
# logged_in = True
# else:
# logged_in = False
response = render_to_response('card/index.html')
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('ind... | [
"0.85183567",
"0.8432923",
"0.8432657",
"0.8416253",
"0.8416253",
"0.8386969",
"0.82956177",
"0.82400775",
"0.8239558",
"0.8239558",
"0.8122614",
"0.8122614",
"0.8122614",
"0.81219",
"0.81049687",
"0.8094918",
"0.80905485",
"0.80903816",
"0.8078912",
"0.8077632",
"0.8077632",... | 0.0 | -1 |
Returns the name of the group this tool belongs to. | def group(self):
return self.tr("Locatie Server") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_name(self):\n return self.groupname",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self):\n\n return self._group_name",
"def group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"group_name\")",
"... | [
"0.8259154",
"0.8186801",
"0.8106378",
"0.800916",
"0.788337",
"0.77045196",
"0.77045196",
"0.76990175",
"0.75706464",
"0.7519584",
"0.7445713",
"0.74442655",
"0.73797625",
"0.73492265",
"0.73492265",
"0.733111",
"0.72849625",
"0.7240928",
"0.72376376",
"0.72169375",
"0.71713... | 0.0 | -1 |
Returns the unique ID of the group this tool belongs to. | def groupId(self):
return "pdok-locatie-server" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self):\n return self._group",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self):\n return self._id",
"def getId(self):\n return _libsbml.Group_getId(self)"... | [
"0.83183986",
"0.8280999",
"0.8280999",
"0.82483894",
"0.8126504",
"0.80731875",
"0.8056496",
"0.8056496",
"0.8056496",
"0.80251515",
"0.79972404",
"0.7969146",
"0.79258794",
"0.77669746",
"0.7667986",
"0.7667986",
"0.7667986",
"0.7426211",
"0.7417094",
"0.7341196",
"0.733186... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.