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 body of the response as a string. | def body(self):
return ''.join(list(self.iter)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body(self):\n return self._response and self._response.body or \"\"",
"def text_body(response: tornado.httpclient.HTTPResponse) -> str:\n return response.body.decode(encoding(response))",
"def body(self) -> str:\n return self.data['body']",
"def body(self) -> str:\n return pulumi.... | [
"0.77618974",
"0.7634755",
"0.71462876",
"0.71328974",
"0.676726",
"0.6609478",
"0.65844536",
"0.65267783",
"0.6523355",
"0.65051955",
"0.64888895",
"0.64888895",
"0.6477859",
"0.6477859",
"0.6472144",
"0.64687914",
"0.6436542",
"0.6426441",
"0.6421984",
"0.6398593",
"0.63941... | 0.56295437 | 87 |
Rounds of a number to the nearest multiple of 60. | def round_to_nearest_60(x):
return int(60 * round(float(x) / 60)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _round(self, x):\n return x - x % self.minutes_per_step",
"def roundSeconds(seconds):\n\n minutes = seconds / 60\n remainder = seconds % 60\n\n if(remainder >= 30):\n minutes += 1\n\n return minutes * 60",
"def round_minutes(minutes):\n i = math.floor(minutes / 15)\n under, ... | [
"0.73490435",
"0.6938613",
"0.6627475",
"0.6536494",
"0.6517901",
"0.6497273",
"0.6484199",
"0.6470891",
"0.6287086",
"0.62870663",
"0.6285944",
"0.6254145",
"0.62485313",
"0.6243248",
"0.62205416",
"0.6220222",
"0.61582285",
"0.6157152",
"0.6157001",
"0.615248",
"0.6063034",... | 0.80421484 | 0 |
Convert [x1 y1 x2 y2] box format to [x1 y1 w h] format. | def xyxy_to_xywh(xyxy):
if isinstance(xyxy, (list, tuple)):
# Single box given as a list of coordinates
assert len(xyxy) == 4
x1, y1 = xyxy[0], xyxy[1]
w = xyxy[2] - x1 + 1
h = xyxy[3] - y1 + 1
return (x1, y1, w, h)
elif isinstance(xyxy, np.ndarray):
# Mul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert(size, box):\n # TODO rewrite box to be [TL, BR] coordinates\n #pdb.set_trace()\n dw = 1./size[0]\n dh = 1./size[1]\n x = (box[0] + box[1])/2.0\n y = (box[2] + box[3])/2.0\n w = box[1] - box[0]\n h = box[3] - box[2]\n x = x*dw\n w = w*dw\n y = y*dh\n h = h*dh\n ret... | [
"0.74933684",
"0.66450065",
"0.64518017",
"0.63903135",
"0.629781",
"0.62881047",
"0.6257044",
"0.6185842",
"0.6155915",
"0.60946023",
"0.60437065",
"0.60348773",
"0.60308635",
"0.6010959",
"0.5949661",
"0.594619",
"0.59180725",
"0.587396",
"0.586395",
"0.5845732",
"0.5829519... | 0.5727566 | 35 |
Euclidean distance b/w two points. | def l2_distance(self, x, y):
if len(x) != len(y):
raise ValueError("Dimensions of x {} and y {} are not the same".format(len(x), len(y)))
dist = 0.0
for idx in range(len(x)):
dist += (x[idx] - y[idx]) ** 2
return math.sqrt(dist) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(point1, point2):\n\n return math.sqrt(sum([(x - y) ** 2 for x, y in zip(point1, point2)]))",
"def euclidean_distance(point_one, point_two):\n return np.linalg.norm(point_one-point_two)",
"def euclidean_distance(a, b):\n return np.linalg.norm(a - b)",
"def euclidean_distance(po... | [
"0.8306667",
"0.8208776",
"0.8173411",
"0.8147561",
"0.8137375",
"0.8108716",
"0.8102029",
"0.8086302",
"0.8074275",
"0.8057225",
"0.802979",
"0.8020551",
"0.800423",
"0.79799306",
"0.7971197",
"0.79606545",
"0.79473853",
"0.79185575",
"0.79127175",
"0.7846296",
"0.78451514",... | 0.0 | -1 |
verify that the POST has the request user as the owner of the class | def create(self, request, *args, **kwargs):
result = Class.objects.filter(id = request.data.get("school_class",)).filter(instructor_id = request.user.id)
if result.count() == 1:
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_owner(self):\n self.client.force_authenticate(self.user)\n response = self.post(content='foo')\n self.assertEqual(response.data['owner'], self.user.pk)",
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n ret... | [
"0.69587564",
"0.6736528",
"0.6736528",
"0.6736528",
"0.67143756",
"0.6695397",
"0.6695397",
"0.63899755",
"0.6173422",
"0.6152934",
"0.61240697",
"0.61240697",
"0.6120112",
"0.6100327",
"0.6088725",
"0.6053204",
"0.60459524",
"0.60432637",
"0.6041242",
"0.6036626",
"0.603034... | 0.0 | -1 |
Returns a list of bits for a char. | def bitlist(n):
return [n >> i & 1 for i in range(7,-1,-1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _char2bits(c):\r\n return \"{0:05b}\".format(CHARMAP[c])",
"def _string_to_bitlist(self, data):\n l = len(data) * 8\n result = [0] * l\n pos = 0\n for ch in data:\n i = 7\n while i >= 0:\n # bit-wise operation\n if ch & (1 << ... | [
"0.7356296",
"0.7175737",
"0.71516675",
"0.70587236",
"0.6904226",
"0.68122125",
"0.6764881",
"0.6738341",
"0.65936065",
"0.65351194",
"0.64686394",
"0.64274824",
"0.6386062",
"0.631148",
"0.6241721",
"0.6241721",
"0.61806905",
"0.6078682",
"0.60100955",
"0.60088176",
"0.5962... | 0.65362424 | 9 |
Tests model as units are randomly ablated (zeroed out or noise added) Units are ablated in random order from a specified set of layers. Ablation is achieved by setting a unit's input weights and bias to zero. | def ablation_test(model, data_loader, criterion, params_path,
ablation_data={}, device='cpu',
n_repetitions=10, data_fraction=1, ablation_type='zero',
ablation_steps=None, noise_scale=[-1.5, 1]):
# Paths
path_models_and_targets = params_path + 'models_and_ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_torch_train_original_layer_multiple(self):\n model = Sequential(\n self.get_digital_layer(in_channels=2, out_channels=2, kernel_size=4, padding=2),\n self.get_digital_layer(in_channels=2, out_channels=3, kernel_size=4, padding=2)\n )\n\n analog_model = Sequential... | [
"0.641168",
"0.6408439",
"0.6408007",
"0.6242119",
"0.6164506",
"0.61573505",
"0.61554193",
"0.5991504",
"0.59580946",
"0.5953665",
"0.5951885",
"0.5899616",
"0.58986026",
"0.58260876",
"0.58205086",
"0.57409745",
"0.57149845",
"0.5707362",
"0.56824404",
"0.5678851",
"0.56163... | 0.5900992 | 11 |
The derivitive of the activation function is used in calculating error | def activate_der(self):
return self.value * (1 - self.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative_activation(z):\n return activation(z) * (1 - activation(z))",
"def derivate_error(self, in_influence):\n deriv_vector = self._activation_function.derivate(self.activation_levels)\n return deriv_vector * in_influence",
"def activation_func(x):\r\n a = -1\r\n return 1/(1+np.... | [
"0.7351366",
"0.69890904",
"0.6973354",
"0.69063866",
"0.6883979",
"0.68832415",
"0.67835635",
"0.6748231",
"0.674133",
"0.67256886",
"0.6712983",
"0.6671499",
"0.66420394",
"0.66368955",
"0.6629879",
"0.6620683",
"0.66191375",
"0.66057265",
"0.6589919",
"0.6556705",
"0.65536... | 0.60806656 | 69 |
Filter the Child objects to only display those for the currently signed in user. | def queryset(self, request):
qs = super(ChildAdmin, self).queryset(request)
if request.user.is_superuser:
return qs
if request.user.user_category == 'block':
return qs.filter(block=request.user.account.associated_with)
if request.user.user_category == 'school':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return super().get_queryset().filter(user=self.request.user)",
"def get_queryset(self, request):\n qs = super().get_queryset(request)\n return qs.filter(user=request.user)",
"def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwar... | [
"0.7381652",
"0.7164784",
"0.7022436",
"0.678043",
"0.6723382",
"0.66934246",
"0.6684575",
"0.6684575",
"0.6680026",
"0.66783905",
"0.6612759",
"0.6550489",
"0.6524539",
"0.6414828",
"0.6414455",
"0.64065415",
"0.64065415",
"0.63884586",
"0.63780767",
"0.63385814",
"0.6334364... | 0.65414983 | 12 |
Thresholded image (black/white, 3 channels) | def binary(this):
return this._BINARY | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_thresh(orig_img, thresh_img):\n new_img = orig_img\n\n for i in range(orig_img.shape[0]):\n for j in range(orig_img.shape[1]):\n if thresh_img[i,j] == 255:\n new_img[i,j] = 0\n\n return new_img",
"def imthresh(img):\n img_vecs = img.flatten()\n\n # pre-ca... | [
"0.6773297",
"0.66755766",
"0.66390675",
"0.6568149",
"0.64711714",
"0.6467599",
"0.6444201",
"0.6436213",
"0.6434295",
"0.64263964",
"0.6407311",
"0.63944405",
"0.6380219",
"0.637929",
"0.6368858",
"0.6312871",
"0.6301924",
"0.6295678",
"0.6284145",
"0.62749565",
"0.6268438"... | 0.0 | -1 |
Set blur kernel, number of pixels around to average | def setBlurSize(this, size):
this._KERNEL = np.ones((size, size), np.float32) / (size**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_blur(img: np.ndarray, kernel_size: int = 3):\n imgtype = img.dtype\n h,w,c = img.shape\n\n #Get a valid kernel size\n kernel_size = valid_kernel(h,w,kernel_size)\n \n #Averaging Filter Blur (Homogeneous filter)\n blurred = cv2.blur(img,(kernel_size,kernel_size))\n\n return blurr... | [
"0.7121801",
"0.7113799",
"0.6964218",
"0.6933509",
"0.68477577",
"0.6787509",
"0.6787509",
"0.67608994",
"0.67398",
"0.66585547",
"0.663609",
"0.65700483",
"0.65418035",
"0.65418035",
"0.65418035",
"0.65418035",
"0.65418035",
"0.65418035",
"0.65418035",
"0.65418035",
"0.6541... | 0.68168056 | 5 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def accuracy_on_one(y_true, y_pred):
sum_true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
sum_all_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
acc_on_one = sum_true_positives / (sum_all_positives + K.epsilon())
return acc_on_one | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.76060426",
"0.744954",
"0.7404815",
"0.72813565",
"0.72100145",
"0.7166562",
"0.715813",
"0.71459836",
"0.71459836",
"0.71459836",
"0.71459836",
"0.71459836",
"0.71459836",
"0.713231",
"0.71015733",
"0.70978653",
"0.70978653",
"0.70978653",
"0.70978653",
"0.70978653",
"0.7... | 0.0 | -1 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def accuracy_on_zero(y_true, y_pred):
y_true_flipped = 1 - y_true
y_pred_flipped = 1- y_pred
sum_true_negatives = K.sum(K.round(K.clip( y_true_flipped * y_pred_flipped, 0, 1)))
sum_all_negatives = K.sum(K.round(K.clip(y_true_flipped, 0, 1)))
ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.76057607",
"0.7448947",
"0.7404686",
"0.72816885",
"0.7210289",
"0.7166584",
"0.7158369",
"0.71459687",
"0.71459687",
"0.71459687",
"0.71459687",
"0.71459687",
"0.71459687",
"0.7132504",
"0.71015626",
"0.7097816",
"0.7097816",
"0.7097816",
"0.7097816",
"0.7097816",
"0.7097... | 0.0 | -1 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision_on_1(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.7489052",
"0.7288358",
"0.7159325",
"0.715323",
"0.7065856",
"0.6984727",
"0.6964892",
"0.69536865",
"0.6912471",
"0.68334424",
"0.68176156",
"0.68093187",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.67855513",
"0.67575085",
"0.67575085... | 0.6453792 | 61 |
Given a dictionary, returns it as a YAML oneliner. | def _dict_to_single_line_yaml(self, *, data):
result = yaml.dump(data, default_flow_style=True)
result = result.replace("\n", " ").strip()
result = re.sub(r" *", " ", result)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_to_yaml(dict_data):\n\n return yaml.dump(dict_data, default_flow_style=False)",
"def format_yaml(yaml, **kwargs):\n template = _YamlTemplate(yaml)\n try:\n return template.substitute(flatten(kwargs or {},\n reducer='dot'))\n except KeyError as... | [
"0.7041046",
"0.65853167",
"0.64784247",
"0.61616373",
"0.6034454",
"0.59981424",
"0.5945537",
"0.5944129",
"0.5909306",
"0.58480567",
"0.5836314",
"0.582053",
"0.5763354",
"0.57461613",
"0.57365924",
"0.56866086",
"0.56500816",
"0.5643083",
"0.5572954",
"0.55451465",
"0.5537... | 0.68601173 | 1 |
Initialize restaurant name and cuisine type attributes | def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name.title()
self.cuisine_type = cuisine_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, restaurant_name, cuisine_type):\r\n\t\tself.restaurant_name = restaurant_name\r\n\t\tself.cuisine_type = cuisine_type",
"def __init__(self, restaurant_name, cuisine_type):\n\t\tself.name = restaurant_name\n\t\tself.type = cuisine_type",
"def __init__(self, restaurant_name, cuisine_type):\n ... | [
"0.8867893",
"0.88307756",
"0.87326837",
"0.87326837",
"0.87326837",
"0.86650914",
"0.8590518",
"0.854975",
"0.854975",
"0.8524922",
"0.85144866",
"0.84030193",
"0.84030193",
"0.8368049",
"0.83221966",
"0.83221966",
"0.8252662",
"0.8079612",
"0.7813271",
"0.78129244",
"0.7811... | 0.8777077 | 2 |
Creates a unique name based on the current time in nanoseconds. | def fixture_make_unique_name():
def _make_unique_name(prefix):
return f"{prefix}{time.time_ns()}"
return _make_unique_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetUniqueName():\n dt = datetime.datetime.now()\n return '%s%s%s%s%s%s%s' % (dt.year, dt.month, dt.day, dt.hour, dt.minute,\n dt.second, dt.microsecond)",
"def create_simple_exp_name():\n now = datetime.datetime.now(dateutil.tz.tzlocal())\n timestamp = now.strftime... | [
"0.85094583",
"0.76051795",
"0.7464745",
"0.7455738",
"0.7258981",
"0.7216248",
"0.70942444",
"0.70670295",
"0.698558",
"0.6769456",
"0.6748526",
"0.67477596",
"0.6642752",
"0.6596146",
"0.65697443",
"0.65592194",
"0.65518713",
"0.6504124",
"0.64644015",
"0.6463761",
"0.64574... | 0.7162828 | 6 |
This is the home or index API Call this api to get back "Hello World!" | def index():
return "Hello!" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n return \"Hello World!\"",
"def index():\r\n return (\r\n jsonify(\r\n {\"Hello\": \"World\"}\r\n ),\r\n 202,\r\n )",
"def index():\n return \"Hello, world!\"",
"def get(self):\n return 'Hello World!'",
"def index():\n return jsoni... | [
"0.7810405",
"0.7807815",
"0.77136195",
"0.7710482",
"0.76535714",
"0.7602622",
"0.75734496",
"0.7572216",
"0.7567605",
"0.7487087",
"0.74552613",
"0.7375069",
"0.7342173",
"0.731316",
"0.72639084",
"0.72503096",
"0.71716744",
"0.7158711",
"0.7109938",
"0.70937246",
"0.708679... | 0.7748956 | 2 |
Check whether the file exist If the file doesn't exist, the function raise IOError. | def check_file_existence(file_name):
if not os.path.isfile(file_name):
raise IOError("{} doesn't exist or isn't a file".format(file_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FileCheck(fn):\n try:\n open(fn, \"r\")\n return 1\n except IOError:\n print(\"Error: File does not exist.\")\n return 0",
"def check_file_exist(self):\n return False",
"def file_exist() -> bool:\n pass",
"def check_file(path):\n if not os.path.exists(pa... | [
"0.80500877",
"0.79195726",
"0.771937",
"0.7490264",
"0.74625784",
"0.7430897",
"0.73822993",
"0.73693097",
"0.73266417",
"0.7270954",
"0.7251365",
"0.723097",
"0.7209729",
"0.7201712",
"0.71836376",
"0.71749014",
"0.7172245",
"0.71610487",
"0.71610487",
"0.7145045",
"0.71385... | 0.802928 | 1 |
Convert list parameter defiction to list The function takes as an argument a list of strings as a string. An element in the list string has to be enclosed in apostrophe. Proper format is ['val1', 'val2', 'val3', ...] | def conf_load_par_list(par_def):
par_def = par_def[1:-1].split(',')
par_list = list()
for p in par_def:
par_list.append(p.strip())
return par_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_list_arg(arg):\n if isinstance(arg, list):\n return arg\n elif isinstance(arg, basestring):\n args = []\n for part in arg.split(\",\"):\n args.append(part.strip())\n return args",
"def str_list(x):\n #import ast\n #x = ast.literal_eval(x)\n x = x.... | [
"0.7365944",
"0.7252396",
"0.72455037",
"0.70480776",
"0.70304245",
"0.70152986",
"0.6977405",
"0.6943815",
"0.69063246",
"0.6878974",
"0.68249696",
"0.6790646",
"0.6746373",
"0.67441833",
"0.67333907",
"0.6730398",
"0.6710779",
"0.669768",
"0.66592884",
"0.6657795",
"0.66465... | 0.0 | -1 |
unquote_to_bytes('abc%20def') > b'abc def'. | def unquote_to_bytes(string):
if not string:
string.split
return b''
if isinstance(string, str):
string = string.encode('utf-8')
bits = string.split(b'%')
if len(bits) == 1:
return string
res = [bits[0]]
append = res.append
global _hextobyte
if _hextobyte ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b2_url_encode(s):\n return quote(s.encode('utf-8'))",
"def b2_url_decode(s):\n return unquote_plus(s)",
"def urldecode(val):\n return urllib2.unquote(val)",
"def test_normalize_percent_encoding_in_querystring():\n assert (normalize_url(\"http://example.com/?a=b%c2\") ==\n \"http://... | [
"0.7136339",
"0.69008356",
"0.66393024",
"0.64481807",
"0.64285296",
"0.6353806",
"0.6343397",
"0.6304222",
"0.62181413",
"0.61122966",
"0.59896916",
"0.59586006",
"0.5948718",
"0.59390354",
"0.5900599",
"0.588036",
"0.5878536",
"0.58590144",
"0.58467263",
"0.583664",
"0.5821... | 0.71045595 | 1 |
Returns the first item from a doubleended queue and returns the first item. Used to provide a continuous loop of values for a process. | def rotate_queue(queue):
next_value = queue[0]
queue.rotate(-1)
return next_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(self):\n if self.is_empty():\n raise Empty('Queue is empty')\n return self._data[self._front]",
"def first(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Queue is empty')\n\t\treturn self._head._element",
"def first(self):\r\n if self.is_empty():\r\n ra... | [
"0.72452354",
"0.7243898",
"0.7137052",
"0.71172285",
"0.70865446",
"0.6985086",
"0.69569564",
"0.6944946",
"0.6939742",
"0.6932504",
"0.69217885",
"0.6787081",
"0.6784721",
"0.6769681",
"0.67367876",
"0.6724787",
"0.6724787",
"0.66812867",
"0.66699743",
"0.66608274",
"0.6624... | 0.0 | -1 |
Build a flask application. | def build_app(target_app, calendar):
@target_app.route('/', defaults={'path': ''}, methods=['GET'])
@target_app.route('/<path:path>', methods=['GET'])
def render_scheudle_view(path):
"""Render the schedule view with react."""
client_build_dir = 'client/build'
if path != "" and os.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self) -> Flask:\n app = Flask(self.name, *self.args, **self.kwargs)\n app = self.setup_app_config(app)\n app = self.add_app_headers(app)\n app = self.add_xsrf_error_handler(app)\n\n return app",
"def make_app() -> Flask:\n logger.info('creating flask application... | [
"0.7946427",
"0.7857918",
"0.7726593",
"0.77167445",
"0.7688322",
"0.7356393",
"0.73559546",
"0.73436135",
"0.7332231",
"0.73200095",
"0.7319781",
"0.7315051",
"0.72919494",
"0.7277921",
"0.72598",
"0.7259427",
"0.72382736",
"0.7223886",
"0.7216343",
"0.7208086",
"0.72069424"... | 0.0 | -1 |
Max along the zero dimension. | def dim_zero_max(x: Tensor) ->Tensor:
return torch.max(x, dim=0).values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum(x):\n return np.maximum(x, 0)",
"def max(self):\n if 0 in type(self).flatten_shape(self.shape):\n raise ValueError(\"zero-size array has no maximum\")\n if self.isscalar():\n return self.defval\n # If not all blocks are set, then the tensor has an element... | [
"0.8040035",
"0.7890929",
"0.776785",
"0.75103337",
"0.7425385",
"0.73064846",
"0.7295634",
"0.72105473",
"0.72044814",
"0.71865314",
"0.71812564",
"0.71656746",
"0.71218395",
"0.708043",
"0.7026626",
"0.69970953",
"0.69889486",
"0.69688827",
"0.69688827",
"0.6967642",
"0.696... | 0.82211095 | 0 |
Min along the zero dimension. | def dim_zero_min(x: Tensor) ->Tensor:
return torch.min(x, dim=0).values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self):\n if 0 in type(self).flatten_shape(self.shape):\n raise ValueError(\"zero-size array has no minimum\")\n if self.isscalar():\n return self.defval\n # If not all blocks are set, then the tensor has an element of defval\n # somewhere.\n m = np.i... | [
"0.77934754",
"0.7503109",
"0.7427814",
"0.73987216",
"0.7374089",
"0.7223842",
"0.7219645",
"0.71925414",
"0.7160778",
"0.7090202",
"0.7047364",
"0.7042481",
"0.70128506",
"0.70061505",
"0.69548464",
"0.6945946",
"0.6937568",
"0.69232994",
"0.6923083",
"0.6920368",
"0.688806... | 0.8175422 | 0 |
Summation along the zero dimension. | def dim_zero_sum(x: Tensor) ->Tensor:
return torch.sum(x, dim=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_to_0d(x):\n assert_equal(x.ndim, 1)\n return np.squeeze(np.sum(x, keepdims=True))",
"def zsum(s, *args, **kwargs):\n return 0 if s.empty else s.sum(*args, **kwargs)",
"def sum(self, axis=None, keepdims=False):\n return F.Sum.apply(self, axis, keepdims)",
"def sum(self)... | [
"0.7796292",
"0.6977428",
"0.69562584",
"0.6883054",
"0.6664602",
"0.6640772",
"0.6592098",
"0.65453315",
"0.6516383",
"0.65059614",
"0.64885205",
"0.6428575",
"0.64075583",
"0.64075077",
"0.6399962",
"0.639547",
"0.6392207",
"0.6387929",
"0.62831646",
"0.6261077",
"0.6258682... | 0.7995261 | 0 |
Flatten dict of dicts into single dict. | def _flatten_dict(x: Dict) ->Dict:
new_dict = {}
for key, value in x.items():
if isinstance(value, dict):
for k, v in value.items():
new_dict[k] = v
else:
new_dict[key] = value
return new_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(self):\n flat = {}\n for d in self.dicts:\n flat.update(d)\n return flat",
"def flatten_dict(d):\n def items():\n for key, value in d.items():\n if isinstance(value, dict):\n for subkey, subvalue in flatten_dict(value... | [
"0.77828306",
"0.75326556",
"0.7442014",
"0.73136836",
"0.727962",
"0.70605755",
"0.67743653",
"0.67672753",
"0.6726913",
"0.67065555",
"0.66614926",
"0.6635427",
"0.66196144",
"0.66179395",
"0.66091895",
"0.6556009",
"0.64971346",
"0.6461731",
"0.6459693",
"0.6434372",
"0.64... | 0.81254715 | 0 |
Wrapper of torch.allclose that is robust towards dtype difference. | def allclose(tensor1: Tensor, tensor2: Tensor) ->bool:
if tensor1.dtype != tensor2.dtype:
tensor2 = tensor2
return torch.allclose(tensor1, tensor2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_allclose(x, y, atol=1e-5, rtol=1e-4, verbose=True):\n try:\n #logging.warning(\"int8_outputis {} and fp32 output is {} \".format(x, y))\n np.testing.assert_allclose(\n x, y, atol=atol, rtol=rtol, verbose=verbose)\n return True\n except AssertionError as e:\n ... | [
"0.7156294",
"0.71211123",
"0.69557077",
"0.6901459",
"0.683574",
"0.68341774",
"0.67174286",
"0.66873014",
"0.6579537",
"0.6401924",
"0.6393823",
"0.63038266",
"0.6285875",
"0.6242017",
"0.62331414",
"0.61906064",
"0.6179336",
"0.61700016",
"0.61604065",
"0.6156231",
"0.6150... | 0.69427043 | 3 |
Drop all rows and columns containing only zeros. | def _drop_empty_rows_and_cols(confmat: Tensor) ->Tensor:
confmat = confmat[confmat.sum(1) != 0]
confmat = confmat[:, confmat.sum(0) != 0]
return confmat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_zeros(x):\n assert len(x.shape) == 2\n return x[~np.all(x == 0, axis=1)]",
"def remove_zero_features(df,no_zeros = 1):\n thing = df.astype(bool).sum(axis=0) # number of nonzeros in each column\n idx = pd.Index(thing) #Index format\n location = idx.get_loc(no_zeros) # Set all elements that... | [
"0.7658553",
"0.75908375",
"0.72366744",
"0.71366894",
"0.6862481",
"0.66673523",
"0.66558874",
"0.66462904",
"0.6598128",
"0.6568297",
"0.65615356",
"0.644415",
"0.6429023",
"0.62996554",
"0.62971926",
"0.62715185",
"0.6207608",
"0.6172788",
"0.6167235",
"0.61491513",
"0.612... | 0.6934652 | 4 |
Check that predictions and target have the same shape, else raise error. | def _check_same_shape(preds: Tensor, target: Tensor) ->None:
if preds.shape != target.shape:
raise RuntimeError(f'Predictions and targets are expected to have the same shape, but got {preds.shape} and {target.shape}.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_shape_equal(pred, labels):\n if pred.shape != labels.shape:\n raise ValueError('Prediction and labels shapes must be equal:'\n f'{pred.shape} vs {labels.shape}.')",
"def _check_shape(self, y_pred, y):\n if self._type == 'classification':\n if y_pred.ndim != y.n... | [
"0.770629",
"0.74215806",
"0.7411364",
"0.7219916",
"0.6821432",
"0.681927",
"0.6691203",
"0.66151506",
"0.66081774",
"0.6598889",
"0.65159684",
"0.6507568",
"0.63592905",
"0.63367945",
"0.6331001",
"0.63250756",
"0.62995505",
"0.62900436",
"0.6284418",
"0.62282544",
"0.6222"... | 0.85626614 | 0 |
Check that predictions and target have the correct shape, else raise error. | def _check_data_shape_to_num_outputs(preds: Tensor, target: Tensor, num_outputs: int) ->None:
if preds.ndim > 2 or target.ndim > 2:
raise ValueError(f'Expected both predictions and target to be either 1- or 2-dimensional tensors, but got {target.ndim} and {preds.ndim}.')
if num_outputs == 1 and preds.nd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_same_shape(preds: Tensor, target: Tensor) ->None:\n if preds.shape != target.shape:\n raise RuntimeError(f'Predictions and targets are expected to have the same shape, but got {preds.shape} and {target.shape}.')",
"def _check_shape(self, y_pred, y):\n if self._type == 'classification'... | [
"0.8181059",
"0.73771954",
"0.73430777",
"0.7169801",
"0.71421885",
"0.71364963",
"0.7088017",
"0.685947",
"0.6693363",
"0.6670583",
"0.66029984",
"0.6554414",
"0.6495942",
"0.64599836",
"0.6452373",
"0.64254725",
"0.6420091",
"0.64112115",
"0.63943666",
"0.6358352",
"0.63502... | 0.7337888 | 3 |
Computes x log(y). Returns 0 if x=0. | def _safe_xlogy(x: Tensor, y: Tensor) ->Tensor:
res = x * torch.log(y)
res[x == 0] = 0.0
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log2(x: float) -> float:\n return math.log2(x) if x > 0 else 0",
"def log(self, x, base=2):\n if x == 0:\n return 0\n return math.log(x, base)",
"def log(x, base=math.e):\n return 0.0",
"def safelog(x):\n #return np.log(x)\n return np.log(np.clip(x,floor,np.inf))",
"def... | [
"0.77524406",
"0.77205205",
"0.76844645",
"0.7642335",
"0.7591742",
"0.7465603",
"0.7437937",
"0.7433669",
"0.7417593",
"0.732204",
"0.7281724",
"0.72580296",
"0.72580296",
"0.7247305",
"0.72431856",
"0.7220947",
"0.72013474",
"0.72013474",
"0.7149388",
"0.7143482",
"0.713494... | 0.82068676 | 0 |
Computes Mean Absolute Percentage Error. | def _mean_absolute_percentage_error_compute(sum_abs_per_error: Tensor, num_obs: int) ->Tensor:
return sum_abs_per_error / num_obs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_percentage_error(y_true, y_pred):\n output_errors = 100*np.average(np.abs(y_true - y_pred)/y_true)\n return np.average(output_errors)",
"def mean_absolute_percentage_error(groundtruth, predictions):\n gt = np.array(groundtruth)\n pred = np.array(predictions)\n errors = np.abs(pre... | [
"0.79571223",
"0.7900373",
"0.7898755",
"0.7835608",
"0.7765584",
"0.77655226",
"0.77603894",
"0.7688887",
"0.7688887",
"0.76464933",
"0.75755376",
"0.75512975",
"0.74737775",
"0.7418563",
"0.7409837",
"0.73585606",
"0.73472285",
"0.7229161",
"0.72031826",
"0.7163521",
"0.716... | 0.8305921 | 0 |
find and return values which have repeats i.e. the same value are more than once in the tensor. | def _find_repeats(data: Tensor) ->Tensor:
temp = data.detach().clone()
temp = temp.sort()[0]
change = torch.cat([torch.tensor([True], device=temp.device), temp[1:] != temp[:-1]])
unique = temp[change]
change_idx = torch.cat([torch.nonzero(change), torch.tensor([[temp.numel()]], device=temp.device)])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeats(arr):\n return sum([el for el in arr if arr.count(el) == 1])",
"def is_duplicates(trajs):\n if len(trajs) < 2:\n return False \n for j in range(len(trajs)-1):\n for i in range(j+1, len(trajs)):\n R = (trajs[i].get_slice()[:,:2]==trajs[j].get_slice()[:,:2])\n ... | [
"0.6683863",
"0.6357573",
"0.63124835",
"0.62952906",
"0.6256204",
"0.6216161",
"0.6155577",
"0.61427987",
"0.61327606",
"0.6128838",
"0.6117912",
"0.60622287",
"0.6036541",
"0.5961879",
"0.59206265",
"0.590035",
"0.58591396",
"0.5835687",
"0.58325785",
"0.5810832",
"0.580620... | 0.7739222 | 0 |
Computes Symmetric Mean Absolute Percentage Error. | def _symmetric_mean_absolute_percentage_error_compute(sum_abs_per_error: Tensor, num_obs: int) ->Tensor:
return sum_abs_per_error / num_obs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mean_absolute_percentage_error_compute(sum_abs_per_error: Tensor, num_obs: int) ->Tensor:\n return sum_abs_per_error / num_obs",
"def _mean_absolute_error_compute(sum_abs_error: Tensor, n_obs: int) ->Tensor:\n return sum_abs_error / n_obs",
"def mean_absolute_percentage_error(y_true, y_pred):\n o... | [
"0.7303503",
"0.70845044",
"0.67566967",
"0.6646075",
"0.6625918",
"0.6617028",
"0.66153914",
"0.6599637",
"0.6535691",
"0.65185624",
"0.6488955",
"0.6488518",
"0.6488518",
"0.645109",
"0.6419355",
"0.6405687",
"0.64019644",
"0.63901997",
"0.6376228",
"0.6311095",
"0.63083977... | 0.78874034 | 0 |
Check ``preds`` and ``target`` tensors are of the same shape and of the correct data type. | def _check_retrieval_target_and_prediction_types(preds: Tensor, target: Tensor, allow_non_binary_target: bool=False) ->Tuple[Tensor, Tensor]:
if target.dtype not in (torch.bool, torch.long, torch.int) and not torch.is_floating_point(target):
raise ValueError('`target` must be a tensor of booleans, integers ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_same_shape(preds: Tensor, target: Tensor) ->None:\n if preds.shape != target.shape:\n raise RuntimeError(f'Predictions and targets are expected to have the same shape, but got {preds.shape} and {target.shape}.')",
"def _verify_data(inputs, targets):\n check_value_type('inputs', inputs... | [
"0.8112511",
"0.7162145",
"0.70912766",
"0.68388134",
"0.66268575",
"0.6605161",
"0.6541759",
"0.653069",
"0.63269305",
"0.62606084",
"0.6236373",
"0.6233234",
"0.61148995",
"0.605481",
"0.60351175",
"0.60291475",
"0.6028686",
"0.60114115",
"0.59943324",
"0.5992083",
"0.59709... | 0.68585163 | 3 |
Check ``preds`` and ``target`` tensors are of the same shape and of the correct data type. | def _check_retrieval_functional_inputs(preds: Tensor, target: Tensor, allow_non_binary_target: bool=False) ->Tuple[Tensor, Tensor]:
if preds.shape != target.shape:
raise ValueError('`preds` and `target` must be of the same shape')
if not preds.numel() or not preds.size():
raise ValueError('`pred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_same_shape(preds: Tensor, target: Tensor) ->None:\n if preds.shape != target.shape:\n raise RuntimeError(f'Predictions and targets are expected to have the same shape, but got {preds.shape} and {target.shape}.')",
"def _verify_data(inputs, targets):\n check_value_type('inputs', inputs... | [
"0.81128013",
"0.7163503",
"0.7091363",
"0.6861648",
"0.6838455",
"0.6604161",
"0.65418875",
"0.6531771",
"0.6327058",
"0.62604415",
"0.62397206",
"0.6232886",
"0.61139643",
"0.605549",
"0.60342425",
"0.60309017",
"0.6028685",
"0.6013382",
"0.5994167",
"0.59915555",
"0.597216... | 0.6628416 | 5 |
Computes the Fallout (for information retrieval), as explained in `IR Fallout`_ Fallout is the fraction of nonrelevant documents retrieved among all the nonrelevant documents. ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is ``True``, ``0`` is returned. ``target`` mu... | def retrieval_fall_out(preds: Tensor, target: Tensor, k: Optional[int]=None) ->Tensor:
preds, target = _check_retrieval_functional_inputs(preds, target)
k = preds.shape[-1] if k is None else k
if not (isinstance(k, int) and k > 0):
raise ValueError('`k` has to be a positive integer or None')
tar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieval_hit_rate(preds: Tensor, target: Tensor, k: Optional[int]=None) ->Tensor:\n preds, target = _check_retrieval_functional_inputs(preds, target)\n if k is None:\n k = preds.shape[-1]\n if not (isinstance(k, int) and k > 0):\n raise ValueError('`k` has to be a positive integer or No... | [
"0.6366051",
"0.63137865",
"0.5833296",
"0.557318",
"0.556978",
"0.55005246",
"0.54490787",
"0.54078",
"0.5406778",
"0.5387875",
"0.53567433",
"0.53348345",
"0.5306074",
"0.5295209",
"0.52292454",
"0.52151",
"0.5146197",
"0.5124343",
"0.5122784",
"0.5107078",
"0.5106473",
"... | 0.6577421 | 0 |
Computes the hit rate (for information retrieval). The hit rate is 1.0 if there is at least one relevant document among all the top `k` retrieved documents. ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is ``True``, ``0`` is returned. ``target`` must be either `bool`... | def retrieval_hit_rate(preds: Tensor, target: Tensor, k: Optional[int]=None) ->Tensor:
preds, target = _check_retrieval_functional_inputs(preds, target)
if k is None:
k = preds.shape[-1]
if not (isinstance(k, int) and k > 0):
raise ValueError('`k` has to be a positive integer or None')
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieval_recall(preds: Tensor, target: Tensor, k: Optional[int]=None) ->Tensor:\n preds, target = _check_retrieval_functional_inputs(preds, target)\n if k is None:\n k = preds.shape[-1]\n if not (isinstance(k, int) and k > 0):\n raise ValueError('`k` has to be a positive integer or None... | [
"0.7064314",
"0.6908161",
"0.66571385",
"0.65306395",
"0.6483591",
"0.62737924",
"0.62295383",
"0.61009467",
"0.60927975",
"0.60927975",
"0.60927975",
"0.60829914",
"0.6042567",
"0.6034532",
"0.60099",
"0.600382",
"0.60033244",
"0.5971579",
"0.5955237",
"0.59244955",
"0.58995... | 0.82973486 | 0 |
Computes Discounted Cumulative Gain for input tensor. | def _dcg(target: Tensor) ->Tensor:
denom = torch.log2(torch.arange(target.shape[-1], device=target.device) + 2.0)
return (target / denom).sum(dim=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cumgain(df, outcome_col='y', treatment_col='w', treatment_effect_col='tau',\n steps=100, normalize=False, random_seed=42):\n\n cumlift = get_cumlift(df, outcome_col, treatment_col, treatment_effect_col, steps, random_seed)\n\n # cumulative gain = cumulative lift x (# of population)\n ... | [
"0.6200078",
"0.5988861",
"0.59678537",
"0.59399575",
"0.59326285",
"0.5852391",
"0.5843366",
"0.5791593",
"0.57911277",
"0.5749161",
"0.57099295",
"0.57099295",
"0.57099295",
"0.57099295",
"0.57099295",
"0.57099295",
"0.57099295",
"0.57008207",
"0.5685289",
"0.5674926",
"0.5... | 0.55036926 | 28 |
Computes the precision metric (for information retrieval). Precision is the fraction of relevant documents among all the retrieved documents. ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is ``True``, ``0`` is returned. ``target`` must be either `bool` or `integers` ... | def retrieval_precision(preds: Tensor, target: Tensor, k: Optional[int]=None, adaptive_k: bool=False) ->Tensor:
preds, target = _check_retrieval_functional_inputs(preds, target)
if not isinstance(adaptive_k, bool):
raise ValueError('`adaptive_k` has to be a boolean')
if k is None or adaptive_k and k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieval_r_precision(preds: Tensor, target: Tensor) ->Tensor:\n preds, target = _check_retrieval_functional_inputs(preds, target)\n relevant_number = target.sum()\n if not relevant_number:\n return tensor(0.0, device=preds.device)\n relevant = target[torch.argsort(preds, dim=-1, descending=... | [
"0.71165365",
"0.71069264",
"0.7051194",
"0.6935805",
"0.69275016",
"0.6919255",
"0.6919255",
"0.6919255",
"0.6919255",
"0.6919255",
"0.6919255",
"0.68998045",
"0.68998045",
"0.68998045",
"0.68998045",
"0.68998045",
"0.68998045",
"0.68998045",
"0.68998045",
"0.68998045",
"0.6... | 0.7531003 | 0 |
Computes precisionrecall pairs for different k (from 1 to `max_k`). In a ranked retrieval context, appropriate sets of retrieved documents are naturally given by the top k retrieved documents. Recall is the fraction of relevant documents retrieved among all the relevant documents. Precision is the fraction of relevant ... | def retrieval_precision_recall_curve(preds: Tensor, target: Tensor, max_k: Optional[int]=None, adaptive_k: bool=False) ->Tuple[Tensor, Tensor, Tensor]:
preds, target = _check_retrieval_functional_inputs(preds, target)
if not isinstance(adaptive_k, bool):
raise ValueError('`adaptive_k` has to be a boolea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_recall_at_k(predictions, k, threshold):\n # First map the predictions to each user.\n user_est_true = defaultdict(list)\n for uid, _, true_r, est, _ in predictions:\n user_est_true[uid].append((est, true_r))\n\n precisions = dict()\n recalls = dict()\n for uid, user_ratings i... | [
"0.7755801",
"0.7722373",
"0.7691844",
"0.7457988",
"0.717476",
"0.7037737",
"0.6980095",
"0.6961605",
"0.68935204",
"0.6822222",
"0.67377913",
"0.6728384",
"0.67174506",
"0.6715983",
"0.65947205",
"0.6583769",
"0.65619904",
"0.65286356",
"0.65012944",
"0.64898306",
"0.643042... | 0.8063614 | 0 |
Computes maximum recall with condition that corresponding precision >= `min_precision`. | def _retrieval_recall_at_fixed_precision(precision: Tensor, recall: Tensor, top_k: Tensor, min_precision: float) ->Tuple[Tensor, Tensor]:
try:
max_recall, best_k = max((r, k) for p, r, k in zip(precision, recall, top_k) if p >= min_precision)
except ValueError:
max_recall = torch.tensor(0.0, dev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _retrieval_recall_at_fixed_precision(\n precision: Tensor,\n recall: Tensor,\n top_k: Tensor,\n min_precision: float,\n) -> Tuple[Tensor, Tensor]:\n try:\n max_recall, best_k = max((r, k) for p, r, k in zip(precision, recall, top_k) if p >= min_precision)\n\n except ValueError:\n ... | [
"0.74577063",
"0.6657458",
"0.6552493",
"0.65356386",
"0.6535204",
"0.6531926",
"0.65123874",
"0.6384157",
"0.6367068",
"0.6355923",
"0.6348172",
"0.6333052",
"0.6328094",
"0.6328094",
"0.6318043",
"0.63154465",
"0.63000476",
"0.62718374",
"0.62199986",
"0.6184658",
"0.617952... | 0.73637414 | 1 |
Computes the rprecision metric (for information retrieval). RPrecision is the fraction of relevant documents among all the top ``k`` retrieved documents where ``k`` is equal to the total number of relevant documents. ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is `... | def retrieval_r_precision(preds: Tensor, target: Tensor) ->Tensor:
preds, target = _check_retrieval_functional_inputs(preds, target)
relevant_number = target.sum()
if not relevant_number:
return tensor(0.0, device=preds.device)
relevant = target[torch.argsort(preds, dim=-1, descending=True)][:re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieval_precision(preds: Tensor, target: Tensor, k: Optional[int]=None, adaptive_k: bool=False) ->Tensor:\n preds, target = _check_retrieval_functional_inputs(preds, target)\n if not isinstance(adaptive_k, bool):\n raise ValueError('`adaptive_k` has to be a boolean')\n if k is None or adaptiv... | [
"0.7534451",
"0.72511786",
"0.70110047",
"0.6832553",
"0.681112",
"0.6798141",
"0.6698143",
"0.668471",
"0.66116107",
"0.66043824",
"0.6596001",
"0.658006",
"0.6577106",
"0.65720904",
"0.65720904",
"0.65720904",
"0.65720904",
"0.65720904",
"0.65720904",
"0.65631485",
"0.65622... | 0.804721 | 0 |
Computes the recall metric (for information retrieval). Recall is the fraction of relevant documents retrieved among all the relevant documents. ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is ``True``, ``0`` is returned. ``target`` must be either `bool` or `integer... | def retrieval_recall(preds: Tensor, target: Tensor, k: Optional[int]=None) ->Tensor:
preds, target = _check_retrieval_functional_inputs(preds, target)
if k is None:
k = preds.shape[-1]
if not (isinstance(k, int) and k > 0):
raise ValueError('`k` has to be a positive integer or None')
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall_at(prediction, target, k=10):\n rank_target = (prediction.t() > prediction[range(prediction.shape[0]), target]).sum(0) + 1.0\n recall = (rank_target <= k).to(torch.float32).mean()\n return recall",
"def M_Recall(y_true, y_pred):\n true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1... | [
"0.75270057",
"0.73172915",
"0.7275617",
"0.7271459",
"0.727095",
"0.72627115",
"0.72627115",
"0.72627115",
"0.72627115",
"0.72627115",
"0.72627115",
"0.72476935",
"0.72335774",
"0.72335774",
"0.72335774",
"0.72335774",
"0.72335774",
"0.72335774",
"0.72335774",
"0.72335774",
... | 0.813332 | 0 |
Computes reciprocal rank (for information retrieval). See `Mean Reciprocal Rank`_ ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is ``True``, 0 is returned. ``target`` must be either `bool` or `integers` and ``preds`` must be ``float``, otherwise an error is raised. | def retrieval_reciprocal_rank(preds: Tensor, target: Tensor) ->Tensor:
preds, target = _check_retrieval_functional_inputs(preds, target)
if not target.sum():
return tensor(0.0, device=preds.device)
target = target[torch.argsort(preds, dim=-1, descending=True)]
position = torch.nonzero(target).vi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieval_r_precision(preds: Tensor, target: Tensor) ->Tensor:\n preds, target = _check_retrieval_functional_inputs(preds, target)\n relevant_number = target.sum()\n if not relevant_number:\n return tensor(0.0, device=preds.device)\n relevant = target[torch.argsort(preds, dim=-1, descending=... | [
"0.66930157",
"0.63864976",
"0.6244135",
"0.60403866",
"0.5987901",
"0.5964957",
"0.59507835",
"0.5947474",
"0.58797544",
"0.58374995",
"0.5806638",
"0.5803889",
"0.57497734",
"0.57497734",
"0.57497734",
"0.57497734",
"0.57497734",
"0.57497734",
"0.57497734",
"0.57497734",
"0... | 0.86376584 | 0 |
Helper function that pads the model output and attention mask to the target length. | def _output_data_collator(model_output: Tensor, attention_mask: Tensor, target_len: int) ->Tuple[Tensor, Tensor]:
zeros_shape = list(model_output.shape)
zeros_shape[2] = target_len - zeros_shape[2]
model_output = torch.cat([model_output, torch.zeros(zeros_shape, dtype=model_output.dtype)], dim=2)
zeros ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_model_inputs(input, max_seq_length, pad_value=0): # pylint: disable=redefined-builtin\n with ops.name_scope(\"pad_model_inputs\"):\n # Verify that everything is a RaggedTensor\n if not isinstance(input, ragged_tensor.RaggedTensor):\n raise TypeError(\"Expecting a `RaggedTensor`, instead found:... | [
"0.6312427",
"0.6196465",
"0.61802644",
"0.6115596",
"0.6065447",
"0.60354376",
"0.6015824",
"0.60043377",
"0.5932696",
"0.59083706",
"0.5894972",
"0.58879536",
"0.5863077",
"0.5855191",
"0.5831514",
"0.5784388",
"0.5756185",
"0.5738889",
"0.57086563",
"0.56997097",
"0.569184... | 0.65216374 | 0 |
Process attention mask to be zero for special [CLS] and [SEP] tokens as they're not included in a calculation for BERT score. | def _process_attention_mask_for_special_tokens(attention_mask: Tensor) ->Tensor:
attention_mask[:, 0] = 0
sep_token_position = (attention_mask - 0.1).cumsum(-1).argmax(-1)
attention_mask[torch.arange(attention_mask.size(0)).long(), sep_token_position] = 0
return attention_mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_attention_mask(input_ids): \n attention_masks = [] \n\n # 1 for input and 0 for pad\n for seq in input_ids: \n attention_masks.append([float(i>0) for i in seq])\n\n return attention_masks",
"def preprocessing_for_bert(self, data):\n # Create empty lists to store outputs\n ... | [
"0.5773599",
"0.56110185",
"0.54681945",
"0.544788",
"0.5409218",
"0.5353715",
"0.5238451",
"0.51931816",
"0.5189999",
"0.5189184",
"0.51676166",
"0.51586473",
"0.51541257",
"0.51074547",
"0.5073596",
"0.50673026",
"0.5036693",
"0.5036178",
"0.5023721",
"0.49867204",
"0.49849... | 0.75569296 | 0 |
Tokenizes sentence into list of words. | def _tokenize_fn(sentence: str) ->Sequence[str]:
return sentence.split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_to_words(sentence):\n\n regex_of_word = re.findall(SENTENCE_TO_WORDS_REGEX, sentence)\n\n words = [x.lower() for x in regex_of_word if x is not '']\n\n return words",
"def tokenize(sentence):\n lower_s = sentence.lower()\n no_punc_s = lower_s.translate(TRANS, string.punctuation)\n\n w... | [
"0.8311132",
"0.82815385",
"0.8184632",
"0.8165114",
"0.8102701",
"0.8020231",
"0.7940098",
"0.7853865",
"0.77405834",
"0.7700952",
"0.76840514",
"0.76840514",
"0.7655818",
"0.7613874",
"0.75969857",
"0.7580177",
"0.75762975",
"0.7571726",
"0.7555356",
"0.7545908",
"0.7539692... | 0.729281 | 28 |
Get a dictionary of dictionaries with a counts of given ngrams. | def _char_and_word_ngrams_counts(sentence: str, n_char_order: int, n_word_order: int, lowercase: bool) ->Tuple[Dict[int, Dict[Tuple[str, ...], Tensor]], Dict[int, Dict[Tuple[str, ...], Tensor]]]:
if lowercase:
sentence = sentence.lower()
char_n_grams_counts = _ngram_counts(_get_characters(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_ngrams_dict(ngrams_list):\n counts = {}\n\n for t in ngrams_list:\n key = hash_function(t)\n if key in counts:\n counts[key] += 1\n else:\n counts[key] = 1\n return counts",
"def count_ngrams(word_list,n):\n ngram_dict = dict()\n for i in xrange(len(word_list)-n+1):\n ... | [
"0.79986924",
"0.77268463",
"0.74879426",
"0.7414837",
"0.7356984",
"0.7348704",
"0.73244435",
"0.7235248",
"0.71227163",
"0.7076846",
"0.70717764",
"0.70469695",
"0.70444894",
"0.70335686",
"0.70163",
"0.70079976",
"0.6992083",
"0.6916037",
"0.68709505",
"0.682671",
"0.68231... | 0.6792265 | 22 |
Get total sum of ngrams over ngrams w.r.t n. | def _get_total_ngrams(n_grams_counts: Dict[int, Dict[Tuple[str, ...], Tensor]]) ->Dict[int, Tensor]:
total_n_grams: Dict[int, Tensor] = defaultdict(lambda : tensor(0.0))
for n in n_grams_counts:
total_n_grams[n] = tensor(sum(n_grams_counts[n].values()))
return total_n_grams | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_ngrams(self, n):\n\n output = {}\n\n for i in range(len(self.text)-n+1):\n s = ' '.join(self.text[i:i+n])\n # if s is not already in dictionary, set value to 0\n output.setdefault(s, 0)\n output[s] += 1\n return output",
"def _sum_over_dic... | [
"0.7215652",
"0.7055839",
"0.69814706",
"0.69272774",
"0.6867613",
"0.6627976",
"0.661652",
"0.661237",
"0.6597013",
"0.65765536",
"0.6539877",
"0.64409435",
"0.64365846",
"0.6416276",
"0.63471746",
"0.6333982",
"0.6324324",
"0.63042855",
"0.62975055",
"0.6291195",
"0.6283753... | 0.7561346 | 0 |
Split a sentence into separate tokens. | def _get_tokens(s: str) ->List[str]:
return [] if not s else _normalize_text(s).split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_sentence(self,sentence):\n sents = self.sentence_splitter.tokenize(sentence) \n return sents",
"def split_sentence(sentence):\n sentences = []\n split = nltk.sent_tokenize(sentence)\n for s in split:\n sentences.append(s)\n\n return sentences",
"def word_split(se... | [
"0.83718485",
"0.81028837",
"0.78982383",
"0.7777003",
"0.7702361",
"0.7695749",
"0.76037633",
"0.75773597",
"0.7561082",
"0.7521331",
"0.7439896",
"0.73493534",
"0.7314325",
"0.72982085",
"0.7214128",
"0.71987516",
"0.7189333",
"0.7153087",
"0.7143342",
"0.71259737",
"0.7119... | 0.6302563 | 66 |
Apply a different tokenization techniques according. | def __call__(self, sentence: str) ->str:
if not sentence:
return ''
if self.lowercase:
sentence = sentence.lower()
if self.normalize:
sentence = self._normalize_general_and_western(sentence)
if self.asian_support:
sentence = self._n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenizer(self):\n tokenizer = RegexpTokenizer(r'\\w+')\n \n self.tweet_tokenized_train = [tokenizer.tokenize(x.lower()) for x in self.tweet_prepro_train]\n self.tweet_tokenized_test = [tokenizer.tokenize(x.lower()) for x in self.tweet_prepro_test]",
"def preprocessing(text, token... | [
"0.649972",
"0.62013525",
"0.6143272",
"0.61368275",
"0.60289043",
"0.6003302",
"0.5959159",
"0.59293044",
"0.5929144",
"0.58742756",
"0.584906",
"0.58407956",
"0.58312845",
"0.5824927",
"0.58179855",
"0.5805867",
"0.5770613",
"0.5762543",
"0.57461935",
"0.5741264",
"0.574090... | 0.0 | -1 |
Update the wip score with the current set of references and predictions. | def _wip_update(preds: Union[str, List[str]], target: Union[str, List[str]]) ->Tuple[Tensor, Tensor, Tensor]:
if isinstance(preds, str):
preds = [preds]
if isinstance(target, str):
target = [target]
total = tensor(0.0)
errors = tensor(0.0)
target_total = tensor(0.0)
preds_total =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_score():\n pass",
"def update_score(self):\n self.score = TurboMQ.calculate_fitness(self.result, self.graph)",
"def update_predictions(self, context):\n x, y, o = context.get_predictions()\n self.x_eval += x\n self.y_eval += y\n self.o_eval += o\n sel... | [
"0.66043866",
"0.64556634",
"0.6174345",
"0.61138785",
"0.6099475",
"0.60567325",
"0.6019269",
"0.60173756",
"0.6006496",
"0.59535116",
"0.59528244",
"0.5950176",
"0.591886",
"0.5900983",
"0.5862655",
"0.58404696",
"0.58397824",
"0.5834123",
"0.5814171",
"0.57919466",
"0.5788... | 0.0 | -1 |
Get indices of rows along dim 0 which have NaN values. | def _get_nan_indices(*tensors: Tensor) ->Tensor:
if len(tensors) == 0:
raise ValueError('Must pass at least one tensor as argument')
sentinel = tensors[0]
nan_idxs = torch.zeros(len(sentinel), dtype=torch.bool, device=sentinel.device)
for tensor in tensors:
permuted_tensor = tensor.flatt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate_nan_rows(arr):\n # Count the number of NaNs in each row\n nan_counts = np.sum(~np.isfinite(arr), axis=1)\n # Trigger on a NaN appearing anywhere in a line/row\n nans, = np.where(nan_counts > 1)\n return frozenset(nans)",
"def columns_with_na_values(data):\n aux = data.isna().sum() > ... | [
"0.7165634",
"0.66182244",
"0.64247483",
"0.6394519",
"0.63789696",
"0.63346905",
"0.6195757",
"0.61902004",
"0.6128271",
"0.60890377",
"0.60418016",
"0.5964616",
"0.5901305",
"0.58923835",
"0.58780015",
"0.5862449",
"0.5862449",
"0.5862449",
"0.5829332",
"0.5818259",
"0.5794... | 0.73045224 | 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.70900273 | 48 |
Generate a rotation matrix that rotates a point by an angle theta about the Zaxis. By default, assumes that the angle is passed in ``radians``. | def rotZ(theta, mode = 'radians'):
if mode != 'radians' and mode != 'degrees':
raise ValueError('Mode should either be ``radians`` or ``degrees``.')
if mode == 'degrees':
theta = np.deg2rad(theta)
return np.matrix([[np.cos(theta), -np.sin(theta), 0], [np.sin(theta), np.cos(theta), 0], \
[0., 0., 1.]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotateZMatrix(self, radians):\n\n c = np.cos(radians)\n s = np.sin(radians)\n return np.array([[c,-s, 0, 0],\n [s, c, 0, 0],\n [0, 0, 1, 0],\n [0, 0, 0, 1]])",
"def RotationMatrix(theta, x, y, z, point=None):\n\tretu... | [
"0.78562224",
"0.6925061",
"0.6757941",
"0.66810715",
"0.6665597",
"0.66074413",
"0.64646536",
"0.64412093",
"0.6367583",
"0.6357769",
"0.63407505",
"0.63345206",
"0.63345206",
"0.6330516",
"0.63222605",
"0.6311498",
"0.63021284",
"0.62926024",
"0.62789595",
"0.6269656",
"0.6... | 0.6835736 | 2 |
Test manual update entity via service homeassistant/update_entity. | async def test_manual_update_entity(hass: HomeAssistant) -> None:
await init_integration(hass, forecast=True)
await async_setup_component(hass, "homeassistant", {})
current = load_json_object_fixture("accuweather/current_conditions_data.json")
forecast = load_json_array_fixture("accuweather/forecast_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_manual_update(hass: HomeAssistant) -> None:\n await async_setup_component(hass, \"homeassistant\", {})\n respx.get(\"http://localhost\").respond(\n status_code=HTTPStatus.OK, json={\"data\": \"first\"}\n )\n assert await async_setup_component(\n hass,\n SENSOR_DOMAIN... | [
"0.7796293",
"0.76356006",
"0.74668574",
"0.74229115",
"0.74229115",
"0.74229115",
"0.7321319",
"0.71958214",
"0.7100282",
"0.7076642",
"0.6978721",
"0.6966874",
"0.6941876",
"0.691457",
"0.6800545",
"0.6784447",
"0.67496794",
"0.6748255",
"0.6744794",
"0.6720059",
"0.6686694... | 0.78510654 | 0 |
Apply the mask color to given image | def apply_mask(image, mask, cls2color=cityscapes_cls2color, alpha=0.5):
masks = []
for c in range(3):
mask_copy = mask.copy()
for k, v in cls2color.items():
mask_copy[mask == k] = v[c]
mask_copy = np.expand_dims(mask_copy, 2)
masks.append(mask_copy)
mask = np.conc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_mask(im, mask, color=(1, 0, 0)):\n masked = np.zeros(im.shape)\n for x, y in mask: masked[x][y] = color\n return masked",
"def apply_mask(image, mask, color, alpha=0.5):\n for c in range(3):\n image[:, :, c] = np.where(mask == 1,\n image[:, :, c] *\n ... | [
"0.8334109",
"0.8037327",
"0.80192494",
"0.7856319",
"0.7853038",
"0.7780787",
"0.77806455",
"0.76650286",
"0.7625786",
"0.75943446",
"0.75507796",
"0.7534981",
"0.74687713",
"0.74409735",
"0.7364049",
"0.7265084",
"0.72409713",
"0.72236633",
"0.7081653",
"0.7004605",
"0.6990... | 0.7675112 | 7 |
Blit the player to the target surface. | def draw(self,surface):
surface.blit(self.image, self.rect)
for moving in self.shots.values():
moving.draw() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blit(self, surface):\n surface.blit(self.surface, self.rect)",
"def draw_player(self):\n self.screen.blit(self.player_image, (self.player_position[\"x\"],self.player_position[\"y\"]))",
"def blit(self):\n self.screen.blit(self.image, self.rect)",
"def blitme(self):\r\n self.sc... | [
"0.773816",
"0.72039574",
"0.71470946",
"0.7090703",
"0.7090703",
"0.7090703",
"0.7090703",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.70666385",
"0.7038491",
"0.7038491",
"0.7038491",
"0.69... | 0.59688556 | 64 |
Store any number of experiment statistics. This will write the statistics from the most recent step to the output directory if one is specified. The statistics are also displayed in stdout at the step interval specified by `self.log_freq`. The statistics needn't change across multiple calls to this function as they wil... | def store(self, **stats):
if self.first_row:
self.log_headers = list(stats.keys())
for key in stats:
assert key in self.log_headers, f"Can't introduce a new key that you didn't include before: {key}"
# Write to output file
if self.first_row:
self.file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_stats(self):\n with open(self.log_file,'a') as output:\n writer = csv.writer(output)\n n_comps,comp_size = self.connected_component() # Calculate number of connected components (sub-colonies)\n writer.writerow([self.pop_size,\n self.get_average_ag... | [
"0.6334855",
"0.6235505",
"0.60259587",
"0.601794",
"0.59792906",
"0.5975385",
"0.59662896",
"0.5925985",
"0.5925901",
"0.5874682",
"0.5814251",
"0.5809331",
"0.58027244",
"0.57764137",
"0.5738266",
"0.5731305",
"0.5723422",
"0.5656563",
"0.56473047",
"0.5633934",
"0.5621433"... | 0.7055499 | 0 |
E[X] + c == E[X + c] | def expected_value_test_3(self):
c = 10
fun = self.x_ev.add(c)
res_x_c = self.X_dist.expectedValue(self.x_ev) + c
res_xc = self.X_dist.expectedValue(fun)
assert_almost_equal(res_x_c, res_xc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, c):\n for i in range(SPACE_DIMENSION):\n if self[i]!=c[i]:\n return False\n return True",
"def test07(self):\n a, b = np.arange(self.N), np.arange(1, self.N+1)\n c, d = bcolz.carray(a, rootdir=self.rootdir), b\n cr = c[\"a + 2 * d - 3 ... | [
"0.63298523",
"0.59646475",
"0.57949275",
"0.5774223",
"0.5683136",
"0.56673676",
"0.5629574",
"0.5566141",
"0.5515495",
"0.5511411",
"0.55041397",
"0.5479444",
"0.5463045",
"0.5457695",
"0.5397484",
"0.53792757",
"0.53756267",
"0.53687215",
"0.5358684",
"0.5354538",
"0.53508... | 0.0 | -1 |
Creates a Census object and calls its get method with the appropriate code_dict. | def get_demographic_set(code_dict, year, state_code, county_code, bg=False):
key = Names.get_census_key()
census = Census(key)
dataset = 'acs/acs5' if int(year) >= 2016 else 'acs5'
data = census.get(code_dict, state_code, county_code, year, dataset, bg)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_consensus(self, consensus):\r\n pass",
"def create_census_api_session(self):\n self._census_api = CensusAPI(self.census_api_key)\n yield\n del self._census_api",
"def covid_fetch():\n #Sets the structure of the data retrieved from the API\n cases_and_deaths = {\n \"dat... | [
"0.59460074",
"0.56518215",
"0.51518065",
"0.5129447",
"0.5092474",
"0.49909538",
"0.49885908",
"0.4983232",
"0.49574143",
"0.49363077",
"0.4915872",
"0.4910287",
"0.489077",
"0.48633897",
"0.48456693",
"0.48175806",
"0.48175633",
"0.47714576",
"0.47470647",
"0.4735681",
"0.4... | 0.46269244 | 37 |
Returns the file size in Bytes | def get_file_size(fname):
return os.path.getsize(fname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_size():\n return os.path.getsize(FILE_NAME)",
"def get_file_size(self) -> int:\n return self.get_main_information()['FileSize']",
"def file_size(self) -> int:\n return self.get_main_information()['FileSize']",
"def file_size(self,file_path):\n if os.path.isfile(file_path):\n ... | [
"0.8939642",
"0.88487613",
"0.87167144",
"0.8617665",
"0.858042",
"0.8552906",
"0.85349053",
"0.8477013",
"0.8477013",
"0.8477013",
"0.842872",
"0.8428169",
"0.8391353",
"0.8364002",
"0.8353534",
"0.83478826",
"0.83288074",
"0.83200955",
"0.83085316",
"0.8225882",
"0.82044923... | 0.80469847 | 36 |
Initialise the event manager. A sleeper function is used to wake up once a new event comes available. | def __init__(self):
self._events = collections.deque()
self._alarms = 0
self._alarm_active = True
self._kq = select.kqueue()
self._kq_events = {}
self.traceback = ()
self.event_count = 0
self._no_tb = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.events = {}\n self.eventmatchers = {}\n self.alive = True",
"def __init__(self):\n self.started = Event()",
"def __init__(self):\n self._event = multiprocessing.Event()\n self._queue = multiprocessing.JoinableQueue()\n self._results = ... | [
"0.6291824",
"0.6139287",
"0.6124241",
"0.59811056",
"0.5956005",
"0.5901791",
"0.58723813",
"0.58687854",
"0.58553445",
"0.5853665",
"0.5838681",
"0.5834964",
"0.58256614",
"0.58242524",
"0.58083224",
"0.57737243",
"0.57737243",
"0.57737243",
"0.57737243",
"0.57737243",
"0.5... | 0.63840324 | 0 |
Set your birthday to show up on the Cosmos Profile. | async def set_profile_birthday(self, ctx, *, birthday: str):
profile = await self.cache.get_profile(ctx.author.id)
await profile.set_birthday(birthday)
res = f"Your birthday is set to {profile.birthday.strftime('%A, %B %e, %Y')}."
await ctx.send_line(res, ctx.author.avatar_url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setBirthday(self, birthdate):\r\n self.birthday = birthdate",
"def setBirthday(self, birthdate):\n self.birthday = birthdate",
"def setBirthday(self,month,day,year):\n self.birthday = datetime.date(year,month,day)",
"def setBirthday(self,month,day,year):\n self.birthday = date... | [
"0.79154086",
"0.78290045",
"0.7735932",
"0.7735932",
"0.7647021",
"0.7486532",
"0.72227335",
"0.6997337",
"0.6909457",
"0.68309444",
"0.68281704",
"0.6793288",
"0.67897093",
"0.6561549",
"0.6546439",
"0.6440436",
"0.6429883",
"0.6403304",
"0.63885874",
"0.62992233",
"0.62937... | 0.79826754 | 0 |
Reads the nodes file and stores as a DataFrame. | def _read_node_file(self):
self.node_df = gt.remove_colons(pd.read_csv(self.node_file, dtype=str)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(self):\n data = pd.read_table(self.file_dir, sep=\"\\t\", header=None)\n data.columns = [\"FromNodeId\", \"ToNodeId\"]\n return data",
"def nodes_df_creation(self, path: str) -> pyspark.sql.dataframe.DataFrame:\n try:\n nodes_df = self.spark.read.parquet(path)... | [
"0.7188342",
"0.71578753",
"0.6900229",
"0.6444844",
"0.64122266",
"0.63447076",
"0.6292413",
"0.6283478",
"0.62274796",
"0.6195567",
"0.6190417",
"0.6174446",
"0.61594933",
"0.6149182",
"0.6056232",
"0.6002325",
"0.6001004",
"0.59962726",
"0.5949263",
"0.59192026",
"0.590031... | 0.7482473 | 0 |
Expect that an object can be instantiated with the right attributes. | def test_init(attributes):
instance = Participant(**attributes)
for attr, value in attributes.items():
assert getattr(instance, attr) == value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_constructors(self, name, obj):\n assert getattr(forge, name) == obj",
"def test_constructors(self, name, obj):\n assert getattr(forge, name) == obj",
"def test_from_object_fail(self):\n class InvalidClass(object):\n pass\n Invalid_object = InvalidClass()\n ... | [
"0.71503836",
"0.71503836",
"0.6796081",
"0.67125994",
"0.66723245",
"0.6597072",
"0.6565062",
"0.6543619",
"0.65400124",
"0.6530825",
"0.6482194",
"0.64496",
"0.6442326",
"0.6433054",
"0.6426752",
"0.6417383",
"0.6406627",
"0.6394254",
"0.6380104",
"0.63665533",
"0.63609433"... | 0.668577 | 4 |
Routine to calculate the initial velocities for the photon geodesic. | def calculate_ic(self):
# dt:
dt = self.E
# dr:
dr = np.sqrt(self.E ** 2 - (self.Q + self.L ** 2) / self.r ** 2)
#print(dr)
if np.isnan(dr):
dr = 0
#dr = self._check_dr_sign(self.alpha)
# dtheta:
omega = self.Q - self.L ** 2 * (np.cos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_velocities(self):\r\n self.wx = np.copy(Turbine.wzero)\r\n self.wy = np.copy(Turbine.wzero)",
"def init_pvelocity(self, population):\n for individual in population:\n # the initial speed is set to zero\n individual.features['velocity'] = [0] * len(individual.vec... | [
"0.66319895",
"0.6600563",
"0.64240515",
"0.63148826",
"0.6251954",
"0.61698514",
"0.6161908",
"0.61526215",
"0.60619813",
"0.6037457",
"0.60283023",
"0.5977822",
"0.59695166",
"0.59669995",
"0.5966139",
"0.59558713",
"0.5952949",
"0.59339803",
"0.5923478",
"0.59141403",
"0.5... | 0.0 | -1 |
Getter for the constants of motion. | def get_com(self):
return self.E, self.L, self.Q | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constants(self):\n return self.bot.constants",
"def get_constants(self):\n return self.D1, self.D2, self.A1, self.A2, \\\n self.F1, self.F2, self.S12",
"def get_constants(self) -> CWConstants:\n self.serial.write(b\"M!\")\n values = self.__read_response(1)[0]\n ... | [
"0.69824326",
"0.68576247",
"0.68563247",
"0.6706594",
"0.66856366",
"0.6625861",
"0.6439698",
"0.6367437",
"0.6367437",
"0.6367437",
"0.6241887",
"0.60466206",
"0.59321713",
"0.59240234",
"0.5836313",
"0.58210975",
"0.580013",
"0.579165",
"0.57712245",
"0.576145",
"0.5726428... | 0.0 | -1 |
Set (and possibly recalc) the emission angle beta. | def set_eta(self, eta, recalc=True):
self.eta = eta
if recalc:
self.setup() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setBetaFactor(self, newBeta):\n self.beta = newBeta\n self.gamma = self.calculateGammaFactors()",
"def updateBeta(self):\n\n priorBeta = np.copy(self.beta) # 返り値で更新幅を与えるので初期値を保持しておく\n W = self.__genW() # diag Matrix\n # update beta : Fisher Scoring Update\n result = ... | [
"0.6286281",
"0.5918907",
"0.5883902",
"0.5883902",
"0.5794211",
"0.5788358",
"0.5781255",
"0.5727266",
"0.57012814",
"0.57012814",
"0.5683675",
"0.5670008",
"0.55926746",
"0.5579683",
"0.5491432",
"0.5465267",
"0.54574746",
"0.54439783",
"0.5443078",
"0.5427309",
"0.5420321"... | 0.5366386 | 24 |
Sets up the window and widgets. | def __init__(self):
Frame.__init__(self)
self.master.title("Canvas Demo")
self.grid()
# create a canvas and place in this frame
self.canvas = Canvas(self, width = 200, height = 100,
bg = "white")
self.canvas.grid(row = 0, column = 0)
# Place buttons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self):\n self.ui.setup_window()",
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\... | [
"0.7910691",
"0.78307253",
"0.7798649",
"0.77902734",
"0.76395255",
"0.7474737",
"0.74304384",
"0.7420984",
"0.73780614",
"0.7364978",
"0.7345623",
"0.7325864",
"0.7305605",
"0.7287119",
"0.7264732",
"0.72239757",
"0.72001356",
"0.71263516",
"0.70997447",
"0.7087031",
"0.7052... | 0.0 | -1 |
A list of IP addresses or subnet masks to restrict group access. Will be concatenated together into a comma separated string. Only allowed on top level groups. | def ip_restriction_ranges(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "ip_restriction_ranges") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_ips(self):\n\n return value_list_to_comma('AllowedIPs', self._peer.allowed_ips)",
"def subnetting(self):\n ip = netaddr.IPNetwork(addr=self.subnet)\n subnets = list(ip.subnet(prefixlen=24))\n list_subnets = [str(subnet) for subnet in subnets]\n return list_subnets",... | [
"0.58076185",
"0.56698346",
"0.5669276",
"0.5526559",
"0.5416609",
"0.5408387",
"0.5370072",
"0.53700453",
"0.5362421",
"0.53332394",
"0.53322905",
"0.5311524",
"0.53109765",
"0.5286949",
"0.5245677",
"0.5245677",
"0.5245677",
"0.5245677",
"0.5245677",
"0.5244102",
"0.5244102... | 0.5412086 | 6 |
Defaults to true. Enable/disable Large File Storage (LFS) for the projects in this group. | def lfs_enabled(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "lfs_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lfs_enabled(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"lfs_enabled\")",
"def enable_files(self):\r\n if not self.files:\r\n self._set_subclient_properties(\"_subclient_properties['cloudAppsSubClientProp']\\\r\n ['salesforceSubc... | [
"0.59640765",
"0.53409183",
"0.5294283",
"0.5078812",
"0.5044131",
"0.49713063",
"0.49425024",
"0.49237454",
"0.48656824",
"0.48082808",
"0.4751746",
"0.4744643",
"0.47360379",
"0.46859276",
"0.46536738",
"0.46287233",
"0.460106",
"0.45899716",
"0.45667297",
"0.45523623",
"0.... | 0.5919325 | 1 |
The name of this group. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def getName(self):\n return _libsbml.Group_getName(self)",
"def group_name(self):\n\n return self._group_name",
"def get_group_na... | [
"0.8815308",
"0.8796503",
"0.85862744",
"0.851612",
"0.83817255",
"0.8212201",
"0.8212201",
"0.8212201",
"0.8212201",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
... | 0.0 | -1 |
Defaults to false. When enabled, users can not fork projects from this group to external namespaces. | def prevent_forking_outside_group(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "prevent_forking_outside_group") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevent_forking_outside_group(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"prevent_forking_outside_group\")",
"def project_grp():\n pass",
"def enable_fork_parent(self):\n\n self.vm_obj.EnableForkParent()",
"def any_parent_is_group(self):\n if self._any_parent_is_grou... | [
"0.66202724",
"0.6068462",
"0.574182",
"0.5532868",
"0.5396893",
"0.53494096",
"0.5336113",
"0.5290635",
"0.5287365",
"0.52774566",
"0.5236394",
"0.522874",
"0.5227244",
"0.5216911",
"0.5196178",
"0.5196178",
"0.51514256",
"0.51514256",
"0.5149977",
"0.51298887",
"0.5079952",... | 0.6631784 | 1 |
Defaults to false. Allow users to request member access. | def request_access_enabled(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "request_access_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def is_allowed(self) -> bool:\n return self.effect == ALLOW_ACCESS",
"def has_permission(self, request):\n\t\treturn request.user.is_active",
"def is_administrator(self):\n return False",
"def need_membership(view_func):\n def check_membe... | [
"0.6849366",
"0.6660746",
"0.6605702",
"0.6540382",
"0.6526027",
"0.65252775",
"0.65252775",
"0.65252775",
"0.6502478",
"0.6483457",
"0.6468765",
"0.6468765",
"0.6463506",
"0.64629406",
"0.64150304",
"0.6389049",
"0.638731",
"0.6382487",
"0.6380744",
"0.6372533",
"0.6356196",... | 0.6498075 | 10 |
Can be set by administrators only. Maximum number of monthly CI/CD minutes for this group. Can be nil (default; inherit system default), 0 (unlimited), or > 0. | def shared_runners_minutes_limit(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "shared_runners_minutes_limit") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shared_runners_minutes_limit(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"shared_runners_minutes_limit\")",
"def minutes(input=None):\n return get(input).minutes",
"def maxTimes(self)->int:\n return self._lic.params['maxAccessTimes'].value",
"def _get_cgroups_max_cpu_usage(se... | [
"0.64227384",
"0.6111857",
"0.6108748",
"0.6010775",
"0.5994632",
"0.59869397",
"0.598075",
"0.59454626",
"0.5873803",
"0.57794523",
"0.5773599",
"0.5773599",
"0.5773482",
"0.5711413",
"0.5632766",
"0.55791867",
"0.55679387",
"0.5553973",
"0.554364",
"0.5530836",
"0.55178136"... | 0.6214698 | 1 |
Input properties used for looking up and filtering Group resources. | def __init__(__self__, *,
auto_devops_enabled: Optional[pulumi.Input[bool]] = None,
avatar: Optional[pulumi.Input[str]] = None,
avatar_hash: Optional[pulumi.Input[str]] = None,
avatar_url: Optional[pulumi.Input[str]] = None,
default_br... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"property_group_id\")",
"def groupfilter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"groupfilter\")",
"def groupfilter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"groupf... | [
"0.584398",
"0.58083916",
"0.58083916",
"0.57833415",
"0.5757807",
"0.5751791",
"0.5710303",
"0.5698739",
"0.5673951",
"0.56210864",
"0.5609828",
"0.55844724",
"0.55844724",
"0.55844724",
"0.5570786",
"0.5551417",
"0.5551417",
"0.5547407",
"0.55390674",
"0.5536077",
"0.553569... | 0.0 | -1 |
The full name of the group. | def full_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "full_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def get_group_name(self):\n return self.groupname",
"def group_name(self):\n\n return self._group_name",
"def group_name(self) ->... | [
"0.87655264",
"0.87619334",
"0.8648473",
"0.85542977",
"0.8263364",
"0.81084156",
"0.79874754",
"0.79874754",
"0.7945599",
"0.7945599",
"0.7935524",
"0.77901536",
"0.77501506",
"0.7732263",
"0.7721572",
"0.7721572",
"0.7700081",
"0.7631772",
"0.7600773",
"0.75541866",
"0.7535... | 0.0 | -1 |
A list of IP addresses or subnet masks to restrict group access. Will be concatenated together into a comma separated string. Only allowed on top level groups. | def ip_restriction_ranges(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "ip_restriction_ranges") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_ips(self):\n\n return value_list_to_comma('AllowedIPs', self._peer.allowed_ips)",
"def subnetting(self):\n ip = netaddr.IPNetwork(addr=self.subnet)\n subnets = list(ip.subnet(prefixlen=24))\n list_subnets = [str(subnet) for subnet in subnets]\n return list_subnets",... | [
"0.5807656",
"0.56691176",
"0.5668636",
"0.552672",
"0.5417261",
"0.540896",
"0.53714293",
"0.5370836",
"0.5363122",
"0.53342706",
"0.5333277",
"0.5311564",
"0.5311217",
"0.52880347",
"0.5246972",
"0.5246972",
"0.5246972",
"0.5246972",
"0.5246972",
"0.52450806",
"0.52450806",... | 0.54131126 | 5 |
The name of this group. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def getName(self):\n return _libsbml.Group_getName(self)",
"def group_name(self):\n\n return self._group_name",
"def get_group_na... | [
"0.8815308",
"0.8796503",
"0.85862744",
"0.851612",
"0.83817255",
"0.8212201",
"0.8212201",
"0.8212201",
"0.8212201",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
... | 0.0 | -1 |
Defaults to false. When enabled, users can not fork projects from this group to external namespaces. | def prevent_forking_outside_group(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "prevent_forking_outside_group") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevent_forking_outside_group(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"prevent_forking_outside_group\")",
"def project_grp():\n pass",
"def enable_fork_parent(self):\n\n self.vm_obj.EnableForkParent()",
"def any_parent_is_group(self):\n if self._any_parent_is_grou... | [
"0.66202724",
"0.6068462",
"0.574182",
"0.5532868",
"0.5396893",
"0.53494096",
"0.5336113",
"0.5290635",
"0.5287365",
"0.52774566",
"0.5236394",
"0.522874",
"0.5227244",
"0.5216911",
"0.5196178",
"0.5196178",
"0.51514256",
"0.51514256",
"0.5149977",
"0.51298887",
"0.5079952",... | 0.6631784 | 0 |
Defaults to false. Allow users to request member access. | def request_access_enabled(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "request_access_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def is_allowed(self) -> bool:\n return self.effect == ALLOW_ACCESS",
"def has_permission(self, request):\n\t\treturn request.user.is_active",
"def is_administrator(self):\n return False",
"def need_membership(view_func):\n def check_membe... | [
"0.6849366",
"0.6660746",
"0.6605702",
"0.6540382",
"0.6526027",
"0.65252775",
"0.65252775",
"0.65252775",
"0.6502478",
"0.6483457",
"0.6468765",
"0.6468765",
"0.6463506",
"0.64629406",
"0.64150304",
"0.6389049",
"0.638731",
"0.6382487",
"0.6380744",
"0.6372533",
"0.6356196",... | 0.6498075 | 9 |
Can be set by administrators only. Maximum number of monthly CI/CD minutes for this group. Can be nil (default; inherit system default), 0 (unlimited), or > 0. | def shared_runners_minutes_limit(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "shared_runners_minutes_limit") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shared_runners_minutes_limit(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"shared_runners_minutes_limit\")",
"def minutes(input=None):\n return get(input).minutes",
"def maxTimes(self)->int:\n return self._lic.params['maxAccessTimes'].value",
"def _get_cgroups_max_cpu_usage(se... | [
"0.6423931",
"0.6113475",
"0.61100674",
"0.6012798",
"0.599724",
"0.5987509",
"0.5982947",
"0.59468603",
"0.5875",
"0.5779746",
"0.577555",
"0.577555",
"0.5774766",
"0.5710874",
"0.56311494",
"0.5581071",
"0.556822",
"0.55538523",
"0.5544943",
"0.55336136",
"0.5517607",
"0.... | 0.6217226 | 2 |
The full name of the group. | def full_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "full_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def get_group_name(self):\n return self.groupname",
"def group_name(self):\n\n return self._group_name",
"def group_name(self) ->... | [
"0.87655264",
"0.87619334",
"0.8648473",
"0.85542977",
"0.8263364",
"0.81084156",
"0.79874754",
"0.79874754",
"0.7945599",
"0.7945599",
"0.7935524",
"0.77901536",
"0.77501506",
"0.7732263",
"0.7721572",
"0.7721572",
"0.7700081",
"0.7631772",
"0.7600773",
"0.75541866",
"0.7535... | 0.0 | -1 |
A list of IP addresses or subnet masks to restrict group access. Will be concatenated together into a comma separated string. Only allowed on top level groups. | def ip_restriction_ranges(self) -> pulumi.Output[Optional[Sequence[str]]]:
return pulumi.get(self, "ip_restriction_ranges") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_ips(self):\n\n return value_list_to_comma('AllowedIPs', self._peer.allowed_ips)",
"def subnetting(self):\n ip = netaddr.IPNetwork(addr=self.subnet)\n subnets = list(ip.subnet(prefixlen=24))\n list_subnets = [str(subnet) for subnet in subnets]\n return list_subnets",... | [
"0.5807656",
"0.56691176",
"0.5668636",
"0.552672",
"0.5417261",
"0.54131126",
"0.54131126",
"0.53714293",
"0.5370836",
"0.5363122",
"0.53342706",
"0.5333277",
"0.5311564",
"0.5311217",
"0.52880347",
"0.5246972",
"0.5246972",
"0.5246972",
"0.5246972",
"0.5246972",
"0.52450806... | 0.540896 | 7 |
The name of this group. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def getName(self):\n return _libsbml.Group_getName(self)",
"def group_name(self):\n\n return self._group_name",
"def get_group_na... | [
"0.8815308",
"0.8796503",
"0.85862744",
"0.851612",
"0.83817255",
"0.8212201",
"0.8212201",
"0.8212201",
"0.8212201",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
"0.8184721",
... | 0.0 | -1 |
Defaults to false. When enabled, users can not fork projects from this group to external namespaces. | def prevent_forking_outside_group(self) -> pulumi.Output[bool]:
return pulumi.get(self, "prevent_forking_outside_group") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevent_forking_outside_group(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"prevent_forking_outside_group\")",
"def prevent_forking_outside_group(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"prevent_forking_outside_group\")",
"def project_grp():\n ... | [
"0.6631784",
"0.6631784",
"0.6068462",
"0.574182",
"0.5532868",
"0.5396893",
"0.53494096",
"0.5336113",
"0.5290635",
"0.5287365",
"0.52774566",
"0.5236394",
"0.522874",
"0.5227244",
"0.5216911",
"0.5196178",
"0.5196178",
"0.51514256",
"0.51514256",
"0.5149977",
"0.51298887",
... | 0.66202724 | 2 |
Defaults to false. Allow users to request member access. | def request_access_enabled(self) -> pulumi.Output[bool]:
return pulumi.get(self, "request_access_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def is_allowed(self) -> bool:\n return self.effect == ALLOW_ACCESS",
"def has_permission(self, request):\n\t\treturn request.user.is_active",
"def is_administrator(self):\n return False",
"def need_membership(view_func):\n def check_membe... | [
"0.6849366",
"0.6660746",
"0.6605702",
"0.6540382",
"0.6526027",
"0.65252775",
"0.65252775",
"0.65252775",
"0.6502478",
"0.6498075",
"0.6498075",
"0.6483457",
"0.6468765",
"0.6468765",
"0.6463506",
"0.64629406",
"0.64150304",
"0.6389049",
"0.6382487",
"0.6380744",
"0.6372533"... | 0.638731 | 18 |
Can be set by administrators only. Maximum number of monthly CI/CD minutes for this group. Can be nil (default; inherit system default), 0 (unlimited), or > 0. | def shared_runners_minutes_limit(self) -> pulumi.Output[int]:
return pulumi.get(self, "shared_runners_minutes_limit") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shared_runners_minutes_limit(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"shared_runners_minutes_limit\")",
"def shared_runners_minutes_limit(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"shared_runners_minutes_limit\")",
"def minutes(input=None):\n ... | [
"0.62170434",
"0.62170434",
"0.61141247",
"0.6109233",
"0.6010572",
"0.5997726",
"0.5987793",
"0.5980146",
"0.59467024",
"0.587503",
"0.57783365",
"0.57752204",
"0.57752204",
"0.5774505",
"0.57086927",
"0.5631148",
"0.5579466",
"0.55692446",
"0.5553937",
"0.5544016",
"0.55335... | 0.64242864 | 0 |
Return a random email address ending in dbca.wa.gov.au | def random_dbca_email():
s = ''.join(random.choice(string.ascii_letters) for i in range(20))
return '{}@dbca.wa.gov.au'.format(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_email():\n return _random_string(10, 15) + \"@\" + _random_string(10, 15) + \".\" + _select_from([\"ac.uk\", \"edu\", \"com\"])",
"def generate_email():\n valid_domain_name_chars = [c for c in range(48,57)]+[c for c in range(65,90)]+[c for c in range(97,122)]+[45]\n username = ''.join(genera... | [
"0.8056285",
"0.715848",
"0.715546",
"0.65744054",
"0.65642",
"0.63009435",
"0.624172",
"0.6102155",
"0.60532564",
"0.59849274",
"0.59799176",
"0.59672624",
"0.59315455",
"0.59061956",
"0.5881061",
"0.58275795",
"0.5827534",
"0.57853866",
"0.5766564",
"0.5760094",
"0.5731833"... | 0.84247315 | 0 |
Calculates the perspective transform from at least 4 points of corresponding points using the Normalized Direct Linear Transformation method. | def compute_homography(src, dst):
h_matrix = np.eye(3, dtype=np.float64)
### YOUR CODE HERE
raise NotImplementedError() # Delete this line
### END YOUR CODE
return h_matrix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perspectiveNormalizationXform(self):\n return np.array([[1.0/np.tan(self.view_angle_h), 0, 0, 0],\n [0, 1.0/np.tan(self.view_angle_v), 0, 0],\n [0, 0, (self.far + self.near)/(self.far - self.near),\n 2*self.far*self.near/(self.far - self.near)],\n... | [
"0.68986464",
"0.68684274",
"0.68525153",
"0.68331325",
"0.67566794",
"0.6730854",
"0.6669902",
"0.66085714",
"0.6593573",
"0.6529709",
"0.6470461",
"0.63970774",
"0.630993",
"0.6265241",
"0.62621355",
"0.62558347",
"0.6218966",
"0.6213023",
"0.6206424",
"0.6183548",
"0.61702... | 0.0 | -1 |
Initializes a new HealthStatisticsPublisherManager with a given number of seconds as the interval | def __init__(self, publish_interval, health_stat_plugin):
Thread.__init__(self)
self.log = LogFactory().get_log(__name__)
self.publish_interval = publish_interval
""":type : int"""
self.terminated = False
self.publisher = HealthStatisticsPublisher()
""":type : Hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,interval):\n _interval = interval",
"def __init__(self, duration=1, max_per_interval=5):\n\n self.duration = duration\n self.max_per_interval = max_per_interval\n\n self.stopwatch = StopWatch()\n self.num_processed_this_interval = 0",
"def __init__(self, inter... | [
"0.62409776",
"0.61241734",
"0.5839857",
"0.57668424",
"0.57667977",
"0.5561957",
"0.55196255",
"0.5516953",
"0.5491214",
"0.54747677",
"0.54636186",
"0.54372716",
"0.54213154",
"0.5366436",
"0.53312963",
"0.5288059",
"0.5268801",
"0.5232484",
"0.52041787",
"0.5201852",
"0.51... | 0.6346899 | 0 |
Reformat annotations dict to return list of corresponding zipkin_core objects. | def annotation_list_builder(annotations, host):
return [create_annotation(
int(timestamp * 1000000), key, host)
for key, timestamp in annotations.items()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_annotations(self) -> List[Dict[int, Dict[str, Any]]]:\n annotations = []\n for item in self.collector:\n data_file_type = os.path.basename(item).split(\".\")[-1]\n annotations.append(\n load_annotation_file(\n os.path.join(\n ... | [
"0.6210559",
"0.59787285",
"0.5924995",
"0.58572626",
"0.5723241",
"0.5723241",
"0.572062",
"0.5702353",
"0.5643333",
"0.562474",
"0.5565374",
"0.5560835",
"0.55036104",
"0.5496457",
"0.54670227",
"0.5444577",
"0.5409689",
"0.5400708",
"0.53580207",
"0.5357135",
"0.53443575",... | 0.53406125 | 21 |
Return queried user record by provided id. | async def get(cls, user_id):
try:
user = await db.one(cls.SELECT_USER, user_id=user_id)
except exceptions.NoResultFound:
LOGGER.error("Could not find user=%s.", user_id)
raise DatabaseError
except SQLAlchemyError as err:
LOGGER.error("Failed to fet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_id(cls, _id):\n user = cls.query.filter_by(id=_id).first()\n return user",
"def get(id):\n return User.query.filter_by(id=id).first()",
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def get_by_id(self, id):\n return self.session.query(User).filter_by... | [
"0.8249657",
"0.82025254",
"0.80225414",
"0.80082965",
"0.79531187",
"0.78832614",
"0.78375834",
"0.7828614",
"0.78095007",
"0.7798457",
"0.7781435",
"0.777003",
"0.7767997",
"0.7755758",
"0.7738673",
"0.7713266",
"0.7702857",
"0.7702857",
"0.7702857",
"0.7702857",
"0.7695712... | 0.7188699 | 65 |
Return queried user`s limit by provided mcc code. | async def get_limit(cls, user_id, mcc_code):
try:
limit = await db.one(cls.SELECT_LIMIT, user_id=user_id, mcc_code=mcc_code)
except exceptions.NoResultFound:
LOGGER.error("Could not find limit by mcc code=%s for user=%s.", mcc_code, user_id)
raise DatabaseError
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_limit(self):\n return self.limit",
"def get_limit(self):\n return self._limit",
"def get_limit(self):\n return self._limit",
"def getLCLimits(*args):\n return args[0].Limit.LCLimit.lc_limit",
"def get_limits(self):\n raise NotImplementedError(\"Limits are not availabl... | [
"0.6607065",
"0.6379157",
"0.6379157",
"0.6094501",
"0.6067294",
"0.60339046",
"0.60040474",
"0.5994278",
"0.5994278",
"0.5985502",
"0.5978674",
"0.59709644",
"0.5958785",
"0.5945581",
"0.59402275",
"0.58742934",
"0.587186",
"0.5862946",
"0.5860463",
"0.5860301",
"0.58583546"... | 0.85457164 | 0 |
Test string to list with default delimiter (comma). | def test_string_to_list_string(self):
assert_equals(
str_to_list('a, b, c'),
['a', 'b', 'c']
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_string_to_list_string(self):\n\n assert_equals(\n str_to_list('a, b, c'),\n ['a', 'b', 'c']\n )",
"def test_string_to_list_string_delimiter(self):\n assert_equals(\n str_to_list(' a | b | c ', delimiter='|'),\n ['a', 'b', 'c']\n )",... | [
"0.7516786",
"0.73749596",
"0.73197794",
"0.7104217",
"0.70850724",
"0.69901824",
"0.69228685",
"0.6868293",
"0.6827386",
"0.68251467",
"0.68251467",
"0.68128663",
"0.6805993",
"0.6741072",
"0.6619719",
"0.6602993",
"0.65685004",
"0.6544581",
"0.65275055",
"0.65158194",
"0.65... | 0.7599828 | 0 |
Check to see if we created the 0001 frame of this file. | def check_already_extracted(video_parts):
filename_no_ext, _ = video_parts
return bool(os.path.exists(os.path.join(output_dir,
filename_no_ext + '-0030.jpg'))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_frame(self):\n first_byte_as_bits = bin(int(self.packet_body[self.reader], base=16))[2:].zfill(8)\n return first_byte_as_bits[0:3] == \"001\"",
"def check_encoder(self):\n file = Path(self.get_encoder_path() + \".data-00000-of-00001\")\n\n return file.exists()",
"def hasCurre... | [
"0.6845341",
"0.6385996",
"0.62448496",
"0.6057301",
"0.58535653",
"0.5787386",
"0.57349885",
"0.57237864",
"0.56976765",
"0.56358933",
"0.5621559",
"0.559981",
"0.55927694",
"0.5521344",
"0.550883",
"0.5489131",
"0.5481525",
"0.54558146",
"0.5454623",
"0.54435945",
"0.543617... | 0.0 | -1 |
Return the state attributes. | def device_state_attributes(self):
attrs = {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_DEVICE_ID: self.unique_id,
}
return attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.78084475 | 41 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.