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 |
|---|---|---|---|---|---|---|
Computes area of boxes. | def area(boxes):
y_min, x_min, y_max, x_max = np.split(boxes, 4, axis=-1)
return np.squeeze((y_max - y_min) * (x_max - x_min), [1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])",
"def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])",
"def compute_area(boxes):\n area = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])\n\n return area",
"def ... | [
"0.84715885",
"0.84715885",
"0.8369817",
"0.8334332",
"0.830171",
"0.81802857",
"0.80124605",
"0.79808813",
"0.7970544",
"0.7858747",
"0.78092647",
"0.7688126",
"0.7576553",
"0.7440499",
"0.73104835",
"0.72514987",
"0.72302496",
"0.7130858",
"0.71270365",
"0.7125084",
"0.7123... | 0.84084266 | 2 |
Return a new instance of the specified method. | def callable(self, method):
# Look up method
if method not in self.all_methods:
raise PLCInvalidAPIMethod(method)
# Get new instance of method
try:
classname = method.split(".")[-1]
if method in self.native_methods:
fullpath = "PLC.Met... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_method(*args, **kwargs):\n key = _represent_args(*args, **kwargs)\n if key not in method.cache:\n method.cache[key] = method(*args, **kwargs)\n return method.cache[key]",
"def _new_method(self, *arg, **kws):\n try:\n re_entrant_thread_lock.acquire()\n ... | [
"0.7451693",
"0.68201995",
"0.64889497",
"0.64889497",
"0.61384743",
"0.59899044",
"0.59899044",
"0.59707767",
"0.596249",
"0.5905678",
"0.58328",
"0.582707",
"0.582707",
"0.582707",
"0.582707",
"0.582707",
"0.582707",
"0.5821479",
"0.5782157",
"0.57746065",
"0.57746065",
"... | 0.61897504 | 4 |
Estimate the `magnitude' parameter beta from data points. | def calc_beta(fx, dfx):
assert fx.ndim == 1 and fx.shape == dfx.shape
n = fx.size
f_bar = fx.mean()
ratio = (dfx**2).sum() / ((fx - f_bar)**2).sum() * (n-1) / float(n)
beta = sqrt(((fx - f_bar)**2).sum() / (n-1) * exp(-ratio))
return beta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_beta(self):\n\n return np.matmul(self.rotation_x, self.beta_z)",
"def beta(self):\n eTheta = self.eTheta()\n cosOmg = np.cos(self.omega())\n return self.a1()/c.c*(1-eTheta**2)**0.5*cosOmg",
"def _beta(self):\n return _handle_ab(self.solution, self.use_const)[1]",
"d... | [
"0.65688133",
"0.642205",
"0.6313718",
"0.63035256",
"0.6100482",
"0.6047445",
"0.60314447",
"0.60250443",
"0.59190375",
"0.59039533",
"0.59039533",
"0.5852442",
"0.5829021",
"0.5821624",
"0.5817636",
"0.5790095",
"0.57856953",
"0.5782379",
"0.57470626",
"0.5745991",
"0.57295... | 0.59558654 | 8 |
A utility function used by calc_gamma, calculates the average ratio of real residual to the estimated residual, which is used to make decision in the bisection. | def calc_res_ratio_avg_1d(beta, gamma, x, fx, dfx, y, fpy, dfpy):
n = x.size
n_remove = max(1, n / 5)
i_sorted = sorted(range(n), key=x.__getitem__)
var_total = 0.0
for i in range(0,n,n_remove):
# interpolate each value data point using all other data points
target = i_sorted[i:i+n_remove]
base = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residual_bright_faint_ratio(magnitudes):\n mean = np.mean(magnitudes)\n\n brighter = magnitudes[magnitudes > mean]\n fainter = magnitudes[magnitudes < mean]\n\n resid_brighter = np.mean(np.square(brighter - mean))\n resid_fainter = np.mean(np.square(fainter - mean))\n\n ratio = resid_fainter ... | [
"0.63875747",
"0.6368717",
"0.61393255",
"0.6122178",
"0.61193264",
"0.606439",
"0.6046174",
"0.5893349",
"0.580081",
"0.5713853",
"0.55815834",
"0.5578031",
"0.5545328",
"0.55436975",
"0.5543313",
"0.554004",
"0.5491286",
"0.54871476",
"0.54819727",
"0.54710394",
"0.546921",... | 0.6469571 | 0 |
Return the boundary of an expansion order set. | def boundary_set_and_zeta(order_set):
d = len(order_set[0])
boundary_set = []
for kappa in order_set:
for k in range(d):
kappa_new = kappa[:k] + (kappa[k] + 1,) + kappa[k+1:]
if kappa_new not in order_set and kappa_new not in boundary_set:
boundary_set.append(kappa_new)
boundary_zeta = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundary_of_set(i):\n b = self.args[i].boundary\n for j, a in enumerate(self.args):\n if j != i:\n b = b - a.interior\n return b",
"def boundary(self):\n return self.substrates.boundary",
"def bounds(self):\n return self._bboxes[0][... | [
"0.64485127",
"0.60470307",
"0.5662163",
"0.5626022",
"0.562263",
"0.55916125",
"0.5367826",
"0.5320096",
"0.5313554",
"0.529304",
"0.526566",
"0.5234156",
"0.5227843",
"0.51969856",
"0.5184476",
"0.5165962",
"0.5150535",
"0.5123518",
"0.51063526",
"0.50904906",
"0.50799584",... | 0.6083883 | 1 |
A utility function used by calc_gamma, calculates the average ratio of real residual to the estimated residual, which is used to make decision in the bisection. | def calc_res_ratio_avg_nd(beta, gamma, x, fx, dfx, y, fpy, dfpy, \
order_set, boundary_set, boundary_zeta):
n = x.shape[0]
n_remove = max(1, n / 5)
i_sorted = sorted(range(n), key=lambda i:tuple(x[i]))
var_total, var_max = 0.0, 0.0
for i in range(0,n,n_remove):
# interpolate each... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_res_ratio_avg_1d(beta, gamma, x, fx, dfx, y, fpy, dfpy):\n n = x.size\n n_remove = max(1, n / 5)\n i_sorted = sorted(range(n), key=x.__getitem__)\n var_total = 0.0\n for i in range(0,n,n_remove):\n # interpolate each value data point using all other data points\n target = i_sorted[i:i+n_remove]... | [
"0.6469043",
"0.6387396",
"0.6139157",
"0.6121806",
"0.6120074",
"0.60657007",
"0.6045959",
"0.5893522",
"0.5800959",
"0.57134116",
"0.5582346",
"0.5578301",
"0.5544524",
"0.5543816",
"0.55428636",
"0.5540894",
"0.5490659",
"0.54870886",
"0.54824674",
"0.5470967",
"0.5469606"... | 0.6368068 | 2 |
Computes the % of correctly ordered pairs | def accuracy(output1, output2):
pred1 = output1
pred2 = output2
correct = torch.gt(pred1, pred2)
return float(correct.sum())/correct.size(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_odpairs_percentage(od_num, counted_od):\n start = 0\n total = 0\n for i in counted_od:\n if start < od_num:\n total += i\n start += 1\n else:\n break\n return total/np.sum(counted_od)",
"def taskOfPairing(freq):\n n_pairs = list(map(lambda x: x ... | [
"0.7133553",
"0.6632147",
"0.6395378",
"0.6173139",
"0.61660075",
"0.6111901",
"0.60757166",
"0.6073128",
"0.6056997",
"0.6033734",
"0.6018136",
"0.60180837",
"0.6015868",
"0.60105246",
"0.5985948",
"0.5945146",
"0.5944799",
"0.5936104",
"0.5917974",
"0.59135574",
"0.5884238"... | 0.0 | -1 |
Mainly for sklearn's classifiers. Since probabilities are needed to compute the ROC, the .predict_proba() function is used. However, this function returns both the probabilities to be False [0] and the probabilities to be True [1], thus the array is reshaped to only return the probabilities to be True. | def _predict_proba(clf, X):
y = clf.predict_proba(X)
if np.any(np.array(clf.n_classes_) < 2):
y = np.array([j if i > 1 else np.concatenate((j, np.zeros([len(j), 1])), axis=1) for i, j in zip(clf.n_classes_, y)])
return np.transpose(y)[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_proba(self, x, **kwargs):\n kwargs = self.filter_sk_params(Sequential.predict_proba, kwargs)\n probs = self.model.predict_proba(x, **kwargs)\n\n # check if binary classification\n if probs.shape[1] == 1:\n # first column is probability of class 0 and second is of class 1\n probs =... | [
"0.7622108",
"0.75802547",
"0.7386499",
"0.7375487",
"0.7361235",
"0.7345964",
"0.73405915",
"0.73054945",
"0.7303352",
"0.7298513",
"0.72737855",
"0.7251661",
"0.7235128",
"0.72160715",
"0.7174717",
"0.71465904",
"0.71311295",
"0.7129355",
"0.7096944",
"0.70907897",
"0.70828... | 0.75003976 | 2 |
Calculate the coverage the proportion of data that has labels predicted. | def calc_coverage(self, y):
coverage = sum(np.any(self._round(y), axis=1)) / len(y)
return coverage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coverage(y_true, y_pred):\n m = tf.shape(y_pred)[1] - tf.constant(1, dtype=tf.int32)\n n_samples = tf.cast(tf.shape(y_pred)[0], tf.float32)\n n_abstain = tf.reduce_sum(\n tf.where(tf.argmax(y_pred, axis=1, output_type=tf.int32) == m, 1.0, 0.0)\n )\n return tf.constant(1.0) - n_abstain / n... | [
"0.67390877",
"0.6608518",
"0.6575663",
"0.65082085",
"0.6373211",
"0.63284093",
"0.62952787",
"0.6295077",
"0.62665135",
"0.6231143",
"0.61568385",
"0.61430395",
"0.6131901",
"0.6128283",
"0.6109812",
"0.60734516",
"0.60718584",
"0.60601395",
"0.6022359",
"0.6012619",
"0.600... | 0.6108809 | 15 |
Gets a 'default' Channel for the connection. Only one channel is created per AMQPConnection instance (note that this is not necessarily the same as one Channel per actual connection, but Channels are cheap anyway). | def channel(self):
if not hasattr(self, '_channel'):
self._channel = self.new_channel()
return self._channel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_channel(self):\n if self.channel is None or not self.channel.is_open:\n if not self.connection.is_open:\n self.connection = CONNECTION_MANAGER.get_connection(self.connection_name)\n self.channel = self.connection.channel()\n return self.channel",
"def ch... | [
"0.7219447",
"0.68459815",
"0.64894015",
"0.64713186",
"0.6403123",
"0.6205544",
"0.6170735",
"0.6151779",
"0.61111003",
"0.61078775",
"0.60045123",
"0.60045123",
"0.5985535",
"0.5985523",
"0.5940445",
"0.593904",
"0.5935622",
"0.59029096",
"0.5878804",
"0.5878804",
"0.575974... | 0.7095066 | 1 |
Pick a random location that isn't in a wall or target. | def random_location(self):
while True:
pt = (random.uniform(self.worldbox.tl[0], self.worldbox.br[0]),
random.uniform(self.worldbox.tl[1], self.worldbox.br[1]))
if not self.is_wall(pt) and not self.is_target(pt):
return pt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_location(self):\n return random.choice(self.locations_list)",
"def get_random_location(self):\n max_x, max_y, max_z, min_x, min_y, min_z = self.get_max_and_min()\n if max_x == float('-inf') and min_x == float('inf') and max_y == float('-inf') and min_y == float('inf') and \\\n ... | [
"0.76451266",
"0.6997501",
"0.69907653",
"0.69907653",
"0.6788121",
"0.67466176",
"0.67274874",
"0.66605395",
"0.6597831",
"0.6572638",
"0.65710706",
"0.64925486",
"0.6464703",
"0.6426935",
"0.6392966",
"0.6390391",
"0.6375245",
"0.6370135",
"0.6358471",
"0.62937176",
"0.6195... | 0.7952381 | 0 |
Return a list of boxes (used for interactive mode display). | def get_boxes(self):
boxes = [(" ", self.worldbox.tl, self.worldbox.br)]
# boxes = []
boxes += [(".", b.tl, b.br) for b in self.wallboxes]
boxes += [("x", b.tl, b.br) for b in self.targetboxes]
agentscale = 100
boxes += [("a", (self.i_state[0] - self.dx * agentscal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_boxes(self) -> List[Box]:\n return [Box.from_npbox(npbox) for npbox in self.boxlist.get()]",
"def get_boxes():\n boxes = []\n\n box_sizes = [256]\n left_x_cords = [x for x in range(0,1280,12)]\n top_y_cords = [y for y in range(360,720,12)]\n\n for box_size in box_sizes:\n fo... | [
"0.7462611",
"0.7340586",
"0.73056316",
"0.7095799",
"0.68854046",
"0.67790186",
"0.67411995",
"0.672064",
"0.67003626",
"0.66541666",
"0.66409636",
"0.6582219",
"0.65562224",
"0.6489382",
"0.6479569",
"0.63949287",
"0.63466483",
"0.6213459",
"0.61513567",
"0.61210495",
"0.61... | 0.7311949 | 2 |
Return the email address to satisfy FlaskLogin's requirements. | def get_id(self):
return self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self,... | [
"0.74636996",
"0.74636996",
"0.74636996",
"0.74636996",
"0.744493",
"0.744493",
"0.744493",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7439936",
"0.7421634",
"0.72910833",
"0.7233626",
"0.7228416",
"0.72064245",
"0.7176058",
"0.71472573",... | 0.0 | -1 |
Return True if the user is authenticated. | def is_authenticated(self):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def is_authenticated(self) -> bool:\n return self._authenticated",
"def is_authenticated(self):\r\n re... | [
"0.8739372",
"0.87086535",
"0.8613915",
"0.8609252",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8580474",
"0.8578436",
"0.83723366",
"0.83587176",
"0.8258534",
... | 0.86574197 | 5 |
False, as anonymous users aren't supported. | def is_anonymous(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_anonymous():\n return False",
"def is_anonymous(self):\r\n return False",
"def is_anonymous(self):\n return False",
"def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed",
"def is_authenticated(self):\n return False",
"def _is_anonymous_u... | [
"0.85624325",
"0.83800477",
"0.82456774",
"0.7815806",
"0.7576082",
"0.72904116",
"0.72619915",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72338396",
"0.715833",
"0.7106215",
"0.70944613",
"0.70567185",
"0.70209265",
"... | 0.8360155 | 16 |
Check if length (number of results for a query) is below the maximum This function raises an error if the given length (or number of results for a query) is below the maximum value | def check_length(length):
if length > lengthLimit:
err_str = "The length value (%s) is higher than the " % (length)
err_str += "limit length (%s)" % (lengthLimit)
raise ValueError(err_str) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __numRecordsMoreThanMax(self, numRecords):\n return numRecords > self.maxRecordCount",
"def exceeded_max(self):\n return self.total_max is not None and self.counter > self.total_max",
"def _validate_length(self, value):\n return (self.maximum_length is None) or (len(value) <= self.maxi... | [
"0.67209107",
"0.6538787",
"0.62144583",
"0.6208526",
"0.61998534",
"0.6196866",
"0.6189787",
"0.61853564",
"0.61585903",
"0.61572725",
"0.60966265",
"0.6092299",
"0.60781157",
"0.6072257",
"0.6029848",
"0.59820503",
"0.5981683",
"0.59764844",
"0.59662706",
"0.5963452",
"0.59... | 0.63516164 | 2 |
Build the URL to retrieve data or taxon This function builds the URL to retrieve data or taxon on ENA. It takes several arguments, check their validity before combining them to build the URL. | def build_retrieve_url(
ids, display, result=None, download=None, file=None, offset=None,
length=None, subseq_range=None, expanded=False, header=False
):
url = baseUrl + "data/view/"
url += ids
check_display_option(display)
url += "&display=%s" % (display)
if result is not None:
url ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_url(ori_lon, ori_lat, des_lon, des_lat, year, month, day, hour, minute, args={}):\n options = dict()\n with open(option_file, 'r', newline='') as file:\n # Read the options file\n for line in file:\n if line[0] == '#': # if the first character of a line is '#' skip it\n ... | [
"0.6370685",
"0.6218281",
"0.6210813",
"0.6128686",
"0.6109777",
"0.6043113",
"0.5998418",
"0.59229726",
"0.5877106",
"0.5875201",
"0.58705455",
"0.5838482",
"0.5836275",
"0.58170575",
"0.58170575",
"0.5812214",
"0.58119226",
"0.57938004",
"0.57747805",
"0.5762833",
"0.573460... | 0.57182854 | 21 |
Provides the logic for managing a specific owner. | def manage_owner(owner_id):
return _get_owner_service().get_owner(owner_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage_owners():\n\n owner_data = request.get_json(force=True)\n return _get_owner_service().create_owner(owner_data)",
"def owner(self, owner: str):\n\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def o... | [
"0.71787643",
"0.6820965",
"0.67825025",
"0.67825025",
"0.67825025",
"0.67825025",
"0.674174",
"0.6678004",
"0.6653119",
"0.6653119",
"0.6653119",
"0.6653119",
"0.6574441",
"0.6529369",
"0.64376384",
"0.6433443",
"0.64292586",
"0.6399345",
"0.6382449",
"0.6381194",
"0.635603"... | 0.76932526 | 0 |
Temporarily set the font size. | def __enter__(self):
self.old_size = plt.rcParams["font.size"]
plt.rcParams["font.size"] = self.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def font_size(self, font_size):\n\n self._font_size = font_size",
"def set_font_size(*args):\n size = font_size.get()\n message_inp.configure(font=f'TKDefault {size}')",
"def set_font_size(self, fontsize):\n self.parent.setFontPointSize(fontsize)",
"def set_font_size(window, size):\n\n ... | [
"0.8052195",
"0.79180616",
"0.7750005",
"0.7616636",
"0.74137217",
"0.7149415",
"0.71118265",
"0.70994306",
"0.70736057",
"0.6868277",
"0.6866142",
"0.6819373",
"0.67923784",
"0.6720979",
"0.6716418",
"0.6657657",
"0.6570369",
"0.6541387",
"0.6535178",
"0.6527875",
"0.6427244... | 0.7132592 | 6 |
Shifts ticklabels on an axis. | def shift_ticklabels(axis, dx=0, dy=0):
# Create offset transform by 5 points in x direction
offset = mpl.transforms.ScaledTranslation(dx, dy, axis.get_figure().dpi_scale_trans)
# apply offset transform to all ticklabels.
for label in axis.get_majorticklabels():
label.set_transform(label.get_tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_ticks(axis, labelsize):\n axis.get_xaxis().set_tick_params(\n which='both', direction='in', width=1.5, labelrotation=0, labelsize=labelsize)\n axis.get_yaxis().set_tick_params(\n which='both', direction='in', width=1.5, labelcolor='k', labelsize=labelsize)\n # axis.grid(color='r',... | [
"0.66834706",
"0.6579894",
"0.64926606",
"0.6488547",
"0.645174",
"0.6374485",
"0.6240437",
"0.61678416",
"0.6118228",
"0.6117124",
"0.6013688",
"0.6003552",
"0.5973148",
"0.5948677",
"0.5922383",
"0.59012765",
"0.5892673",
"0.5885213",
"0.5877282",
"0.5876372",
"0.586936",
... | 0.78159916 | 0 |
For returning skip grams out of a sequence. | def make_skipgrams(sentence, window_length):
skipgrams = []
for i in range(0, len(sentence)):
window = 1
w_i = sentence[i]
while window is not window_length+1:
if (i-window) >= 0:
w_c_front = sentence[i-window]
skipgrams.append([w_i, w_c_fron... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findGaps(sequence):\n patt = re.compile(r\"[Nn]+\")\n for match in patt.finditer(sequence):\n yield (match.start(), match.end())",
"def _calc_skips(self, heatmap, num_lines):\n if num_lines < self.MIN_SKIP_SIZE:\n return []\n skips, prev_line = [], 0\n for line in... | [
"0.65870106",
"0.62211204",
"0.6185802",
"0.61499465",
"0.61499465",
"0.61367786",
"0.604247",
"0.6034223",
"0.5998363",
"0.59883416",
"0.5964613",
"0.58874923",
"0.5835378",
"0.58032745",
"0.5778112",
"0.5768731",
"0.57213575",
"0.5718572",
"0.5632514",
"0.56275344",
"0.5622... | 0.595348 | 11 |
convert 1000 Pa to kpi | def pressure_to_kpa(pressure):
kpa = pressure / 10.0
return kpa | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kPa(self):\n return KiloPascal(self.base_value / 1000.0)",
"def pound_to_kilograms(pound):\n kilograms = pound * 0.45359237\n return kilograms",
"def test_kpa_conversion(self):\n\n result = get_kpa(5.6, 25)\n\n self.assertTrue(result == -34.281679)",
"def mmHg_to_kPa(p_mmHg):\n... | [
"0.7196644",
"0.67191935",
"0.6634556",
"0.6387182",
"0.63833755",
"0.63629293",
"0.6141199",
"0.61376405",
"0.60490185",
"0.59917307",
"0.5966158",
"0.5942846",
"0.592271",
"0.59173757",
"0.590442",
"0.5903991",
"0.58284473",
"0.5781904",
"0.573154",
"0.5724647",
"0.57009816... | 0.7478303 | 0 |
Get name of queryset model. | def model_name(self):
return self.get_queryset().model._meta.model_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_name(self):\n return self.get_queryset().model._meta.model_name # pylint: disable=protected-access",
"def name(self) -> str: # pragma: no cover\n return self.model.__name__",
"def model_name(self) -> str:\n return self._model_name",
"def name(self) -> str:\n return sel... | [
"0.8728515",
"0.7818633",
"0.7694884",
"0.75767446",
"0.74012893",
"0.71349776",
"0.71055174",
"0.7069971",
"0.67992675",
"0.6728948",
"0.6720449",
"0.6689568",
"0.6683943",
"0.6628682",
"0.66066116",
"0.65805113",
"0.65268993",
"0.65268993",
"0.64644045",
"0.6450019",
"0.642... | 0.87962496 | 0 |
Validate service catalog endpoint data. Validate a list of actual service catalog endpoints vs a list of expected service catalog endpoints. | def validate_svc_catalog_endpoint_data(self, expected, actual):
self.log.debug('actual: {}'.format(repr(actual)))
for k, v in expected.iteritems():
if k in actual:
ret = self._validate_dict_data(expected[k][0], actual[k][0])
if ret:
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_138_service_catalog(self):\n u.log.debug('Checking keystone service catalog...')\n self.set_api_version(2)\n endpoint_check = {\n 'adminURL': u.valid_url,\n 'id': u.not_null,\n 'region': 'RegionOne',\n 'publicURL': u.valid_url,\n ... | [
"0.69916314",
"0.6973263",
"0.6379388",
"0.6159132",
"0.6079578",
"0.60136753",
"0.5902091",
"0.57698405",
"0.575101",
"0.56785446",
"0.55161065",
"0.54834914",
"0.5480712",
"0.54423004",
"0.5430228",
"0.53913283",
"0.537125",
"0.5355991",
"0.53534985",
"0.53030694",
"0.52995... | 0.7347884 | 0 |
Segment generator for audio files from a list of files. Yields segments of `segment_duration` each time. | def file_generator(files: list,
segment_duration: float,
sampleRate: int,
db_thr: float or None = None,
frame_length: int = 512,
hop_length: int = 128,
) -> None:
I = 0
J = 0
segment = np.zero... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_file_list(\n cls,\n audio_file_list,\n target_sr=None,\n int_values=False,\n offset=0,\n duration=0,\n trim=False,\n channel_selector=None,\n *args,\n **kwargs,\n ):\n if isinstance(channel_selector, int):\n # Short... | [
"0.5887438",
"0.58090013",
"0.55940676",
"0.55753434",
"0.5435027",
"0.5433496",
"0.5312826",
"0.52907354",
"0.5287205",
"0.5287035",
"0.5266637",
"0.52547175",
"0.52243716",
"0.52146345",
"0.5189688",
"0.51555127",
"0.5145683",
"0.5128361",
"0.51228637",
"0.50839627",
"0.508... | 0.7487098 | 0 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.7125813 | 32 |
Is user a developer. | def is_developer(self):
return int(self.developer_status) == 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_developer(self):\n\n return self._is_developer",
"def has_user(self, user): # pylint: disable=unused-argument\r\n return False",
"def get_viewable(self, user):\n if user.get('role') in ('admin', 'manager', 'engineer'):\n return True\n return user['name'] == self.d... | [
"0.77806205",
"0.70397127",
"0.69394696",
"0.67183757",
"0.67175573",
"0.67167026",
"0.66777146",
"0.6653183",
"0.65692014",
"0.65637565",
"0.65637565",
"0.6557937",
"0.65542775",
"0.653787",
"0.6504135",
"0.6504135",
"0.6504135",
"0.6477316",
"0.64700603",
"0.64580154",
"0.6... | 0.8075512 | 0 |
Return the entry block. | def entry_block(self) -> int:
entry_blocks = [n for n in self.nodes if self.IsEntryBlock(n)]
if not entry_blocks:
raise NoEntryBlock()
elif len(entry_blocks) > 1:
raise MultipleEntryBlocks()
return entry_blocks[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_entry_basic_block(self):\n bb = BasicBlock(self)\n self.basic_blocks.insert(0, bb)\n return bb",
"def getBlock(self) -> ghidra.program.model.correlate.Block:\n ...",
"def GetBlock(self):\n return self._block",
"def get_block(self):\n return Gumtree.gumtree.get... | [
"0.6849301",
"0.6694795",
"0.6619621",
"0.655859",
"0.637405",
"0.62701523",
"0.6092251",
"0.60553885",
"0.6034222",
"0.598452",
"0.5955915",
"0.59524316",
"0.5950896",
"0.59356064",
"0.59210044",
"0.58932793",
"0.58765644",
"0.5851576",
"0.58342797",
"0.5831812",
"0.5814451"... | 0.7583633 | 0 |
A mock remote temp directory. | def remote_temp_dir(tmpdir):
return str(tmpdir) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_temp_dir():\n with patch(\n # Patch temp dir name to avoid tests fail running in parallel\n \"homeassistant.components.mqtt.util.TEMP_DIR_NAME\",\n \"home-assistant-mqtt\" + f\"-{getrandbits(10):03x}\",\n ) as mocked_temp_dir:\n yield mocked_temp_dir",
"def remote_mock_... | [
"0.7775972",
"0.77344996",
"0.7068947",
"0.70164263",
"0.69169647",
"0.68677956",
"0.685939",
"0.68574536",
"0.6847054",
"0.6749687",
"0.6749035",
"0.67019534",
"0.66627526",
"0.666026",
"0.6644531",
"0.662416",
"0.6620011",
"0.66120934",
"0.6578965",
"0.65470797",
"0.6519251... | 0.7242211 | 2 |
This function takes in the index to a cell in the game string and returns a new index corresponding to an adjacent cell in the speci ed direction. Return None for invalid directions. | def index_in_direction(index, grid_size, direction):
pos_to_return = 0
#position to return
if direction == 'up':
pos_to_return = index-grid_size
if direction == 'down':
pos_to_return = index+grid_size
if direction == 'left':
pos_to_return = index-1
if (pos_to_return+1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_in_direction(self, index, grid_size, direction):\n # convert index to row, col coordinate\n col = index % grid_size\n row = index // grid_size\n if RIGHT in direction:\n col += 1\n elif LEFT in direction:\n col -= 1\n # Notice the use of if,... | [
"0.6514532",
"0.61623234",
"0.6139411",
"0.59851706",
"0.5969111",
"0.59320134",
"0.5897712",
"0.58908653",
"0.58614886",
"0.58274966",
"0.57174397",
"0.57058114",
"0.5703943",
"0.5687996",
"0.56705916",
"0.5650977",
"0.56459373",
"0.56431025",
"0.56339985",
"0.5604966",
"0.5... | 0.64295286 | 1 |
Get the action that gives the highest total future reward based on the current policy | def get_highest_value_action(self, state):
a = self.sess.run(self.network.maxOutputNode, feed_dict={self.network.inputs: [state]})
return a[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for terminal state (no possible actions)\n if len(possibleActions) is 0: \n return None\n \n #attempt at using the Counter\n eValsActions = ut... | [
"0.79716426",
"0.77533215",
"0.7210606",
"0.7172442",
"0.7167455",
"0.7108632",
"0.71054506",
"0.7092872",
"0.7080876",
"0.70398873",
"0.69727755",
"0.6953851",
"0.6949744",
"0.6928191",
"0.69230556",
"0.69032395",
"0.68890685",
"0.688901",
"0.68734914",
"0.68669844",
"0.6857... | 0.679639 | 30 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
legalActions = gameState.getLegalActions(0)
#print legalActions
score = -999999999
n_action = 'Stop'
for action in legalActions :
temp = self.alphabeta(gameState.generateSuccessor(0,action),1,1,-99999999... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7484238",
"0.73829436",
"0.71820045",
"0.7109766",
"0.70878094",
"0.7070147",
"0.706809",
"0.7048819",
"0.7004379",
"0.696503",
"0.6965024",
"0.6961986",
"0.6944898",
"0.68987685",
"0.6896576",
"0.6885053",
"0.68281513",
"0.6766339",
"0.675802",
"0.67537147",
"0.6707646",
... | 0.0 | -1 |
Serialize a trajectory into a JSON string. | def trajectory_to_json(trajectory: Trajectory) -> str:
# numpy arrays need to be converted to normal tuples
return json.dumps(trajectory, cls=NumpyEncoder) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump(self, trajectory, data='simulation', occupancy=None,\n fractional=False, raw=False):\n f = io.StringIO()\n self.write(trajectory, f, occupancy=occupancy, fractional=fractional, raw=raw)\n return f.getvalue()",
"def to_json(self) -> str:\n data_dict = self._to_list... | [
"0.6308176",
"0.62615454",
"0.623477",
"0.62019145",
"0.61990064",
"0.6176558",
"0.61022794",
"0.61017257",
"0.60266227",
"0.59930193",
"0.59781456",
"0.59534526",
"0.5945451",
"0.5935647",
"0.59284663",
"0.59275943",
"0.58699095",
"0.5854041",
"0.5849753",
"0.58289534",
"0.5... | 0.8754451 | 0 |
Check if file is in the correct extension mp3. | def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_mp3_file(filename):\n ext = str(os.path.splitext(filename)[1]).lower()\n return ext == '.mp3'",
"def have_mp3_extension(l):\r\n if \".mp3\" in str(l):\r\n return 1\r\n else:\r\n return 0",
"def test_audio_extension(filename):\n\t\n\t# We need to make a test for extention :\n\ti... | [
"0.8563349",
"0.83595484",
"0.7522398",
"0.7468372",
"0.72197014",
"0.68058777",
"0.6785107",
"0.66489124",
"0.6640459",
"0.6581203",
"0.6543869",
"0.65289265",
"0.64148504",
"0.64094263",
"0.639572",
"0.6381494",
"0.6372932",
"0.6362967",
"0.63561255",
"0.63506335",
"0.63213... | 0.60196453 | 70 |
Initialize a new Dataset instance. | def __init__(
self,
root: str = "data",
split: str = "trainval",
transforms: Optional[Callable[[dict[str, Any]], dict[str, Any]]] = None,
download: bool = False,
checksum: bool = False,
) -> None:
assert (
split in self.valid_splits
), f"Pl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self):\n self.__dataset = None",
"def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s... | [
"0.7940832",
"0.78073645",
"0.76478857",
"0.7256711",
"0.70480615",
"0.69977355",
"0.69806486",
"0.69297254",
"0.69010466",
"0.684484",
"0.68099326",
"0.67982",
"0.67956704",
"0.67834836",
"0.67800754",
"0.6764315",
"0.6755509",
"0.66887796",
"0.6630972",
"0.6606904",
"0.6573... | 0.0 | -1 |
Return the number of data points in the dataset. | def __len__(self) -> int:
import h5py
with h5py.File(
os.path.join(self.root, self.data_dir, self.img_file_name), "r"
) as f:
num_datapoints: int = f[self.split]["pv_log"].shape[0]
return num_datapoints | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_data(self):\n try:\n ndata = len(self.x)\n logger.info(\"Number of data points: {0}\".format(ndata))\n except AttributeError:\n logger.error(\"Data object has not been defined\")\n ndata = 0\n return ndata",
"def n_points(self):\n\n ... | [
"0.880061",
"0.8231192",
"0.81478024",
"0.79469246",
"0.79161364",
"0.7906998",
"0.778869",
"0.77796876",
"0.7765048",
"0.7703485",
"0.768326",
"0.76774395",
"0.7650531",
"0.75353074",
"0.75095433",
"0.7476521",
"0.73538625",
"0.7345897",
"0.73293126",
"0.72561383",
"0.722389... | 0.7688301 | 10 |
Splits a text line into a list of tuples (word, next_word) | def process(self, element, **kwargs):
regex = r'[a-zA-Z]+' # r'\w+' to include numbers as well
line_words = re.findall(regex, element.lower()) # clean punctuation: get a list of (re)
words_to_tuples = [(line_words[i], line_words[i+1]) for i in range(len(line_words)-1)]
return words_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize_words(line):\n return",
"def split_word(word):\n return [(word[:i], word[i:]) for i in range(len(word) + 1)]",
"def tokens(text) -> Tuple[Word]:\n return tuple(re.findall('[a-z]+', text.lower()))",
"def lines_into_list(line):\n\n words = line.rstrip().split('|')\n return w... | [
"0.7118813",
"0.6803",
"0.663311",
"0.6516607",
"0.6516372",
"0.6456035",
"0.64053464",
"0.63516545",
"0.6337064",
"0.6315775",
"0.6212915",
"0.6195259",
"0.61346334",
"0.61246645",
"0.61212456",
"0.61174595",
"0.6110984",
"0.6109867",
"0.60613394",
"0.59866714",
"0.59595466"... | 0.6054002 | 19 |
convert timezones in python can result in minutes shifting... just do a simple hour offset with timedelta | def convertToLocalTime(zone, when=None):
if when is None:
when = datetime.today()
offset = getTimeZoneOffset(zone, when)
if offset >= 0:
when = when - timedelta(hours=offset)
else:
when = when + timedelta(hours=offset)
return when | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tz_localize(dataframe, offset_in_hours=0, copy=True):\n return dataframe.tz_localize(FixedOffset(offset_in_hours * 60), copy=copy)",
"def _tzoffset2iso8601zone(seconds):\n return \"%+03d:%02d\" % divmod((seconds // 60), 60)",
"def get_fixed_timezone(offset):\n if isinstance(offset, timedelta):\n ... | [
"0.6856684",
"0.65116304",
"0.649837",
"0.6411374",
"0.63906646",
"0.6372482",
"0.6332565",
"0.61859465",
"0.6159756",
"0.6157833",
"0.6139855",
"0.60928243",
"0.608656",
"0.60617167",
"0.6010767",
"0.59329337",
"0.59184664",
"0.5903324",
"0.5874753",
"0.5843728",
"0.584142",... | 0.56362444 | 33 |
this function is critical to lookups and the catch here is daylight savings the correct approach i believe is to first use UTC to set time frame then adjust for timezone offset we assume incoming start, end dates are in UTC | def getDateRange(start, end=None, kind=None, zone=None, hour=0, eod=None, end_eod=None):
if start is None:
start = datetime.now()
if zone is None or zone == "":
zone = "UTC"
if start == end:
end = None
if eod != None:
hour = eod
start = parseDate(start)
orig_star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convertTZ(self):\n tz = timezone.get_current_timezone()\n dtstart = self['DTSTART']\n dtend = self['DTEND']\n if dtstart.zone() == \"UTC\":\n dtstart.dt = dtstart.dt.astimezone(tz)\n if dtend.zone() == \"UTC\":\n dtend.dt = dtend.dt.astimezone(tz)",
... | [
"0.6824008",
"0.62374264",
"0.6012137",
"0.58935624",
"0.588197",
"0.5837422",
"0.58115566",
"0.58102703",
"0.5801301",
"0.5782799",
"0.571876",
"0.5716811",
"0.5689683",
"0.5669534",
"0.5571751",
"0.5560124",
"0.5557081",
"0.55479205",
"0.55273134",
"0.5524657",
"0.5522492",... | 0.55472076 | 18 |
Determines if the given word is contained in the dictionary. word the word to be checked. True if the word is in the dictionary, False otherwise. | def check_word(self, word):
word = word.lower().strip()
return not word or word in self.dictionary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isWord(word, dictionary):\n return word in dictionary",
"def word_dict_contains (self,\r\n word):\r\n\r\n\r\n\r\n if self.using_database:\r\n aprint('WORDDICT CONTAINS')\r\n\r\n value_tuple = (notebookname, word,)\r\n db_cursor.execute(\"SE... | [
"0.85332704",
"0.7787835",
"0.77818346",
"0.7556933",
"0.74459577",
"0.73361164",
"0.730161",
"0.72659737",
"0.7251214",
"0.72030187",
"0.7192013",
"0.7129889",
"0.70670223",
"0.7036707",
"0.6982686",
"0.6922983",
"0.6913599",
"0.6909896",
"0.6905871",
"0.68994284",
"0.689790... | 0.73961926 | 5 |
Converts the image to rgb format. | def get_rgb_bands(image, bands):
if bands is not MONOCHROME:
red = image[:, :, bands['red']]
green = image[:, :, bands['green']]
blue = image[:, :, bands['blue']]
img = np.rollaxis(np.array([red, green, blue]), 0, 3)
else:
img = color.grey2rgb(image)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_img(self):\r\n self.img = self.img.convert('RGB')",
"def to_color(self):\n if self.channels == 4:\n color = opencv.cvtColor(self.img, opencv.COLOR_BGRA2BGR)\n return Image(color)\n elif self.channels == 1:\n color = opencv.cvtColor(self.img, openc... | [
"0.7436798",
"0.70498824",
"0.69319326",
"0.69092584",
"0.6884476",
"0.68483657",
"0.6821436",
"0.6735431",
"0.67076206",
"0.66908205",
"0.66515344",
"0.66445464",
"0.65666306",
"0.65547305",
"0.64814633",
"0.64654803",
"0.64560044",
"0.64472514",
"0.64353323",
"0.64253545",
... | 0.5892905 | 66 |
Compute Canny edge image | def get_canny_edge_image(image, radius, sigma):
# local histogram equalization
grayscale = equalize(image, selem=disk(radius))
try:
return canny(grayscale, sigma=sigma)
except TypeError:
print("Canny type error")
return np.zeros(image.shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge_detect_canny(gray_img):\n\n edges = cv2.Canny(gray_img, 100, 200)\n\n return edges",
"def run_canny_edge_detection(image, min_threshold=100, max_threshold=150):\n return cv2.Canny(image, min_threshold, max_threshold)",
"def canny(self,img):\n return cv2.Canny(img, self.low_threshold, s... | [
"0.80708593",
"0.8029905",
"0.7874638",
"0.7831503",
"0.781839",
"0.780328",
"0.77371556",
"0.7704402",
"0.7700632",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"0.7682926",
"... | 0.6882807 | 40 |
Unload a config entry. | async def async_unload_entry(opp: OpenPeerPower, entry: ConfigEntry) -> bool:
return await opp.data[DOMAIN].async_unload_entry(entry) # type: ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.60818183 | 65 |
Return the minimum value. | def min_value(self) -> float:
return DEFAULT_MIN_VALUE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_minimum(self):\n return self._minimum",
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"min\")",
"def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"mi... | [
"0.8728359",
"0.8631188",
"0.8631188",
"0.8599283",
"0.8599283",
"0.8502898",
"0.8491298",
"0.8481871",
"0.846595",
"0.846595",
"0.84328246",
"0.84303063",
"0.84303063",
"0.84216654",
"0.84054255",
"0.8311696",
"0.8290971",
"0.82861054",
"0.8281118",
"0.8254961",
"0.8184649",... | 0.8284037 | 18 |
Return the maximum value. | def max_value(self) -> float:
return DEFAULT_MAX_VALUE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_value(self):\n max_value = max(self.values)\n return max_value",
"def _get_maximum(self):\n return self._maximum",
"def get_max(self):\n return self._max",
"def get_max(self):\n return self.max[-1]",
"def _get_maximum_value(self):\n if hasattr(self, '_m... | [
"0.8933136",
"0.88841957",
"0.87473977",
"0.861131",
"0.8606676",
"0.85935724",
"0.8586842",
"0.8532539",
"0.8532539",
"0.8495911",
"0.8495911",
"0.8488697",
"0.8487578",
"0.8399635",
"0.83845997",
"0.836424",
"0.83359325",
"0.8261219",
"0.8261219",
"0.8256761",
"0.8229282",
... | 0.8262177 | 17 |
Escapes string to be used in markdown link | def markdown_escape(text):
return text.translate(MARDOWN_TRANS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markdown_escape(text):\n return ESCAPE_CHARS_RE.sub(\n lambda m: MARKDOWN_SPECIAL_CHARS_RE.sub(r'\\\\\\1', m.group(0)),\n text)",
"def md_link(link_text, link_target):\n return '[%s](%s)' % (md_escape(link_text, characters=']'),\n md_escape(link_target, characters=')')... | [
"0.7200808",
"0.70624894",
"0.6904632",
"0.6904632",
"0.6768619",
"0.65677285",
"0.6535491",
"0.643305",
"0.64065015",
"0.63941264",
"0.63886416",
"0.630367",
"0.62350464",
"0.619173",
"0.6186041",
"0.61670405",
"0.61646426",
"0.615001",
"0.6146635",
"0.6141269",
"0.61289364"... | 0.75486755 | 0 |
Plots day and night images as clusters in 2D space for given features. And, draws a line of separation | def fsep(features_, sep_coords=([25, 129], [200, 50])):
night = df2.loc[df2["labels"]==0, features_]
day = df2.loc[df2["labels"]==1, features_]
data = night, day
colors = "red", "green"
groups = "Night", "Day"
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
for data, color, grou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_clusters(self):\n pass",
"def visualize_clusters(x, y, imgs, colors=None):\n # create figure and plot scatter\n fig = plt.figure()\n ax = fig.add_subplot(111)\n ax.tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False)\n ax.tick_params(axis='y', which='both... | [
"0.6235816",
"0.6222693",
"0.6183442",
"0.59449726",
"0.5909048",
"0.58626944",
"0.5841642",
"0.58224785",
"0.57740366",
"0.57559943",
"0.57539386",
"0.5743093",
"0.5731689",
"0.5731689",
"0.5731689",
"0.5725746",
"0.57250965",
"0.57110894",
"0.5690413",
"0.568808",
"0.568084... | 0.71149343 | 0 |
Returns True if the given Twitter status is to be skipped. | def skip_tweet(self, status, from_stream=True):
log_status = 'author: {}, reply_to_status: {}, reply_to_user: {}, quoting: {}, retweet: {}, text: {}'
log_status = log_status.format(status.author.screen_name,
status.in_reply_to_status_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsSkipped(self):\n state = self.GetState()\n return state.status == TestState.SKIPPED",
"def _should_include_tweet(tweet: Status) -> bool:\n if (\n tweet.in_reply_to_status_id is not None\n and tweet.retweeted_status is None\n and tweet.in_reply_to_user_id != tweet.user.id\n ... | [
"0.66428435",
"0.6414191",
"0.6347439",
"0.6117404",
"0.6008422",
"0.5893264",
"0.5842119",
"0.58113396",
"0.5767048",
"0.5763887",
"0.5745861",
"0.5683721",
"0.5657151",
"0.558517",
"0.558517",
"0.5579998",
"0.55609214",
"0.553793",
"0.5513619",
"0.5502769",
"0.54743487",
... | 0.718822 | 0 |
Returns whether or not a Twitter stream is running. | def running(self):
return self.sub_process and self.sub_process.is_alive() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_streaming(self) -> bool:\n return self.stream_status == StreamStatus.STREAMING",
"def is_running(self):\n\t\treturn self in _running",
"def is_running(self):\n\t\treturn self._running",
"def is_running(self):\n return self.running",
"def is_running(self):\n return self.running",... | [
"0.72394526",
"0.69978935",
"0.69556427",
"0.69316256",
"0.69316256",
"0.69316256",
"0.6926906",
"0.68830675",
"0.68830675",
"0.68746626",
"0.68705916",
"0.68638986",
"0.68575424",
"0.68575424",
"0.6857385",
"0.68493444",
"0.6846004",
"0.68330395",
"0.68330395",
"0.6830109",
... | 0.65765107 | 40 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.8401451",
"0.83834934",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.83464265",
"0.83455426",
"0.83455426",
"0.83455426",
"0.83455426",
"0.8345542... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.84009135",
"0.83839273",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.83473957",
"0.834622",
"0.834622",
"0.834622",
"0.834622",
"0.834622",
"0.... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.8401451",
"0.83834934",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.83464265",
"0.83455426",
"0.83455426",
"0.83455426",
"0.83455426",
"0.8345542... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.84010684",
"0.8383534",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8346675",
"0.8345806",
"0.8345806",
"0.8345806",
"0.8345806",
"0.8345806",
... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.8401451",
"0.83834934",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.83464265",
"0.83455426",
"0.83455426",
"0.83455426",
"0.83455426",
"0.8345542... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.84009135",
"0.83839273",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.8361698",
"0.83473957",
"0.834622",
"0.834622",
"0.834622",
"0.834622",
"0.834622",
"0.... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.8401451",
"0.83834934",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.8361363",
"0.83464265",
"0.83455426",
"0.83455426",
"0.83455426",
"0.83455426",
"0.8345542... | 0.0 | -1 |
String representation of this class. | def __str__(self):
return self.message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.84010684",
"0.8383534",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8361253",
"0.8346675",
"0.8345806",
"0.8345806",
"0.8345806",
"0.8345806",
"0.8345806",
... | 0.0 | -1 |
Sets the learning rate | def adjust_learning_rate(optimizer, gamma, epoch, step_index, iteration, epoch_size):
if epoch < 0:
lr = 1e-6 + (args.lr - 1e-6) * iteration / (epoch_size * 5)
else:
lr = args.lr * (gamma ** (step_index))
for param_group in optimizer.param_groups:
param_group['lr'] = lr
return lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.8623272",
"0.76981455",
"0.7697208",
"0.7697208",
"0.7636927",
"0.758479",
"0.7572249",
"0.7514606",
"0.7490861",
"0.74744666",
"0.74288964",
"0.7413075",
"0.739503",
"0.73916996",
"0.73894364",
"0.73817927",
"0.73783433",
"0.7377333",
"0.7363047",
"0.7362884",
"0.7362884"... | 0.0 | -1 |
Returns all birthday entries for a specific date or chat. Accepts date string as 'DDMM' or chat object. | def get_birthdays(self, date=None, chat=None):
# kind of hacky and not really universal at the moment
if date:
self.cursor.execute("""
SELECT * from birthday
WHERE substr(date,1,5)=?
""", (date,))
elif chat:
self.cursor.execute(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_birthday_reminders(self):\n try:\n results = self.graph.request(\"me/friends\",\n args={'fields': 'id,name,birthday'})\n except facebook.GraphAPIError:\n response = (\"I have not been authorized to query your Facebook. If you \" +\... | [
"0.674992",
"0.6695634",
"0.648888",
"0.5909184",
"0.5858932",
"0.5635574",
"0.5462768",
"0.5436349",
"0.54109836",
"0.54015756",
"0.5251594",
"0.5232925",
"0.51951206",
"0.5182736",
"0.51108915",
"0.5102773",
"0.50579673",
"0.50461614",
"0.5041468",
"0.50223047",
"0.50222456... | 0.8395756 | 0 |
Return the angular distance between this star and the one given as parameter. | def get_distance(self, star):
if self.centroid == star.centroid:
print("distance for same star")
return 0
unitary_a = self.get_unitary_vector()
unitary_b = star.get_unitary_vector()
dab = math.degrees(math.acos(unitary_a[0] * unitary_b[0] +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angular_distance(self, z):\n\n return self.proper_distance(z) / (1 + z)",
"def get_distance(self, star):\n if self == star:\n return 0\n\n a_car = self.get_cartesian_coords()\n b_car = star.get_cartesian_coords()\n dab = math.degrees(math.acos(a_car[0] * b_car[0]... | [
"0.69820136",
"0.6947291",
"0.67347693",
"0.6252374",
"0.6228162",
"0.62202084",
"0.6197052",
"0.60835147",
"0.60314506",
"0.5926111",
"0.5915784",
"0.5906819",
"0.5871798",
"0.5823697",
"0.5815515",
"0.5809056",
"0.5768312",
"0.5768312",
"0.5768312",
"0.5768312",
"0.5747347"... | 0.6827997 | 2 |
Load an image from a path and resize it. | def load_image(path, image_size, num_channels, interpolation,
smart_resize=False):
img = io_ops.read_file(path)
img = image_ops.decode_image(
img, channels=num_channels, expand_animations=False)
if smart_resize:
img = keras_image_ops.smart_resize(img, image_size,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_image(path):\r\n image = Image.open(path)\r\n size = image.size\r\n \r\n image = image.resize((550,550), Image.ANTIALIAS)\r\n# image = image.thumbnail((200,200), Image.ANTIALIAS)\r\n return image",
"def load_image(image_path, resize_shape=None):\n\n ... | [
"0.78586197",
"0.76438546",
"0.75304145",
"0.7317215",
"0.71766394",
"0.7134615",
"0.7098634",
"0.70947665",
"0.7058047",
"0.6977929",
"0.69719833",
"0.69345456",
"0.6893484",
"0.6774576",
"0.6763188",
"0.6752307",
"0.6751657",
"0.6724555",
"0.67214245",
"0.6672323",
"0.66650... | 0.6895179 | 12 |
Returns True if the list is currently sorted in strictly increasing order. Returns False otherwise | def is_increasing(data):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted_list(list_):\n prev = -1\n for item in list_:\n if item < prev:\n return False\n prev = item\n return True",
"def is_sorted(self):\n previous = 0 # Setting to 0 shouldn't be an issue aslong as MIN_VALUE is at least 0\n for value in self.data:\n ... | [
"0.83735055",
"0.8179466",
"0.78771746",
"0.7782561",
"0.7779171",
"0.7692661",
"0.7650377",
"0.75622493",
"0.75263625",
"0.75249934",
"0.75171953",
"0.748978",
"0.747037",
"0.74076605",
"0.7394759",
"0.73632306",
"0.7341124",
"0.7259062",
"0.7213577",
"0.72031164",
"0.719229... | 0.5676924 | 80 |
Setup the queue on RabbitMQ by invoking the Queue.Declare RPC command. When it is complete, the on_queue_declareok method will be invoked by pika. | def setup_queue(self, method_frame):
logger.info('Declaring queue %s', self.queue_name)
# self._channel.queue_declare(self.on_queue_declareok, queue_name)
self._channel.queue_declare(self.on_queue_declareok, exclusive=False, durable=True, queue=self.queue_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_queue(self):\n self.logger.info('declaring queue %s', self.queue)\n if self.otq:\n self._channel.queue_declare(self.on_queue_declareok, self.queue, auto_delete=True)\n else:\n self._channel.queue_declare(self.on_queue_declareok, self.queue)",
"def declare_queu... | [
"0.82787967",
"0.8206529",
"0.7809811",
"0.7621755",
"0.7539728",
"0.7380336",
"0.73658395",
"0.7231855",
"0.72157735",
"0.7107892",
"0.69160116",
"0.6913928",
"0.68992496",
"0.6769969",
"0.6728639",
"0.66872275",
"0.66815084",
"0.6675327",
"0.66608167",
"0.66070664",
"0.6508... | 0.81290513 | 2 |
Closes the connection again. | def close(self):
self.connection.close()
print("Connection on port " + str(self.port) + " closed.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")",
"def close(self): \n\t\tself.connection = None",
"def close_connection(self):\n if not self.is_open():\n return\n if self._active_result is not None:\n self._active_re... | [
"0.7716956",
"0.7648268",
"0.76419955",
"0.76137185",
"0.7612818",
"0.7609557",
"0.7593152",
"0.7589735",
"0.7582936",
"0.7582936",
"0.757624",
"0.754702",
"0.75363714",
"0.75351745",
"0.7518304",
"0.75135535",
"0.74926764",
"0.74926764",
"0.74926764",
"0.74926764",
"0.749267... | 0.72828484 | 39 |
Returns the appropriate character for the desired valve position. | def switch_valve(self, valve_position):
if valve_position == "inlet":
return inlet
elif valve_position == "outlet":
return outlet
else:
pass # todo: error handling | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_char(self):\r\n self._i += 1\r\n if self._i < len(self._text):\r\n self._char = self._text[self._i]\r\n else:\r\n self._char = -1",
"def _current_char(self):\r\n\r\n return self._input_string[self._index]",
"def character(index):\n # Default: ac... | [
"0.7000783",
"0.6729816",
"0.6713614",
"0.6597136",
"0.65439016",
"0.64704835",
"0.64535415",
"0.6450054",
"0.6446525",
"0.64105177",
"0.6383865",
"0.63638085",
"0.63601667",
"0.6314862",
"0.63055634",
"0.6250241",
"0.6206843",
"0.61838543",
"0.6183132",
"0.6182026",
"0.61789... | 0.0 | -1 |
Add the given Component as a subcomponent. | def add(self, comp):
if comp:
if isinstance(comp, Component):
comp.container = self
else:
for item in comp:
self.add(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, component) -> None:\n pass",
"def appendcomp(self, componentname, component):\n self.components.append(componentname, component)\n return component",
"def add_component(self, lib_component):\n comp_name = lib_component.name\n try:\n comp = self.__comp... | [
"0.7278566",
"0.668905",
"0.66550744",
"0.6509693",
"0.63608325",
"0.631722",
"0.6027435",
"0.6012407",
"0.5844365",
"0.5800785",
"0.5753853",
"0.5736182",
"0.57015187",
"0.5692067",
"0.5673304",
"0.56556356",
"0.56500447",
"0.5617432",
"0.56027126",
"0.55951357",
"0.5556353"... | 0.639814 | 4 |
Adjust the size of the component so that it neatly encloses its contents. If padding is specified, it specifies the amount of space to leave at right and bottom, otherwise the minimum distance from the left and top sides to the nearest components is used. | def shrink_wrap(self, padding = None):
contents = self.contents
if not contents:
return
if padding:
hpad, vpad = padding
else:
hpad = min([item.left for item in contents])
vpad = min([item.top for item in contents])
rights = [item.right for item in contents]
bottoms = [item.bottom for item in co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_padding(self, prop=1):\n self.add_spacer(0)\n self.formLayout.setRowStretch(self.formLayout.rowCount(),prop)",
"def padding_width(self):\n ...",
"def SetToolBorderPadding(self, padding):\r\n\r\n self._tool_border_padding = padding",
"def right_padding_width(self):\n ... | [
"0.6551818",
"0.6291356",
"0.586527",
"0.58604884",
"0.56960994",
"0.56907576",
"0.5603756",
"0.56033325",
"0.56028914",
"0.5577688",
"0.557505",
"0.5537319",
"0.5514219",
"0.5511577",
"0.548995",
"0.5390627",
"0.5384272",
"0.5377189",
"0.5358484",
"0.5352065",
"0.53373724",
... | 0.6708265 | 0 |
Construct linear reward model for `obs_dim`dimensional observation space. Initial values are generated from given seed (int or None). | def __init__(self, obs_dim, *, seed=None):
if seed is not None:
rng = np.random.RandomState(seed)
else:
rng = np.random
self._weights = rng.randn(obs_dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, obs_dim, *, seed=None):\n # TODO: apply jax.jit() to everything in sight\n net_init, self._net_apply = self.make_stax_model()\n if seed is None:\n # oh well\n seed = np.random.randint((1 << 63) - 1)\n rng = jrandom.PRNGKey(seed)\n out_shap... | [
"0.625324",
"0.5905843",
"0.58319336",
"0.5701086",
"0.56973547",
"0.56217533",
"0.55938876",
"0.5567075",
"0.5541123",
"0.5503761",
"0.54974747",
"0.54814553",
"0.5446507",
"0.5427025",
"0.5409548",
"0.5407711",
"0.54066133",
"0.5400923",
"0.5390077",
"0.5389272",
"0.5384811... | 0.66119426 | 0 |
Internal setup for Jaxbased reward models. Initialises reward model using given seed & input size (`obs_dim`). | def __init__(self, obs_dim, *, seed=None):
# TODO: apply jax.jit() to everything in sight
net_init, self._net_apply = self.make_stax_model()
if seed is None:
# oh well
seed = np.random.randint((1 << 63) - 1)
rng = jrandom.PRNGKey(seed)
out_shape, self._net... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, obs_dim, *, seed=None):\n if seed is not None:\n rng = np.random.RandomState(seed)\n else:\n rng = np.random\n self._weights = rng.randn(obs_dim)",
"def __init__(self, action_size, state_size, buffer_size, batch_size, seed, device):\n self.acti... | [
"0.697236",
"0.6703998",
"0.66627324",
"0.6559021",
"0.6543022",
"0.6523261",
"0.65087086",
"0.6412598",
"0.6403606",
"0.6389871",
"0.6388692",
"0.63532573",
"0.6351084",
"0.63385004",
"0.6329984",
"0.63294625",
"0.62778604",
"0.62778604",
"0.626282",
"0.6259645",
"0.6256537"... | 0.71915954 | 0 |
Constructs a batched dataset with three datapoints. | def _create_dataset(batch_size):
ds = collections.OrderedDict([('x', [[-1.0, -1.0], [1.0, 1.0], [1.0, 1.0]]),
('y', [[1.0], [1.0], [1.0]])])
# Note: batching is needed here as it creates the required batch dimension.
# The batch size can be re-set (by `unbatch()` first) in personal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.6698367",
"0.6514954",
"0.6432409",
"0.62055844",
"0.6189888",
"0.59918076",
"0.5920256",
"0.58941036",
"0.5859279",
"0.58535546",
"0.58470863",
"0.5829169",
"0.58206713",
"0.5775675",
"0.5767169",
"0.5742561",
"0.57380736",
"0.57211995",
"0.5712441",
"0.57095045",
"0.5708... | 0.63762885 | 3 |
Creates the model weights with all zeros. | def _create_zero_model_weights(model_fn):
dummy_model = model_utils.enhance(model_fn())
return tf.nest.map_structure(tf.zeros_like, dummy_model.weights) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeWeightsToZero(self):\n\t\t## YOUR CODE BELOW\n\t\t\n\t\tutil.raiseNotDefined()\n\t\treturn",
"def init_weights(model):\n ...",
"def _initialize_weights(self):\n pass",
"def set_to_zero_model_weights(model):\n\n for layer_weigths in model.parameters():\n layer_weigths.dat... | [
"0.79767513",
"0.7871182",
"0.76376677",
"0.76313424",
"0.7582489",
"0.7496298",
"0.7493921",
"0.7493921",
"0.7493921",
"0.74724233",
"0.7463922",
"0.73075",
"0.72871643",
"0.72871643",
"0.728702",
"0.72720575",
"0.7210453",
"0.71830904",
"0.7178007",
"0.7126493",
"0.7109071"... | 0.7967307 | 1 |
Given a point, returns the lnorm | def norm(point, l=2):
#test if l is infinite:
if l == float('inf'):
return max(point)
else:
return (sum([v**l for v in point]))**(1/l) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm(point):\n return np.sqrt(norm2(point))",
"def get_norm(self, l):\n return self._W.norm(l)",
"def get_norm(self, l):\n return self._W.norm(l)",
"def get_normal_dist(line, point):\n \n # Rotate: \n x_rot = np.cos(line[1])*point[0] + np.sin(line[1])*point[1]\n \n # Norma... | [
"0.78783965",
"0.7098674",
"0.7098674",
"0.6817137",
"0.6807478",
"0.67614913",
"0.6710842",
"0.66709477",
"0.66298044",
"0.6625851",
"0.6625851",
"0.6625851",
"0.6614376",
"0.65783465",
"0.6575125",
"0.6536513",
"0.6532951",
"0.6521047",
"0.6500374",
"0.6465336",
"0.64568245... | 0.8095473 | 0 |
Given two points and an L, returns the ldistance between the two points. | def distance(point1, point2, l=2):
d = [point1.point[i] - point2.point[i] for i in range(len(point1.point))]
return norm(d, l) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_distance(x1, x2, y1, y2):\n return ((x1-y1)**2 + (x2-y2)**2)**0.5",
"def distance_l1(p1, p2):\n return abs(x(p1) - x(p2)) + abs(y(p1) - y(p2))",
"def distancetoline(p, l1, l2):\n vx = l1.x-p.x \n vy = l1.y-p.y\n ux = l2.x-l1.x\n uy = l2.y-l1.y\n\n length = ux*ux+uy*uy;\n\n det = (-vx*ux)... | [
"0.74487334",
"0.73953706",
"0.7280281",
"0.7040578",
"0.70286685",
"0.7015547",
"0.701023",
"0.68182707",
"0.6712487",
"0.6709707",
"0.66391754",
"0.66154474",
"0.6585054",
"0.65714926",
"0.6563884",
"0.65156823",
"0.6451084",
"0.64415544",
"0.64415544",
"0.6436673",
"0.6425... | 0.8236655 | 0 |
Validate a required string | def validate_file(inp, name=''):
validate_string(inp, name)
assert (os.path.exists(inp)), name + ' settings with value ' + inp + ' should exist.' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_str(self):\n try:\n lowercase_validator('hg213i75%^&$efg')\n except ValidationError:\n self.fail('String raised ValidationError unexpectedly')",
"def _validate_str(s):\n if not isinstance(s, str):\n raise TypeError(\"Expected string, got {}\".format(ty... | [
"0.7489743",
"0.7307142",
"0.72767013",
"0.72713035",
"0.72216856",
"0.72031057",
"0.7143371",
"0.71347445",
"0.6986766",
"0.69474846",
"0.6829257",
"0.68204063",
"0.6793516",
"0.6787318",
"0.6786533",
"0.6779979",
"0.6766918",
"0.6764867",
"0.66984344",
"0.6664439",
"0.66141... | 0.0 | -1 |
This function checks whether or not an hdf5 array is of expected shape | def check_array_shape(logger, arr, name, expected_shape):
shape = arr.shape
check_array_ndim(arr, name, len(expected_shape))
for i in range(len(shape)):
check_array_dim(logger, arr, name, expected_shape[i], i)
return arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_array(self):\n htype = h5t.py_create(('f',(2,2)))\n self.assertIsInstance(htype, h5t.TypeArrayID)\n self.assertEqual(htype.get_array_dims(), (2,2))",
"def _is_1d_harray(arr):\r\n return len(arr.shape) < 2 or arr.shape[0] == 1",
"def _check_shape(input_shape):\n msg = ('I... | [
"0.69791967",
"0.69722676",
"0.68591064",
"0.67562836",
"0.65660244",
"0.6543666",
"0.6451869",
"0.6444119",
"0.63485813",
"0.631514",
"0.6293247",
"0.627974",
"0.6213141",
"0.621012",
"0.62068224",
"0.61876833",
"0.6182775",
"0.6155193",
"0.6117846",
"0.60671276",
"0.6038974... | 0.6024817 | 21 |
Returns a function that maps each index in 0, 1, ..., n1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name. | def get_cmap(n, name='Paired'):
return plt.cm.get_cmap(name, n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name=\"hsv\"):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name=\"hsv\")... | [
"0.70274997",
"0.69777095",
"0.69777095",
"0.6929636",
"0.6929636",
"0.6929636",
"0.6722068",
"0.65804446",
"0.65117544",
"0.64281064",
"0.6359997",
"0.6328479",
"0.6287425",
"0.6182517",
"0.6140233",
"0.6113617",
"0.6093848",
"0.6043708",
"0.6020416",
"0.599198",
"0.59604865... | 0.6946189 | 3 |
Compute the median expression entropy for each nodegroup. | def aga_expression_entropies(adata):
from scipy.stats import entropy
groups_order, groups_masks = utils.select_groups(adata, smp='aga_groups')
entropies = []
for mask in groups_masks:
X_mask = adata.X[mask]
x_median = np.median(X_mask, axis=0)
x_probs = (x_median - np.min(x_media... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(group_counts):\n total = sum(group_counts)\n entro = 0\n for item_count in group_counts:\n entro += item_entropy(item_count, total)\n return entro",
"def ensemble_entropy(self):\n return transition_matrices.entropy_measure(self.ensemble_transition_matrix)",
"def calc_entro... | [
"0.658507",
"0.5736451",
"0.57284784",
"0.5708104",
"0.56793267",
"0.5536836",
"0.550967",
"0.55060744",
"0.54905754",
"0.5478489",
"0.5465526",
"0.5432973",
"0.5386437",
"0.5385966",
"0.5360683",
"0.5348236",
"0.53468496",
"0.5310411",
"0.52956",
"0.52874714",
"0.5282013",
... | 0.57676446 | 1 |
Sets the org_name of this Body66. | def org_name(self, org_name):
self._org_name = org_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_id(self, org_id):\n\n self._org_id = org_id",
"def set_name(self, room_name):\n self.name = room_name",
"def __set_name(self, name):\r\n\t\tself.__name = name\r\n\t\tself._window.chat_panel.place_name = name\r\n\t\tself.encode_message(action=\"NO\", selected_name=name)",
"def set_name(s... | [
"0.643787",
"0.59833145",
"0.59335166",
"0.57488096",
"0.5701006",
"0.56367934",
"0.5599724",
"0.5570718",
"0.55199504",
"0.551628",
"0.551628",
"0.5512924",
"0.55125016",
"0.55018944",
"0.5494965",
"0.548489",
"0.5480857",
"0.5470007",
"0.54664814",
"0.54491025",
"0.5425089"... | 0.79243827 | 1 |
Sets the primary_email of this Body66. | def primary_email(self, primary_email):
self._primary_email = primary_email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_contact_email(self, primary_contact_email):\n\n self._primary_contact_email = primary_contact_email",
"def primary_contact_phone(self, primary_contact_phone):\n\n self._primary_contact_phone = primary_contact_phone",
"def get_primary_email(self):\n return self.associated_emails... | [
"0.8063543",
"0.66430384",
"0.6357451",
"0.61875427",
"0.60424984",
"0.6042074",
"0.5989163",
"0.5903577",
"0.58055574",
"0.5782031",
"0.5749868",
"0.5737479",
"0.573552",
"0.573552",
"0.573552",
"0.573552",
"0.573552",
"0.573552",
"0.573552",
"0.573552",
"0.573552",
"0.573... | 0.83779037 | 0 |
Sets the production of this Body66. | def production(self, production):
self._production = production | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amp_body(self, val: str):\n self._amp_body = val",
"def product(self, product):\n self._product = product",
"def _setbeneficiary_customer_59F(self, val):\n self.swift_obj.BeneficiaryCustomer_F = val\n self.swift_obj.BeneficiaryCustomer_F.swiftTag = '59F'",
"def setPowerFromDen... | [
"0.51815313",
"0.5153395",
"0.5114669",
"0.50589466",
"0.5042398",
"0.5010118",
"0.5005076",
"0.5005076",
"0.49976757",
"0.49666646",
"0.49221417",
"0.4907817",
"0.4906579",
"0.48988795",
"0.48988795",
"0.48988795",
"0.48988795",
"0.48594123",
"0.48560992",
"0.48514184",
"0.4... | 0.6551189 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Body66):
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.80891633",
"0.80891633",
"0.8055254",
"0.7983334",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
... | 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 |
Initialises a new 'Transaction' instance. | def __init__(self, donorReference='', kind="other", receiverReference='', serviceUnitsError=0.0, diverseReference='', serviceUnitsEnergy=0.0, reversedId='', PricingStructure=None, line=None, UserAttributes=None, AuxiliaryAccount=None, VendorShift=None, Receipt=None, Meter=None, CustomerAccount=None, CashierShift=None, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction(self):\n return Transaction(self)",
"def transaction(self, *args, **kwargs):\n # Build database transaction class\n class DBTransaction(BaseTransaction, self.__class__):\n pass\n return DBTransaction(self, *args, **kwargs)",
"def transaction(self, uuid):\r... | [
"0.7518132",
"0.7069632",
"0.6880315",
"0.66759294",
"0.6610979",
"0.65968335",
"0.6581705",
"0.6575061",
"0.6570488",
"0.6570031",
"0.6543345",
"0.6516487",
"0.64194316",
"0.6402135",
"0.6380142",
"0.63299614",
"0.6329482",
"0.6290477",
"0.62703407",
"0.62593484",
"0.6253577... | 0.0 | -1 |
Auxiliary account for this payment transaction. | def getAuxiliaryAccount(self):
return self._AuxiliaryAccount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account(self):\r\n return Account(self)",
"def account(self):\n return Account(self)",
"def get_temp_account(cls) -> \"Account\":\n if not hasattr(cls, \"_temp_account\"):\n cls._temp_account = Account.objects.get(name=\"temp\")\n return cls._temp_account",
"def get... | [
"0.62464386",
"0.6097026",
"0.604867",
"0.5980719",
"0.5868413",
"0.5861512",
"0.58483315",
"0.5818998",
"0.5818998",
"0.5711917",
"0.5655521",
"0.56423235",
"0.5629034",
"0.5590783",
"0.5544849",
"0.5522783",
"0.54884195",
"0.54542595",
"0.54363275",
"0.54363275",
"0.5395915... | 0.8345522 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues):
if not title:
if normalize:
title = 'Normalized confusion matrix'
else:
title = 'Confusion matrix,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194965",
"0.8095361",
"0.8029404",
"0.8019132",
"0.79937756",
"0.7991249",
"0.798065",
"0.7975405",
"0.79608935",
"0.79568267",
"0.79377085",
"0.79348165",
"0.7934456",
"0.79314065",
"0.7926248",
"0.79243755",
"0.79241306",
"0.7922902",
"0.79228246",
"0.792212",
"0.791808... | 0.0 | -1 |
Create invalid sell order. Insufficient shares on account | def test_invalid_sell_order(self):
_ = self.set_auth_token_header()
data = {
'stock': 'GOOG',
'quantity': 15,
'price': 1.25,
'order_type': 'SELL'
}
# Order create API
url = reverse('orders-list')
response = self.client.po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_buy_order(self):\n\n _ = self.set_auth_token_header()\n\n data = {\n 'stock': 'GOOG',\n 'quantity': 15,\n 'price': 1.25,\n 'order_type': 'BUY'\n }\n\n # Order create API\n url = reverse('orders-list')\n response ... | [
"0.731046",
"0.65683424",
"0.6562567",
"0.65225804",
"0.6458205",
"0.6296203",
"0.61694056",
"0.61680347",
"0.6095909",
"0.60935867",
"0.60671246",
"0.60550356",
"0.60343236",
"0.60288435",
"0.60091454",
"0.600204",
"0.5996069",
"0.59907347",
"0.59433997",
"0.5930718",
"0.592... | 0.7828949 | 0 |
Constructs an empty SkipiList. | def __init__(self):
self.head = None
self.tail = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty(cls, n):\n l1 = [None] * n\n return cls(l1)",
"def __init__(self):\r\n self._items = [[] for _ in range(20)]",
"def new_empty_ll():\n from linked_list import Linked_List\n this_empty_ll = Linked_List()\n return this_empty_ll",
"def __init__(self, list, store_none=True)... | [
"0.56931996",
"0.5646356",
"0.55736446",
"0.55551785",
"0.55479324",
"0.55299884",
"0.5525676",
"0.549734",
"0.541541",
"0.541541",
"0.5380281",
"0.53759134",
"0.53759134",
"0.53455114",
"0.53332925",
"0.5308",
"0.53043294",
"0.53029877",
"0.5272583",
"0.5269183",
"0.52501756... | 0.0 | -1 |
Return the status of the message. | def successful(self) -> bool:
return self._unparsed_response is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self.msg",
"def status_message(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"status_message\")",
"def status_message(self) -> str:\n return pulumi.get(self, \"status_message\")",
"def status(self):\n return STATUSES.get(self._mower_status,... | [
"0.8734268",
"0.7981881",
"0.7913678",
"0.76961005",
"0.76908225",
"0.74490684",
"0.74395376",
"0.7411409",
"0.7392006",
"0.7392006",
"0.7392006",
"0.7348421",
"0.73325247",
"0.73191434",
"0.73073566",
"0.7269592",
"0.72666997",
"0.72575957",
"0.7213303",
"0.7213303",
"0.7202... | 0.0 | -1 |
Initialize the Control response message. | def __init__(self, loop: AbstractEventLoop, response: bytes) -> None:
super().__init__(loop, response, ResponseMessageType.CONTROL) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, loop: AbstractEventLoop, response: bytes) -> None:\n super().__init__(loop, response, ResponseMessageType.AUTO_OFF)",
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(SetElectromotorsControlResponse, self).__init__(*args, **kwds)\n #message fields cannot be No... | [
"0.64077324",
"0.6328726",
"0.6320327",
"0.6307446",
"0.61867684",
"0.61498237",
"0.6050951",
"0.604248",
"0.60272056",
"0.59810376",
"0.5980768",
"0.59737444",
"0.59576327",
"0.5880851",
"0.57715845",
"0.5771365",
"0.576015",
"0.5686709",
"0.56684345",
"0.56485677",
"0.56238... | 0.7457604 | 0 |
Initialize the Set Name response message. | def __init__(self, loop: AbstractEventLoop, response: bytes) -> None:
super().__init__(loop, response, ResponseMessageType.UPDATE_NAME) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, PersonName):\r\n self.name = PersonName",
"def set_name(self, _name):\n self.name = _name",
"def setName(self, name):\n self.name = name",
"def setName(self, name):\n self.name = name",
"def setName(self, n... | [
"0.6840193",
"0.6686182",
"0.66768605",
"0.6644087",
"0.6644087",
"0.6644087",
"0.6644087",
"0.66216683",
"0.6620766",
"0.65824777",
"0.65824777",
"0.65799534",
"0.6523273",
"0.65147996",
"0.65147996",
"0.65147996",
"0.65147996",
"0.65147996",
"0.6452938",
"0.6444196",
"0.641... | 0.0 | -1 |
Initialize the Set Name response message. | def __init__(self, loop: AbstractEventLoop, response: bytes) -> None:
super().__init__(loop, response, ResponseMessageType.GET_SCHEDULES)
self._schedule_list = [] # type: List[SwitcherV2Schedule]
res = hexlify(response)
idx = res[90:-8].decode(ENCODING_CODEC)
# TODO schdule_det... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, PersonName):\r\n self.name = PersonName",
"def set_name(self, _name):\n self.name = _name",
"def setName(self, name):\n self.name = name",
"def setName(self, name):\n self.name = name",
"def setName(self, n... | [
"0.6840193",
"0.6686182",
"0.66768605",
"0.6644087",
"0.6644087",
"0.6644087",
"0.6644087",
"0.66216683",
"0.6620766",
"0.65824777",
"0.65824777",
"0.65799534",
"0.6523273",
"0.65147996",
"0.65147996",
"0.65147996",
"0.65147996",
"0.65147996",
"0.6452938",
"0.6444196",
"0.641... | 0.0 | -1 |
Return True if the move require updating the clusters. | def move_require_cluster_update(self, system_changes):
bin_changes = self.get_bin_changes(system_changes)
for k, v in bin_changes.items():
if self.bins[k] == 0 and v > 0:
# An empty bin becomes occupied
return True
elif v < 0 and abs(v) >=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_cluster_was_upgraded():\n return True if \"replaces\" in get_ocs_csv().get().get(\"spec\") else False",
"def has_moved(self):\n return self.move_count > 0",
"def needs_update(self) -> bool:\n return False",
"def ismoving(self):\n return not self.get_par(\"done_moving\")",
"... | [
"0.62536234",
"0.61956054",
"0.61750716",
"0.6097936",
"0.6011143",
"0.5954543",
"0.59472275",
"0.59016466",
"0.588481",
"0.58782333",
"0.58488405",
"0.5844969",
"0.58424366",
"0.5825943",
"0.5790977",
"0.57403874",
"0.5739159",
"0.5720136",
"0.57120806",
"0.57106143",
"0.569... | 0.6562794 | 0 |
Constructs a subclass compatible with the members of the CoarsenedTarget. | def for_targets(
union_membership: UnionMembership, component: CoarsenedTarget, resolve: CoursierResolveKey
) -> ClasspathEntryRequest:
compatible = []
impls = union_membership.get(ClasspathEntryRequest)
for impl in impls:
if all(any(fs.is_applicable(t) for fs in impl.fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create(self, target_class, *args, **kw):\n\n raise NotImplementedError",
"def __new__(cls, name, bases, attrs):\n super_new = super(ClientMeta, cls).__new__\n\n # Create the class.\n module = attrs.pop('__module__')\n base_attrs = {'__module__': module,\n ... | [
"0.6350745",
"0.6289258",
"0.6102257",
"0.6032093",
"0.6008244",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"0.5794509",
"... | 0.0 | -1 |
Mock setting up a config entry. | def mock_setup_entry() -> Generator[None, None, None]:
with patch(
"homeassistant.components.open_meteo.async_setup_entry", return_value=True
):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config_entry() -> MockConfigEntry:\n return MockConfigEntry(\n domain=DOMAIN,\n title=DEFAULT_TITLE,\n unique_id=DEFAULT_UNIQUE_ID,\n data=CONFIG,\n options=None,\n )",
"def mock_config_entry() -> MockConfigEntry:\n return MockConfigEntry(\n title=\"Hom... | [
"0.8142725",
"0.7924758",
"0.785828",
"0.7342885",
"0.70208496",
"0.69166386",
"0.6822786",
"0.6820016",
"0.67610127",
"0.6749247",
"0.67256975",
"0.6698294",
"0.66255873",
"0.6566723",
"0.6561804",
"0.6537094",
"0.65083903",
"0.6501225",
"0.64746106",
"0.6447488",
"0.6447086... | 0.0 | -1 |
Return a mocked OpenMeteo client. | def mock_open_meteo(request: pytest.FixtureRequest) -> Generator[None, MagicMock, None]:
fixture: str = "forecast.json"
if hasattr(request, "param") and request.param:
fixture = request.param
forecast = Forecast.parse_raw(load_fixture(fixture, DOMAIN))
with patch(
"homeassistant.compone... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_engine_client(decoy: Decoy) -> EngineClient:\n return decoy.mock(cls=EngineClient)",
"def mock_moira_client(mocker):\n return mocker.patch(\"moira_lists.moira_api.get_moira_client\", autospec=True)",
"def mock_client():\n client = PolicyComputeEngine(url=\"https://127.0.0.1:8443\", port=8443,... | [
"0.7345737",
"0.6855822",
"0.67067605",
"0.66853005",
"0.64904493",
"0.6426035",
"0.6364616",
"0.6348467",
"0.6223075",
"0.62028974",
"0.61708456",
"0.6145244",
"0.61199665",
"0.6087985",
"0.6062801",
"0.6054867",
"0.5995941",
"0.5993895",
"0.596293",
"0.59628266",
"0.595292"... | 0.5933648 | 21 |
Yield successive nsized chunks from list. | def chunk(list, chunksize):
for i in range(0, len(list), chunksize):
yield list[i:i + chunksize] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def _chunks(l, n)... | [
"0.797306",
"0.78654736",
"0.78504497",
"0.7844687",
"0.7844551",
"0.7844551",
"0.78411376",
"0.7835319",
"0.78306717",
"0.78306717",
"0.77592033",
"0.7755597",
"0.7731902",
"0.7698615",
"0.76923877",
"0.76923877",
"0.76923877",
"0.76923877",
"0.76923877",
"0.76906675",
"0.76... | 0.0 | -1 |
Get a bucket name that probably does not exist. We make every attempt to use a unique random prefix, so if a bucket by this name happens to exist, it's ok if tests give false negatives. | def get_new_bucket_name():
name = '{prefix}{num}'.format(
prefix=prefix,
num=next(bucket_counter),
)
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attemptBucketCreate(self, bucketName) -> str:\n for i in range(10):\n suffix = randint(1000, 9999)\n suffixedBucketName = '{}-{}'.format(bucketName, suffix)\n try:\n self.client.create_bucket(\n Bucket=suffixedBucketName,\n ... | [
"0.7213397",
"0.6925773",
"0.66932607",
"0.6639567",
"0.66090536",
"0.6522992",
"0.6522992",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.65090954",
"0.6487234",
"0.64224625",
"0.64224625",
"0... | 0.69408536 | 1 |
Checks if two positions are the same, up to a lattice vector. | def _is_same_position(pos1, pos2, position_tolerance):
return np.isclose(_pos_distance(pos1, pos2), 0, atol=position_tolerance) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_position_for_same_occupancy(self, position1, position2):\n return self.board.board[position1] == self.board.board[position2]",
"def check_place(self, positions):\n return self.size == len(set(positions[i] + i for i in range(self.size))) == len(\n set(positions[i] - i for i in r... | [
"0.6998616",
"0.66790015",
"0.6594393",
"0.6536093",
"0.64687204",
"0.6423734",
"0.64187104",
"0.6287759",
"0.6261422",
"0.62346756",
"0.6230324",
"0.6225282",
"0.6211702",
"0.6198809",
"0.61520267",
"0.61507636",
"0.6112254",
"0.60760283",
"0.60342854",
"0.6014663",
"0.60086... | 0.67409813 | 1 |
Returns the periodic distance between two positions. | def _pos_distance(pos1, pos2):
delta = np.array(pos1).astype(float).flatten(
) - np.array(pos2).astype(float).flatten()
delta %= 1
return la.norm(np.array(np.minimum(delta, 1 - delta)).astype(float)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(cls, atom_1, atom_2):\n\t\t\n\t\treturn np.linalg.norm((atom_1-atom_2).atom_loc)",
"def distance(p1, p2):\r\n return math.hypot(p1[0] - p2[0], p1[1] - p2[1])",
"def distance(pos1, pos2):\n return math.sqrt((pos1[0] - pos2[0])**2. + (pos1[1] - pos2[1])**2.)",
"def getDistance(self,p1,p2... | [
"0.66207093",
"0.6602832",
"0.6588054",
"0.654874",
"0.6505045",
"0.64960283",
"0.64951843",
"0.6489827",
"0.6473115",
"0.64622736",
"0.6458235",
"0.64565307",
"0.6449535",
"0.6445451",
"0.6443395",
"0.64140576",
"0.64023924",
"0.6382859",
"0.6364797",
"0.63613594",
"0.633651... | 0.6824157 | 0 |
Get a sublogger for ``name``. The returned logger instance will be a childlogger of your librarywide main logger. Parts of the library can use this to separate their log output. | def get(name):
log = logging.getLogger("%s.%s" % (ROOT_NAME, name))
return log | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logger(name):\n # type: (str) -> Logger\n return logging.getLogger(name)",
"def get_logger(name):\n return logging.getLogger(name)",
"def get_logger(name):\n log = logging.getLogger(name)\n # we don't set the logger's level to inherit from the parent logger.\n if log.handlers:\n ... | [
"0.68885326",
"0.68759483",
"0.68511826",
"0.6837787",
"0.6831576",
"0.6825399",
"0.68241847",
"0.6820039",
"0.6726255",
"0.6607911",
"0.6568345",
"0.6530804",
"0.64992136",
"0.6478987",
"0.6477124",
"0.6433103",
"0.6419281",
"0.6415663",
"0.64155984",
"0.639293",
"0.63736093... | 0.65612906 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.