query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns the number of incoming edges a given Stack has in the StackGraph. The number of incoming edge also represents the number of Stacks that depend on the given Stack. | def count_dependencies(self, stack):
return self.__graph.in_degree(stack) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_edges(self):\n return self._top_exp.number_of_edges()",
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def get_num_edges(self):\n\n return self._graph_state.get_num_edges()",
"def return_num_edges(self):\n return sum(map(lambda x: len(x),self._... | [
"0.72772425",
"0.7205154",
"0.70886415",
"0.6989499",
"0.6958669",
"0.6957508",
"0.689919",
"0.68849486",
"0.68188494",
"0.68153244",
"0.67455715",
"0.6717251",
"0.66675067",
"0.66592574",
"0.6645671",
"0.6636326",
"0.6559431",
"0.65306413",
"0.6399459",
"0.6391311",
"0.63341... | 0.68788356 | 8 |
Gets the number of time bins | def num_time_bins(self):
return self.header.time_gate_bin_count * self.header.samples_per_time_bin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ntimebins(self, t0, t1):\n t0 = Time(t0, scale='utc')\n t1 = Time(t1, scale='utc')\n nt = ((t1-t0).to(u.s) / self.dtsample /\n (self.setsize)).to(u.dimensionless_unscaled).value\n return np.round(nt).astype(int)",
"def time_bin_width(self):\n return (self.heade... | [
"0.78884566",
"0.7341071",
"0.6812186",
"0.6678192",
"0.6560778",
"0.6559253",
"0.6519222",
"0.6495545",
"0.64930296",
"0.6466418",
"0.64633924",
"0.6441701",
"0.64246935",
"0.642161",
"0.6408246",
"0.63995695",
"0.639357",
"0.6382628",
"0.6375767",
"0.6346752",
"0.63335514",... | 0.8684272 | 0 |
This function creates a box plot for the column distribution of colName. | def oneNumBox(df, colName):
boxData = [go.Box(x=df[colName[0]], name=colName[0])]
layout = go.Layout(title='Box Plot for distribution of ' + str(colName[0]))
fig = go.Figure(data = boxData, layout = layout)
return {"label":"Boxplot", "plot":fig} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_box(df, column_name):\n df.boxplot(column=column_name)\n plt.show()",
"def plot_columns(dataframe, title):\n sns.boxplot(x=dataframe['category_id'], y=dataframe['price'])\n plt.title(title)\n plt.xlabel('Category ID')\n plt.ylabel('Price')\n plt.show()",
"def plot_boxplot(df, coln... | [
"0.74498236",
"0.6772844",
"0.6753704",
"0.6648415",
"0.6388226",
"0.63763636",
"0.633584",
"0.62740636",
"0.61444587",
"0.60842496",
"0.6083751",
"0.59873444",
"0.593163",
"0.5873978",
"0.58440197",
"0.583945",
"0.57907087",
"0.5790423",
"0.5732122",
"0.5665896",
"0.5642569"... | 0.73588854 | 1 |
This function creates a distribution plot for the column colName. | def oneNumDist(df, colName):
distData = [df[colName[0]]]
group_labels = ['colName']
fig = ff.create_distplot(distData, group_labels, show_hist=False, show_rug = False)
fig['layout'].update(title='Distribution of ' + str(colName[0]))
fig['layout'].update(xaxis=dict(title= colName[0]))
fig['l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_distribution(kind_, df, *col):\n \n if kind_ == 'box':\n \n if len(col) == 1:\n boxplot = df.boxplot(column = col[0], rot = 90)\n plt.show()\n \n elif len(col) > 1:\n for c in col[1:]:\n boxplot = df.boxplot(column = col[0],... | [
"0.6637238",
"0.6529613",
"0.6472679",
"0.64063513",
"0.63834196",
"0.6323733",
"0.61246824",
"0.61117584",
"0.6090261",
"0.6080325",
"0.605933",
"0.60465586",
"0.60130113",
"0.6002314",
"0.5941179",
"0.5933714",
"0.58825856",
"0.5864881",
"0.58347625",
"0.5780886",
"0.571662... | 0.7656902 | 0 |
Splits an input string containing multiple complete FIX messages into individul FIX messages. Returns a tuple, one FIX message per tuple item. | def split_fix_msgs( longstring ) :
return tuple( filter(lambda x: x, re.split('(8=FIX\\.[45]\\.[0-9]\x01.*?\x0110=[0-9]{3}\x01)', longstring)) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str2tuple(str):\n pack = (int(str[1]), int(str[4]))\n return pack",
"def parse_messages(buffer):\n messages = []\n message, expected = parse_message(buffer)\n\n while message:\n messages.append(message)\n message, expected = parse_message(buffer)\n\n return messages, expected"... | [
"0.5650809",
"0.5629154",
"0.5575934",
"0.5315437",
"0.5272299",
"0.52617013",
"0.52615064",
"0.5261039",
"0.5231532",
"0.52051973",
"0.52009034",
"0.51968575",
"0.5170099",
"0.516239",
"0.5161756",
"0.51367146",
"0.5124484",
"0.5118948",
"0.51064634",
"0.50957894",
"0.509255... | 0.78909516 | 0 |
Get requested manifest object. | def get_queryset(self):
return Manifest.objects.filter(pid=self.kwargs['pid']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_manifest(self):\r\n if os.path.exists(self.manifestfile):\r\n return Manifest(json.loads(file(self.manifestfile).read()))\r\n return Manifest({})",
"def get_manifest(self):\n return self.manifest",
"def fetch_manifest(self):\n manifest = self.open(self.urls['manif... | [
"0.7480596",
"0.7413678",
"0.7309094",
"0.6737419",
"0.6655985",
"0.64891446",
"0.6347094",
"0.63281494",
"0.6289859",
"0.6289859",
"0.62650424",
"0.6131964",
"0.6107416",
"0.6035085",
"0.60236675",
"0.599285",
"0.5946704",
"0.5898346",
"0.5863856",
"0.58596516",
"0.5843279",... | 0.5273295 | 49 |
Get the mount corresponding to the given path. | def get_mount(path, _mounts=None):
path = os.path.abspath(path)
for mount in sorted(mounts() if _mounts is None else _mounts, key=lambda m: len(m.path), reverse=True):
if path.startswith(mount.path) and (mount.path.endswith('/') or path[len(mount.path):len(mount.path)+1] in ('/', '')):
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mount(cls, path: os.PathLike) -> ty.Tuple[Path, str]:\n try:\n # Only the first match (most recent parent) counts, mount table sorted longest\n # to shortest\n return next(\n (Path(p), t)\n for p, t in cls.get_mount_table()\n ... | [
"0.76399225",
"0.72761863",
"0.7134569",
"0.7107078",
"0.70253044",
"0.69817704",
"0.68928486",
"0.6883348",
"0.68832374",
"0.687298",
"0.6643485",
"0.65681857",
"0.65681857",
"0.6548973",
"0.654707",
"0.6411354",
"0.6345403",
"0.6337208",
"0.6301106",
"0.62855",
"0.6142402",... | 0.8156922 | 0 |
GIVEN that a user is already registered WHEN a request is sent to login with user credentials THEN a 200 status code should be returned | def test_login(self):
response = self.client.post("/login", json=self.payload)
self.assertEqual(response.status_code, 200)
self.assertIsNotNone(response.json.get("access_token"))
self.assertIsNotNone(response.json.get("refresh_token")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_registered_with_already_registered_user(self):\n self.client.post(\n '/api/v1/auth/register',\n data=json.dumps(dict(\n username='joe',\n password='123456'\n )),\n content_type='application/json'\n )\n response ... | [
"0.7304492",
"0.7173485",
"0.7087089",
"0.7076034",
"0.7069506",
"0.70545596",
"0.6995657",
"0.6972732",
"0.6964402",
"0.691874",
"0.6911096",
"0.69080055",
"0.68910265",
"0.6890058",
"0.6861274",
"0.6846386",
"0.6840393",
"0.682627",
"0.68243337",
"0.6804064",
"0.6798152",
... | 0.0 | -1 |
To generate a string representation of a number array. Used to generate the vertex keys in PointSet dictionary, and other similar operations. | def vcode0 (vect):
return prepKey(AA(fixedPrec(PRECISION))(vect)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_numeric_array(self, value):\n return '<numeric_array id=\"%s\" encoding=\"base64\">%s</numeric_array>' % \\\n (self.register(value), Numeric.dumps(value).encode('base64'))",
"def __str__(self):\n output = \"\"\n for i in self.values:\n st = []\n outp... | [
"0.70693964",
"0.68095493",
"0.67140716",
"0.66429996",
"0.65580493",
"0.65544236",
"0.65273523",
"0.6440183",
"0.63897693",
"0.6387019",
"0.6269334",
"0.62533706",
"0.61678696",
"0.61482096",
"0.6123613",
"0.60802",
"0.60628647",
"0.6033026",
"0.6012935",
"0.6001879",
"0.597... | 0.0 | -1 |
Check if an array is sorted in ascending order (assumes an array of numbers, such as integers or float) | def is_sorted(array):
for i in range(1,len(array)):
if array[i-1] > array[i]:
print("Array is not sorted")
return False
print("Array is sorted")
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted(array):\n if(all(array[i] <= array[i + 1] for i in range(len(array)-1))) or (all(array[i] >= array[i + 1] for i in range(len(array)-1))):\n return True\n return False",
"def is_sorted_array(arr, increasing=True):\n # If only 1\n if len(arr) == 0:\n return True\n # If mu... | [
"0.8214363",
"0.7962729",
"0.79553723",
"0.79090273",
"0.7765588",
"0.76141334",
"0.74153453",
"0.7338457",
"0.7263228",
"0.7204343",
"0.7103531",
"0.7098121",
"0.6942261",
"0.6836335",
"0.6758373",
"0.6743232",
"0.6731614",
"0.67268413",
"0.6703243",
"0.6693806",
"0.6582811"... | 0.7613879 | 6 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lon1, lat1, lon2, lat2):
Re = 6378.137
# convert decimal degrees to radians
deg2rad = np.pi / 180.
lon1 = np.array(lon1) * deg2rad
lat1 = np.array(lat1) * deg2rad
lon2 = np.array(lon2) * deg2rad
lat2 = np.array(lat2) * deg2rad
if lon2.shape:
N = lon2.shape[0]
... | {
"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.8146062",
"0.78638023",
"0.7632202",
"0.7604661",
"0.7595527",
"0.75950956",
"0.7592873",
"0.757031",
"0.7564319",
"0.75560796",
"0.75300086",
"0.7516366",
"0.7493803",
"0.746558",
"0.7450864",
"0.7432722",
"0.7391925",
"0.7355981",
"0.7347892",
"0.7330029",
"0.73271745",
... | 0.0 | -1 |
Compute the area of grid cells. | def compute_grid_area(ds, check_total=True):
radius_earth = 6.37122e6 # m, radius of Earth
area_earth = 4.0 * np.pi * radius_earth**2 # area of earth [m^2]e
def infer_lon_name(ds):
lon_names = ['longitude', 'lon']
for n in lon_names:
if n in ds:
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(self):\n num_rows = self.row_end - self.row_start\n num_cols = self.col_end - self.col_start\n area = num_rows*num_cols\n return area",
"def area(self):\n return numpy.prod(\n numpy.meshgrid(*self.binwidths, indexing='ij'), axis=0)",
"def calculatearea(sel... | [
"0.788239",
"0.78482604",
"0.7497436",
"0.74233127",
"0.7374402",
"0.7357601",
"0.7270625",
"0.7269669",
"0.7255076",
"0.72430474",
"0.7227959",
"0.7224641",
"0.7215719",
"0.7215719",
"0.72091466",
"0.72091466",
"0.72091466",
"0.720836",
"0.7206918",
"0.7194399",
"0.7193877",... | 0.65556985 | 99 |
rearrange time to put austral summer in the middle. | def austral_year_daily(x, y):
if isinstance(x, xr.DataArray):
x = x.values
jfmamj = x < 182.
jasond = x >= 182.
x_jasond = []
y_jasond = []
if any(jasond):
x_jasond = x[jasond] - 181
y_jasond = y[jasond]
x_jfmamj = []
y_jfmamj = []
if any(jfmamj):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _adjustHour(hour: int, meridiem: str) -> int:\r\n if(meridiem == \"PM\" and hour < 12):\r\n hour += 12\r\n elif(meridiem == \"AM\" and hour == 12):\r\n hour = 0\r\n return hour",
"def fix_time_units( timeunits ):\n imon = timeunits.find(\"months since \")\n if... | [
"0.60116136",
"0.5764526",
"0.5315105",
"0.5313343",
"0.5261097",
"0.52512854",
"0.52169853",
"0.51664436",
"0.51532894",
"0.51249015",
"0.5088908",
"0.50719756",
"0.5066444",
"0.50463414",
"0.5040423",
"0.5003004",
"0.49666005",
"0.49636024",
"0.4960331",
"0.49540094",
"0.49... | 0.0 | -1 |
end of month day | def eomday(year, month):
if hasattr(year, '__iter__'):
assert hasattr(month, '__iter__')
return np.array([calendar.monthrange(y, m)[-1] for y, m in zip(year, month)])
else:
return calendar.monthrange(year, month)[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_month(d):\n return date(d.year, d.month, monthrange(d.year, d.month)[1])",
"def get_end_month(month):\n return datetime(2020, month, 28)",
"def floor_end_month(date):\n return datetime(date.year, date.month, 1) + timedelta(days=-1)",
"def get_end_date(year, month):\n num_days = int(calend... | [
"0.7634243",
"0.74817556",
"0.69794214",
"0.6907938",
"0.6826484",
"0.6807931",
"0.6789926",
"0.67466354",
"0.6733794",
"0.6703177",
"0.6666026",
"0.6649959",
"0.6500736",
"0.64781207",
"0.64558196",
"0.6404312",
"0.64042103",
"0.63908696",
"0.63718075",
"0.63707715",
"0.6370... | 0.63095105 | 25 |
return a list with unique entries, but don't change the order | def list_set(seq):
seen = set()
seen_add = seen.add
return [x for x in seq if not (x in seen or seen_add(x))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unique(li):\n return list(set(li))",
"def unique(x):\n\n return list(set(x))",
"def unique(li):\r\n seen = set()\r\n seen_add = seen.add\r\n return [x for x in li if not (x in seen or seen_add(x))]",
"def _naive_unique(li):\n tmp = []\n for el in li:\n if el not in tmp:\n ... | [
"0.8046526",
"0.7668888",
"0.7653071",
"0.7576993",
"0.7532018",
"0.7500516",
"0.74825764",
"0.7419812",
"0.7374705",
"0.733722",
"0.7311688",
"0.72872996",
"0.72858495",
"0.72837687",
"0.72799385",
"0.7273521",
"0.7269689",
"0.72558814",
"0.7235664",
"0.7234846",
"0.7210553"... | 0.0 | -1 |
compute coefficient of determination | def _calc_r2(self):
sse = np.sum((self.data.y - self.predict(self.data.x))**2)
sst = np.sum((self.data.y - self.data.y.mean())**2)
return (1. - sse/sst) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficient(self) -> float:\n ...",
"def coefficient_determination(data_y, prediction):\n sum_numerator = np.sum((data_y - prediction) ** 2)\n sum_denominator = np.sum((data_y - prediction.mean()) ** 2)\n return 1 - sum_numerator / sum_denominator",
"def det(self):\n if self.x == 0 o... | [
"0.7171652",
"0.6999487",
"0.6612829",
"0.6426675",
"0.64180464",
"0.640523",
"0.6387252",
"0.6350718",
"0.6348035",
"0.63423896",
"0.63397646",
"0.63313454",
"0.62892926",
"0.6207614",
"0.6206039",
"0.6200083",
"0.6162931",
"0.6156804",
"0.6119922",
"0.61063445",
"0.60805494... | 0.0 | -1 |
Given a sequence of numbers, calculate the average of them. | def AVERAGE(nums):
if type(nums) == list or type(nums) == np.ndarray:
return(np.mean(nums))
else:
print('Invalid type: nums needs to be a list or numpy array.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_average(numbers):\n return sum(numbers) // len(numbers) # integer division //",
"def average(sequence):\n try:\n # first assume that numpy is installed for the fastest approach\n return sequence.mean()\n\n except AttributeError:\n # no numpy available, fall back to support regular list... | [
"0.81556594",
"0.8090954",
"0.7946982",
"0.793427",
"0.79193133",
"0.7893692",
"0.78671145",
"0.77538055",
"0.7669911",
"0.76558876",
"0.7652239",
"0.76408434",
"0.7428281",
"0.7408728",
"0.73901063",
"0.73898107",
"0.738119",
"0.738119",
"0.735108",
"0.73435336",
"0.7340045"... | 0.64265484 | 99 |
Calculate the angular distance between two coordinates. | def getAngDist(ra1, dec1, ra2, dec2):
delt_lon = (ra1 - ra2)*np.pi/180.
delt_lat = (dec1 - dec2)*np.pi/180.
# Haversine formula
dist = 2.0*np.arcsin( np.sqrt( np.sin(delt_lat/2.0)**2 + np.cos(dec1*np.pi/180.)*np.cos(dec2*np.pi/180.)*np.sin(delt_lon/2.0)**2 ) )
return dist/np.pi*180. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angular_distance( lat1, lon1, lat2, lon2 ):\n\tpi_180 = pi / 180\n\treturn acos( cos( lat1 * pi_180 ) * cos( lon1 * pi_180 ) * cos( lat2 * pi_180) * cos( lon2 * pi_180 ) + \n\t\t\tcos( lat1 * pi_180) * sin( lon1 * pi_180 ) * cos( lat2 * pi_180) * sin( lon2 * pi_180 ) + \n\t\t\tsin( lat1 * pi_180 ) * sin( lat2 ... | [
"0.8073124",
"0.77694464",
"0.6896379",
"0.6814788",
"0.68001467",
"0.6660871",
"0.6648392",
"0.66088325",
"0.6499083",
"0.646374",
"0.63813066",
"0.6376411",
"0.63277",
"0.6317756",
"0.6295193",
"0.62445444",
"0.6234149",
"0.62277234",
"0.61829424",
"0.6150075",
"0.61456716"... | 0.6440657 | 10 |
Iterate through the 'Product' response tags. | def products(self):
for tag in self._tag.iterdescendants('Product'):
yield ProductParser(tag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prod_parser(self, response):\n products = []\n pk = Product.objects.last()\n if pk:\n i = pk.id\n else:\n i = 0\n for product in response:\n # crawling product for name, desc, API_url, image_url, nutriscore, nutient_100g\n if 'ingre... | [
"0.6740828",
"0.6547733",
"0.631417",
"0.6299203",
"0.6260291",
"0.6260279",
"0.6137855",
"0.61339784",
"0.6104141",
"0.6090387",
"0.60582495",
"0.6034605",
"0.597348",
"0.5939808",
"0.59301203",
"0.5925287",
"0.59077907",
"0.5903081",
"0.58574",
"0.58506566",
"0.58133626",
... | 0.68449175 | 0 |
Return whether TOAHModel self is equivalent to other. Two TOAHModels are equivalent if their current configurations of cheeses on stools look the same. More precisely, for all h,s, the hth cheese on the sth stool of self should be equivalent the hth cheese on the sth stool of other | def __eq__(self, other):
for i in self._stools:
if not self._stools[i] == other._stools[i]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self: 'TOAHModel', other: 'TOAHModel') -> bool:\n return self.stool_lst == other.stool_lst",
"def equivalent(self, other):\n return id(self) == id(other)",
"def is_equivalent(self, other):\n A = self.minimization().relabeled()\n [initial] = A.initial_states()\n add... | [
"0.7675344",
"0.7389438",
"0.7364917",
"0.7210071",
"0.70732707",
"0.7039867",
"0.6950409",
"0.694263",
"0.6938312",
"0.68981266",
"0.6846222",
"0.6821377",
"0.6804145",
"0.6790955",
"0.6742427",
"0.6729195",
"0.67251754",
"0.67087126",
"0.6703534",
"0.6683057",
"0.6665138",
... | 0.6837803 | 11 |
Return the number of moves that have been played since the start of the game. | def number_of_moves(self):
return self._move_seq.length() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_moves(self):\n return self._number_of_moves",
"def number_moves(game, player):\n return float(len(game.get_legal_moves(player)))",
"def get_turn_count(self):\n return self.turns.count()",
"def get_num_moves(self, player: PlayerColor) -> int:\r\n player_squares: List[... | [
"0.7698358",
"0.71947163",
"0.69577485",
"0.6855067",
"0.6845205",
"0.6732028",
"0.66507626",
"0.6583397",
"0.6565476",
"0.6536588",
"0.640368",
"0.6374573",
"0.6348817",
"0.63231575",
"0.63171047",
"0.6292354",
"0.6282588",
"0.6127229",
"0.61241573",
"0.6113308",
"0.6101653"... | 0.74638337 | 1 |
Add a number of cheeses to the last stool. | def fill_last_stool(self, number_of_cheeses):
for i in range(number_of_cheeses, 0, -1):
self._stools[max(self._stools)].append(Cheese(i)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_first_stool(self, number_of_cheeses):\n for i in range(number_of_cheeses, 0, -1):\n self._stools[0].append(Cheese(i))",
"def fill_first_stool(self: 'TOAHModel', number_of_cheeses: int):\n self._number_of_cheeses = number_of_cheeses\n first_stool = self.stool_lst[0]\n ... | [
"0.70451784",
"0.6662271",
"0.6024769",
"0.5820514",
"0.5799186",
"0.5618816",
"0.5616417",
"0.5562337",
"0.5552165",
"0.54589385",
"0.5413732",
"0.5378334",
"0.53430796",
"0.52527344",
"0.52500755",
"0.52305824",
"0.5210188",
"0.52092415",
"0.5184598",
"0.515491",
"0.5154747... | 0.77200055 | 0 |
Is self equivalent to other? We say they are if they're the same size. | def __eq__(self, other):
return isinstance(other, type(self)) and self.size == other.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\r\n if self is other:\r\n return True\r\n if type(self) != type(other):\r\n return False\r\n if self.size() != other.size():\r\n return False\r\n for index in range(self.size()):\r\n if self[index] != other[index]:\r\n... | [
"0.75361466",
"0.7295249",
"0.7269822",
"0.71853644",
"0.71330845",
"0.71167344",
"0.71051854",
"0.7072695",
"0.704994",
"0.70439506",
"0.70168173",
"0.70130074",
"0.701285",
"0.6925093",
"0.69202673",
"0.6912432",
"0.69088316",
"0.68935174",
"0.68680483",
"0.6850945",
"0.684... | 0.81858116 | 0 |
Reads a dataset, and handles repetition and shuffling. | def read_dataset(file_read_func, input_files, config):
# Shard, shuffle, and read files.
filenames = tf.gfile.Glob(input_files)
if not filenames:
raise ValueError('Invalid input path specified in '
'`input_reader_config`.')
num_readers = config.num_readers
if num_readers > len(fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_datasets(self):\n assert self.data_tags is not None\n assert self.training_dataset is not None\n assert self.validation_dataset is not None\n self.training_dataset = self.shuffle_data_dictionary(self.training_dataset)\n self.validation_dataset = self.shuffle_data_dict... | [
"0.6416195",
"0.6392218",
"0.6275127",
"0.6252088",
"0.62274146",
"0.61871964",
"0.6137446",
"0.6118787",
"0.6054238",
"0.6049569",
"0.6012324",
"0.5997862",
"0.5958047",
"0.5955012",
"0.59117734",
"0.5885263",
"0.58770514",
"0.58683866",
"0.58572733",
"0.5852467",
"0.5826145... | 0.58154106 | 21 |
Given a matrix T, evolve a point Z on the nsimplex and return it. | def evolve(Z, T, n=1):
Z = closure(Z)
for i in range(n):
prob_T = prob(Z, T)
if prob_T != 0.0:
Z = np.matmul(Z, T)/prob_T
else:
Z = closure([1]*len(Z))
Z = np.matmul(Z, T)/prob(Z, T)
return Z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, T, X):\n dims = (T.shape[0], 1, 1)\n\n a = X[:, 0:1].reshape(dims)\n e = X[:, 1:2].reshape(dims)\n i = X[:, 2:3].reshape(dims)\n w = X[:, 4:5].reshape(dims)\n f = X[:, 5:6].reshape(dims)\n\n sf = np.sin(f)\n cf = np.cos(f)\n st = np.... | [
"0.58604",
"0.55016977",
"0.5494856",
"0.5487278",
"0.53921306",
"0.53729683",
"0.5341942",
"0.53400165",
"0.53257084",
"0.5236877",
"0.5211561",
"0.5200815",
"0.517127",
"0.51684237",
"0.516761",
"0.5150064",
"0.51452965",
"0.5132466",
"0.509386",
"0.50926304",
"0.508447",
... | 0.6556731 | 0 |
Update ``hasher`` with ``string``. | def update_hasher(hasher, string, codec='utf8'):
if isinstance(string, str):
hasher.update(string)
elif isinstance(string, unicode):
hasher.update(string.encode(codec))
return hasher | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_string(self, hash_string):\n\n self._hash_string = hash_string",
"def hash(self, string):\n h = md5()\n h.update(string)\n return h.digest()",
"def hash(self, string):\n return self.__scaffydb.hash(string)",
"def apply_hash (self, s):\r\n m = md5()\r\n ... | [
"0.71470696",
"0.6984489",
"0.6796498",
"0.6600572",
"0.6349129",
"0.62111497",
"0.61200255",
"0.60377216",
"0.60088164",
"0.59267515",
"0.5913179",
"0.5892349",
"0.5845414",
"0.58435625",
"0.5841524",
"0.5806818",
"0.5777173",
"0.57288176",
"0.5715254",
"0.5692991",
"0.56834... | 0.81067663 | 0 |
Seperate the symbols in symbolic function func. Return them in alphabetical order. | def seperate_symbols(func):
params = []
vars = []
for symbol in func.free_symbols:
if not str(symbol).isidentifier():
continue # E.g. Indexed objects might print to A[i, j]
if isinstance(symbol, Parameter):
params.append(symbol)
elif isinstance(symbol, Idx):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_fn(fn_string, symbols):\n fn_string = fn_string.replace('^', '**')\n fn = lambdify([sympy.symbols(symbols)], fn_string, 'numpy')\n return fn",
"def split_symbols_custom(predicate: Callable[[str], bool]):\n def _split_symbols(tokens: List[TOKEN], local_dict: DICT, global_dict: DICT):\n ... | [
"0.6423545",
"0.6198006",
"0.58888936",
"0.56594294",
"0.55979365",
"0.559099",
"0.5582595",
"0.5537977",
"0.54961663",
"0.5426786",
"0.54029727",
"0.5365869",
"0.5341528",
"0.5325418",
"0.5294751",
"0.5293736",
"0.5275363",
"0.5256423",
"0.52551985",
"0.52452266",
"0.5223613... | 0.6941614 | 0 |
Return a dict with all the Vars that apply to this task according to the task_role for the task. This method returns a dict of Vars that represent the view of the Var space from the perspective of the task's Role (task_role). This will be the Vars expanded from the perspective of that role. | def task_variables(self, for_env=False):
the_vars = {}
task_role = self.get_task_role()
if task_role is not None:
the_vars = {k:v.get_value(task_role)
for k, v in task_role.get_visible_vars().items()
if not for_env or (for_env and v.in_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def getVariables(self):\n statVars = [self[vn] for vn in self.statVars]\n timeVars = [self[vn] for vn in self.timeVars]\n return statVars + timeVars",
"def get_variables(self):\n local_variables = self._des... | [
"0.64747906",
"0.64349014",
"0.63510406",
"0.6317267",
"0.62683344",
"0.61825764",
"0.61799973",
"0.6175024",
"0.6166144",
"0.6125326",
"0.6117106",
"0.6070665",
"0.6068115",
"0.60528946",
"0.6038206",
"0.60029924",
"0.599413",
"0.59917784",
"0.59647244",
"0.5955935",
"0.5952... | 0.7978854 | 0 |
Return the effective remote user to use for this task. | def get_remote_user(self):
remote_user = (self.remote_user
if self.remote_user is not None
else (self.delegate.get_remote_user()
if self.delegate is not None
else None))
return remote_user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_remote_user(self, username):\n return 'ec2-user'",
"def __call__(self, req):\n return req.remote_user",
"def repo_user(self):\n if 'repoze.who.identity' in self.environ:\n return self.environ['repoze.who.identity'].get('user')",
"def get_ssh_user():\n\n return getpa... | [
"0.73137546",
"0.7248746",
"0.7076029",
"0.7009849",
"0.69299936",
"0.6720796",
"0.6690437",
"0.66117835",
"0.659132",
"0.6589816",
"0.6574206",
"0.65683377",
"0.6542362",
"0.65085113",
"0.6453833",
"0.6450967",
"0.6448139",
"0.6436463",
"0.64362365",
"0.64331555",
"0.6421732... | 0.73975164 | 0 |
Compute the L{Role} to use for as the default task_role for this model. This method computes the task_role, either from this model or from the model's delegate, and returns the actual Role object to use. | def get_task_role(self):
if self.default_task_role is None and self.delegate is None:
raise ConfigException("No default task role defined on the config model")
if self.namespace_model_instance is None:
raise ConfigException("ConfigModel instance can't get a default task role fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_role(self):\n self.fix_arguments()\n if self.task_role is not None:\n comp = self.task_role\n elif self._model_instance:\n #fetch the default task role for the entire model\n #this can raise an exception if there isn't a\n #default task ... | [
"0.80605596",
"0.6455118",
"0.63975924",
"0.6324114",
"0.6324114",
"0.61963266",
"0.61963266",
"0.61963266",
"0.6178694",
"0.6165453",
"0.61376363",
"0.6093497",
"0.6062734",
"0.6062734",
"0.6062734",
"0.60511154",
"0.6047456",
"0.5895616",
"0.5895616",
"0.58813745",
"0.58695... | 0.8363977 | 0 |
Returns the namespace model instance for this config model. | def get_namespace(self):
if not self.namespace_model_instance:
self.namespace_model_instance = self.nexus.find_instance(NamespaceModel)
return self.namespace_model_instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace(self):\n return Namespace(self)",
"def namespace (self) :\n\n return self.__namespace__",
"def namespace(self):\n return self._namespace",
"def namespace(self, namespace, lowercase=True, trim_namespace=True):\n\t\treturn Config(\n\t\t\t\tself.root_path,\n\t\t\t\tself.get_na... | [
"0.70460635",
"0.6636454",
"0.6402093",
"0.64018774",
"0.6398787",
"0.6243978",
"0.6113757",
"0.6092838",
"0.60506684",
"0.60448587",
"0.60202265",
"0.60202265",
"0.60202265",
"0.60121566",
"0.59813595",
"0.59613967",
"0.5957378",
"0.59540343",
"0.59528416",
"0.591677",
"0.59... | 0.8207099 | 0 |
Returns a list of _Dependency objects that captures all the task dependency pairs in the config model. | def get_dependencies(self):
inst_nodes = [getattr(self, name).value() for name in self._node_dict.values()]
return list(itertools.chain(list(itertools.chain(*[n.unpack()
for n in inst_nodes
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dependency_configurations(self):\n deps = []\n\n for variant in self.resolve_variants():\n # Note: the variants have already been resolved\n # This for loop simply needs to resolve the dependencies one\n # by one, potentially overwriding earlier ones\n name, value = next(iter(vari... | [
"0.73051786",
"0.71063894",
"0.68602127",
"0.67880315",
"0.67533594",
"0.6616975",
"0.65361357",
"0.6515832",
"0.6485797",
"0.64229614",
"0.6406096",
"0.63834846",
"0.63826835",
"0.6346205",
"0.6304355",
"0.6222923",
"0.61693645",
"0.6164254",
"0.6101858",
"0.6070012",
"0.603... | 0.6640788 | 5 |
Returns a list of nodes that have no predecessors in the TaskGroup; these are the nodes that represent "entering" the group from a dependency graph perspective. | def entry_nodes(self):
return list(itertools.chain(*[arg.entry_nodes() for arg in self.args])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tasks_without_predecessors(self) -> TaskList:\n return TaskList([task for task in self._tasks if not len(task.predecessors)])",
"def get_entry_nodes(self):\n top_nodes = []\n for node in self.graph.nodes_iter():\n if len(self.graph.predecessors(node)) == 0:\n ... | [
"0.76038766",
"0.7069459",
"0.6779221",
"0.66465074",
"0.65739846",
"0.6528018",
"0.62994224",
"0.62410164",
"0.6163187",
"0.61213",
"0.6106773",
"0.607117",
"0.6070428",
"0.60565764",
"0.6021042",
"0.6011508",
"0.597538",
"0.5958595",
"0.59470695",
"0.594263",
"0.58712065",
... | 0.0 | -1 |
Unpacks the internal dependencies for the tasks that the MultiTask contains, returns a list of _Dependency objects. | def unpack(self):
deps = list(self.dependencies)
deps.extend(itertools.chain(*[c.unpack() for c in self.instances if isinstance(c, _Unpackable)]))
return deps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unpack(self):\n deps = []\n if isinstance(self.from_task, _Unpackable):\n deps.extend(self.from_task.unpack())\n if isinstance(self.to_task, _Unpackable):\n deps.extend(self.to_task.unpack())\n entries = self.from_task.exit_nodes()\n exits = self.to_task... | [
"0.7964286",
"0.74229574",
"0.71604764",
"0.655894",
"0.6495268",
"0.6067974",
"0.6067005",
"0.59941673",
"0.59872794",
"0.5975218",
"0.5912984",
"0.58766484",
"0.58591163",
"0.58124727",
"0.5811587",
"0.5799529",
"0.5798127",
"0.5773876",
"0.575269",
"0.57259077",
"0.5725608... | 0.7578195 | 1 |
Since dependencies are "orable", it's entirely possible that a dependency may be set up between dependencies rather than between tasks (or a mix of tasks and dependencies). Actual work lists can only be constructed on dependencies between tasks, so what this method does is unpack a set of nested dependencies and covert... | def unpack(self):
deps = []
if isinstance(self.from_task, _Unpackable):
deps.extend(self.from_task.unpack())
if isinstance(self.to_task, _Unpackable):
deps.extend(self.to_task.unpack())
entries = self.from_task.exit_nodes()
exits = self.to_task.entry_nodes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sort_circular_dependencies(self, trans, cycles):\n allobjects = []\n for task in cycles:\n allobjects += [e.obj for e in task.get_elements(polymorphic=True)]\n tuples = []\n \n cycles = util.Set(cycles)\n \n #print \"BEGIN CIRC SORT-------\"\n ... | [
"0.6746443",
"0.6678885",
"0.65148854",
"0.6372926",
"0.6337993",
"0.6161914",
"0.6102153",
"0.6074393",
"0.6041916",
"0.59989387",
"0.5982734",
"0.59790087",
"0.59572047",
"0.5952667",
"0.59470254",
"0.59362024",
"0.5919329",
"0.59048957",
"0.5900662",
"0.5870729",
"0.586739... | 0.70221364 | 0 |
Set a limit for `jail_code`. `limit_name` is a string, the name of the limit to set. `value` is the value to use for that limit. The type, meaning, default, and range of accepted values depend on `limit_name`. | def set_limit(limit_name, value):
LIMITS[limit_name] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createLimit(name, maxValue):\n return Limit(Cuebot.getStub('limit').Create(\n limit_pb2.LimitCreateRequest(name=name, max_value=maxValue), timeout=Cuebot.Timeout))",
"def set_Limit(self, value):\n super(DescribeEvaluationsInputSet, self)._set_input('Limit', value)",
"def set(\n self... | [
"0.5972543",
"0.5867357",
"0.5808608",
"0.5543227",
"0.5437595",
"0.53425455",
"0.5329154",
"0.5307113",
"0.5306315",
"0.52793765",
"0.5259901",
"0.5256695",
"0.52299404",
"0.51858866",
"0.51528436",
"0.50746256",
"0.504095",
"0.50371546",
"0.50065947",
"0.50065947",
"0.50062... | 0.7254196 | 0 |
Returns the protocol for the given self.url. | def __find_protocol(self, url):
match = self.__REGEX_SCHEMA.search(url)
if match:
protocol = match.group(0).split(':')[0]
return protocol
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_protocol(url):\n result = re.search(r\"^https?://\", url)\n return result.group(0) if result else None",
"def protocol(self, code):\n return self.url.scheme",
"def get_protocol():\n if https():\n protocol = 'https'\n else:\n protocol = 'http'\n return protocol",
"d... | [
"0.8030298",
"0.7286053",
"0.68485206",
"0.68434453",
"0.6707391",
"0.6634757",
"0.6594081",
"0.6577397",
"0.65271443",
"0.6478635",
"0.64487493",
"0.6420222",
"0.6411562",
"0.6372328",
"0.6345152",
"0.6302995",
"0.6264109",
"0.6237375",
"0.6237375",
"0.6235042",
"0.62099046"... | 0.8065134 | 0 |
Returns the path for the given self.url. | def __find_path(self, url):
for matches in re.finditer(self.__REGEX_PATH, url):
matched_groups = matches.group()
slash_position = url.find(matched_groups) - 1
if url[slash_position] is not None and url[slash_position] != '/':
return matched_groups
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPathFromUrl(url):\n return __ParseUrl(url)[2]",
"def _url(self, path):\n \n return self.url + path",
"def urlpath(self, url):\n\t\t# remove schema + hostname\n\t\turl = re.sub('^[^:]*://[^/]+', '/', url)\n\n\t\treturn self.canonicalize(url)",
"def url(self) -> str:\n return self.... | [
"0.7347242",
"0.7200889",
"0.7168486",
"0.71047497",
"0.70148844",
"0.7011918",
"0.69828814",
"0.6979602",
"0.6954033",
"0.695056",
"0.6946101",
"0.69204116",
"0.6910116",
"0.6905976",
"0.6905976",
"0.6897269",
"0.6897269",
"0.68740237",
"0.68550164",
"0.6840348",
"0.68334794... | 0.0 | -1 |
Convert a unix timestamp in stringify datetime (UTC) | def convert_unix_timestamp_to_datetime_str(unix_ts):
timestamp = datetime.utcfromtimestamp(unix_ts)
return timestamp.strftime('%Y-%m-%dT%H:%M:%S.%fZ') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def epoch2UTCstr(timestamp=time(), fmat=\"%Y-%m-%d %H:%M:%S\"):\n return strftime(fmat, gmtime(timestamp))",
"def utc_to_unix_time(self, t):\n (y,m,d) = str(t).split('-')\n return datetime(int(y), int(m), int(d)).strftime('%s')",
"def datetime_to_utc(timestamp):\n\n epoch = datetim... | [
"0.74088883",
"0.7273378",
"0.7013416",
"0.6990894",
"0.6972318",
"0.695929",
"0.69034106",
"0.6886631",
"0.68661165",
"0.6836051",
"0.6792977",
"0.67885697",
"0.67801505",
"0.672935",
"0.67102975",
"0.6708447",
"0.6691395",
"0.6664989",
"0.66601646",
"0.6632887",
"0.6612012"... | 0.7572793 | 0 |
Convert the UTC timestamp to timezone by given new timezone. | def convert_utc_timestamp_in_timezone(utc_timestamp, timezone="GMT"):
from_zone = tz.gettz('UTC')
to_zone = tz.gettz(timezone)
utc = utc_timestamp.replace(tzinfo=from_zone)
return utc.astimezone(to_zone) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertToUsersTimeZone(self, timestamp):\n user = self.zport.dmd.ZenUsers.getUserSettings()\n if user.timezone:\n utc_dt = pytz.utc.localize(datetime.utcfromtimestamp(int(timestamp)))\n tz = pytz.timezone(user.timezone)\n tval = tz.normalize(utc_dt.astimezone(tz))... | [
"0.6792479",
"0.6649737",
"0.66389257",
"0.65631527",
"0.6556731",
"0.64940673",
"0.6482443",
"0.645134",
"0.64305115",
"0.6376043",
"0.63433456",
"0.6319062",
"0.63147",
"0.6243294",
"0.62328583",
"0.6214316",
"0.6185847",
"0.60898536",
"0.60819656",
"0.6061975",
"0.6057222"... | 0.74734247 | 0 |
Sample initial states by taking random number of noops on reset. Noop is assumed to be action 0. | def __init__(self, env, noop_max=30):
gym.Wrapper.__init__(self, env)
self.noop_max = noop_max
self.override_num_noops = None
self.noop_action = 0
assert env.unwrapped.get_action_meanings()[0] == 'NOOP' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n # Sample random state from initial state distribution\n self._cur_state = self._sample_state(self._mdp.I)\n self._prev_state = self._cur_state",
"def reset(self, **kwargs):\n self.env.reset(**kwargs)\n noops = self.unwrapped.np_random.randint(1, self.noop_max... | [
"0.72193784",
"0.72192264",
"0.7072182",
"0.7020714",
"0.70182014",
"0.69456506",
"0.6894622",
"0.6889975",
"0.67928576",
"0.6788414",
"0.6638059",
"0.65487605",
"0.654527",
"0.6478535",
"0.6470629",
"0.64657193",
"0.6429265",
"0.64276826",
"0.64265233",
"0.6419323",
"0.63762... | 0.0 | -1 |
clips the reward to {+1, 0, 1} by its sign. | def __init__(self, env):
gym.RewardWrapper.__init__(self, env) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self, reward):\r\n return np.sign(reward)",
"def reward(self, reward):\n return np.sign(reward)",
"def reward(self, reward):\n return np.sign(reward)",
"def reward(self, reward):\n return np.sign(reward)",
"def reward(self, reward):\n return np.sign(reward)",
... | [
"0.765923",
"0.7549669",
"0.7549669",
"0.7549669",
"0.7549669",
"0.7549669",
"0.71505404",
"0.64642996",
"0.6438022",
"0.636221",
"0.62719584",
"0.6199013",
"0.6162346",
"0.6150474",
"0.60861486",
"0.60645854",
"0.6032676",
"0.60250956",
"0.60137343",
"0.5964764",
"0.59603924... | 0.0 | -1 |
Bin reward to {+1, 0, 1} by its sign. | def reward(self, reward):
return np.sign(reward) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self, reward):\r\n return np.sign(reward)",
"def reward(self, reward):\n return float(np.sign(reward))",
"def sign(x):\n return(copysign(1, x))",
"def sign(self):\n return 1 - 2 * self._ltz()",
"def sign(self, inputs):\n pass",
"def sign(self, inputs):\n pass"... | [
"0.716841",
"0.6649643",
"0.65168613",
"0.61958915",
"0.60515827",
"0.60515827",
"0.6047905",
"0.6013856",
"0.5960513",
"0.5951386",
"0.5906012",
"0.5821817",
"0.5815375",
"0.57975495",
"0.57144666",
"0.57087195",
"0.5688879",
"0.56577635",
"0.56449455",
"0.56294537",
"0.5621... | 0.70789427 | 2 |
Overwrite the owner email. | def update(self):
self.application['email'] = 'test@example.spinnaker' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def technical_owner_email(self, technical_owner_email):\n\n self._technical_owner_email = technical_owner_email",
"def business_owner_email(self, business_owner_email):\n\n self._business_owner_email = business_owner_email",
"def set_owner(self, owner):\n self.settings[\"owner\"] = owner",... | [
"0.7009598",
"0.6962702",
"0.68217576",
"0.6551548",
"0.64316934",
"0.6412031",
"0.63543993",
"0.63261753",
"0.6312127",
"0.6230993",
"0.61875993",
"0.61875993",
"0.61875993",
"0.61875993",
"0.6153608",
"0.61434615",
"0.61168647",
"0.61168647",
"0.61168647",
"0.61168647",
"0.... | 0.60774225 | 31 |
Return the sale price for this truck as a float amount. | def sale_price(self):
if self.sold_on is not None:
return 0.0 # Already sold
return 5000.0 * self.wheels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_price(self):\n if self.sold_on is None:\n return 0.0 # Not yet sold\n return self.base_sale_price - (.10 * self.miles)",
"def purchase_price(self):\n if self.sold_on is None:\n return 0.0 # Not yet sold\n return self.base_sale_price - (.10 * self.m... | [
"0.78949636",
"0.78949636",
"0.7623875",
"0.75753903",
"0.75275487",
"0.74290484",
"0.73781294",
"0.73510665",
"0.71917707",
"0.71798295",
"0.7089901",
"0.70243806",
"0.69548696",
"0.692822",
"0.692822",
"0.6915999",
"0.68974936",
"0.6880515",
"0.6880515",
"0.6880515",
"0.686... | 0.8129219 | 0 |
Return the price for which we would pay to purchase the truck. | def purchase_price(self):
if self.sold_on is None:
return 0.0 # Not yet sold
return 10000 - (.10 * self.miles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\n return self._price",
"def get_price(self):\n return self.price",
"def get_price(self):\n return self.price",
"def get_price(self):\n return self.price",
"def price(self) -> float:\n r... | [
"0.77131534",
"0.76909304",
"0.76709116",
"0.76709116",
"0.76709116",
"0.766792",
"0.7591001",
"0.75353324",
"0.7533828",
"0.7533828",
"0.75329506",
"0.74735254",
"0.74735254",
"0.7466448",
"0.7457321",
"0.7402987",
"0.7362509",
"0.73422575",
"0.72716874",
"0.7247101",
"0.712... | 0.7769539 | 0 |
Return the sale price for this vehicle as a float amount. | def sale_price(self):
if self.sold_on is not None:
return 0.0 # Already sold
return 5000.0 * self.wheels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_price(self):\n if self.sold_on is None:\n return 0.0 # Not yet sold\n return self.base_sale_price - (.10 * self.miles)",
"def purchase_price(self):\n if self.sold_on is None:\n return 0.0 # Not yet sold\n return self.base_sale_price - (.10 * self.m... | [
"0.75489116",
"0.75489116",
"0.75028676",
"0.74810225",
"0.74524456",
"0.7279996",
"0.71826845",
"0.71584177",
"0.7092038",
"0.69568723",
"0.69046813",
"0.69046813",
"0.68660736",
"0.6865651",
"0.68468446",
"0.6846379",
"0.6846379",
"0.6846379",
"0.67912155",
"0.6785617",
"0.... | 0.7874844 | 2 |
Return the price for which we would pay to purchase the vehicle. | def purchase_price(self):
if self.sold_on is None:
return 0.0 # Not yet sold
return self.base_sale_price - (.10 * self.miles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\n return self._price",
"def get_price(self):\n return self.price",
"def get_price(self):\n return self.price",
"def get_price(self):\n return self.price",
"def price(self) -> float:\n r... | [
"0.77958965",
"0.7711989",
"0.7700835",
"0.7700835",
"0.7700835",
"0.7679395",
"0.7563702",
"0.7524472",
"0.7524472",
"0.75011563",
"0.74690515",
"0.73525053",
"0.7275231",
"0.72681016",
"0.72582346",
"0.7175284",
"0.7159883",
"0.7073043",
"0.70446146",
"0.7013411",
"0.699196... | 0.7084454 | 17 |
Return the sale price for this vehicle as a float amount. | def sale_price(self):
if self.sold_on is not None:
return 0.0 # Already sold
return 5000.0 * self.wheels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_price(self):\n if self.sold_on is None:\n return 0.0 # Not yet sold\n return self.base_sale_price - (.10 * self.miles)",
"def purchase_price(self):\n if self.sold_on is None:\n return 0.0 # Not yet sold\n return self.base_sale_price - (.10 * self.m... | [
"0.75489116",
"0.75489116",
"0.75028676",
"0.74810225",
"0.74524456",
"0.7279996",
"0.71826845",
"0.71584177",
"0.7092038",
"0.69568723",
"0.69046813",
"0.69046813",
"0.68660736",
"0.6865651",
"0.68468446",
"0.6846379",
"0.6846379",
"0.6846379",
"0.67912155",
"0.6785617",
"0.... | 0.7874844 | 0 |
Return the price for which we would pay to purchase the vehicle. | def purchase_price(self):
if self.sold_on is None:
return 0.0 # Not yet sold
return self.base_sale_price - (.10 * self.miles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desired_price(self):\n return self._desired_price",
"def get_price(self):\n return self._price",
"def get_price(self):\n return self.price",
"def get_price(self):\n return self.price",
"def get_price(self):\n return self.price",
"def price(self) -> float:\n r... | [
"0.77958965",
"0.7711989",
"0.7700835",
"0.7700835",
"0.7700835",
"0.7679395",
"0.7563702",
"0.7524472",
"0.7524472",
"0.75011563",
"0.74690515",
"0.73525053",
"0.7275231",
"0.72681016",
"0.72582346",
"0.7175284",
"0.7159883",
"0.7073043",
"0.70446146",
"0.7013411",
"0.699196... | 0.7084454 | 18 |
Return a string representing the type of vehicle this is. | def vehicle_type(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vehicle_type():\n pass",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'truck'",
"def vehicle_type(self):\n return 'truck'",
"def type(self) ->... | [
"0.8264676",
"0.7994656",
"0.7994656",
"0.7994656",
"0.78400844",
"0.78400844",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
... | 0.81698346 | 1 |
Return a string representing the type of vehicle this is. | def vehicle_type(self):
return 'car' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vehicle_type():\n pass",
"def vehicle_type(self):\n pass",
"def vehicle_type(self):\n return 'truck'",
"def vehicle_type(self):\n return 'truck'",
"def type(self) -> str:\n return pulumi.get(self, \"type\")",
"def type(self) -> str:\n return pulumi.get(self, ... | [
"0.8264676",
"0.81698346",
"0.78400844",
"0.78400844",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"... | 0.7994656 | 4 |
Return a string representing the type of vehicle this is. | def vehicle_type(self):
return 'truck' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vehicle_type():\n pass",
"def vehicle_type(self):\n pass",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'car'",
"def type(self) -> str:\n return pulumi.get(self, \"type\")",
"def type(... | [
"0.8266015",
"0.8171301",
"0.799574",
"0.799574",
"0.799574",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.73887587",
"0.7... | 0.78414714 | 6 |
Return a string representing the type of vehicle this is. | def vehicle_type(self):
return 'motorcycle' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vehicle_type():\n pass",
"def vehicle_type(self):\n pass",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'car'",
"def vehicle_type(self):\n return 'truck'",
"def vehicle_type(self):\n ... | [
"0.8264676",
"0.81698346",
"0.7994656",
"0.7994656",
"0.7994656",
"0.78400844",
"0.78400844",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
"0.738759",
... | 0.7290494 | 51 |
Returns `True` if object is a dataclass instance, `False` otherwise. | def is_dataclass_instance(obj: Any) -> bool:
return dataclasses.is_dataclass(obj) and not isinstance(obj, type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_dataclass_instance(obj):\n return hasattr(type(obj), '__dataclass_fields__')",
"def isclassinstance(object):\n if not hasattr(object, \"__class__\"):\n return False\n if isbuiltin(object.__class__):\n return False\n return True",
"def _is_user_class(obj):\n type_dict = type... | [
"0.88146114",
"0.7511304",
"0.7461899",
"0.74062276",
"0.7209373",
"0.7057078",
"0.69766736",
"0.6852587",
"0.68417186",
"0.6816968",
"0.677517",
"0.677517",
"0.6759726",
"0.67241764",
"0.67241764",
"0.67241764",
"0.67241764",
"0.67241764",
"0.67241764",
"0.67175746",
"0.6715... | 0.891268 | 0 |
Checks if a list has a value other then zero | def nonzero(list_):
for a in list_:
if a!=0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False",
"def has_positive(l):\n return any([p > 0 for p in l])",
"def isVecZero(vec):\n trues = [isZero(e) for e in vec]\n return all(trues)",
"def is_zero(self):\n for t in sel... | [
"0.71666956",
"0.7130968",
"0.69070715",
"0.6876754",
"0.67001724",
"0.6657063",
"0.66158926",
"0.6597678",
"0.6576671",
"0.6570329",
"0.65518945",
"0.6437133",
"0.63840353",
"0.63439596",
"0.6329796",
"0.6327994",
"0.6296214",
"0.62903833",
"0.62518203",
"0.624812",
"0.62261... | 0.8261807 | 0 |
Add line to the plot | def add_line(self, src_state: int, dst_state: int, color: str):
src_y = src_state // self.width
src_x = src_state % self.width
dst_y = dst_state // self.width
dst_x = dst_state % self.width
self.lines[(src_x, src_y, dst_x, dst_y, color)] += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_line(self,x_0,y_0,x_1,y_1,col=\"black\",line_width=1,line_type=\"solid\"):\n self._fig.add_shape(\n go.layout.Shape(\n type=\"line\",\n x0=x_0,\n y0=y_0,\n x1=x_1,\n y1=y_1,\n line=dict(\n ... | [
"0.7735947",
"0.7688628",
"0.74493057",
"0.7434205",
"0.74032885",
"0.73632026",
"0.73447704",
"0.7300983",
"0.7196209",
"0.71308213",
"0.71285146",
"0.7076803",
"0.6983811",
"0.69803905",
"0.6928182",
"0.69068986",
"0.6887216",
"0.6883392",
"0.68555903",
"0.6843642",
"0.6835... | 0.0 | -1 |
Sets the valid_source_format of this TranslationsGetTranslatorFormatsResponse200Items. | def valid_source_format(self, valid_source_format):
self._valid_source_format = valid_source_format | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_destination_format(self, valid_destination_format):\n\n self._valid_destination_format = valid_destination_format",
"def set_ResponseFormat(self, value):\n super(AddressValidationInputSet, self)._set_input('ResponseFormat', value)",
"def setInputFormats(self, value):\n return sel... | [
"0.5314362",
"0.5118696",
"0.4967109",
"0.49611962",
"0.49468386",
"0.48728472",
"0.48194426",
"0.4729159",
"0.4729159",
"0.46949083",
"0.4684286",
"0.46688443",
"0.46688443",
"0.46318734",
"0.46081227",
"0.45997345",
"0.45917243",
"0.45877478",
"0.45839137",
"0.45827553",
"0... | 0.7389632 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TranslationsGetTranslatorFormatsResponse200Items):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80886984",
"0.80886984",
"0.8055307",
"0.7983415",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Checks whether a string fits the form [alpha]+[numeric]+ | def is_topic_or_cutter(string):
at_num = False
found_alpha = False
for char in string:
if at_num is False:
if char.isalpha():
found_alpha = True
elif char.isnumeric():
if found_alpha:
at_num = True
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isAlphaNumeric(string):\n return (True)",
"def alphanumeric(s: str) -> bool:\n return len(re.findall(r'[^A-Za-z0-9]', s)) == 0",
"def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)",
"def ascii_alphanumeric(s: str) -> bool:\n return frozenset(s).issubset(_ascii_an... | [
"0.76804155",
"0.71037567",
"0.6911765",
"0.68736285",
"0.6819184",
"0.6788513",
"0.656705",
"0.65280104",
"0.64977753",
"0.64658016",
"0.64296985",
"0.6420758",
"0.6414716",
"0.6411938",
"0.63994086",
"0.639831",
"0.6395618",
"0.6376247",
"0.6354022",
"0.63503265",
"0.633714... | 0.7136575 | 1 |
Listing of topics in a forum. | def forum(request, forum_id):
topics = Topic.objects.filter(forum=forum_id).order_by("-created")
topics = mk_paginator(request, topics, DJANGO_SIMPLE_FORUM_TOPICS_PER_PAGE)
forum = get_object_or_404(Forum, pk=forum_id)
return render_to_response("forum/forum.html", add_csrf(request, topics=topics, pk=f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_list(request, forum_id, pagination_id=1):\n\ttry:\n\t\ttopics = Topic.objects.order_by('-is_global', '-is_sticky', '-topic_modification_date').filter(Q(topic_forum=forum_id) | Q(is_global='1'))\n\t\tforum_name = Forum.objects.get(id=forum_id)\n\t\tforum_name = forum_name.forum_name\n\texcept:\n\t\treturn... | [
"0.8186726",
"0.7314122",
"0.7310877",
"0.72472256",
"0.7109863",
"0.70867354",
"0.6959493",
"0.68796974",
"0.6793357",
"0.6758194",
"0.6749351",
"0.6698746",
"0.6617969",
"0.6556119",
"0.6525596",
"0.64797693",
"0.6474251",
"0.64285874",
"0.63593096",
"0.635887",
"0.6339465"... | 0.7054 | 6 |
Executes the teardown code to close the connection to the database. | def __exit__(self, exc_type, exc_value, exc_trace):
try:
self.conn.commit()
self.cursor.close()
self.conn.close()
except Exception as error:
print(f"DBCM::__exit__::{error}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n DBSession.close()\n daemons.execute_in_thread('radicale', lambda: transaction.commit())\n teardown_db()\n transaction.commit()\n DBSession.close_all()\n config['tg.app_globals'].sa_engine.dispose()",
"def teardown():\n teardown_db()",
"def clea... | [
"0.822475",
"0.78570855",
"0.78088546",
"0.76545805",
"0.7653576",
"0.76529336",
"0.7649902",
"0.76492363",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",
"0.7608793",... | 0.0 | -1 |
funkcija koja se poziva promjenom broja dana u comboboxu update defaulte, pozovi na ponovno crtanje grafa | def promjeni_broj_dana(self, x):
broj = int(self.brojDana.itemText(x))
logging.info('request za prikazom drugog broja dana, novi = {0}'.format(str(broj)))
self.emit(QtCore.SIGNAL('update_zs_broj_dana(PyQt_PyObject)'), broj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_comboBox_celuebianhao_currentIndexChanged(self, p0):\n # TODO: not implemented yet\n raise NotImplementedError",
"def on_combobox1_changed(self, widget, data=None):\n\t\tself.Paciente0.Test = self.Tests[self.ComboBox.get_active()][0]",
"def on_comboBox_qihuozhanghao_currentIndexChanged(sel... | [
"0.70677465",
"0.6737093",
"0.6722821",
"0.6404771",
"0.63269496",
"0.63113934",
"0.6306072",
"0.6287383",
"0.6261227",
"0.62568873",
"0.62446094",
"0.6159394",
"0.6100773",
"0.60871094",
"0.6080785",
"0.6056731",
"0.60546553",
"0.60463387",
"0.60143054",
"0.59968054",
"0.597... | 0.0 | -1 |
Collate data into batch. | def _batchify(batch):
im_name, im0, im1, im2, im3, im4, im5, im6, im7, im8, im9 = zip(*batch)
im0 = nd.stack(*im0)
im1 = nd.stack(*im1)
im2 = nd.stack(*im2)
im3 = nd.stack(*im3)
im4 = nd.stack(*im4)
im5 = nd.stack(*im5)
im6 = nd.stack(*im6)
im7 = nd.stack(*im7)
im8 = nd.stack(*im... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collate_batch(self) -> Dict[str, Any]:\n pass",
"def individual_collate(batch):\n\n data = batch\n\n collected_data = defaultdict(list)\n\n for i in range(len(list(data))):\n for k in data[i].keys():\n collected_data[k].append(data[i][k])\n\n for k in collected_data.keys(... | [
"0.7418104",
"0.71304685",
"0.701843",
"0.6917199",
"0.69071877",
"0.6774246",
"0.6744187",
"0.67011607",
"0.66829616",
"0.66829616",
"0.6648199",
"0.6611645",
"0.6550466",
"0.6541084",
"0.6539108",
"0.6502471",
"0.6486975",
"0.64702487",
"0.64624596",
"0.6454566",
"0.6440992... | 0.0 | -1 |
Construct an ConvolutionModule object. | def __init__(self,
channels: int,
kernel_size: int=15,
activation: nn.Layer=nn.ReLU(),
norm: str="batch_norm",
causal: bool=False,
bias: bool=True,
adaptive_scale: bool=False,
init_wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_conv(cls, module):\n kernel_size = unpack_all_equal_tuple(module.kernel_size)\n stride = unpack_all_equal_tuple(module.stride)\n return cls(kernel_size, stride)",
"def _createModuleObj(self):\n # Create the SWIG module object to provide access to the C++ object.\n Modu... | [
"0.68666476",
"0.6155687",
"0.59573984",
"0.5854176",
"0.5815953",
"0.56537634",
"0.5630243",
"0.562485",
"0.5621267",
"0.56205547",
"0.5607003",
"0.5602968",
"0.5585454",
"0.55831",
"0.5582511",
"0.5560355",
"0.5553718",
"0.55282974",
"0.5525447",
"0.5525273",
"0.5523681",
... | 0.5187529 | 76 |
Add padding to an array. | def _pad(self, a, axis, extrap, out):
if a.shape[axis] == self.N:
return a
elif a.shape[axis] != self.Nin:
raise ValueError("array much be of size len(x) or N")
axis %= a.ndim # to fix the indexing below with axis+1
to_axis = [1] * a.ndim
to_axis[axis]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(arr, n):\n m = len(arr)\n if m < n:\n return arr + type(arr)(ZERO for _ in range(n - m))\n else:\n return arr",
"def padArray(self, np_array):\n return padArray(np_array, self.margin)",
"def add_padding(img, x_padding):\n w = img.shape[1] + x_padding... | [
"0.7121357",
"0.70699555",
"0.7003509",
"0.6956489",
"0.6936915",
"0.68846005",
"0.68365896",
"0.6728185",
"0.6697491",
"0.6621393",
"0.6603096",
"0.65634984",
"0.6540787",
"0.6460261",
"0.64524037",
"0.6421974",
"0.6419976",
"0.6411205",
"0.63794047",
"0.63734865",
"0.632567... | 0.0 | -1 |
Return the max_items to be displayed in the syndication | def getMaxItems(self, obj=None):
if obj is not None:
max_items = self.getSyndicationInfo(obj).max_items
else:
max_items = self.max_items
return max_items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_item(self):\n return self._get_page('maxitem').json()",
"def maximum_item_count(self):\n return self._maximum_item_count",
"def get_select_all_max_items(self):\n return 1500",
"def max_count(self):\n return self.config.get('max_count', 500)",
"def max_results(self) -... | [
"0.7776277",
"0.7125317",
"0.6646662",
"0.6606162",
"0.65172786",
"0.64845383",
"0.6374803",
"0.626151",
"0.62502325",
"0.62502325",
"0.6198606",
"0.6182204",
"0.6164095",
"0.61333936",
"0.61333936",
"0.61273587",
"0.6073913",
"0.6045044",
"0.60417587",
"0.60351074",
"0.60339... | 0.79875886 | 0 |
Scales the parameter numFFTBinsAt44100Hz according to the sampling frequency. | def _calcNumFFTBins(self, sampleRate):
# numFFTBins should be proportional to sampleRate
ratioFreq = sampleRate / 44100.0
numFFTBins = self.getValue("numFFTBinsAt44100Hz") * ratioFreq
return int(round(numFFTBins * 0.5)) * 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_microphone_sample_rate_to_22khz():\n\n return _update_device_state_bit(_16khz_bit, 0)",
"def scaling_factor(self):\n bin_scale = self.spabins * self.spebins\n return bin_scale * self.int_time",
"def get_scale_freq():\n return sf / 2 / (num_freq-1)",
"def set_microphone_sample_rate... | [
"0.60310924",
"0.586242",
"0.58555216",
"0.568752",
"0.56050014",
"0.5393462",
"0.53360444",
"0.5245483",
"0.5232109",
"0.52217174",
"0.52026665",
"0.5171696",
"0.5168747",
"0.51672167",
"0.5154609",
"0.514866",
"0.5140443",
"0.5103257",
"0.5097735",
"0.50887287",
"0.5073725"... | 0.6707887 | 0 |
Calculates the absolute loudness of the harmonic or percussive part of a song. | def _loudness(part, sampleRate, loudness):
return ld.loudnessSignal(part, sampleRate) - loudness | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loudness(chunk):\n data = numpy.array(chunk, dtype=float) / 32768.0\n ms = math.sqrt(numpy.sum(data ** 2.0) / len(data))\n if ms < 10e-8: ms = 10e-8\n return 10.0 * math.log(ms, 10.0)",
"def loudness_factor(db):\n db += 20 # 'calibration factor'\n unit = (db + 96.0) / 96.0; # now in (0, 1)\... | [
"0.6723624",
"0.6009858",
"0.569727",
"0.5654799",
"0.5565402",
"0.5521218",
"0.55205864",
"0.5515483",
"0.55003494",
"0.5473982",
"0.54602486",
"0.5459319",
"0.5431672",
"0.53635293",
"0.5348528",
"0.53139997",
"0.529165",
"0.52789474",
"0.5272676",
"0.52602875",
"0.52400047... | 0.6292774 | 1 |
Detect and return the number of digits used in patch IDs (indices). Look for the first patchline, and use that as a reference. 0 no patch ID at all, just a bare "Patch" 1 no leading zeros for patch IDs 2 or more the minimum number of digits to be used for patch IDs. | def patch_id_digits(self) -> int:
if self._patch_id_digits is not None:
return self._patch_id_digits
self._patch_id_digits = 1
for line in self.spec_content.section("%package"):
if line.lower().startswith("patch"):
match = re.match(r"^patch(\d*)\s*:.+", l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNoOfPatches(self):\n return _patchExtractor.patchExtractor_getNoOfPatches(self)",
"def calc_n_patches(img_ref, patch_size):\n with Image.open(img_ref) as img:\n width, height = img.size\n\n line_patches = np.ceil(height / patch_size).astype(int)\n column_patches = np... | [
"0.643502",
"0.61479133",
"0.5954849",
"0.57034236",
"0.5660092",
"0.5468143",
"0.54306746",
"0.54158854",
"0.5387525",
"0.53838456",
"0.5374513",
"0.5260607",
"0.5179598",
"0.51601595",
"0.51415247",
"0.5079229",
"0.50771374",
"0.5065594",
"0.50559163",
"0.5048048",
"0.50452... | 0.82547706 | 0 |
Gets the both the market data and trade/order data associated with a TCA calculation as a tuple of (DataFrame, DataFrameHolder) | def get_market_trade_holder_via_celery(tca_request):
#from celery import group
#return group(get_market_trade_holder_via_celery(_tca_request), get_trade_order_holder_via_celery(_tca_request))
return tca_ticker_loader.get_market_trade_order_holder(tca_request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(list_data_tuples):\n \n \n benchmark_symbol=list_data_tuples[0][0]; # First element is the benchmark symbol\n \n #print benchmark_symbol\n \n df=pd.DataFrame(index=list_data_tuples[0][1]['data'].index) # First dataframe index is nothing but date\n \n for tpl in list_data_... | [
"0.6151624",
"0.5892034",
"0.5755414",
"0.5732368",
"0.56993943",
"0.5641084",
"0.56046224",
"0.5563897",
"0.55586535",
"0.55249804",
"0.54079956",
"0.5389017",
"0.537946",
"0.53750414",
"0.5349407",
"0.5339952",
"0.53327787",
"0.53326756",
"0.5314968",
"0.5296567",
"0.527329... | 0.4875258 | 92 |
Gets the market data associated with a TCA calculation as DataFrame | def get_market_data_via_celery(market_request):
return tca_ticker_loader.get_market_data(market_request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_data(self) -> pd.DataFrame:\r\n os.chdir(r'\\\\192.168.8.90\\投研部\\Jessica\\test_data')\r\n if self.tic in ['RB.CCRI', 'HC.CCRI', 'I.CCRI', 'J.CCRI', 'JM.CCRI', 'ZC.CCRI']:\r\n f = pd.read_hdf('data.h5', 'snc')\r\n if self.tic in ['CU.CCRI', 'ZN.CCRI', 'AL.CCRI', 'NI.CCRI']... | [
"0.59945023",
"0.5842658",
"0.58300567",
"0.5816719",
"0.5812122",
"0.57963413",
"0.5792681",
"0.5785656",
"0.5785656",
"0.5741052",
"0.57408476",
"0.5730061",
"0.57208407",
"0.57182294",
"0.5716236",
"0.5710986",
"0.5710425",
"0.5700942",
"0.5688139",
"0.56726253",
"0.565356... | 0.0 | -1 |
Gets the DataFrameHolder associated with a TCA calculation | def get_trade_order_holder_via_celery(tca_request):
try:
return tca_ticker_loader.get_trade_order_holder(tca_request)
except Exception as e:
print(str(e)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self) -> DataFrame:\n with self.create_census_api_session():\n logger.info('Retrieving variables...')\n variables: Variables = self.get_variables()\n logger.info('Retrieving ACS tables...')\n tables = self.get_tables()\n\n # Add geometry\n ... | [
"0.53330225",
"0.5181793",
"0.51516646",
"0.51076865",
"0.50962543",
"0.5089413",
"0.5082016",
"0.50666404",
"0.5060254",
"0.50479406",
"0.50456345",
"0.5039186",
"0.5038918",
"0.49785188",
"0.49767238",
"0.4908325",
"0.49016276",
"0.48847046",
"0.48746416",
"0.48627168",
"0.... | 0.0 | -1 |
Gets the both the market data and trade/order data associated with a TCA calculation as a tuple of (DataFrame, DataFrameHolder) | def get_market_trade_holder_and_calculate_metrics_single_ticker_via_celery(tca_request, dummy_market):
#from celery import group
#return group(get_market_trade_holder_via_celery(_tca_request), get_trade_order_holder_via_celery(_tca_request))
return tca_ticker_loader.calculate_metrics_single_ticker(tca_tic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(list_data_tuples):\n \n \n benchmark_symbol=list_data_tuples[0][0]; # First element is the benchmark symbol\n \n #print benchmark_symbol\n \n df=pd.DataFrame(index=list_data_tuples[0][1]['data'].index) # First dataframe index is nothing but date\n \n for tpl in list_data_... | [
"0.6151624",
"0.5892034",
"0.5755414",
"0.5732368",
"0.56993943",
"0.5641084",
"0.56046224",
"0.5563897",
"0.55586535",
"0.55249804",
"0.54079956",
"0.5389017",
"0.537946",
"0.53750414",
"0.5349407",
"0.5339952",
"0.53327787",
"0.53326756",
"0.5314968",
"0.5296567",
"0.527329... | 0.50089985 | 58 |
Random set of model parameters for mixture model | def random():
combined_pars = {}
for k, part in enumerate(parts):
prefix = chr(ord('A')+k) + '_'
pars = part.random()
combined_pars.update((prefix+k, v) for k, v in pars.items())
return combined_pars | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomize(self):\n #first take care of all parameters (from N(0,1))\n x = self._get_params_transformed()\n x = np.random.randn(x.size)\n self._set_params_transformed(x)\n #now draw from prior where possible\n x = self._get_params()\n [np.put(x,i,p.rvs(1)) for i,... | [
"0.657273",
"0.65450084",
"0.6462468",
"0.63953364",
"0.6358064",
"0.63491094",
"0.62749624",
"0.62714505",
"0.61800903",
"0.6173669",
"0.61626405",
"0.6135046",
"0.6130496",
"0.6110366",
"0.61081785",
"0.61064184",
"0.60926676",
"0.6083094",
"0.60599715",
"0.6053606",
"0.605... | 0.0 | -1 |
Return package version as listed in `__version__` in `init.py`. | def get_version(package):
init_py = codecs.open(os.path.join(package, '__init__.py'), encoding='utf-8').read()
return re.search("^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_from_package() -> str:\n path = join(dirname(__file__), \"__init__.py\")\n path = normpath(abspath(path))\n with open(path) as f:\n for line in f:\n if line.startswith(\"__version__\"):\n token, version = line.split(\" = \", 1)\n version = ve... | [
"0.84893894",
"0.83908445",
"0.83863354",
"0.8379423",
"0.8370828",
"0.8370828",
"0.8370828",
"0.8370828",
"0.8370828",
"0.8370828",
"0.8370828",
"0.83694756",
"0.83582735",
"0.8357903",
"0.835638",
"0.8078477",
"0.7975143",
"0.7938866",
"0.78928864",
"0.78928864",
"0.7892886... | 0.8380136 | 3 |
Generates a random MAC addr and changes the interface the random MAC | def randomize_interface(self, interface):
mac = self.get_rand_mac()
command = "ifconfig %s hw ether %s" % (interface, mac)
subprocess.call("ifconfig %s down" % interface, shell=True)
rc = subprocess.call(command, shell=True)
subprocess.call("ifconfig %s up" % interface, shell=Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_random_mac_addr(self):\n return \"02:00:00:%02x:%02x:%02x\" % (random.randint(0, 255),\n random.randint(0, 255),\n random.randint(0, 255))",
"def get_random_mac():\n\t\n\t# use the Dlink range\n\tmac = \"00:... | [
"0.8024386",
"0.7627201",
"0.75638455",
"0.7447258",
"0.70603627",
"0.70603627",
"0.69038665",
"0.6894523",
"0.6648316",
"0.6466636",
"0.6342935",
"0.62219965",
"0.60721344",
"0.6044645",
"0.5960872",
"0.5953936",
"0.59280396",
"0.59162587",
"0.590076",
"0.58709866",
"0.58683... | 0.69625413 | 6 |
Return the wind controller status. | def get_status(self):
return self.read_register(259, 0, 3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStatus(self):\r\n return self.controller.getStatus()",
"def controller_status(self) -> Optional['outputs.CSIPowerStoreStatusControllerStatus']:\n return pulumi.get(self, \"controller_status\")",
"def controller_status(self) -> Optional['outputs.CSIVXFlexOSStatusControllerStatus']:\n ... | [
"0.75383455",
"0.7499349",
"0.7449815",
"0.7284407",
"0.7257396",
"0.711363",
"0.71125287",
"0.7013763",
"0.6884245",
"0.6838627",
"0.6783159",
"0.6752413",
"0.6743827",
"0.66341037",
"0.66179466",
"0.66108483",
"0.6600721",
"0.6597998",
"0.65962964",
"0.65480256",
"0.6532693... | 0.6888526 | 8 |
Return the solar voltage. | def get_vsolar(self):
return self.read_register(4098, 1, 3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def voltage(self):\n return self.outputValue()",
"def get_voltage(self):\n return self.environment.get_voltage(self.neuron_id)",
"def get_voltage(self):\n summary = \" \".join(self.get_summary().split())\n pattern = '\\$.... .. (.*?) .*? .*? .*? .*? . .*? .*? . . . .*?'\n vol... | [
"0.8203644",
"0.8137676",
"0.8064254",
"0.80349964",
"0.79962105",
"0.79466784",
"0.79138047",
"0.7501929",
"0.7384861",
"0.736154",
"0.7299521",
"0.7234127",
"0.7165203",
"0.71505994",
"0.70756763",
"0.7055544",
"0.6992103",
"0.69862777",
"0.6952349",
"0.6912379",
"0.6905933... | 0.8189408 | 1 |
Extract unique elements from a column as a list | def get_unique_elements(column_name:str) -> list:
c=data_to_cluster[column_name].values.tolist()
cuisines_list=[]
for i in range(len(c)):
item=ast.literal_eval(c[i])
for j in range(len(item)):
cuisines_list.append(item[j][0])
c_s=set(cuisines_list)
cuisines=list(c_s)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique (a_data,a_column) :\n return list(__np.unique(a_data[a_column]))",
"def unique_column_values(rows, column_name):\r\n\r\n values = [] #Create an empty list\r\n for row in rows: #Iterate through each row\r\n values.append(row[column_name]) \r\n values = set(values)\r\n ... | [
"0.77191085",
"0.7574577",
"0.71822554",
"0.7066592",
"0.6971823",
"0.6953218",
"0.6908101",
"0.686589",
"0.6848778",
"0.6825685",
"0.6813218",
"0.675542",
"0.6684354",
"0.66787094",
"0.66297245",
"0.6596611",
"0.6576079",
"0.653607",
"0.65292305",
"0.6489355",
"0.6377869",
... | 0.77354735 | 0 |
Generator that yields ngrams from a sequence. | def generate_ngrams(iterable, n):
return zip(*[itertools.islice(it, i, None) for i, it in enumerate(itertools.tee(iterable, n))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_ngrams(self, sequence):\n sequence = self.prefix + sequence + self.suffix\n for i, event in enumerate(sequence[self.n:], self.n):\n yield event, sequence[i-self.n: i]",
"def everygrams(seq):\n for n in range(1, len(seq) + 1):\n for ng in nltk.util.ngrams(seq... | [
"0.8290349",
"0.82437456",
"0.7780717",
"0.71088296",
"0.7023633",
"0.7001076",
"0.69941705",
"0.6964612",
"0.693276",
"0.69231796",
"0.68719983",
"0.68339616",
"0.6827855",
"0.6820348",
"0.6720228",
"0.66739285",
"0.6662072",
"0.6637273",
"0.66312015",
"0.6621198",
"0.658667... | 0.66914886 | 15 |
Break lst into nsized chunks | def chunk(lst, n):
return [lst[i:i + n] for i in range(0, len(lst), n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def get_chunks(lst, n):\n size = int(len(lst) / n)\n output_list = []\n for i in range(0, n):\n sub_list = lst[i*size:i*size + size]\n output_list.append(sub_list)\n if len(lst) ... | [
"0.76128155",
"0.7593582",
"0.7568147",
"0.75516045",
"0.75516045",
"0.7551108",
"0.75463605",
"0.7506201",
"0.7433062",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",
"0.7430897",... | 0.7667378 | 0 |
Remove an Action from the queue of actions. Once this is done the Bot cannot restart the action. | def remove_action(self, _id):
assert _id in self._workers, 'Unknown action id'
assert not self._workers[_id].is_alive(), \
'Cannot remove a action that is currently running'
with self._mutex:
self._used_ids.remove(_id)
del self._workers[_id], self._actions[_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_action(self, action):\n if action not in self.actions:\n return\n old_actions = self.actions\n self.actions = []\n if action in old_actions:\n for a in old_actions:\n if a != action:\n self.actions += [a]\n\n if n... | [
"0.7943711",
"0.68708056",
"0.6388238",
"0.6330225",
"0.62956035",
"0.6143536",
"0.61021554",
"0.6097367",
"0.6077963",
"0.60775",
"0.5974723",
"0.5912357",
"0.5810648",
"0.5795613",
"0.57849884",
"0.57688504",
"0.5759988",
"0.5745182",
"0.5720643",
"0.5656891",
"0.5618868",
... | 0.7379539 | 1 |
Retrieves the container types to merge. Container types not defined in _CONTAINER_TYPES are ignored and not merged. Specific container types reference other container types, such as event referencing event data. The names are ordered to ensure the attribute containers are merged in the correct order. | def _GetContainerTypes(self):
container_types = []
for container_type in self._CONTAINER_TYPES:
# pylint: disable=protected-access
if self._store._HasAttributeContainers(container_type):
container_types.append(container_type)
return container_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTypes():\n\n\t\tquery = \"\\\n\t\t\tSELECT\\\n\t\t\t\tid_item_container_type,\\\n\t\t\t\tlabel\\\n\t\t\tFROM\\\n\t\t\t\titem_container_type\\\n\t\t\"\n\n\t\treturn {t['id_item_container_type']: t['label'] for t in Model.fetchAllRows(query)}",
"def get_child_types(self):\n types = set()\n for... | [
"0.6277974",
"0.5391704",
"0.53720915",
"0.53697675",
"0.52713853",
"0.52642953",
"0.52123386",
"0.51235425",
"0.5092419",
"0.5083809",
"0.50343156",
"0.4980909",
"0.49574783",
"0.4928214",
"0.49149346",
"0.49146336",
"0.49083138",
"0.49072948",
"0.48971298",
"0.48892725",
"0... | 0.66901577 | 0 |
Convert date to a Unix Seconds value | def to_unix_sec(self):
ts_type = self.ts_types['unix_sec']
try:
dt_obj = duparser.parse(self.timestamp)
if hasattr(dt_obj.tzinfo, '_offset'):
dt_tz = dt_obj.tzinfo._offset.total_seconds()
dt_obj = duparser.parse(self.timestamp, ignoretz=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetimeToUnixSec(date):\n return int(time.mktime(date.timetuple()))",
"def epoch_seconds(date):\r\n td = date - epoch\r\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)",
"def datetimeToUnix(date):\n return int(time.mktime(date.timetuple())*1000)",
"def epoch_second... | [
"0.80015",
"0.73247415",
"0.730998",
"0.72946167",
"0.72946167",
"0.69092965",
"0.6872264",
"0.6811874",
"0.6796202",
"0.67940915",
"0.66746664",
"0.6614821",
"0.6583494",
"0.65821856",
"0.64730597",
"0.6467745",
"0.64617205",
"0.64282095",
"0.64246887",
"0.64212453",
"0.6354... | 0.70804304 | 5 |
Convert date to a Unix Millisecond value | def to_unix_milli(self):
ts_type = self.ts_types['unix_milli']
try:
dt_obj = duparser.parse(self.timestamp)
if hasattr(dt_obj.tzinfo, '_offset'):
dt_tz = dt_obj.tzinfo._offset.total_seconds()
dt_obj = duparser.parse(self.timestamp, ignoretz=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unix_time_millisecond(date):\r\n return unix_time(date, float=True) * 1e3",
"def datetimeToUnix(date):\n return int(time.mktime(date.timetuple())*1000)",
"def datetimeToUnixSec(date):\n return int(time.mktime(date.timetuple()))",
"def timestamp_to_unix(timestamp):\n return timestamp / 1e6",
... | [
"0.82807875",
"0.77584636",
"0.7531014",
"0.7184201",
"0.7148117",
"0.7079632",
"0.70408297",
"0.702171",
"0.70105946",
"0.68891644",
"0.68392503",
"0.681694",
"0.68165857",
"0.68134284",
"0.6754815",
"0.6675617",
"0.6658929",
"0.6642811",
"0.66386724",
"0.6603719",
"0.657033... | 0.6562315 | 21 |
Convert a Mac Absolute timestamp to a date Also used for Safari plist timestamps | def from_mac(self):
reason = "[!] Mac Absolute timestamps are 9 digits, commonly followed by a decimal and up to 6 digits for milliseconds"
ts_type = self.ts_types['mac']
try:
if "." not in self.mac or not ((len(mac.split(".")[0]) == 9) and (len(self.mac.split(".")[1]) in range(0, 7)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapt_timestamp(data):\n return str(time.mktime(data.timetuple()))",
"def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600",
"def forge_timestamp(value) -> int:\n assert isinstance(value, str)\n dt = datetime.strptim... | [
"0.69574004",
"0.6715473",
"0.66348",
"0.6629909",
"0.6616872",
"0.65675676",
"0.65399504",
"0.65103465",
"0.6499327",
"0.6480312",
"0.6455841",
"0.6421591",
"0.6383134",
"0.63351357",
"0.63176686",
"0.62874347",
"0.62734836",
"0.62642956",
"0.626158",
"0.6259721",
"0.6248973... | 0.0 | -1 |
Convert a Microsoft 128bit SYSTEMTIME timestamp to a date | def from_systime(self):
reason = "[!] Microsoft 128-bit SYSTEMTIME timestamps are 32 hex characters (16 bytes)"
ts_type = self.ts_types['systemtime']
try:
if not len(self.systime) == 32 or not all(char in hexdigits for char in self.systime):
self.in_systemtime = indiv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ldap_to_datetime(timestamp: float):\n from datetime import datetime, timedelta\n return datetime(1601, 1, 1) + timedelta(timestamp/10000000)",
"def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600",
"def convert_timesta... | [
"0.67079026",
"0.66242117",
"0.66172886",
"0.6577654",
"0.6566204",
"0.6516551",
"0.6509257",
"0.6477741",
"0.64362204",
"0.6432865",
"0.63993454",
"0.6338205",
"0.6332146",
"0.6325549",
"0.62919617",
"0.62905884",
"0.62525517",
"0.62487525",
"0.623556",
"0.62294847",
"0.6212... | 0.6475056 | 8 |
Convert a date to a Microsoft 128bit SYSTEMTIME timestamp | def to_systime(self):
ts_type = self.ts_types['systemtime']
try:
dt_obj = duparser.parse(self.timestamp)
if hasattr(dt_obj.tzinfo, '_offset'):
dt_tz = dt_obj.tzinfo._offset.total_seconds()
dt_obj = duparser.parse(self.timestamp, ignoretz=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_timestamp(date):\n return int(calendar.timegm(date.utctimetuple()))",
"def system_to_ntp_time(date):\n return date + NTP_DELTA",
"def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600",
"def ntp_to_system_t... | [
"0.6973901",
"0.6756699",
"0.6655168",
"0.6641216",
"0.6594741",
"0.65467346",
"0.6537244",
"0.6486399",
"0.64819926",
"0.64640915",
"0.63781506",
"0.6352102",
"0.63079244",
"0.6307849",
"0.6244377",
"0.61995846",
"0.6185825",
"0.6180002",
"0.6179605",
"0.6159549",
"0.6131037... | 0.59575325 | 37 |
Convert a Microsoft Hotmail timestamp to a date | def from_hotmail(self):
reason = "[!] Microsoft Hotmail timestamps are 2 sets of 8 hex characters (4 bytes), separated by a colon"
ts_type = self.ts_types['hotmail']
try:
if ":" not in self.hotmail or not (all(char in hexdigits for char in self.hotmail[0:8]) and all(char in hexdigits... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSmsRecivedDate(self,timestamp):\n #convert millisec to sec\n timestamp = timestamp/1000\n date = datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%b-%d %H:%M %p')\n return date",
"def _convert_timestamp(timestamp):\n extract_time = re.match('(.*?\\+\\d{2}):(.*)', ... | [
"0.6874161",
"0.6732578",
"0.66007787",
"0.64955604",
"0.6479627",
"0.6478224",
"0.64737386",
"0.6470756",
"0.6386812",
"0.6367772",
"0.636408",
"0.63554734",
"0.6337966",
"0.6331731",
"0.6323805",
"0.63237286",
"0.63135785",
"0.6310229",
"0.6299179",
"0.62868327",
"0.6273811... | 0.5778 | 88 |
Convert an iOS 11 timestamp to a date | def from_ios_time(self):
reason = "[!] iOS 11 timestamps are typically 15-18 digits"
ts_type = self.ts_types['iostime']
try:
if not len(self.ios) in range(15, 19) or not self.ios.isdigit():
self.in_iostime = indiv_output = combined_output = False
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromtimestamp(cls, timestamp):\n return date()",
"def _convert_timestamp(timestamp):\n extract_time = re.match('(.*?\\+\\d{2}):(.*)', timestamp)\n formated = datetime.strptime('{}{}'.format(extract_time.group(1), extract_time.group(2)),\n '%Y-%m-%dT%H:... | [
"0.716403",
"0.68267757",
"0.68258494",
"0.6821402",
"0.68055016",
"0.677414",
"0.67386466",
"0.6690118",
"0.66589516",
"0.6658844",
"0.66268545",
"0.6602538",
"0.65678626",
"0.6557426",
"0.6552822",
"0.64536494",
"0.64246416",
"0.6412377",
"0.63869846",
"0.63568366",
"0.6352... | 0.0 | -1 |
Convert a timestamp to a GSM timestamp | def to_gsm(self):
ts_type = self.ts_types['gsm']
try:
dt_obj = duparser.parse(self.timestamp)
if hasattr(dt_obj.tzinfo, '_offset'):
dt_tz = dt_obj.tzinfo._offset.total_seconds()
else:
dt_tz = 0
if dt_tz == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_timestamp(timestamp):\n extract_time = re.match('(.*?\\+\\d{2}):(.*)', timestamp)\n formated = datetime.strptime('{}{}'.format(extract_time.group(1), extract_time.group(2)),\n '%Y-%m-%dT%H:%M:%S%z').strftime('%Y-%m-%dT%H:%M:%S%z')\n return forma... | [
"0.6929139",
"0.6928604",
"0.6877842",
"0.66339785",
"0.6595173",
"0.6551951",
"0.65402913",
"0.6504355",
"0.6478306",
"0.6431171",
"0.6428978",
"0.64164084",
"0.6376079",
"0.63256705",
"0.63166654",
"0.629443",
"0.62887335",
"0.6256878",
"0.62364244",
"0.62047803",
"0.620038... | 0.7689971 | 0 |
Extract a timestamp from a KSUID value | def from_ksuid(self):
reason = "[!] KSUID values are 27 characters"
ts_type = self.ts_types['ksuid']
try:
KSUIDCHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
if len(str(self.ksuid)) != 27 or not all(char in KSUIDCHARS for char in self.ksuid):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forge_timestamp(value) -> int:\n assert isinstance(value, str)\n dt = datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')\n return calendar.timegm(dt.utctimetuple())",
"def get_timestamp(chid):\n return get_timevars(chid).get('timestamp', 0)",
"def extract_timestamp(tweet):\n\n if 'timestamp_ms' ... | [
"0.68405914",
"0.65652996",
"0.65340316",
"0.6284323",
"0.62503487",
"0.62403697",
"0.61737776",
"0.61713964",
"0.6164974",
"0.6151784",
"0.6072838",
"0.6070326",
"0.6068812",
"0.60479254",
"0.604306",
"0.6030629",
"0.596953",
"0.59533304",
"0.5875243",
"0.5873095",
"0.585996... | 0.6769528 | 1 |
The set of arguments for constructing a IAMPolicy resource. | def __init__(__self__, *,
folder: pulumi.Input[str],
policy_data: pulumi.Input[str]):
pulumi.set(__self__, "folder", folder)
pulumi.set(__self__, "policy_data", policy_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: PolicyArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: AssessmentPolicyArgs,\n opts: Opt... | [
"0.67290044",
"0.6683979",
"0.66201115",
"0.6375484",
"0.6282084",
"0.6261985",
"0.62070596",
"0.606285",
"0.605271",
"0.60482824",
"0.6022158",
"0.6001994",
"0.5993332",
"0.59921676",
"0.59898937",
"0.5988024",
"0.5953157",
"0.5940971",
"0.5930414",
"0.5916907",
"0.59150475"... | 0.0 | -1 |
(Computed) The etag of the folder's IAM policy. | def etag(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "etag") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n ... | [
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6360385",
"0.6360385",
"0.6360385",
"0.6360385",
"0.6360385",
"0.6360385",
"0.6360385",
"0.63227206",
"0.6128659",
"0.6078536",
... | 0.6079093 | 25 |
Get an existing IAMPolicy resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
etag: Optional[pulumi.Input[str]] = None,
folder: Optional[pulumi.Input[str]] = None,
policy_data: Optional[pulumi.Input[str]] = None) -> 'IAMPolicy':
opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'IoMAMPolicyByName':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = dict()\n\n __props__[\"access_recheck_offline_timeout\"... | [
"0.6730773",
"0.62943447",
"0.5991634",
"0.57783455",
"0.5723162",
"0.5594087",
"0.5315862",
"0.5294431",
"0.5280061",
"0.52267236",
"0.52137315",
"0.5205417",
"0.51969236",
"0.513978",
"0.51319057",
"0.51281047",
"0.50992334",
"0.5037234",
"0.5036034",
"0.50265807",
"0.50214... | 0.7043442 | 0 |
(Computed) The etag of the folder's IAM policy. | def etag(self) -> pulumi.Output[str]:
return pulumi.get(self, "etag") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n return pulumi.get(self, \"etag\")",
"def etag(self) -> str:\n ... | [
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.6380078",
"0.63227206",
"0.6128659",
"0.6079093",
"0.6079093",
"0.6079093",
"0.6079093",
"0.6079093",
"0.6079093",
"0.6079093",
"0.6079093",
... | 0.6360385 | 17 |
the slug has to be consistent for each item, even when pulled from yaml file thus we cant use uuid here as it is generated unique every time; where as this is based on a uniqe combo of the item details | def item_slug(self, item, **kwargs):
name = self.project_data.slug(item_name=item.name)
if len(kwargs.keys()) > 0:
name = '{name}{extra}'.format(name=name, extra='-'.join([unicode(i) for i in kwargs.values()]))
return shortuuid.uuid(name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_unique_slug(self):\n set_unique_slug(self, based_on_field='name')",
"def test_unique_slug(self):\n # While unique_slug lives in the storybase app, I test it here\n # because this is the app where the relevent models live\n from storybase.utils import unique_slugify\n st... | [
"0.6804739",
"0.6638412",
"0.6579043",
"0.64857644",
"0.6451946",
"0.64459014",
"0.6380446",
"0.63275534",
"0.631819",
"0.62966955",
"0.6290166",
"0.62444276",
"0.6227533",
"0.62217915",
"0.6208051",
"0.6152805",
"0.6147064",
"0.614622",
"0.61410016",
"0.61227673",
"0.611754"... | 0.7523377 | 0 |
Define a line as a list of Term instances. | def __init__(self,l=None,c=True):
# default None to zero
if l is None:
l = 0
if l == []:
l = 0
# attempt to translate from string
try:
l = Li._translate(l)
# otherwise try to make a Term in a list
except:
try:
l = [Te(l)]
# or assume already list of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lineToList(self, line):\n raise NotImplementedError",
"def _create_examples(self, lines, set_type):\n examples = []\n for (i, ids) in enumerate(lines):\n text_a = lines[ids]['sentence']\n examples.append(\n InputExample(text_a=text_a) )\n retur... | [
"0.640686",
"0.6109169",
"0.603667",
"0.59105754",
"0.58692014",
"0.5822065",
"0.58101696",
"0.5793072",
"0.57401437",
"0.5729469",
"0.5721214",
"0.57100934",
"0.57100934",
"0.57099295",
"0.5705616",
"0.5694946",
"0.5692348",
"0.5691312",
"0.56885463",
"0.56812394",
"0.566981... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.