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 |
|---|---|---|---|---|---|---|
Compute triplet loss for anchor/positive pairs and randomly sampled imposters. `anchor_embeddings` should contain embeddings each paired with a positive embedding in `positive_embeddings`. For example, anchor and positive embeddings may result from image pairs or image and spoken caption pairs. | def loss(anchor_embeddings, positive_embeddings):
# based on:
# https://github.com/dharwath/DAVEnet-pytorch/blob/23a6482859dd2221350307c9bfb5627a5902f6f0/steps/util.py#L88-L116
anchor_shape = tf.shape(anchor_embeddings)
positive_shape = tf.shape(positive_embeddings)
# should hav... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triplet_imposter_random_sample_loss(margin=1.0, metric=\"cosine\"):\n assert metric in [\"cosine\", \"euclidean\", \"squared_euclidean\"]\n\n @tf.function\n def loss(anchor_embeddings, positive_embeddings):\n # based on:\n # https://github.com/dharwath/DAVEnet-pytorch/blob/23a6482859dd22... | [
"0.6489589",
"0.6172423",
"0.6149359",
"0.59976786",
"0.5970333",
"0.5909695",
"0.5718353",
"0.54869294",
"0.5481794",
"0.54428804",
"0.5414899",
"0.5371133",
"0.5368377",
"0.5361744",
"0.53575516",
"0.5315496",
"0.531376",
"0.5301899",
"0.528587",
"0.5257055",
"0.51682866",
... | 0.764437 | 0 |
The sum of self and other. | def __add__(self, other):
try:
new_num = (self._num * other._den) + (self._den * other._num)
new_den = (self._den * other._den)
return Rational(new_num, new_den)
except AttributeError:
return (self + Rational.parse_number(other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add__(self, other):\n try:\n total = {self.var: 1, other.var: 1}\n return AutoDiffReverse(self.val + other.val, None, der=total)\n except AttributeError:\n return AutoDiffReverse(self.val + other, None, {self.var: 1})",
"def __radd__(self, other):\n ret... | [
"0.7947677",
"0.77887416",
"0.77887416",
"0.77651924",
"0.7717441",
"0.77122545",
"0.77122545",
"0.77122545",
"0.77122545",
"0.77122545",
"0.77122545",
"0.77122545",
"0.76347935",
"0.7619139",
"0.7527559",
"0.7508768",
"0.73910403",
"0.73910403",
"0.7378393",
"0.7366302",
"0.... | 0.69016945 | 71 |
Is self equal to other? | def __eq__(self, other):
try:
same_num = (self._num == other._num)
same_den = (self._den == other._den)
return same_num and same_den
except AttributeError:
return (self == Rational.parse_number(other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self,other):\n return self is other",
"def __eq__(self, other):\n return equal(self, other)",
"def same_as(self... | [
"0.8820725",
"0.8820725",
"0.87159795",
"0.86937904",
"0.8654434",
"0.85539377",
"0.8540647",
"0.8540647",
"0.8531783",
"0.8507663",
"0.8507663",
"0.85040134",
"0.8457744",
"0.8453699",
"0.8443939",
"0.843342",
"0.843342",
"0.8430281",
"0.84220684",
"0.83970225",
"0.8385382",... | 0.0 | -1 |
Is self less than other? | def __lt__(self, other):
try:
lhs = (self._num * other._den)
rhs = (other._num * self._den)
return (lhs < rhs)
except AttributeError:
return (self < Rational.parse_number(other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, other):\r\n # self <= other <=> not (other < self)\r\n return 1 - runtime.lt(other, self)",
"def __ge__(self, other):\r\n # self >= other <=> not (self < other)\r\n return 1 - runtime.lt(self, other)",
"def __le__(self, other):\n return not (other < self)",
... | [
"0.84359944",
"0.82814175",
"0.82653344",
"0.8160216",
"0.8149444",
"0.81135225",
"0.8065218",
"0.8039228",
"0.8039228",
"0.8021802",
"0.8005029",
"0.7993756",
"0.799117",
"0.7965735",
"0.79651886",
"0.79651886",
"0.79553676",
"0.7934043",
"0.7931866",
"0.79014754",
"0.787153... | 0.7336868 | 95 |
Is self less than or equal to other? | def __le__(self, other):
try:
lhs = (self._num * other._den)
rhs = (other._num * self._den)
return (lhs <= rhs)
except AttributeError:
return (self <= Rational.parse_number(other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, other):\n return less_equal(self, other)",
"def __ge__(self, other):\n return other <= self",
"def __le__(self, other):\n # self <= other <=> other >= self\n return self.runtime.greater_than_equal(other, self)",
"def __le__(self, other):\r\n # self <= other... | [
"0.84847564",
"0.8462154",
"0.84531677",
"0.8440182",
"0.84063125",
"0.83879566",
"0.8383959",
"0.8335061",
"0.8335061",
"0.8299887",
"0.8276419",
"0.8276419",
"0.82606417",
"0.824309",
"0.8220053",
"0.8212114",
"0.8211626",
"0.8191206",
"0.81797653",
"0.81729305",
"0.8166361... | 0.79237896 | 43 |
Is self equal to 0? | def is_zero(self):
return (self._num == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self) -> bool:\n return self.field.zero == self",
"def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False",
"def __eq__(self,other):\n return (self - other == 0.)",
"def isZero(self):\n return self.count == 0"... | [
"0.78026944",
"0.7630986",
"0.7561389",
"0.74907005",
"0.7483753",
"0.7351913",
"0.70747674",
"0.7068141",
"0.7048426",
"0.7048426",
"0.70373225",
"0.6995084",
"0.6882755",
"0.6877487",
"0.68556017",
"0.68531024",
"0.6839516",
"0.6760004",
"0.6756906",
"0.672773",
"0.67222327... | 0.73992306 | 5 |
converts a class name to a collection name. | def cls_to_col(db, cls):
col_name = cls + 's'
if not col_name in db.collection_names():
try:
db.create_collection(col_name)
except:
raise
return eval('db.' + col_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_class_name(name: str) -> str:\n name_tokens = re_class_name.findall(name)\n return \"_\".join(i.lower() for i in name_tokens if i)",
"def get_collection(self, collection_name):\r\n collection = None\r\n if collection_name == 'talent5__staff_collection':\r\n collection =... | [
"0.63989913",
"0.6150703",
"0.60976315",
"0.6067518",
"0.59168804",
"0.5873975",
"0.5857611",
"0.5826658",
"0.5825699",
"0.57716376",
"0.5733161",
"0.57302594",
"0.57173073",
"0.5702063",
"0.5659152",
"0.5625095",
"0.5604019",
"0.55640864",
"0.55379534",
"0.55086833",
"0.5496... | 0.65355176 | 0 |
Return text between the first occurence of string start and string end in haystack. | def find_text_between(start,end,haystack):
found = re.search(start+'(.*)'+end,haystack,re.IGNORECASE | re.DOTALL)
if found:
return found.group(1).strip()
else:
raise Exception("There is no substring starting with '{}', ending"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_between(self, s, first, last):\n try:\n start = s.index(first) + len(first)\n end = s.index(last, start)\n return s[start:end]\n except ValueError:\n return \"\"",
"def find_start_end(text, start_text, end_text, start=0):\n # return (s, e) o... | [
"0.69310933",
"0.6827349",
"0.6742492",
"0.67385876",
"0.673743",
"0.6727924",
"0.6695689",
"0.6679793",
"0.65434897",
"0.6487082",
"0.6473873",
"0.6447456",
"0.620745",
"0.6158415",
"0.60701555",
"0.601583",
"0.58966005",
"0.5811713",
"0.5788526",
"0.57882255",
"0.5746307",
... | 0.842572 | 0 |
load monthly pdo dataset | def load_pdo():
df = pd.read_csv('./archive/pdo_monthly.csv')
pdo = pd.DataFrame(index = pd.to_datetime(df['yyyymm'], format='%Y%m'), columns=['pdo'])
pdo['pdo'] = df.pdo.values
return pdo | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data(self, year, month):\n data = _download_to_df(self.url, self.table_name, year, month)\n data = data.loc[:, self.table_columns]\n with self.con:\n data.to_sql(self.table_name, con=self.con, if_exists='replace', index=False)\n self.con.commit()",
"def load_dai... | [
"0.64837146",
"0.63213676",
"0.6265034",
"0.6207991",
"0.6202124",
"0.6197799",
"0.618341",
"0.61627",
"0.61543244",
"0.6145329",
"0.61441267",
"0.6137599",
"0.612636",
"0.6119787",
"0.61104655",
"0.610339",
"0.6101154",
"0.60984874",
"0.60821027",
"0.60752285",
"0.6069135",
... | 0.7482942 | 0 |
Write a single summary value to tensorboard | def write_summary(value, tag, summary_writer, global_step):
summary = tf.Summary()
summary.value.add(tag=tag, simple_value=value)
summary_writer.add_summary(summary, global_step) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeSummary(self, value, tag, summaryWriter, global_step):\n\n summary = tf.Summary()\n summary.value.add(tag=tag, simple_value=value)\n summaryWriter.add_summary(summary, global_step)",
"def scalar_summary(self, tag, value, step):\n with self.writer.as_default():\n tf.summary.sca... | [
"0.7692856",
"0.7424265",
"0.7346214",
"0.7346214",
"0.7346214",
"0.7255747",
"0.70672417",
"0.7037515",
"0.70122087",
"0.7000477",
"0.6957464",
"0.6911966",
"0.6908891",
"0.6880707",
"0.686772",
"0.6857955",
"0.68418956",
"0.68370825",
"0.6821709",
"0.6794511",
"0.67150164",... | 0.76693326 | 1 |
Returns the Engineering Units of the readback PV, as reported by EPICS. | def egu(self):
return self.motor_egu.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def E(self):\n return self.generic_getter(get_energy, \"E\", \"convert_energy\")",
"def _get_Etot(self, file):\n f = open_general(file)\n tmptxt = f.readlines()\n f.close()\n itmp = 0\n Etot = []\n while itmp >= 0:\n itmp = search_string('TOTAL ENERGY',... | [
"0.6649683",
"0.66006416",
"0.6219275",
"0.6219275",
"0.61868346",
"0.6127352",
"0.6121531",
"0.60821927",
"0.607153",
"0.601557",
"0.5971765",
"0.5970985",
"0.5935506",
"0.58844244",
"0.58423054",
"0.5794599",
"0.5789594",
"0.5769547",
"0.57451886",
"0.57427156",
"0.5727138"... | 0.0 | -1 |
Convert yposition to coating index | def _get_coating_index(self, y: float) -> int:
if self.y_ranges == []:
return 1
y_idxs = self._find_matching_range_indices(self.y_ranges, y)
valid_y_idx = np.where(y_idxs)[0]
if len(valid_y_idx) > 1:
# should only see one valid y-range, coating unknown
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_coating_index(self, y: int) -> int:\n if y < 1:\n raise MirrorLogicError('coating state not valid or unknown')\n return y - 1",
"def coor2idx(x, y):\r\n a = round(x/4000,0)*4000\r\n b = (round_down(y/4000,0)+0.5)*4000\r\n i = int((a - 24000)/4000) + 1\r\n j = int((b ... | [
"0.71685374",
"0.7140193",
"0.69487894",
"0.6777433",
"0.66792977",
"0.66553956",
"0.6589918",
"0.65641373",
"0.6533462",
"0.6509694",
"0.63731486",
"0.63672674",
"0.63576",
"0.63090163",
"0.63031566",
"0.63031566",
"0.62564147",
"0.624553",
"0.6217407",
"0.6209876",
"0.62029... | 0.69487137 | 3 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
# Get the user to input their name. Characters, hypens, spaces and brackets are valid - numbers are not
valid_characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -_(){}[]&'
while True:
name = input("\nPlease enter your name, using only characters, spaces and hypens:... | {
"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.6671396",
"0.65349597",
"0.6458871",
"0.637442",
"0.6348152",
"0.63093895",
"0.6286328",
"0.6258814",
"0.6232131",
"0.6213363",
"0.62047696",
"0.618054",
"0.6172124",
"0.61680824",
"0.6158066",
"0.6157817",
"0.6152588",
"0.6143721",
"0.61312693",
"0.61040294",
"0.61019015"... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city_input, month_input, day_input):
# Read csv for city_input using CITY_DATA dictionary to create df
df = pd.read_csv(CITY_DATA[city_input])
# Convert 'Start Time' and 'End Time' columns in df to datetime with pd.to_datetime function
df['Start Time'] = pd.to_datetime(df['Start Time'])
... | {
"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.8131563",
"0.81086665",
"0.8045787",
"0.80421764",
"0.80088735",
"0.8007066",
"0.79992354",
"0.7998196",
"0.7988249",
"0.7978888",
"0.79734164",
"0.79605865",
"0.7955767",
"0.7946851",
"0.79458547",
"0.79078835",
"0.7907882",
"0.7904109",
"0.7900328",
"0.78928494",
"0.7888... | 0.0 | -1 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...')
start_time = time.time()
## TO DO: display the most common month
# Method 1 (commented out below) converts the integer into a character - however, it can only return one value for the mode # month_mode = df['month'].m... | {
"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.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.0 | -1 |
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()
# TO DO: display most commonly used start station
start_station_count = df['Start Station'].value_counts()[df['Start Station'].value_counts() == df['Start Station'].value_counts().max()]
... | {
"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.71912503 | 46 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...')
start_time = time.time()
# TO DO: display total travel time
trip_duration_total = df['Trip Duration'].sum()
print('\nThe total travel time:', trip_duration_total)
# TO DO: display mean travel time
trip_duration_mean = df... | {
"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.8143107",
"0.80261016",
"0.8005204",
"0.79381585",
"0.79319245",
"0.7927495",
"0.79160804",
"0.7915442",
"0.7908906",
"0.790647",
"0.7901531",
"0.7892363",
"0.7890434",
"0.78873086",
"0.7885862",
"0.7885026",
"0.7883604",
"0.7874962",
"0.7869428",
"0.7867245",
"0.7864788",... | 0.79503816 | 3 |
Generate dictionary that represents the manifest The single key at the top is a generated string of the form PRODUCTVERSIONBLD_NUM and the value is a dictionary containing the collected data from the manifest | def generate_manifest_dict(self):
annotations = dict()
for build_project in self.projects.get('build', []):
for annotation in build_project.get('annotation', []):
annotations[annotation['name']] = annotation['value']
product = annotations.get('PRODUCT', 'unknown')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_manifest_json(\n name: str,\n version: str,\n description: str\n) -> Dict[str, Union[str, List[str]]]:\n return ({\n \"name\": name,\n \"version_number\": version,\n \"website_url\": GITHUB_URL,\n \"description\": description,\n \"dependencies\": []\n })"... | [
"0.6723729",
"0.660061",
"0.63167304",
"0.6301826",
"0.6301826",
"0.6151704",
"0.61013114",
"0.6035424",
"0.58860636",
"0.5841266",
"0.5780536",
"0.5772059",
"0.5730861",
"0.57131946",
"0.56993896",
"0.5680654",
"0.56622285",
"0.5651734",
"0.56483537",
"0.56352484",
"0.562787... | 0.74733555 | 0 |
Ensure the url doesn't start with either git or hg. | def normalize_url(url):
if not url.startswith(("git+", "hg+")):
return url
return url[4:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url(url):\n return get_svninfo(url) != {}",
"def _is_git_url_mismatch(\n mismatch_item: Tuple[str, ValidatedMismatchType]\n) -> bool:\n _, (required, _) = mismatch_item\n return required.startswith('git')",
"def trim_repo_url(url):\n return url.replace(\".git\", \"\")",
"def test_bad... | [
"0.66992337",
"0.66715586",
"0.6491474",
"0.6354417",
"0.62808365",
"0.6273125",
"0.61421114",
"0.6134395",
"0.6080041",
"0.60779494",
"0.60522074",
"0.5990106",
"0.5959558",
"0.5928997",
"0.5924408",
"0.59096044",
"0.58794314",
"0.58471155",
"0.5845393",
"0.58164054",
"0.581... | 0.7623044 | 0 |
Tests whether a line contains only whitespace. | def is_blank(line):
return not bool(line.strip()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_valid(line: str) -> bool:\n\n return line != ' ' and line != ''",
"def determine_if_whitespace(self):\n value = self.current.value\n\n if value == \"\\n\":\n self.is_space = True\n else:\n self.is_space = False\n if value == \"\" or regexes[\"whit... | [
"0.76573575",
"0.76201767",
"0.7491552",
"0.7323895",
"0.7289925",
"0.7212329",
"0.720179",
"0.71086794",
"0.7089248",
"0.70851374",
"0.70671356",
"0.70643705",
"0.6998826",
"0.69024354",
"0.6850201",
"0.68233633",
"0.6722262",
"0.67207265",
"0.66700274",
"0.66336924",
"0.660... | 0.72711307 | 5 |
Expands all but leading tabs to spaces. | def untabify(line, tabwidth):
assert tabwidth > 0
body = list()
i = 0
while i < len(line) and line[i] == '\t':
i += 1
indent = '\t' * i
while i < len(line):
if line[i] == '\t':
skip = tabwidth - (len(body) % tabwidth)
body.extend(' ' for i in range(skip))
else:
body.append(line[i])
i += 1
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tab2space(text, tabsize=1):\n return text.expandtabs(tabsize)",
"def converttabs(text, spaces=4):\n\n return text.replace('\\t', ' ' * spaces)",
"def clean_tabs(self, text):\n\n if text:\n # lines = text.split('\\n')\n lines = text.splitlines()\n lines = [l for... | [
"0.6872284",
"0.677523",
"0.672045",
"0.6563201",
"0.6434349",
"0.64189017",
"0.6381054",
"0.6373866",
"0.6363714",
"0.6330364",
"0.62977666",
"0.62646765",
"0.6256042",
"0.6204302",
"0.61786246",
"0.6156192",
"0.61003727",
"0.6031927",
"0.60062546",
"0.5997786",
"0.59057087"... | 0.6080902 | 17 |
Given a file name, `return`s the file name for the corresponding backup file. | def make_backup_file_name(filename):
backup_suffix = '~' if os.name == 'posix' else '.backup'
if filename.endswith(backup_suffix):
raise ValueError("Looks like a backup file: " + filename)
return filename + backup_suffix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBaseName(filepath):\n return os.path.basename(filepath)",
"def get_file_name(file):\n return os.path.splitext(os.path.basename(file))[0]",
"def get_filename(filepath):\n return os.path.basename(filepath)",
"def basename(file_path):\n return os.path.basename(file_path)",
"def _backupFile(... | [
"0.68049634",
"0.66896194",
"0.6521807",
"0.65215206",
"0.65059775",
"0.65026",
"0.64820296",
"0.6388873",
"0.6388873",
"0.63628435",
"0.6348544",
"0.62847257",
"0.6257556",
"0.6215179",
"0.62088436",
"0.6183706",
"0.6106535",
"0.608851",
"0.6087688",
"0.6070777",
"0.6070642"... | 0.72565037 | 0 |
`return`s a list of of versioncontrolled files as reported by `git lsfiles` filtered to contain only regular files. [str] list of file names OSError if running Git fails | def git_ls_files():
proc = subprocess.Popen(
['git', 'ls-files'],
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=None
)
(stdout, stderr) = proc.communicate()
if proc.returncode != 0:
raise OSError("Cannot list version-controlled files")
filenames = stdout.decode().split()
return list(filter(is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files_changed():\n files_list = []\n test = os.popen('git show --name-only')\n repo_location = os.popen('git rev-parse --show-toplevel')\n repo_location = repo_location.readlines()\n repo_location = repo_location[0]\n repo_location = repo_location.replace('\\n', '')\n if \"Not a git re... | [
"0.77477914",
"0.7573615",
"0.72460854",
"0.7168919",
"0.71008813",
"0.6920087",
"0.68402743",
"0.6774799",
"0.67328686",
"0.6728607",
"0.65776646",
"0.65639526",
"0.6547751",
"0.6474594",
"0.6345377",
"0.6303023",
"0.62841076",
"0.62651634",
"0.6259392",
"0.62436914",
"0.621... | 0.8440022 | 0 |
Obtains the first element in a pair. | def first(pair):
return pair[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def second(pair):\n\treturn pair[1]",
"def take_first(info):\n return info[0]",
"def find_min(self):\n if self.is_empty():\n return None\n else:\n p = self.first()\n return (p.key(), p.value())",
"def first(xs):\n if not xs:\n return None\n retur... | [
"0.7328187",
"0.6754345",
"0.66419613",
"0.662139",
"0.662139",
"0.657316",
"0.6535706",
"0.6476364",
"0.6389532",
"0.6367985",
"0.636334",
"0.636334",
"0.6287136",
"0.6252859",
"0.6247001",
"0.62439734",
"0.61664194",
"0.61523044",
"0.6151724",
"0.6071555",
"0.60541093",
"... | 0.88343024 | 0 |
Test that redirection is disabled. | def testRedirect(self):
self.assertRaises(NotImplementedError, self.handler.redirect, '/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_auto_auth_disabled(self):\r\n response = self.client.get(self.url)\r\n self.assertEqual(response.status_code, 404)",
"def test_no_access_without_login(self):\n response = self.client.get(reverse('question_list'), follow=True)\n expected_url = reverse('home') + \"?next=\" + re... | [
"0.6628034",
"0.6605337",
"0.6558704",
"0.65535605",
"0.65284395",
"0.6514763",
"0.6406585",
"0.63627374",
"0.62773305",
"0.61921173",
"0.61354196",
"0.6119285",
"0.610915",
"0.6104482",
"0.6074708",
"0.60527",
"0.6042703",
"0.60406125",
"0.60280174",
"0.60243154",
"0.5994112... | 0.6275593 | 9 |
Test what happens when GET is not supported. | def testNoMatch_GetNotSupported(self):
self.mox.ReplayAll()
self.handler.handle('GET', '/my_service', 'method1')
self.VerifyResponse('405',
'Method Not Allowed',
'/my_service.method1 is a ProtoRPC method.\n\n'
'Service %s.Service\n\n'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_request_should_not_work(self):\n response = self.client.get(reverse('user-list'))\n self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)",
"def test_bad_method(self):\n\n request = service.get_request('GET', {})\n x = self.start_request_tests(request... | [
"0.76834744",
"0.75739855",
"0.75163734",
"0.75105375",
"0.7362107",
"0.7236172",
"0.7098942",
"0.7081236",
"0.69224787",
"0.682358",
"0.6817697",
"0.6783566",
"0.6773036",
"0.6756274",
"0.6720492",
"0.67003727",
"0.6664823",
"0.66637963",
"0.66461253",
"0.65994203",
"0.65483... | 0.6867098 | 9 |
Set up test framework. | def setUp(self):
self.Reinitialize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.framework = FrameworkFactory.get_framework()\n self.framework.start()\n self.ipopo = install_ipopo(self.framework)\n\n # Install the test bundle\n self.module = install_bundle(self.framework)",
"def setUp(self):\n logging.debug('setting up')",
"... | [
"0.74742806",
"0.7299929",
"0.7299929",
"0.7208573",
"0.7160565",
"0.70908165",
"0.7007824",
"0.6996411",
"0.69516504",
"0.6913872",
"0.6913872",
"0.69055367",
"0.6894395",
"0.6874683",
"0.68633044",
"0.6856716",
"0.685645",
"0.6824801",
"0.6824801",
"0.67973596",
"0.67973596... | 0.0 | -1 |
Updates current tag categories with the given ones | def update_categories(self):
for btn in self._tags_btn_grp.buttons():
self._tags_btn_grp.removeButton(btn)
qtutils.clear_layout(self._tags_menu_layout)
if not self._outliners:
return
total_buttons = 0
categories_list = self._outliners.keys()
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_categories(self):\n categories = {}\n datasets = self.data['dataset']\n used_categories = self._get_list_categories_used(datasets)\n for category in used_categories:\n categories.update({\n category: self._get_datasets_tasks_by_category(datasets, cat... | [
"0.68098783",
"0.66271836",
"0.6192116",
"0.6174169",
"0.6169032",
"0.60949963",
"0.6077559",
"0.6058552",
"0.60501236",
"0.60501236",
"0.60501236",
"0.60501236",
"0.6043331",
"0.6011572",
"0.5997483",
"0.5994293",
"0.59855324",
"0.59319335",
"0.58538526",
"0.584725",
"0.5844... | 0.64653957 | 2 |
Calculate the signed area of nonselfintersecting polygon Input | def calculate_polygon_area(polygon, signed=False):
# Make sure it is numeric
P = numpy.array(polygon)
# Check input
msg = ('Polygon is assumed to consist of coordinate pairs. '
'I got second dimension %i instead of 2' % P.shape[1])
assert P.shape[1] == 2, msg
msg = ('Polygon is ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polygon_area(x, y):\n return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))",
"def polygon_area(ppath): # pragma: no cover\n v_ = ppath.vertices\n if len(v_) < 3:\n return 0.0\n x_ = v_[:, 1] - v_[:, 1].mean()\n y_ = v_[:, 0] - v_[:, 0].mean()\n correction = x_[-1... | [
"0.7630188",
"0.7455913",
"0.74407256",
"0.7281379",
"0.71095943",
"0.70286936",
"0.697586",
"0.6917494",
"0.68598086",
"0.6822156",
"0.6787302",
"0.6774864",
"0.67683786",
"0.67537516",
"0.6734002",
"0.67136335",
"0.67073476",
"0.66870266",
"0.6684328",
"0.6679429",
"0.66521... | 0.69708323 | 7 |
Delegate attribute lookup to ``ssh.SFTPClient`` instance. | def __getattr__(self, name):
return getattr(self._client, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _openSFTPConnection(self):\n if not self.sftp_open:\n self.sftp = paramiko.SFTPClient.from_transport(self.transport)\n self.sftp_open = True",
"def create_sftp_client(ssh_client):\n sftp_client = ssh_client.open_sftp()\n return sftp_client",
"def open(self):\n self... | [
"0.5755109",
"0.54960364",
"0.5491042",
"0.54413414",
"0.5349827",
"0.5334577",
"0.52766776",
"0.5215798",
"0.5173208",
"0.5156688",
"0.5116287",
"0.5080936",
"0.5080936",
"0.5035736",
"0.49844262",
"0.49668854",
"0.49582428",
"0.49567944",
"0.49426222",
"0.49356583",
"0.4904... | 0.0 | -1 |
Sets the start_duration_ignore of this CaptionsTest. | def start_duration_ignore(self, start_duration_ignore):
self._start_duration_ignore = start_duration_ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_duration_ignore(self, end_duration_ignore):\n\n self._end_duration_ignore = end_duration_ignore",
"def set_duration(self, duration):\n self.__test_result[Result.__DURATION] = round(duration * 1000)",
"def _set_start_suppress_time(self, v, load=False):\n if hasattr(v, \"_utype\"):\n ... | [
"0.65578175",
"0.56109625",
"0.546896",
"0.5431605",
"0.5342073",
"0.5319361",
"0.5301435",
"0.5301435",
"0.5279195",
"0.5279195",
"0.5279195",
"0.5279195",
"0.5279195",
"0.5244279",
"0.5234189",
"0.5218737",
"0.5191608",
"0.5129652",
"0.512705",
"0.512705",
"0.5123905",
"0... | 0.8553009 | 0 |
Sets the start_duration_secs_or_frames of this CaptionsTest. | def start_duration_secs_or_frames(self, start_duration_secs_or_frames):
self._start_duration_secs_or_frames = start_duration_secs_or_frames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_duration(self, duration_secs):\n raise UnsupportedOperation('Duration not implemented')",
"def start_time(self, value):\n self._start_time = value",
"def set_start_time(self, *args, **kwargs):\n return _uhd_swig.usrp_source_sptr_set_start_time(self, *args, **kwargs)",
"def start(... | [
"0.5868528",
"0.586654",
"0.5779276",
"0.57150674",
"0.5705644",
"0.5705644",
"0.5705644",
"0.5705644",
"0.5705644",
"0.5703265",
"0.5703265",
"0.56981725",
"0.55796593",
"0.55634195",
"0.55390906",
"0.54999304",
"0.5448036",
"0.5431289",
"0.5403135",
"0.5371566",
"0.53468233... | 0.817087 | 0 |
Sets the end_duration_ignore of this CaptionsTest. | def end_duration_ignore(self, end_duration_ignore):
self._end_duration_ignore = end_duration_ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_duration_ignore(self, start_duration_ignore):\n\n self._start_duration_ignore = start_duration_ignore",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_... | [
"0.6249625",
"0.5918366",
"0.5918366",
"0.58920896",
"0.58920896",
"0.58920896",
"0.5803121",
"0.57694024",
"0.56892085",
"0.5684028",
"0.5559899",
"0.543804",
"0.543804",
"0.543804",
"0.543804",
"0.543804",
"0.543804",
"0.543804",
"0.543804",
"0.54326415",
"0.5422654",
"0.... | 0.8548458 | 0 |
Sets the end_duration_secs_or_frames of this CaptionsTest. | def end_duration_secs_or_frames(self, end_duration_secs_or_frames):
self._end_duration_secs_or_frames = end_duration_secs_or_frames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n... | [
"0.64020574",
"0.64020574",
"0.63954973",
"0.63954973",
"0.63954973",
"0.6351666",
"0.6166874",
"0.61087143",
"0.6067918",
"0.6038466",
"0.5933365",
"0.59117746",
"0.588067",
"0.58688766",
"0.58666414",
"0.5765339",
"0.5726431",
"0.5662579",
"0.5561297",
"0.5555497",
"0.54900... | 0.8228116 | 0 |
Sets the reject_on_error of this CaptionsTest. | def reject_on_error(self, reject_on_error):
self._reject_on_error = reject_on_error | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_reject(self, reason):\n self.auto_rejection_reason = reason\n self.reject(responder=None)",
"def on_reject(self):\n self.state = REJECTED\n self._reject()",
"def failed_on(self, failed_on):\n\n self._failed_on = failed_on",
"def set_wraperror(self, value: bool = Tr... | [
"0.54983175",
"0.54745865",
"0.54153144",
"0.49972114",
"0.49823782",
"0.49765995",
"0.49764222",
"0.49616134",
"0.49352646",
"0.48874646",
"0.48757416",
"0.47759342",
"0.47689283",
"0.47532094",
"0.47447458",
"0.4723922",
"0.47123286",
"0.46755344",
"0.466631",
"0.46636686",
... | 0.7513312 | 0 |
Sets the checked of this CaptionsTest. | def checked(self, checked):
self._checked = checked | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_checked(self, checked):\n self._checked = checked",
"def set_checked_ts(self, checked_ts):\n self._checked_ts = checked_ts",
"def test_option_marked_correct(self):\r\n\r\n conditions = [\r\n {'input_type': 'radio', 'value': self.VALUE_DICT}]\r\n\r\n self.context['... | [
"0.60362107",
"0.577065",
"0.5279737",
"0.5239455",
"0.5224162",
"0.5224162",
"0.5188421",
"0.5185871",
"0.5143547",
"0.5111244",
"0.51050675",
"0.50650084",
"0.50594735",
"0.5041137",
"0.50288975",
"0.5018342",
"0.49773684",
"0.49773684",
"0.49773684",
"0.4974509",
"0.497307... | 0.608554 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CaptionsTest):
return False
return self.to_dict() == other.to_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):
if not isinstance(other, CaptionsTest):
return True
return self.to_dict() != other.to_dict() | {
"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.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481"... | 0.0 | -1 |
Resets parameters, delete sprite and recreate it (this way it looses its membership to a pyglet drawing batch) | def reset(self):
self.posXY = (0,0)
self.magXY = (1.0,1.0)
self.rot = 0.0
self.trans = 255
self.isDone = False
self.isFirst = True
self.kill()
self.Group = pyglet.graphics.OrderedGroup(self.order)
self.isReady = self.check() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__(self):\n\n # Delete sprite (if it has been defined)\n try:\n self.canvas.delete(self.sprite)\n except AttributeError:\n pass\n except tk.TclError:\n pass",
"def reDraw(self):\n self.canvasIGetDrawnOn.delete(self.spriteOnCanvas)\n ... | [
"0.6966502",
"0.68648",
"0.6533737",
"0.64585555",
"0.6304994",
"0.61768955",
"0.60796183",
"0.60510635",
"0.5961859",
"0.59608626",
"0.5891592",
"0.5888761",
"0.58671874",
"0.58305573",
"0.58243835",
"0.58141524",
"0.5775327",
"0.5775327",
"0.5766265",
"0.5763974",
"0.576170... | 0.6168595 | 6 |
1hot encodes a tensor | def to_categorical(y, num_classes):
return np.eye(num_classes, dtype='uint8')[y] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\... | [
"0.8257079",
"0.80617523",
"0.80132484",
"0.79174834",
"0.7914355",
"0.78827375",
"0.7841532",
"0.7808706",
"0.7765705",
"0.7738052",
"0.7738052",
"0.7733543",
"0.77270126",
"0.7712841",
"0.76859695",
"0.767933",
"0.7584649",
"0.7560244",
"0.7555559",
"0.7535066",
"0.7531917"... | 0.0 | -1 |
Splits the sentences in a dataframe's column into a list of the separate words. The created lists will be placed in a column named 'Split Tweets' in the original dataframe. | def word_splitter(df):
#split the tweets column and lowercase the words
df['Split Tweets'] = df['Tweets'].str.lower().str.split()
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_splitter(df):\n result = []\n l1 = df['Tweets']\n for tweet in l1:\n result.append(tweet.lower().split(' '))\n df['Split Tweets'] = result\n return df",
"def word_splitter(df):\n df['Split Tweets'] = [i.lower().split() for i in df['Tweets']]\n return df",
"def word_splitter... | [
"0.8663457",
"0.8569856",
"0.80885434",
"0.8020399",
"0.69318634",
"0.67669886",
"0.67122436",
"0.66924435",
"0.6667182",
"0.6366687",
"0.6333802",
"0.633019",
"0.628678",
"0.6243796",
"0.6238756",
"0.61439085",
"0.6110238",
"0.6110238",
"0.60993236",
"0.6085219",
"0.60796577... | 0.80847365 | 3 |
Removes english stop words from a tweet. Tokenise the sentences according to the definition in word_splitter. Note that word_spliiter cannot be called within this function. | def stop_words_remover(df):
# dictionary of english stopwords
stop_words_dict = {
'stopwords':[
'where', 'done', 'if', 'before', 'll', 'very', 'keep', 'something', 'nothing', 'thereupon',
'may', 'why', '’s', 'therefore', 'you', 'with', 'towards', 'make', 'really', 'few', 'former',
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stop_words(tweet):\n tokens_without_sw = \"\"\n for word in tweet.split():\n if not word.lower() in STOPWORDS:\n tokens_without_sw += word.lower() + \" \"\n return tokens_without_sw",
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_t... | [
"0.761885",
"0.7476694",
"0.7092159",
"0.7021463",
"0.70013833",
"0.698955",
"0.692694",
"0.68454033",
"0.68315244",
"0.680076",
"0.6763996",
"0.67565334",
"0.6709841",
"0.67096555",
"0.6686163",
"0.6670575",
"0.6656237",
"0.66530454",
"0.66401136",
"0.66245544",
"0.6614128",... | 0.0 | -1 |
Check for sort, annotating the query with subclauses that will be used later. Uses follow_path to sort clauses based on values in subclauses | def lookup_sort(self, query, varenv):
if ':sort' in query:
sortkey = ':sort'
elif '@sort' in query and query.is_root:
sortkey = '@sort'
else:
# no sort in the query!
return
# save what the sort used to look like, just because.
query.sort = query[sortkey]
newsort = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sort_query(self, kind, order, is_number):\n pass",
"def sortby(self):\n ...",
"def collect(transform: dict, expr: ibis.Expr) -> ibis.Expr:\n fields = promote_list(transform[\"sort\"][\"field\"])\n orders = promote_list(transform[\"sort\"].get(\"order\", [\"ascending\"] * len(fields)... | [
"0.6210832",
"0.5689453",
"0.5638119",
"0.5607919",
"0.559826",
"0.5555163",
"0.5548156",
"0.5492111",
"0.54865867",
"0.546398",
"0.54488355",
"0.5342777",
"0.53211045",
"0.53066367",
"0.5270424",
"0.52266085",
"0.52204233",
"0.5203979",
"0.5202314",
"0.5169582",
"0.51666677"... | 0.6462445 | 0 |
Computes the MEANABSOLUTE SCALED ERROR forecast error for univariate time series prediction. | def mean_absolute_scaled_error(training_series, naive_training_series, testing_series, prediction_series):
training_series = np.array(training_series)
testing_series = np.array(testing_series)
prediction_series = np.array(prediction_series)
n = training_series.shape[0]
#d = np.abs(np.diff(training_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_forecast_precision_mase1y_avg():\n joined_data = pd.DataFrame({'temp': [1], 'dt': [1575082800], 'today': ['2019-11-30'],\n 't5': [4.0],\n 't4': [3],\n 't3': [2.0],\n 't2': [1],\n ... | [
"0.6956875",
"0.6604717",
"0.6520744",
"0.6403447",
"0.6369077",
"0.63598293",
"0.63124067",
"0.63008124",
"0.62665206",
"0.62397903",
"0.62148947",
"0.6185061",
"0.6172185",
"0.6115877",
"0.6109159",
"0.6095968",
"0.6093631",
"0.6091216",
"0.6089042",
"0.6086486",
"0.6083112... | 0.67660755 | 1 |
Returns True if the number is prime. | def is_prime(x: int) -> bool:
return not any(x % i == 0 for i in range(2, int(math.sqrt(x)+1))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values == 0:\n flag += 1\n if flag == 1:\n return True\n else:\n return False",
"def is_prime(number):\n\t\n\tif number < 2: return False\n\telif number == 2: return True\n\te... | [
"0.80605435",
"0.80545527",
"0.80251443",
"0.798799",
"0.79747385",
"0.7942501",
"0.7883246",
"0.7849825",
"0.78435755",
"0.78414464",
"0.78173435",
"0.7811025",
"0.7802149",
"0.77832514",
"0.7737036",
"0.7722323",
"0.77109325",
"0.7705231",
"0.7704839",
"0.76976335",
"0.7694... | 0.7349138 | 41 |
Returns the time, already formatted. | def get_time(self):
now = datetime.datetime.now()
hour = 12 if now.hour % 12 == 0 else now.hour % 12
meridiem = "AM" if now.hour < 12 else "PM"
return "%d:%02d %s" % (hour, now.minute, meridiem) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(self):\n return time.strftime(\"%d/%m/%y %M:%H:%S\", self.time)",
"def get_time(self):\n x = time.localtime()\n return ''.join([\n str(x[0]).rjust(4, '0'), '/', str(x[1]).rjust(2, '0'), '/',\n str(x[2]).rjust(2, '0'), ' ', str(x[3]).rjust(2, '0'), ':',\n ... | [
"0.8527367",
"0.84706634",
"0.8404142",
"0.8379445",
"0.8164919",
"0.8126848",
"0.81225216",
"0.80987257",
"0.8073512",
"0.7994178",
"0.7958272",
"0.78573436",
"0.78231186",
"0.7774968",
"0.7761552",
"0.77487373",
"0.77082676",
"0.76877135",
"0.7651776",
"0.7619586",
"0.75990... | 0.8217852 | 4 |
Generator to return sets of n (int) from a l (list) | 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 primeset(source: Iterable[int]) -> Iterator[int]:\n for i in source:\n if prime(i):\n yield i",
"def batches(l, n):\n for i in range(0, l, n):\n yield range(i,min(l,i+n))",
"def chunks(l: List, n: int):\n for i in range(0, len(l), n):\n yield l[i : i... | [
"0.6640865",
"0.6577445",
"0.6396657",
"0.6396657",
"0.6393679",
"0.63433254",
"0.6325061",
"0.6321666",
"0.6320643",
"0.6320431",
"0.6320013",
"0.63179266",
"0.6312608",
"0.6262392",
"0.62604976",
"0.6256165",
"0.6256165",
"0.6256165",
"0.625343",
"0.6244422",
"0.6236262",
... | 0.61530584 | 55 |
Sets the transition matrix as uniform (equal probability of transitioning to all other possible states from each state) corresponding to the topology. Returns | def uniform_transitions(self) -> np.ndarray:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniform_transitions(self) -> np.ndarray:\n transitions = np.zeros((self.n_states, self.n_states))\n for i, row in enumerate(transitions):\n size = min(2, self.n_states - i)\n row[i:(i + size)] = np.ones(size) / size\n return transitions",
"def _updateTransitionMatri... | [
"0.6814929",
"0.67519593",
"0.66898465",
"0.6594941",
"0.65222967",
"0.6440226",
"0.63762784",
"0.6154301",
"0.60273063",
"0.6022528",
"0.5993625",
"0.599268",
"0.59454703",
"0.5939085",
"0.59337443",
"0.58963346",
"0.58941346",
"0.58941346",
"0.5888045",
"0.5814788",
"0.5754... | 0.6275748 | 7 |
Sets the transition matrix as uniform (equal probability of transitioning to all other possible states from each state) corresponding to the topology. Returns | def uniform_transitions(self) -> np.ndarray:
return np.ones((self.n_states, self.n_states)) / self.n_states | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniform_transitions(self) -> np.ndarray:\n transitions = np.zeros((self.n_states, self.n_states))\n for i, row in enumerate(transitions):\n size = min(2, self.n_states - i)\n row[i:(i + size)] = np.ones(size) / size\n return transitions",
"def _updateTransitionMatri... | [
"0.6814929",
"0.67519593",
"0.66898465",
"0.65222967",
"0.6440226",
"0.63762784",
"0.6275748",
"0.6154301",
"0.60273063",
"0.6022528",
"0.5993625",
"0.599268",
"0.59454703",
"0.5939085",
"0.59337443",
"0.58963346",
"0.58941346",
"0.58941346",
"0.5888045",
"0.5814788",
"0.5754... | 0.6594941 | 3 |
Sets the transition matrix as uniform (equal probability of transitioning to all other possible states from each state) corresponding to the topology. Returns | def uniform_transitions(self) -> np.ndarray:
upper_ones = np.triu(np.ones((self.n_states, self.n_states)))
upper_divisors = np.triu(np.tile(np.arange(self.n_states, 0, -1), (self.n_states, 1)).T)
lower_ones = np.tril(np.ones(self.n_states), k=-1)
return upper_ones / (upper_divisors + low... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniform_transitions(self) -> np.ndarray:\n transitions = np.zeros((self.n_states, self.n_states))\n for i, row in enumerate(transitions):\n size = min(2, self.n_states - i)\n row[i:(i + size)] = np.ones(size) / size\n return transitions",
"def _updateTransitionMatri... | [
"0.68172735",
"0.67527854",
"0.66920376",
"0.65967274",
"0.6525021",
"0.6443113",
"0.6379474",
"0.62782747",
"0.60297364",
"0.6024963",
"0.59967434",
"0.59946406",
"0.5947577",
"0.5936303",
"0.5934753",
"0.58988446",
"0.589179",
"0.589179",
"0.5886788",
"0.5816876",
"0.575517... | 0.61568844 | 8 |
Sets the transition matrix as uniform (equal probability of transitioning to all other possible states from each state) corresponding to the topology. Returns | def uniform_transitions(self) -> np.ndarray:
transitions = np.zeros((self.n_states, self.n_states))
for i, row in enumerate(transitions):
size = min(2, self.n_states - i)
row[i:(i + size)] = np.ones(size) / size
return transitions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _updateTransitionMatrix(self):\n N = self.N\n K = self.K\n T= self.T\n\n for i in range(1,self.K+1):\n den = 0\n for t in range(1,self.T):\n for n in range(1,N+1):\n den = den + self.posterior_state_trellis[n][(t,i)]\n ... | [
"0.675143",
"0.6690357",
"0.6594241",
"0.652253",
"0.6440287",
"0.6376322",
"0.6274676",
"0.6153132",
"0.60272145",
"0.6024486",
"0.5995465",
"0.59929824",
"0.5944961",
"0.5937773",
"0.59342676",
"0.5896263",
"0.5893224",
"0.5893224",
"0.5887831",
"0.5813238",
"0.57538915",
... | 0.68142086 | 0 |
Reads a raw file input path into a DataFrame | def _read(self, file_paths: List[str], **read_opts) -> List[DataFrame]:
return [read_file(file_path, **read_opts) for file_path in file_paths] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(txt_path: str = RAW_TXT) -> pd.DataFrame:\n df = pd.read_csv(txt_path)[INDICES]\n return df",
"def load_raw_data(path: str) -> pd.DataFrame:\n data = []\n with open(path) as file:\n for line in file:\n data.append(line)\n data_df = pd.DataFrame(data, columns = {'twe... | [
"0.73540443",
"0.722951",
"0.71990114",
"0.71884215",
"0.71884215",
"0.71884215",
"0.71592927",
"0.70751184",
"0.7008336",
"0.6971603",
"0.6966952",
"0.6961054",
"0.6961054",
"0.6940161",
"0.68897825",
"0.6859166",
"0.6853488",
"0.68470114",
"0.6832555",
"0.68273056",
"0.6774... | 0.0 | -1 |
Simple decorator helper for requiring login on functions decorated with | def require_login(func):
@wraps(func)
def wrapper(*args, **kwrds):
try:
user = get_user()
if user:
setattr(g, 'user', user)
return func(*args, **kwrds)
else:
url = url_for('auth.login', redir=request.url)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_required(func):\n # def wrapper(*args):\n def wrapper(*args, **kwargs):\n \"\"\"\n Wrapper function is a must in decorators. This function does all\n the work, so we have to write TODO code implementation here.\n\n *args -> unnamed arguments passed in de func... | [
"0.82302374",
"0.7955559",
"0.78825676",
"0.788241",
"0.7844724",
"0.77869976",
"0.77673113",
"0.77578616",
"0.7757763",
"0.7746891",
"0.771738",
"0.76758254",
"0.7669145",
"0.76579237",
"0.7645082",
"0.76287156",
"0.76283824",
"0.76212335",
"0.7610484",
"0.7595804",
"0.75939... | 0.76808417 | 11 |
Returns arguments from the stdin. | def get_args_from_console(args):
return {
"cleaning_policy": args.cleaning_policy,
"clear": args.clear,
"content": args.content,
"dry_run": args.dry_run,
"force": args.force,
"in_lines": args.in_lines,
"max_size": args.max_size,
"regex": args.regex,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_stdin():\n return \"\".join(sys.stdin.readlines()).strip()",
"def read_input():\n\n read = sys.stdin.readlines()\n\n text = ''\n for line in read:\n text += line\n\n return text",
"def _get_input_from_stdin():\n params = sys.stdin.read()\n if not params:... | [
"0.7442439",
"0.71162534",
"0.70781636",
"0.7008253",
"0.6875601",
"0.679079",
"0.6757122",
"0.66945004",
"0.66305494",
"0.65988916",
"0.6596492",
"0.65900654",
"0.6573253",
"0.64494175",
"0.64306533",
"0.6417004",
"0.64145255",
"0.6393381",
"0.6391936",
"0.63573855",
"0.6352... | 0.58786565 | 59 |
Update the running average weights of the particles. | def update_running_average_weights(self, t):
self.w_bar = self.w_bar * (float(t)/(t+1)) + self.w / float(t+1)
#print('Running average particle weigths =', self.w_bar)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def update_weights(self, a, obs, t):\n \n new_w_tilde = np.zeros(self.Np... | [
"0.7378303",
"0.7212888",
"0.7102562",
"0.70683163",
"0.69423646",
"0.69102156",
"0.6909552",
"0.6877627",
"0.6795021",
"0.67261326",
"0.6688208",
"0.66347",
"0.6612162",
"0.6552761",
"0.6512551",
"0.63605577",
"0.6345535",
"0.63165003",
"0.6309303",
"0.6291839",
"0.62713623"... | 0.77914083 | 0 |
Generate a sample theta_hat (one particle) based on the current weights on the particles. | def generate_parameter_sample(self, t):
theta_hat = np.zeros(self.K)
k = np.random.choice(self.Npar, 1, p=self.w)[0] # np.random.choice outputs an array
theta_hat = self.Particles[k]
return theta_hat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propose_sample(self) -> np.array:\n norm = np.random.normal\n normal_deviates = norm(size=self.dim_observed)\n r = np.sqrt((normal_deviates**2).sum(axis=0))\n update = normal_deviates / r * self.radius\n return self.theta + update",
"def priors_sample(self):\n \n ... | [
"0.61893725",
"0.60326993",
"0.5946987",
"0.5873588",
"0.58447564",
"0.5752473",
"0.5703958",
"0.56824434",
"0.5654689",
"0.5605382",
"0.55944854",
"0.5586146",
"0.5578327",
"0.5558836",
"0.55476326",
"0.551705",
"0.54987335",
"0.5495258",
"0.54634017",
"0.5455792",
"0.544683... | 0.68666434 | 0 |
The name of the consumer group. | def consumer_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "consumer_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"consumer_group_name\")",
"def consumer_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"consumer_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name... | [
"0.8902197",
"0.8627032",
"0.78753394",
"0.78296584",
"0.77065736",
"0.7698265",
"0.76211333",
"0.76179254",
"0.75253934",
"0.75135463",
"0.7403845",
"0.73626524",
"0.7344025",
"0.7255333",
"0.7216139",
"0.7214246",
"0.7214246",
"0.7206561",
"0.71856993",
"0.71856993",
"0.715... | 0.8733795 | 1 |
The ID of the subscription instance. | def dts_instance_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "dts_instance_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription_id(self):\n return self.instance_metadata.subscription_id",
"def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")",
"def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n i... | [
"0.86872107",
"0.78247845",
"0.77929944",
"0.7329448",
"0.73261005",
"0.73261005",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135"... | 0.0 | -1 |
The ID of the consumer group. | def consumer_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "consumer_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"consumer_group_id\")",
"def group_id(self):\n return self._id",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")"... | [
"0.8802013",
"0.813426",
"0.81136703",
"0.81136703",
"0.8073376",
"0.7904013",
"0.7904013",
"0.7904013",
"0.78792846",
"0.77977866",
"0.77323586",
"0.7692727",
"0.7576124",
"0.75547415",
"0.7511746",
"0.73848623",
"0.7351406",
"0.7351406",
"0.7351406",
"0.7342739",
"0.7332882... | 0.84412825 | 1 |
The name of the consumer group. | def consumer_group_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "consumer_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"consumer_group_name\")",
"def consumer_group_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"consumer_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"d... | [
"0.8902197",
"0.8733795",
"0.78753394",
"0.78296584",
"0.77065736",
"0.7698265",
"0.76211333",
"0.76179254",
"0.75253934",
"0.75135463",
"0.7403845",
"0.73626524",
"0.7344025",
"0.7255333",
"0.7216139",
"0.7214246",
"0.7214246",
"0.7206561",
"0.71856993",
"0.71856993",
"0.715... | 0.8627032 | 2 |
The ID of the subscription instance. | def dts_instance_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "dts_instance_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription_id(self):\n return self.instance_metadata.subscription_id",
"def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")",
"def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n i... | [
"0.86872107",
"0.78247845",
"0.77929944",
"0.7329448",
"0.73261005",
"0.73261005",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7310053",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135",
"0.7280135"... | 0.0 | -1 |
The ID of the consumer group. | def consumer_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "consumer_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"consumer_group_id\")",
"def group_id(self):\n return self._id",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"gro... | [
"0.8442159",
"0.8132146",
"0.81108755",
"0.81108755",
"0.8071401",
"0.790166",
"0.790166",
"0.790166",
"0.7877266",
"0.779515",
"0.77299047",
"0.769078",
"0.75734735",
"0.75518197",
"0.7509535",
"0.73834157",
"0.7348498",
"0.7348498",
"0.7348498",
"0.7343283",
"0.7331403",
... | 0.88030064 | 0 |
The name of the consumer group. | def consumer_group_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "consumer_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_group_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"consumer_group_name\")",
"def consumer_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"consumer_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\... | [
"0.87336934",
"0.8627033",
"0.78791565",
"0.7828638",
"0.7708494",
"0.7701295",
"0.7619592",
"0.76186764",
"0.7524736",
"0.75166595",
"0.74067867",
"0.73667234",
"0.73453593",
"0.7256452",
"0.721773",
"0.721773",
"0.7214793",
"0.72094595",
"0.71876466",
"0.71876466",
"0.71536... | 0.89029264 | 0 |
The ID of the subscription instance. | def dts_instance_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "dts_instance_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription_id(self):\n return self.instance_metadata.subscription_id",
"def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")",
"def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n i... | [
"0.86881745",
"0.7824428",
"0.7792517",
"0.73317075",
"0.73266953",
"0.73266953",
"0.7310511",
"0.7310511",
"0.7310511",
"0.7310511",
"0.7310511",
"0.7310511",
"0.72803116",
"0.72803116",
"0.72803116",
"0.72803116",
"0.72803116",
"0.72803116",
"0.72803116",
"0.72803116",
"0.7... | 0.0 | -1 |
Called when the user specifies an intent for this skill | def on_intent(event, intent_request, session):
logger.info("on_intent requestId=" + intent_request['requestId'] +
", sessionId=" + session['sessionId'])
intent = intent_request['intent']
intent_name = intent_request['intent']['name']
# Dispatch to your skill's intent handlers
if intent ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ... | [
"0.7143966",
"0.6956116",
"0.6949057",
"0.6905333",
"0.68928874",
"0.67641324",
"0.6754843",
"0.6722764",
"0.6720773",
"0.67161995",
"0.6699252",
"0.6691263",
"0.6670276",
"0.6645522",
"0.6642719",
"0.6638686",
"0.6607724",
"0.6594981",
"0.6575682",
"0.6570076",
"0.65620786",... | 0.64873606 | 31 |
ignores path if it matches the given extensions | def ignore(func):
return lambda path : None if path.lower().endswith(
# add whatever makes sense to the list
('.git',
'__pycache__',
'.md', '.txt', 'license', '.png', '.jpg', '.jpeg')
) else func(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_extension(path):\n for extension in EXTENSIONS:\n path = path.replace(\".%s\" % extension, \"\")\n return path",
"def __ignore_files_with_suffix(self, files):\n if self.__config.suffix().strip():\n files = [file for file in files if self.__config.suffix() not in file]\n ... | [
"0.73291343",
"0.6934216",
"0.6896452",
"0.67459136",
"0.6497922",
"0.63181496",
"0.6316766",
"0.6298705",
"0.6222641",
"0.61954206",
"0.61935073",
"0.61727834",
"0.6164662",
"0.61312133",
"0.61289346",
"0.6122215",
"0.61142856",
"0.60492486",
"0.60435635",
"0.60209715",
"0.6... | 0.6693098 | 4 |
Calculate the correlation time shift around the maximum amplitude of the synthetic trace with subsample accuracy. | def subsample_xcorr_shift(d, s):
# Estimate shift and use it as a guideline for the subsample accuracy
# shift.
time_shift = _xcorr_shift(d.data, s.data) * d.stats.delta
# Align on the maximum amplitude of the synthetics.
pick_time = s.stats.starttime + s.data.argmax() * s.stats.delta
# Will r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_lag(data):\n normalize = [i for i in range(1,len(data[0])+1)]\n normalize += normalize[-2::-1]\n idx = len(data[0])//4\n def win(sig):\n res = fftconvolve(sig, np.conj(sig)[::-1])/normalize\n res[len(res)//2] = 0\n return res[idx:idx*7]\n autocorr = np.apply_along_axis(... | [
"0.5871185",
"0.572114",
"0.56688786",
"0.56161046",
"0.5520823",
"0.5503045",
"0.54739916",
"0.5471855",
"0.5414569",
"0.5395246",
"0.5347586",
"0.53426534",
"0.5335265",
"0.5255278",
"0.5220675",
"0.52020884",
"0.5176093",
"0.5170102",
"0.51671886",
"0.51649946",
"0.5160274... | 0.63665766 | 0 |
Return a string representation of the model. | def __str__(self):
return f"{self.sz}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __repr__(self):\n\n mod = f\"{self.__class__.__name__} Model\"\n try:\n mod += f': {self.filename}'\n except AttributeError:\n pass\n s = [mod]\n for name, v in self.metadat... | [
"0.8550562",
"0.78680784",
"0.7859392",
"0.7820475",
"0.78200865",
"0.78200865",
"0.78024864",
"0.7667491",
"0.7658678",
"0.7652298",
"0.7619285",
"0.75894105",
"0.7587887",
"0.7541158",
"0.75327915",
"0.75327915",
"0.75173604",
"0.7495425",
"0.7490489",
"0.7479993",
"0.74670... | 0.0 | -1 |
Closes the database connection | def close(self):
self.db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()",
"def close(self):\n if... | [
"0.85662735",
"0.8412375",
"0.8293456",
"0.8184272",
"0.81580645",
"0.80922866",
"0.8057031",
"0.80505526",
"0.79888546",
"0.7972568",
"0.79306155",
"0.79142356",
"0.7873472",
"0.7871479",
"0.7852316",
"0.782567",
"0.78119534",
"0.77649176",
"0.77649176",
"0.77649176",
"0.775... | 0.80190814 | 8 |
Custom merge dictionary operation. It currently creates a union based on each dictionary's keys and attempts to resolve conflicts and also to recursively add nested dictionary structures | def mergedicts(dict1, dict2):
for k in set(dict1.keys()).union(dict2.keys()):
if k in dict1 and k in dict2:
if isinstance(dict1[k], dict) and isinstance(dict2[k], dict):
yield (k, dict(mergedicts(dict1[k], dict2[k])))
else:
# If one of the values is no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_dict_recursive(target, src):\r\n for k in src.keys():\r\n if ((k in target and isinstance(target[k], dict) and\r\n isinstance(src[k], collections.Mapping))):\r\n merge_dict_recursive(target[k], src[k])\r\n else:\r\n target[k] = src[... | [
"0.73943293",
"0.7280657",
"0.72773165",
"0.7218472",
"0.7100853",
"0.70854926",
"0.70549005",
"0.70437336",
"0.70436805",
"0.70162714",
"0.70132643",
"0.6995891",
"0.6991854",
"0.6919301",
"0.6893565",
"0.6893565",
"0.68897825",
"0.6870836",
"0.68663263",
"0.68658096",
"0.68... | 0.6886583 | 17 |
Create a bytes header for variablesized data messages. | def _create_data_header(self, data):
return pack(self.HEADER_PACK_STR, self.HEADER_VERSION, len(data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_header_data(cls):\n empty_struct = struct.Struct(cls.HEADER_STRUCT_FORMAT_STR)\n packed_data = empty_struct.pack(0, 0, 0, 0)\n return packed_data",
"def __bytes__(self):\n if self._header.value_type in b'ZH':\n value = self._buffer[:-1] # Omit the trailing Null\n... | [
"0.6339416",
"0.6337875",
"0.62970793",
"0.62623936",
"0.62206614",
"0.6213616",
"0.62135166",
"0.61737573",
"0.61717933",
"0.6156612",
"0.6098577",
"0.6087904",
"0.60004175",
"0.59871215",
"0.5936312",
"0.5935992",
"0.5918751",
"0.5905091",
"0.59025824",
"0.58998",
"0.588166... | 0.75547075 | 0 |
get call against REST API to test the API interface of the Product DB | def get_rest_call(api_url, username, password):
response = requests.get(api_url,
auth=HTTPBasicAuth(username, password),
verify=False,
timeout=4)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_product(self):\n self._require_login(self.user1)\n response = self.client.get('/api/1.0/products/1/')\n self.assertEqual(response.data['name'], 'Producto 1')\n self.assertEqual(response.data['description'], 'Descripcion producto 1')\n self.assertEqual(response.data['... | [
"0.77961195",
"0.75496095",
"0.7418874",
"0.7302816",
"0.7301533",
"0.72815037",
"0.7273733",
"0.716868",
"0.7145603",
"0.71435255",
"0.7119358",
"0.7115917",
"0.7022494",
"0.69779444",
"0.6963168",
"0.69476956",
"0.6906799",
"0.6906333",
"0.68217963",
"0.68035275",
"0.678021... | 0.0 | -1 |
put call against REST API to test the API interface of the Product DB | def put_rest_call(api_url, data_dict, username, password, print_output=False):
headers = {
'Content-Type': 'application/json'
}
response = requests.put(api_url,
auth=HTTPBasicAuth(username, password),
data=json.dumps(data_dict),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_stock(self):\n body = StockProduct()\n response = self.client.open(\n '/omogollo2/ServerAPI/1.0.0/stock/{productId}'.format(product_id=56),\n method='PUT',\n data=json.dumps(body),\n content_type='application/json')\n self.assert200(resp... | [
"0.740459",
"0.72521687",
"0.72445995",
"0.7199734",
"0.7104765",
"0.7055011",
"0.7037111",
"0.7017264",
"0.694568",
"0.69367844",
"0.6892213",
"0.68832624",
"0.6863073",
"0.6860482",
"0.68601936",
"0.6849901",
"0.6835989",
"0.68355614",
"0.6800232",
"0.68000734",
"0.67640406... | 0.0 | -1 |
compute v given u and normal. | def _computeUVN(n: np.array, in_: float, planeID: int) -> np.array:
if planeID == 2:
n = np.array([n[1], n[2], n[0]])
elif planeID == 3:
n = np.array([n[2], n[0], n[1]])
bc = n[0] * np.sin(in_) + n[1] * np.cos(in_)
bs = n[2]
out = np.arctan(-bc / (bs + 1e-9))
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal(self, u, v):\n result = np.cross(self.du(u, v), self.dv(u, v))\n result = result / np.sqrt(vectordot(result, result))[:, None]\n return result",
"def normal_at(self, u, v, world=True):\n u = u * pi\n v = v * PI2\n x = cos(u) * sin(v)\n y = sin(u) * sin(... | [
"0.8130392",
"0.72737074",
"0.7220298",
"0.7180438",
"0.7143661",
"0.6871111",
"0.67939126",
"0.67894036",
"0.6780113",
"0.66659045",
"0.659625",
"0.65484643",
"0.6546924",
"0.6537882",
"0.6514161",
"0.65118784",
"0.64926505",
"0.64874864",
"0.648633",
"0.6481188",
"0.6470156... | 0.0 | -1 |
Convert stings of this format to seconds. 10h10m10s 3s 7m9s 1h5s | def getSeconds(self, s):
duration = 0
for i in s.split('-'):
if 'h' in i: duration = duration + int(i.split('h')[0])*3600
if 'm' in i: duration = duration + int(i.split('m')[0])*60
if 's' in i: duration = duration + int(i.split('s')[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_seconds(s):\n return '%dh %dm' % (s//3600, (s//60) % 60)",
"def time2secs( s ):\n t = s.split( ':' )\n nf = len( t )\n if nf == 1:\n # Seconds only!\n secs = int( t[0] )\n elif nf == 2:\n # Minutes & seconds!\n secs = int( t[1] ) + int( t[0] ) * 60\n elif nf == 3:\... | [
"0.77671516",
"0.76056427",
"0.73907477",
"0.7386879",
"0.73104036",
"0.73046017",
"0.7302198",
"0.7222621",
"0.72225225",
"0.719519",
"0.718679",
"0.7155359",
"0.709133",
"0.7058874",
"0.7016889",
"0.70099247",
"0.6972157",
"0.69719833",
"0.696749",
"0.6966481",
"0.69571525"... | 0.76528496 | 1 |
Find the leader node index of node self.__data[node_index] | def find(self, node_index: int)->int:
if node_index < 0 or node_index >= len(self.__data):
print('index '+str(node_index)+' out of range!')
return -1
node = self.__data[node_index]
index_chain = [node_index]
while node_index != node.pre_index:
node_ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_node_index(self, index):\n cur_index = 0\n cur_node = self.head\n prev_node = None\n while cur_node is not None:\n if index >= len(cur_node.data_list) + cur_index:\n cur_index += len(cur_node.data_list)\n prev_node = cur_node\n ... | [
"0.7475407",
"0.6919777",
"0.6831071",
"0.6555754",
"0.6527155",
"0.6520897",
"0.6445846",
"0.644534",
"0.6444477",
"0.6389432",
"0.63786894",
"0.6371318",
"0.6313913",
"0.62457347",
"0.6243091",
"0.6215733",
"0.6203458",
"0.6187711",
"0.6180615",
"0.6152066",
"0.6137931",
... | 0.7146176 | 1 |
Calculate total in the month of August 2020 Includes id = 400, id = 300, id = 800, id = 700, id = 600 id = 600 occurs once on the 31 $100 id = 700 occurs once on the 24 $10 id = 800 occurs once on the 7th $10 id = 300 occurs once on the 8th $200 id = 400 occurs 5th, 12th, 19th, 26th $100 each $400 | def test_calculate_value(self):
user = CustomUser.objects.get(username = "Test User")
start_date = timezone.now().replace(day=1,month=8,year=2020)
end_date = start_date + timedelta(days=30)
expected_result = 720
actual_result = calculate_total_user_expense_value_in_timeperiod(us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_spend_by_campaign_this_month(self, account_id):\n try:\n account = DependentAccount.objects.get(id=account_id)\n except DependentAccount.DoesNotExist:\n return\n\n client = get_client()\n client.client_customer_id = account.dependent_account_id\n\n report_downloader = client.Ge... | [
"0.6001532",
"0.5746446",
"0.5722419",
"0.5597739",
"0.5578195",
"0.5577887",
"0.5549294",
"0.5542426",
"0.5516877",
"0.5481326",
"0.54734063",
"0.5434475",
"0.5409195",
"0.5364376",
"0.53540915",
"0.5352385",
"0.53478783",
"0.5315271",
"0.5307595",
"0.52858526",
"0.52654827"... | 0.0 | -1 |
Can successfully pull any expenses that have not passed. | def test_get_all_upcoming_expenses(self):
print()
print("Get all expenses will still occur")
user = CustomUser.objects.get(username = "Test User")
actual_result = get_all_upcoming_budget_expenses(user = user)
for ele in actual_result:
print(ele)
expected_resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_can_get_all_expenses(self):\n self.register_user()\n result = self.login_user()\n access_token = json.loads(result.data.decode())['access_token']\n res = self.client().post('/expenses/', headers=dict(Authorization=\"Bearer \" + access_token), data=self.expense)\n sel... | [
"0.64480597",
"0.62825984",
"0.6247314",
"0.593421",
"0.59258944",
"0.58932877",
"0.58649087",
"0.58598506",
"0.5834699",
"0.5778493",
"0.5703303",
"0.5702945",
"0.5669201",
"0.56584644",
"0.5597216",
"0.55895317",
"0.5560785",
"0.55503803",
"0.5543616",
"0.55330455",
"0.5512... | 0.6458962 | 0 |
Can successfully get all occurrences of a specific expense Monthly Expense Timeframe that begins around the same time as the bill. Extends over a month in the future. | def test_get_occurrences_monthly_mid_month(self):
print()
print("Get occurrences of a monthly expense between:")
expense = BudgetExpense.objects.get(id = 100)
start_date = expense.start_date
end_date = start_date + timedelta(days = 40)
print(start_date.strftime("%B %d, %y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk_expenses_part_1(expenses) -> int:\n for i in range(len(expenses)):\n for j in range(len(expenses)):\n if i != j and expenses[i] + expenses[-j] == 2020:\n return expenses[i] * expenses[-j]\n return 0",
"def expenses(self, fromdt, todt):\r\n return self._buildTran... | [
"0.56694216",
"0.55568725",
"0.55485594",
"0.55063486",
"0.54155016",
"0.53927964",
"0.5340821",
"0.52612025",
"0.5202876",
"0.51689136",
"0.51650524",
"0.5099387",
"0.5077801",
"0.50766855",
"0.50402874",
"0.5038167",
"0.5017124",
"0.5013414",
"0.49942014",
"0.49645817",
"0.... | 0.67341375 | 0 |
Get a user by user ID. | def user_read(user_id):
user = User.query.get(user_id)
if user is None:
abort(404, "user not found")
return json.dumps(user.as_dict(include_teams_and_permissions=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def get_user_by_id(user_id):\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\n\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\n\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\n\... | [
"0.8674249",
"0.8632913",
"0.8545997",
"0.85293394",
"0.85293394",
"0.85293394",
"0.85293394",
"0.85232663",
"0.8485776",
"0.84202445",
"0.84171796",
"0.840899",
"0.83383137",
"0.8325944",
"0.8296361",
"0.82929343",
"0.82790244",
"0.8275646",
"0.8274844",
"0.826316",
"0.82565... | 0.0 | -1 |
Add a user to a team given the team and user IDs. | def team_user_add(token_user, team_id, user_id):
team = Team.query.get(team_id)
if team is None:
abort(404, 'team not found')
# check for permissions to update the team
if not (token_user.has_permission('team.update.elevated') or
(token_user.has_permission('team.update') and
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user(self, team, params={}, **options):\n path = \"/teams/%s/addUser\" % (team)\n return self.client.post(path, params, **options)",
"def add_member(self, team_id, user_id):\n # Validate that the team and user exist. Raises exception if either\n # does not exist.\n sel... | [
"0.81194603",
"0.7651945",
"0.75387543",
"0.7358632",
"0.7295701",
"0.72269285",
"0.71994686",
"0.70909214",
"0.67135316",
"0.6707469",
"0.6703407",
"0.6601539",
"0.6463021",
"0.6351766",
"0.6337574",
"0.6247779",
"0.62144023",
"0.6203603",
"0.6171507",
"0.614218",
"0.6104547... | 0.8025046 | 1 |
Returns the current macOS version. | def macOS(self) -> str:
result = subprocess.run(["sw_vers", "-productVersion"], stdout=subprocess.PIPE)
return result.stdout.decode("utf-8").strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOsVersion():\n os_version_tuple = platform.mac_ver()[0].split('.')\n return int(os_version_tuple[1])",
"def os_release() -> str:\n\tassert(platform.system() == 'Darwin')\n\n\tver, _, _ = platform.mac_ver()\n\n\treturn ver",
"def version():\n cmd = \"{} -v\".format(_detect_os())\n out = __sal... | [
"0.77943283",
"0.7723094",
"0.7010031",
"0.69886833",
"0.6863025",
"0.6800618",
"0.67179775",
"0.6675995",
"0.6675995",
"0.65920824",
"0.6545015",
"0.64951086",
"0.64300513",
"0.6399567",
"0.6356966",
"0.6336788",
"0.63009113",
"0.6299348",
"0.62949485",
"0.62798566",
"0.6236... | 0.8690196 | 0 |
Renders and serves the front page. | def front_page():
vars = dict(request.args)
vars.setdefault('output', vars.get('format'))
key = vars.get('auth_entity')
if key:
vars['entity'] = ndb.Key(urlsafe=key).get()
if vars['entity']:
vars.setdefault('site', vars['entity'].site_name().lower())
vars.update({
silo + '_html': module.St... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n self.render_front()",
"def index():\r\n\r\n # initializes page title\r\n page_title = 'Home'\r\n\r\n # renders the landing page\r\n return render_template('index.html', page_title=page_title)",
"def display():\n\n #still needs some cleanup on imagry and what the site is a... | [
"0.75057507",
"0.7194527",
"0.71898055",
"0.71845084",
"0.717461",
"0.7143156",
"0.71155155",
"0.71072316",
"0.7056729",
"0.7050666",
"0.7012616",
"0.7012311",
"0.70118886",
"0.7010965",
"0.6999073",
"0.6996603",
"0.69884884",
"0.6988338",
"0.6987198",
"0.6952573",
"0.6952067... | 0.6798897 | 46 |
Loads a YAML file from the filesystem and converts it to a usable python dictionary. | def load_yaml(filename):
try:
f = file(filename, 'r')
data = yaml.load(f)
return data
except (IOError, OSError) as e:
err = e[0]
reason = e[1]
error = 'load_yaml: Failed to open {filename}: {reason} {err}'.format(filename=filename, reason=reason, err=err)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(path: str) -> Dict[str, Any]:\n with open(path, \"r\", encoding=\"utf8\") as fp:\n data = yaml.safe_load(fp)\n return data",
"def load_yaml(file_path: str) -> dict:\n assert file_path.endswith(\".yaml\")\n with open(file_path) as file:\n return yaml.load(file, Loader=y... | [
"0.80195975",
"0.7985536",
"0.79786867",
"0.7913354",
"0.784341",
"0.77410823",
"0.77194446",
"0.76973706",
"0.7693111",
"0.767597",
"0.7603289",
"0.7567403",
"0.75192726",
"0.7478656",
"0.7476931",
"0.74647087",
"0.74342895",
"0.7413626",
"0.7401656",
"0.7359838",
"0.7353790... | 0.7095772 | 32 |
Check if a noteon event can be added at the given time step. Noteon events cannot be added at the same time as or before previous noteon events. | def _can_add_note(self, start_step):
return self.last_on is None or start_step - self.offset > self.last_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def important_event(time: int) -> bool:\n last_event = get_events(True)[0]\n try:\n time_event = int(last_event.split('\\n')[0].strip(\"'\"))\n except ValueError:\n time_event = int(last_event.split('\\n')[-1].strip(\"'\"))\n if time - time_event < 60:\n return 'gol' in last_event ... | [
"0.5923721",
"0.59110117",
"0.58846515",
"0.5701263",
"0.56867164",
"0.55190283",
"0.5492413",
"0.5492293",
"0.54422307",
"0.53720915",
"0.53403354",
"0.5325623",
"0.5324799",
"0.5308427",
"0.52861017",
"0.5259387",
"0.5251862",
"0.5244155",
"0.5239793",
"0.52221316",
"0.5175... | 0.75238377 | 0 |
add operations beyond the builtins ('get' and 'iterate' at the time of writing). auto_func is a function that when passed a type, returns a handler associated with op_name if it's supported, or False if it's not. See glom.core.register_op() for the global version used by extensions. | def register_op(self, op_name, auto_func=None, exact=False):
if not isinstance(op_name, basestring):
raise TypeError('expected op_name to be a text name, not: %r' % (op_name,))
if auto_func is None:
auto_func = lambda t: False
elif not callable(auto_func):
rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _support_op(*args):\n def inner(func):\n for one_arg in args:\n _op_mapping_[one_arg] = func\n return func\n\n return inner",
"def add_custom(self, func: Callable, opset: OpsetVersion) -> None:\n self._functions.add_custom(opset, func)",
"def _regis... | [
"0.5821337",
"0.55265594",
"0.55179375",
"0.5368579",
"0.5364024",
"0.53303105",
"0.520704",
"0.51865315",
"0.50805765",
"0.5064449",
"0.5061494",
"0.5058632",
"0.5028367",
"0.50117123",
"0.50079656",
"0.49968305",
"0.49816278",
"0.49713773",
"0.49650612",
"0.49206403",
"0.48... | 0.7182974 | 0 |
This view makes possible to display a certification item alone | def certification_view(request, slug, id):
company =get_object_or_404(Company,slug=slug)
edit = validate_user_company_access_or_redirect(request,company)
certification_reference = get_object_or_404(Certification, id=id,company=company)
return render_to_response('certification_form.html',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_certificate(self, request, queryset):\n if len(queryset) > 1:\n self.message_user(\n request,\n 'You can only choose one certificate.',\n level=messages.ERROR)\n return None\n response = HttpResponse(content_type=\"text/plain... | [
"0.6416505",
"0.6218467",
"0.6026983",
"0.5816437",
"0.5791219",
"0.5651807",
"0.5645675",
"0.5577816",
"0.55148894",
"0.5484461",
"0.5464285",
"0.5462897",
"0.5451961",
"0.54379",
"0.5424868",
"0.5411511",
"0.53839236",
"0.53442544",
"0.5336062",
"0.5335828",
"0.5328042",
... | 0.67513907 | 0 |
Gets the length of the dataframe. | def _get_lengths(df):
try:
return len(df)
# Because we sometimes have cases where we have summary statistics in our
# DataFrames
except TypeError:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return self.df.shape[0]",
"def size(self):\n\t\t# Better to have this as a method rather than property, as self._dataframe may change\n\t\treturn self._dataframe.shape[0]",
"def __len__(self):\n if self.df is None:\n return 0\n elif len(self.df.keys(... | [
"0.83134365",
"0.8273283",
"0.79416496",
"0.7770864",
"0.7770864",
"0.7749767",
"0.7662901",
"0.7548532",
"0.75082254",
"0.74515885",
"0.7347973",
"0.7317942",
"0.73137057",
"0.7269847",
"0.7236886",
"0.72165364",
"0.71860313",
"0.7180414",
"0.7161166",
"0.71546835",
"0.71546... | 0.8072832 | 2 |
tests whether node in markUp is modified by a tagObject with category equal to queryCategory. Return modifier if True | def isModifiedByCategory(self,node, queryCategory):
pred = self.getModifiers(node )
for p in pred:
#if( queryCategory.lower() == p.getCategory().lower() ):
if( p.isA(queryCategory) ):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isModifiedByCategory(self, node, queryCategory):\n predecessors = self.getModifiers(node)\n for predecessor in predecessors:\n if predecessor.isA(queryCategory):\n return True\n\n return False",
"def is_modified(self):\n return self._tag == 'modified'",
... | [
"0.79240495",
"0.58216435",
"0.56845385",
"0.53827107",
"0.5230961",
"0.49991104",
"0.49694988",
"0.49679482",
"0.49340415",
"0.49319622",
"0.49057326",
"0.48324817",
"0.48293573",
"0.4825029",
"0.48142013",
"0.4778491",
"0.47702438",
"0.47326547",
"0.4730038",
"0.47082862",
... | 0.8243432 | 0 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
r = 395... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.81450045",
"0.7863265",
"0.76322985",
"0.76064754",
"0.75978696",
"0.75965863",
"0.75944835",
"0.75720793",
"0.75630087",
"0.7555095",
"0.7528691",
"0.7517629",
"0.7492963",
"0.7467739",
"0.7452678",
"0.7434477",
"0.73914117",
"0.7357736",
"0.73484355",
"0.73318124",
"0.73... | 0.0 | -1 |
Init weights for models. | def init_weights(self):
if self.init_cfg:
super().init_weights()
else:
# Use smaller std for better stability and performance. We
# use 0.1. See more details in "ESRGAN: Enhanced Super-Resolution
# Generative Adversarial Networks"
for m in [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(model):\n ...",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if needed\n self.tie_weights()",
"def _initialize_weights(self):\n pass",
"def init_weights(self):\n # Initialize weights\n ... | [
"0.8984091",
"0.8641805",
"0.86267096",
"0.86172",
"0.85792875",
"0.85725594",
"0.84296715",
"0.8325935",
"0.8232147",
"0.8045925",
"0.8013931",
"0.8010816",
"0.79973304",
"0.7983617",
"0.7977511",
"0.7962253",
"0.7962253",
"0.7962253",
"0.7959221",
"0.79509515",
"0.7947236",... | 0.7676151 | 48 |
Init weights for ResidualDenseBlock. Use smaller std for better stability and performance. We empirically | def init_weights(self):
for i in range(5):
default_init_weights(getattr(self, f'conv{i+1}'), 0.1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)... | [
"0.7541087",
"0.7460973",
"0.7368466",
"0.7343648",
"0.72806096",
"0.72363317",
"0.72102386",
"0.72102386",
"0.7210094",
"0.71928626",
"0.7191477",
"0.71772796",
"0.708895",
"0.7069712",
"0.70665145",
"0.70592827",
"0.7052508",
"0.70416576",
"0.70416576",
"0.70416576",
"0.703... | 0.6371457 | 84 |
Return whether the reader is set to ignore whitespaces. True if the reader currently ignores whitespaces, False otherwise. | def getIgnoreState(self):
return self.__ignore_white | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_if_whitespace(self):\n value = self.current.value\n\n if value == \"\\n\":\n self.is_space = True\n else:\n self.is_space = False\n if value == \"\" or regexes[\"whitespace\"].match(value):\n self.is_space = True",
"def isspace(se... | [
"0.69618285",
"0.64230645",
"0.6413942",
"0.6301836",
"0.61738014",
"0.6113487",
"0.6055065",
"0.6040846",
"0.6036367",
"0.60177827",
"0.5977744",
"0.59137326",
"0.5890963",
"0.5858496",
"0.5799852",
"0.57955664",
"0.579028",
"0.57883507",
"0.5779739",
"0.57650274",
"0.575177... | 0.4898737 | 59 |
Return the list of token generated by the parser. | def getTokens(self):
return self.__token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokens(self) -> List[str]:\n return self.tokens",
"def tokens(self):\n # type: () -> List[Token]\n return self._tokens",
"def getTokens(self):\n list = []\n for i in range(self.startIdx, self.endIdx + 1):\n token = self.sentence[i]\n list.append(token)\n... | [
"0.81772846",
"0.8140122",
"0.7823502",
"0.7736784",
"0.7716113",
"0.768424",
"0.768424",
"0.768424",
"0.7574518",
"0.75683033",
"0.74537975",
"0.7417418",
"0.73469234",
"0.7344833",
"0.73244977",
"0.7306642",
"0.72955215",
"0.7266408",
"0.7219278",
"0.71664363",
"0.7157687",... | 0.7484468 | 10 |
Return a string representation of this rule. | def __str__(self):
return "\"%s\"" % self.__string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def __str__ (self) :\n\t\ttext_rule = \"\"\n\t\t\n\t\tfor key, rules in self.production_rules.items() :\... | [
"0.85909235",
"0.84542835",
"0.81206566",
"0.80404353",
"0.77661765",
"0.7577172",
"0.75398356",
"0.73718196",
"0.7260761",
"0.7252544",
"0.71422875",
"0.7057961",
"0.70452917",
"0.70162964",
"0.6860555",
"0.6827189",
"0.68119884",
"0.6804846",
"0.67445683",
"0.67385304",
"0.... | 0.0 | -1 |
Return a human readable representation of the rule. | def __str__(self):
return "AnyOf(%s)" % self.__set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def rule(self) -> str:\n if self._rule:\n return self._rule\n return self._make... | [
"0.8315964",
"0.8311807",
"0.80192995",
"0.7592833",
"0.7321493",
"0.7267072",
"0.7224473",
"0.72136474",
"0.72081375",
"0.70596325",
"0.69722635",
"0.6948486",
"0.69253224",
"0.69253224",
"0.6785439",
"0.67325646",
"0.6675134",
"0.6675134",
"0.6675134",
"0.66482425",
"0.6567... | 0.0 | -1 |
Return a human readable representation of the rule. | def __str__(self):
return "NoneOf(%s)" % self.__set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def rule(self) -> str:\n if self._rule:\n return self._rule\n return self._make... | [
"0.83138204",
"0.83096594",
"0.80169153",
"0.7593279",
"0.7319496",
"0.7264386",
"0.7223886",
"0.72137034",
"0.72088915",
"0.70570076",
"0.6972947",
"0.6946455",
"0.6925757",
"0.6925757",
"0.6782774",
"0.67298824",
"0.66754603",
"0.66754603",
"0.66754603",
"0.66463554",
"0.65... | 0.0 | -1 |
Create the rule object with two subrules. | def __init__(self, left_rule, right_rule):
Rule.__init__(self)
self.__autorule = None
self.__subrules = [left_rule, right_rule] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def __add__(self, right_rule):\n self.__subrules.append(right_rule)\n return self",
"def __add__(self, second_rule):\n return AndRule(self, second_rule)",
"def _... | [
"0.8088569",
"0.6599389",
"0.6551066",
"0.6384148",
"0.6220668",
"0.6216981",
"0.62068963",
"0.6168522",
"0.6058798",
"0.60144025",
"0.6011398",
"0.5987596",
"0.5871439",
"0.5871439",
"0.5871439",
"0.5871439",
"0.5871439",
"0.58703536",
"0.58511466",
"0.57580924",
"0.57464397... | 0.79337275 | 1 |
Return a humanreadable representation of the rule object. | def __str__(self):
return "(%s)" % ' '.join(map(str, self.__subrules)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{ %s }\" % str(self.__rule)",
"def __str__(self):\n return \"[ %s ]\" % str(self.__rule)",
"def __str__(self):\n return \"{ %s }1\" % str(self.__rule)",
"def __str__ (self) :\n\t\ttext_rule = \"\"\n\t\t\n\t\tfor key, rules in self.production_rules.items() :\... | [
"0.7927939",
"0.7890161",
"0.7547018",
"0.7204768",
"0.7006613",
"0.6959586",
"0.69466704",
"0.6830363",
"0.66296315",
"0.655315",
"0.6469457",
"0.6400036",
"0.62703335",
"0.62154007",
"0.6195681",
"0.6170786",
"0.6170786",
"0.61576986",
"0.6148944",
"0.61241496",
"0.60579884... | 0.66713595 | 8 |
insert a rule that is automatically matched after every subrule This is useful e.g. for matching comments. | def autoRule(self, rule):
self.__autorule = rule
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(self, rule):\n self.rule.append(rule)",
"def add_rule(rule):\n global RULE_DICT\n\n if rule[0] not in RULE_DICT:\n RULE_DICT[rule[0]] = []\n RULE_DICT[rule[0]].append(rule[1:])",
"def add_rule(self, rule) -> None:\n self.add_rules([rule])",
"def add_rule(self, rule)... | [
"0.691236",
"0.6899922",
"0.68043625",
"0.67551017",
"0.6700226",
"0.65838194",
"0.6581322",
"0.65771294",
"0.6568306",
"0.6534348",
"0.6477078",
"0.6355077",
"0.6347444",
"0.6294685",
"0.6104778",
"0.60894233",
"0.60667455",
"0.6049394",
"0.601886",
"0.5936117",
"0.5812305",... | 0.6448969 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.