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 |
|---|---|---|---|---|---|---|
Opens the init editor. | def run_init(self):
InitEditor(self.root, self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_editor(event):\n event.current_buffer.open_in_editor(event.cli)",
"def _open_editor(self, editcmd):\n subprocess.Popen(editcmd, shell=True).communicate()",
"def open(self):\n self._command = \"open\"",
"def open_editor(self, tbl):\r\n self.choose_frame.destroy()\r\n ... | [
"0.73635787",
"0.6530124",
"0.6349999",
"0.63228106",
"0.6290048",
"0.6197694",
"0.6036526",
"0.60243505",
"0.60178286",
"0.5965472",
"0.5890049",
"0.5883924",
"0.58773047",
"0.58766025",
"0.5871069",
"0.58137065",
"0.578294",
"0.5776598",
"0.57764345",
"0.57478744",
"0.57364... | 0.74665225 | 0 |
Performs a safe division, returning the provided value if the denominator is 0 to avoid a divide by 0 error | def safe_divide(num,denom,ifzero=0.0):
return ifzero if denom==0 else num/denom | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_by(numerator, denominator):\n try:\n return numerator / denominator\n except ZeroDivisionError:\n logging.getLogger().error('Divide by zero!')\n logging.getLogger().error('It is really not a good idea.')\n raise",
"def division(a, b):\n if b != 0:\n return a... | [
"0.8196114",
"0.8113722",
"0.8066289",
"0.8054077",
"0.8015267",
"0.79199505",
"0.78153396",
"0.78012794",
"0.76436037",
"0.7625815",
"0.7607134",
"0.7583292",
"0.7565087",
"0.73328966",
"0.73079956",
"0.72760665",
"0.7256246",
"0.72155493",
"0.719444",
"0.719322",
"0.7181476... | 0.8154627 | 1 |
Yield successive nsized chunks from l. | def _chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.76458347",
"0.76... | 0.7815877 | 5 |
Update the canvas from a numpy array. | def update_canvas_display_from_numpy_array(self, image_data):
if len(self.drop_bands) > 0:
zeros_image = numpy.zeros_like(image_data[:, :, 0])
for drop_band in self.drop_bands:
image_data[:, :, drop_band] = zeros_image
self.canvas_decimated_image = image_data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateArrayPlotData(self):\n self.arrayPlotData.set_data(\"channel0\",self.array0)\n self.arrayPlotData.set_data(\"channel1\",self.array1)\n self.arrayPlotData.set_data(\"channel2\",self.array2)\n self.arrayPlotData.set_data(\"channel3\",self.array3)\n self.arrayPlotData.set_... | [
"0.692149",
"0.6438751",
"0.6347368",
"0.6284326",
"0.60679287",
"0.60043323",
"0.5963867",
"0.5816997",
"0.5806493",
"0.5796366",
"0.5793636",
"0.5780118",
"0.5765778",
"0.5755655",
"0.5727287",
"0.5673312",
"0.5608756",
"0.5606167",
"0.5573033",
"0.5538582",
"0.5529109",
... | 0.6940358 | 0 |
Get the decimation factor from the canvas rectangle size. | def get_decimation_from_canvas_rect(self, canvas_rect):
full_image_rect = self.canvas_rect_to_full_image_rect(canvas_rect)
return self.get_decimation_factor_from_full_image_rect(full_image_rect) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_decimation_factor_from_full_image_rect(self, full_image_rect):\n\n ny = full_image_rect[2] - full_image_rect[0]\n nx = full_image_rect[3] - full_image_rect[1]\n decimation_y = ny / self.canvas_ny\n decimation_x = nx / self.canvas_nx\n decimation_factor = max(decimation_y,... | [
"0.6785282",
"0.6428618",
"0.6286547",
"0.6250641",
"0.6061898",
"0.6061898",
"0.6061898",
"0.6030123",
"0.59987795",
"0.5946437",
"0.5824077",
"0.5812407",
"0.5800032",
"0.5795698",
"0.5789064",
"0.57487595",
"0.5748321",
"0.56569993",
"0.56409323",
"0.562279",
"0.5616516",
... | 0.74476343 | 0 |
Gets the canvas coordinates from full image coordinates in yx order. | def full_image_yx_to_canvas_coords(self, full_image_yx):
decimation_factor = self.decimation_factor
if self.scale_to_fit_canvas:
decimation_factor = decimation_factor / self.display_rescaling_factor
siz = int(len(full_image_yx)/2)
out = []
for i in range(siz):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_coords_to_canvas_coords(self, image_coords):\n\n return self.variables.canvas_image_object.full_image_yx_to_canvas_coords(image_coords)",
"def display_image_coords_to_canvas_coords(display_image_yx_coords):\n\n return [(yx[1], yx[0]) for yx in display_image_yx_coords]",
"def canvas_coor... | [
"0.7808287",
"0.75504386",
"0.7488789",
"0.70280904",
"0.7026112",
"0.70233524",
"0.6950263",
"0.6885934",
"0.68220663",
"0.6816514",
"0.6662937",
"0.65611416",
"0.6548652",
"0.65472275",
"0.64510536",
"0.64381576",
"0.6415152",
"0.63798326",
"0.63271713",
"0.6325277",
"0.629... | 0.80788845 | 0 |
Sets the tool to the closest shape. Returns None | def set_current_tool_to_select_closest_shape(self):
self.variables.active_tool = TOOLS.SELECT_CLOSEST_SHAPE_TOOL
self.variables.current_tool = TOOLS.SELECT_CLOSEST_SHAPE_TOOL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_current_tool_to_edit_shape(self):\n\n self.variables.active_tool = TOOLS.EDIT_SHAPE_TOOL\n self.variables.current_tool = TOOLS.EDIT_SHAPE_TOOL",
"def set_current_tool_to_translate_shape(self):\n\n self.variables.active_tool = TOOLS.TRANSLATE_SHAPE_TOOL\n self.variables.current... | [
"0.66435635",
"0.6610835",
"0.64871246",
"0.648464",
"0.6091421",
"0.5831092",
"0.5660819",
"0.5590695",
"0.55692357",
"0.5445306",
"0.54200065",
"0.5410245",
"0.5401045",
"0.53517497",
"0.5350428",
"0.5342853",
"0.532975",
"0.5314802",
"0.530485",
"0.522619",
"0.5204754",
... | 0.8016262 | 0 |
Sets the current tool to draw arrow by clicking. | def set_current_tool_to_draw_arrow_by_clicking(self, arrow_id=None):
self.variables.current_shape_id = arrow_id
self.show_shape(arrow_id)
self.variables.active_tool = TOOLS.DRAW_ARROW_BY_CLICKING
self.variables.current_tool = TOOLS.DRAW_ARROW_BY_CLICKING | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_current_tool_to_draw_arrow_by_dragging(self, arrow_id=None):\n\n self.variables.current_shape_id = arrow_id\n self.show_shape(arrow_id)\n self.variables.active_tool = TOOLS.DRAW_ARROW_BY_DRAGGING\n self.variables.current_tool = TOOLS.DRAW_ARROW_BY_DRAGGING",
"def set_current_t... | [
"0.76578206",
"0.6712354",
"0.6681209",
"0.65750676",
"0.63660246",
"0.6351923",
"0.63361716",
"0.6260625",
"0.6195327",
"0.6169218",
"0.6162129",
"0.60545754",
"0.6021671",
"0.59788436",
"0.5970578",
"0.59543896",
"0.5952122",
"0.5942005",
"0.5898964",
"0.5868352",
"0.580271... | 0.82416916 | 0 |
Extract list of parameters to be optimized. This function can utilize the native functions of the networks that directly provide the list of parameters, but here we additionally look at the command line arguments and see whether some options freeze certain of those parameters. By default, a list of the parameters to be... | def extract_parameters(net, config, network_type, params_type='forward',
return_nones=False):
if network_type == 'BP':
# For backprop, plasticity might be limited to certain layers.
params = net.params
if return_nones:
for i, p in enumerate(params):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params():\n\n parser = get_params_parser()\n args = parser.parse_args()\n\n tasks = [args.raw, args.enrich, args.identities_load, args.identities_merge, args.panels]\n\n if not any(tasks):\n print(\"No tasks enabled\")\n sys.exit(1)\n\n return args",
"def optim_args(self) -> ... | [
"0.62497723",
"0.61346924",
"0.6015578",
"0.59578526",
"0.57578444",
"0.57184285",
"0.5636824",
"0.5628322",
"0.5607508",
"0.55803627",
"0.55803627",
"0.55803627",
"0.5560631",
"0.5549079",
"0.5549079",
"0.55214",
"0.55186254",
"0.54982835",
"0.5481093",
"0.5466355",
"0.54486... | 0.6359094 | 0 |
Set all the gradients to zero. | def zero_grad(self):
for optimizer in self._optimizer_list:
optimizer.zero_grad() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_grad(self):\n for p, dp in self.params:\n dp.zero_()",
"def zero_grad(self):\r\n for param in self.params:\r\n param.grad = None",
"def zero_grad(self):\n for p, grad, v, square_grad_avg, delta_x_acc in self.params:\n grad.zero_()",
"def zero_gra... | [
"0.8343319",
"0.83069706",
"0.8235486",
"0.8235486",
"0.82018554",
"0.81880325",
"0.8158045",
"0.8119923",
"0.79095554",
"0.78224814",
"0.78083587",
"0.77896386",
"0.77660763",
"0.7739554",
"0.77107763",
"0.77107763",
"0.77107763",
"0.77089274",
"0.7689539",
"0.7597957",
"0.7... | 0.8056257 | 8 |
Get the front element. | def peek(self):
self._a_to_b()
return self.b[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self):
return len(self.a) + len(self.b) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.926939",
"0.92500085",
"0.92354494",
"0.92354494",
"0.915512",
"0.9097911",
"0.9094347",
"0.9091846",
"0.9072278",
"0.9053046",
"0.8920022",
"0.8913165",
"0.8877088",
"0.8843175",
"0.8843175",
"0.8835378",
"0.88035154",
"0.87576264",
"0.8756864",
"0.8730981",
"0.8645161",
... | 0.0 | -1 |
Return the number of rejected lines | def rejectedlines(self):
return self._rejectedlines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines_errored(self) -> int:\n with self.lock:\n return self._lines_errored",
"def _getNewCodeLength(self):\n nb_lines = 0\n for line in self.body.splitlines():\n if not line.startswith(\"-\"):\n nb_lines += 1\n return nb_lines",
"def get_number_of_non_exhausted_ballot... | [
"0.66977626",
"0.5955652",
"0.59393525",
"0.5884256",
"0.58836186",
"0.58721435",
"0.5868433",
"0.5835917",
"0.5835729",
"0.58338916",
"0.58338916",
"0.58326274",
"0.58291185",
"0.58124226",
"0.5801271",
"0.577677",
"0.5728164",
"0.57231474",
"0.57189643",
"0.57153",
"0.57129... | 0.71122307 | 0 |
Test the email for a new user is normalized | def test_new_user_email_normalized(self):
email = 'scottakirschner@GMAIL.COM'
user = get_user_model().objects.create_user(email, 'test123')
self.assertEqual(user.email, email.lower()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user = get_user_model().objects.create_user(email, '212ds')\n\n self.assertEqual(user.email, email.lower())",
"def test_new_email_normalised(self):\n\n email = \"test@RANDOMEMAIL.org\"\n user = get_user_mod... | [
"0.79984254",
"0.7997281",
"0.79201037",
"0.78920823",
"0.78920823",
"0.78920823",
"0.7871696",
"0.78619236",
"0.7858499",
"0.7853585",
"0.7844939",
"0.7773778",
"0.7771046",
"0.7745209",
"0.7744957",
"0.7702127",
"0.75698525",
"0.75344014",
"0.74174696",
"0.7257744",
"0.7147... | 0.785927 | 8 |
Test creating user with no email raises error | def test_new_user_invalid_email(self):
with self.assertRaises(ValueError):
get_user_model().objects.create_user(None, 'test123') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_private_create_user_without_email(self):\n with pytest.raises(ValueError) as exinfo:\n EmailUser.objects._create_user(None, None, False, False)\n self.assertIn('email must be set', str(exinfo.value))",
"def test_creating_a_new_user_without_email(self):\n\n with self.asser... | [
"0.90313256",
"0.8963383",
"0.8736711",
"0.8736247",
"0.87256855",
"0.8717645",
"0.87053293",
"0.87032956",
"0.8700956",
"0.869592",
"0.86902976",
"0.8681168",
"0.86709315",
"0.8597593",
"0.85930586",
"0.85868686",
"0.8557775",
"0.85267687",
"0.8396068",
"0.83576405",
"0.8287... | 0.87146974 | 10 |
Transform bounding boxes to be more like true bounding boxes. 'offsets' is one of the outputs of the nets. | def _calibrate_box(self, bboxes, offsets):
x1, y1, x2, y2 = [bboxes[:, i] for i in range(4)]
w = x2 - x1 + 1.0
h = y2 - y1 + 1.0
w = torch.unsqueeze(w, 1)
h = torch.unsqueeze(h, 1)
# this is what happening here:
# tx1, ty1, tx2, ty2 = [offsets[:, i] for i in rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_bbox(bboxes, old_shape, new_shape):\n bboxes = np.array(bboxes, np.float32)\n if bboxes.shape[0] == 0:\n return bboxes\n\n oh, ow = old_shape\n nh, nw = new_shape\n\n bboxes[:, 0] = bboxes[:, 0] * nh / oh\n bboxes[:, 1] = bboxes[:, 1] * nw / ow\n bboxes[:, 2] = bboxes[:, 2] ... | [
"0.6294375",
"0.62389016",
"0.6235039",
"0.6143996",
"0.6119098",
"0.6060419",
"0.60598797",
"0.6048341",
"0.60462654",
"0.6044357",
"0.60333943",
"0.6030084",
"0.59891045",
"0.5913514",
"0.58497196",
"0.58483124",
"0.58224756",
"0.58200276",
"0.58145607",
"0.5806389",
"0.577... | 0.6836411 | 0 |
SETUP funcion for TestUser class, this function is executed for each function in this TestClass | def setup(self, session):
user_types = []
user_types.append(UserType("ADMIN", 2))
user_types.append(UserType("GUEST", 0))
user_types.append(UserType("USER", 1))
user_type_db = UserType.query.all()
for user in user_type_db:
for seedUser in user_types:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.user_1 = User()",
"def setUpClass(cls):\n cls.ins = User()",
"def setUpClass(cls):\n cls.user = User()\n cls.user.first_name = \"Kev\"\n cls.user.last_name = \"Yo\"\n cls.user.email = \"1234@yahoo.com\"\n cls.storage = db_storage()",
"d... | [
"0.8078728",
"0.80658495",
"0.80610627",
"0.7916541",
"0.7902837",
"0.789154",
"0.78752875",
"0.78639704",
"0.7848155",
"0.7830282",
"0.78217167",
"0.7819956",
"0.7800205",
"0.7772404",
"0.7753675",
"0.7753675",
"0.7744824",
"0.7694",
"0.7690794",
"0.7676174",
"0.7667984",
... | 0.0 | -1 |
Return all categories in the database | def load_categories(request: HttpRequest) -> JsonResponse:
result = {'categories': []}
categories = Category.objects.all().order_by('name')
for category in categories:
sources = category.source_set.all().order_by('name')
result['categories'].append({
'name': category.name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_all_categories() -> dict:\n categories = database.fetchall(\"Categories\", \"id\", \"name_ua\")\n return categories",
"def get_categories():\n return session.query(Category)",
"def getAllCategory():\n return session.query(Category).all()",
"def get_categories(self):\n cate... | [
"0.8455899",
"0.83973366",
"0.8378107",
"0.8281607",
"0.8234351",
"0.8036251",
"0.8033548",
"0.7879338",
"0.78517056",
"0.77666473",
"0.7764305",
"0.7708117",
"0.7651857",
"0.760926",
"0.75509065",
"0.7546427",
"0.75412583",
"0.7525386",
"0.7446411",
"0.73874843",
"0.73716474... | 0.0 | -1 |
Extract all legal words given a piece of text | def _extract(txt):
words = []
blank = re.compile(r"\s+")
num = re.compile(r"[0-9]")
punc = re.compile(r"[^a-z]")
for t in blank.split(txt.lower()):
# omit words that are stop words or contain numbers
if num.match(t):
continue
# remove punctuations
t = punc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_words(text):\n return re.compile('\\w+').findall(text)",
"def _get_word_list(text):\n return re.findall('\\w+', text)",
"def words(self, text):\n return re.findall(r'\\w+', text)",
"def GetWords(phrase):\n # Remove special characters regex\n # It works faster than the standard \\w+... | [
"0.7728435",
"0.74818975",
"0.7397873",
"0.7345839",
"0.7314803",
"0.7187901",
"0.71779233",
"0.71677214",
"0.6951405",
"0.6951405",
"0.6918817",
"0.6870601",
"0.6860676",
"0.68537277",
"0.68344176",
"0.6820462",
"0.677903",
"0.6751708",
"0.6726445",
"0.6718961",
"0.66805625"... | 0.7209557 | 5 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81936234",
"0.80946803",
"0.80283314",
"0.80186",
"0.7993046",
"0.7990442",
"0.79801315",
"0.7974616",
"0.7960565",
"0.79567033",
"0.7936678",
"0.7933718",
"0.7933456",
"0.7930259",
"0.79256636",
"0.79236794",
"0.79229367",
"0.792244",
"0.7922048",
"0.79213953",
"0.7916868... | 0.0 | -1 |
Returns the number of vertices in the graph | def getOrder(self):
return len(self.vertices) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_vertices(self):\r\n return len(self.__graph_dict.keys())",
"def get_num_vertices(self):\n\n return self._graph_state.get_num_vertices()",
"def num_vertices(self):\n return self._top_exp.number_of_vertices()",
"def vertexCount(self):\n return self._nVertices",
"def num_ve... | [
"0.88369066",
"0.8754063",
"0.8631447",
"0.85409254",
"0.849603",
"0.849603",
"0.8460473",
"0.8460104",
"0.8443322",
"0.836717",
"0.8364454",
"0.8279424",
"0.8264743",
"0.82531357",
"0.8013647",
"0.7967211",
"0.7742567",
"0.7563631",
"0.7554066",
"0.75512934",
"0.75006753",
... | 0.6505012 | 97 |
returns a dictionary containing all keys/values of __dict__ of the instance | def to_dict(self):
dic = dict(**self.__dict__)
dic['__class__'] = str(type(self).__name__)
dic['created_at'] = self.created_at.isoformat()
dic['updated_at'] = self.updated_at.isoformat()
return (dic) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_dict(self):\n return {k: v for k, v in vars(self).items()}",
"def dict(cls):\n if cls._dict is None:\n cls._dict = {attr: getattr(cls, attr) for attr in cls.keys()}\n return cls._dict",
"def as_dict(self):\n return self.__dict__",
"def attributes(self):\n return d... | [
"0.80738515",
"0.8041221",
"0.80328816",
"0.8028484",
"0.8012917",
"0.8012917",
"0.8012917",
"0.8012917",
"0.8012917",
"0.8012917",
"0.8012917",
"0.7944696",
"0.78569216",
"0.7856564",
"0.7816041",
"0.7798094",
"0.7794507",
"0.77701664",
"0.77198035",
"0.77039766",
"0.7703787... | 0.0 | -1 |
Makes a base dataframe containing the point id's, OC values, landcodes and OC range. Returns A pandas dataframe. | def make_base_dataframe():
co_data_path = r"C:\Users\User\Documents\LUCAS2015_topsoildata_20200323\LUCAS_Topsoil_2015_20200323.csv"
col_list = ["Point_ID", "NUTS_0", "OC"]
df = pd.read_csv(co_data_path, usecols=col_list)
max_value = df["OC"].max()
for i in range(20, int(max_value) + 1, 20):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_dataframe() -> pd.DataFrame:\n df = pd.DataFrame(\n np.random.randint(0, 1000, size=(1000, 6)), columns=list(\"ABCDEF\")\n )\n\n return df",
"def get_df(self):\n return pd.DataFrame(self.points)",
"def create_df(Varr, Iarr, POA, T, mode):\n df = pd.DataFrame(... | [
"0.636651",
"0.6311015",
"0.6302924",
"0.622166",
"0.6221641",
"0.6209314",
"0.604936",
"0.6028788",
"0.6028675",
"0.60114753",
"0.6004612",
"0.59870476",
"0.5966523",
"0.5956284",
"0.5955453",
"0.59131944",
"0.5909941",
"0.59095573",
"0.59094304",
"0.590485",
"0.5901939",
... | 0.7467725 | 0 |
Returns the states that are considered neighbors. | def mdp_state_neighbors(mdp, s):
neigh = set()
for a in mdp.actions(s):
for s2 in mdp.transition(s, a):
if not s == s2:
neigh.add(s2)
return neigh | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbors(self):\n \n return self.adjacent.keys()",
"def neighbors(self):\n return self._neighbors",
"def neighboring_states(self):\n index = self.state.index(0)\n\n if index == 0:\n return [self.move(movement) for movement in ['down', 'right']]\n el... | [
"0.76460135",
"0.7629951",
"0.760599",
"0.7536056",
"0.75355035",
"0.7527532",
"0.7516274",
"0.7495805",
"0.7495805",
"0.7495805",
"0.7495805",
"0.7463641",
"0.739425",
"0.7392943",
"0.73888713",
"0.7316986",
"0.73044676",
"0.72549134",
"0.7163624",
"0.7148069",
"0.71065813",... | 0.6970356 | 25 |
This function performs a POST request and returns the json body to the caller for any further processing or validation | def http_post_and_check_success(url, json_req, check_util=None, timeout=2.0, verify=True, location=True,
auth=None, headers=put_json_headers):
with requests.Session() as session:
post_resp = session.post(
url,
verify=verify,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_algorithm():\n try:\n request_json = request.get_json()\n result = json.dumps([])\n response = app.response_class(\n response=result,\n status=200,\n mimetype='application/json')\n except ValueError as e:\n response = app.response_class(\n... | [
"0.73959416",
"0.7187669",
"0.7021658",
"0.6934144",
"0.69264513",
"0.6893316",
"0.6893117",
"0.6800202",
"0.67583805",
"0.6754931",
"0.67535293",
"0.6747588",
"0.6743242",
"0.67350113",
"0.67350113",
"0.67350113",
"0.6717103",
"0.67164874",
"0.6691029",
"0.6685849",
"0.66837... | 0.0 | -1 |
This function performs a POST request and returns the json body to the caller for any further processing or validation | def http_patch_and_check_success(url, json_req, check_util=None, timeout=2.0, verify=True,
auth=None, headers=put_json_headers):
with requests.Session() as session:
post_resp = session.patch(
url,
verify=verify,
data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_algorithm():\n try:\n request_json = request.get_json()\n result = json.dumps([])\n response = app.response_class(\n response=result,\n status=200,\n mimetype='application/json')\n except ValueError as e:\n response = app.response_class(\n... | [
"0.73959416",
"0.7187669",
"0.7021658",
"0.6934144",
"0.69264513",
"0.6893316",
"0.6893117",
"0.6800202",
"0.67583805",
"0.6754931",
"0.67535293",
"0.6747588",
"0.6743242",
"0.67350113",
"0.67350113",
"0.67350113",
"0.6717103",
"0.67164874",
"0.6691029",
"0.6685849",
"0.66837... | 0.0 | -1 |
This also tests the situation when Pillow doesn't detect the MIME type of the image (24948). | def test_imagefield_annotate_with_bitmap_image_after_clean(self):
from PIL.BmpImagePlugin import BmpImageFile
try:
Image.register_mime(BmpImageFile.format, None)
f = ImageField()
img_path = get_img_path('filepath_test_files/1x1.bmp')
with open(img_path, 'r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_image(content_type):\n return content_type == \"image/jpeg\" or content_type == \"image/png\"",
"def check_type(filename):\n try:\n im = Image.read(filename)\n except SanperaError:\n return False\n else:\n return im.original_format in [b'JPEG', b'PNG', b'GIF']",
"def tes... | [
"0.74139035",
"0.73247075",
"0.70119476",
"0.6962488",
"0.68712837",
"0.6865752",
"0.6850061",
"0.6809697",
"0.6764392",
"0.67558867",
"0.6731332",
"0.66869634",
"0.6677816",
"0.6668011",
"0.66659975",
"0.6643656",
"0.66390574",
"0.6595373",
"0.65787905",
"0.6573083",
"0.6572... | 0.67432934 | 10 |
Set the maximum severity level. | def max_severity_level(self, max_severity_level=None):
if max_severity_level is not None:
if max_severity_level > self.max_severity_level():
self._max_severity_level = max_severity_level
return self._max_severity_level | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_max(self, level, value):\n if value < 0:\n raise AttributeError('max value should be greater than zero')\n if level in self.progress_maxes:\n self.progress_maxes[level] = value",
"def setMaxValue(self, max_value):\r\n\t\tself.MaxValue = max_value",
"def setMaxValu... | [
"0.7235557",
"0.68648046",
"0.68648046",
"0.6813005",
"0.6617635",
"0.65027475",
"0.64903605",
"0.64765996",
"0.64438653",
"0.6408605",
"0.6381757",
"0.6338733",
"0.6337771",
"0.63131875",
"0.63119334",
"0.6222275",
"0.6215984",
"0.6194721",
"0.61798424",
"0.6151164",
"0.6145... | 0.7466015 | 0 |
Get or set the tolerance level. | def tolerance_level(self, tolerance_level=None):
if tolerance_level is not None:
self._tolerance_level = tolerance_level
return self._tolerance_level | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tolerance(self):\n return self._tolerance",
"def tolerance(self):\n return self.params['tolerance']",
"def tolerance(self) -> float:\n return self._tolerance",
"def get_tolerance(self):\n return self.tolerance",
"def Tolerance(self):\n\t\treturn self._get_attribute('toleranc... | [
"0.6943355",
"0.6937423",
"0.68822503",
"0.68466914",
"0.66368365",
"0.6609316",
"0.65242106",
"0.6413579",
"0.62840825",
"0.62409395",
"0.620766",
"0.61840343",
"0.61502874",
"0.61362535",
"0.6076219",
"0.60392714",
"0.59328306",
"0.58501434",
"0.58142495",
"0.5794941",
"0.5... | 0.87005484 | 0 |
Returns the list of valid actions that can be performed on this node. | def actions(self) -> list:
if self.debug: print(f"AState.actions()")
if not self._examined:
if self.debug: print(f"\tExamining...")
self._actions = self._generate_actions()
self._examined = True
return self._actions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())",
"def get_list_of_actions(self):\n return self.actions",
"def legal_actions(self):\n return self.env.legal_actions()",
"def get_available_actions(self):\n return self.actions",
"def get_actions(self):... | [
"0.8495818",
"0.7829729",
"0.7787893",
"0.77221763",
"0.7660051",
"0.76411813",
"0.7630721",
"0.75045687",
"0.7444823",
"0.7402748",
"0.73896617",
"0.7386115",
"0.73518205",
"0.7298488",
"0.7290686",
"0.72723997",
"0.7265532",
"0.7221811",
"0.7201356",
"0.7195508",
"0.7195508... | 0.7580352 | 7 |
This method must be overridden by any subclasses. It must return a list of all valid actions that can be performed. | def _generate_actions(self) -> list:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())",
"def get_actions(self):\n return []",
"def legal_actions(self):\n raise NotImplementedError",
"def get_list_of_actions(self):\n return self.actions",
"def actions(self) -> list:\n if self.debu... | [
"0.84408236",
"0.8198646",
"0.8012733",
"0.7960869",
"0.78978986",
"0.7881059",
"0.78804106",
"0.7721662",
"0.765515",
"0.7653476",
"0.7629059",
"0.75906795",
"0.75733024",
"0.75540054",
"0.7512063",
"0.7512063",
"0.7512063",
"0.74996406",
"0.7451246",
"0.7439315",
"0.7425061... | 0.75501394 | 14 |
Returns the list of valid actions that can be performed on this node. | def actions(self) -> list:
if self.debug: print(f"StateNode.actions()")
if not self._examined:
if self.debug: print(f"\tExamining...")
self._edges = self.state.actions()
for e in self._edges:
e: Action
e.source = self
e.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())",
"def get_list_of_actions(self):\n return self.actions",
"def legal_actions(self):\n return self.env.legal_actions()",
"def get_available_actions(self):\n return self.actions",
"def get_actions(self):... | [
"0.8495818",
"0.7829729",
"0.7787893",
"0.77221763",
"0.7660051",
"0.76411813",
"0.7630721",
"0.7580352",
"0.75045687",
"0.7444823",
"0.7402748",
"0.73896617",
"0.7386115",
"0.73518205",
"0.7298488",
"0.7290686",
"0.72723997",
"0.7265532",
"0.7221811",
"0.7201356",
"0.7195508... | 0.68325996 | 50 |
This method must be overridden by any subclasses. It must return a list of all valid actions that can be performed. | def get_cost(self, action: Action) -> N:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())",
"def get_actions(self):\n return []",
"def legal_actions(self):\n raise NotImplementedError",
"def get_list_of_actions(self):\n return self.actions",
"def actions(self) -> list:\n if self.debu... | [
"0.8440921",
"0.8199113",
"0.8013199",
"0.796074",
"0.789812",
"0.7880795",
"0.78800946",
"0.7721959",
"0.765502",
"0.76534194",
"0.7629213",
"0.75921136",
"0.75746316",
"0.7553965",
"0.7550985",
"0.7511804",
"0.7511804",
"0.7511804",
"0.75003636",
"0.74517626",
"0.7438982",
... | 0.0 | -1 |
Returns whether the stack is empty. | def empty(self) -> bool:
return not self.queue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self) -> bool:\n return len(self.stack) == 0",
"def isEmpty(self):\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"... | [
"0.9207258",
"0.91276956",
"0.90185934",
"0.9000551",
"0.89481044",
"0.89481044",
"0.8914844",
"0.8904091",
"0.8881541",
"0.88791907",
"0.8867761",
"0.87955654",
"0.8768181",
"0.8748518",
"0.87393755",
"0.8728073",
"0.8719241",
"0.87090814",
"0.87090814",
"0.85431594",
"0.850... | 0.0 | -1 |
Returns whether the stack is empty. | def empty(self) -> bool:
return len(self.q) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self) -> bool:\n return len(self.stack) == 0",
"def isEmpty(self):\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"... | [
"0.9207349",
"0.9127756",
"0.90184367",
"0.8999902",
"0.8948574",
"0.8948574",
"0.89155793",
"0.8903433",
"0.888211",
"0.88793427",
"0.88675356",
"0.8796078",
"0.8768976",
"0.8748719",
"0.87394613",
"0.8728192",
"0.87192214",
"0.87091523",
"0.87091523",
"0.8544101",
"0.850963... | 0.0 | -1 |
Return a list of dicts representing the access points that are linked to this source. | def related_entities(self):
related_entities = []
for point in self.accesspoint_set.all():
related_entities.append({
'name': str(point),
'archive_url': point.archive_url,
'page_number': point.trigger,
'accessed_on': point.access... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_access_list(self):\n return self.manager.get_access_list(self)",
"def accession_map(self):\n\n acc_map = {}\n for seqkey,seqs in self._seqdict.iteritems():\n for seq,seqentry in seqs.iteritems():\n acc_map[seqentry['name']] = seqentry['accessions']\n\n ... | [
"0.67947996",
"0.6453751",
"0.63430655",
"0.6246719",
"0.6231397",
"0.61666477",
"0.6158926",
"0.61223733",
"0.610027",
"0.610027",
"0.610027",
"0.610027",
"0.610027",
"0.60867274",
"0.60544324",
"0.60161954",
"0.6012481",
"0.59774995",
"0.5961584",
"0.5961584",
"0.5936684",
... | 0.63177997 | 3 |
Get user by user_id | def get_user_by_id(self, user_id: int, to_dict: bool = False):
try:
if to_dict:
return model_to_dict(User.get_by_id(user_id))
return User.get_by_id(user_id)
except DoesNotExist:
raise ValueError(HTTPStatus.NOT_FOUND,
'User ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(user_id):\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\n\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\n\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\n\n return User.query.get(user_id)",
"def get_user_by_id(user_id):\... | [
"0.8692944",
"0.8635324",
"0.8635324",
"0.8635324",
"0.8635324",
"0.86033064",
"0.8576779",
"0.8551142",
"0.8487326",
"0.8476727",
"0.83735126",
"0.8331313",
"0.832427",
"0.83178955",
"0.82688314",
"0.82562625",
"0.82310873",
"0.8214999",
"0.8210606",
"0.8189807",
"0.81877637... | 0.0 | -1 |
Return the correct 'key' for an item. This is mainly a helper method for other methods in this class. It is used to shorten code repitition | def _get_key(self, object_type, user_key = None):
if not user_key and not self.object_type_keys.has_key(object_type):
raise ParserError("Unknown key for object type: %s\n" % object_type)
## Use a default key
if not user_key:
user_key = self.object_type_keys[object_type]
return user_key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key(self, item):\r\n return item[0]",
"def _getNextKey(self, item):\n return (2, item)",
"def by_key(item):\n return Line['key', item]",
"def __getitem__(self, item: int) -> int:\n return self.root[item].key",
"def _getPrevKey(self, item):\n return (1, item)",
"... | [
"0.854846",
"0.73755544",
"0.71965224",
"0.7163481",
"0.7145576",
"0.7041787",
"0.6785135",
"0.6781645",
"0.6740919",
"0.6627226",
"0.6591268",
"0.6586165",
"0.6549658",
"0.65049577",
"0.6501452",
"0.64911336",
"0.6421972",
"0.6419695",
"0.6392654",
"0.6390866",
"0.6390866",
... | 0.0 | -1 |
Given an object, return a list of active hosts. This will exclude hosts that ar negated with a "!" | def _get_active_hosts(self, object):
## First, generate the negation list
negate_hosts = []
## Hostgroups
if object.has_key("hostgroup_name"):
for hostgroup_name in self._get_list(object, 'hostgroup_name'):
if hostgroup_name[0] == "!":
hostgroup_obj = self.get_hostgroup(hostgroup_name[1:])
ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_hosts(self, hosts, spec_obj):\n\n ignore_hosts = spec_obj.ignore_hosts or []\n hosts = [host for host in hosts if host not in ignore_hosts]\n return hosts",
"def select_inactive_hosts():\n return IMPL.select_inactive_hosts()",
"def filtered_hosts(config, exclude=True, dbhost... | [
"0.76322234",
"0.6263666",
"0.6062381",
"0.5986657",
"0.5977842",
"0.5931571",
"0.5867927",
"0.57435375",
"0.5739992",
"0.5739992",
"0.56967884",
"0.5639056",
"0.5625297",
"0.55925924",
"0.5588255",
"0.55773956",
"0.55773956",
"0.55477285",
"0.55461586",
"0.55311257",
"0.5474... | 0.7992435 | 0 |
Test that hyperlinks are not containing prohibited characters (such as '<'). | def test_hyperlinks_do_not_contain_prohibited_characters(self):
for h in self.hyperlinks:
self.assertTrue(
re.search(r'[<>]', h['name']) is None,
msg='Hyperlink "%s" contains forbidden characters in "%s".' % (h['md'], h['file'])
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_underscores_in_hyperlinks_are_protected(self):\n for h in self.hyperlinks:\n self.assertTrue(\n re.search(r'[^\\\\]_', h['name']) is None,\n msg='Hyperlink \"%s\" contains unprotected underscore(s) in \"%s\".' % (h['md'], h['file'])\n )",
"def t... | [
"0.71357393",
"0.7015268",
"0.6583877",
"0.6451514",
"0.63255537",
"0.62772864",
"0.6240678",
"0.61405253",
"0.6110742",
"0.60730356",
"0.6048724",
"0.6032845",
"0.6017508",
"0.60169834",
"0.5982169",
"0.59466296",
"0.59213877",
"0.59208995",
"0.5905111",
"0.5897356",
"0.5882... | 0.8876726 | 0 |
Load all path of image, there is two case in this code if train == True then load training image training image calculate there all size and calculate it's validation size if train == False then load test image doesn't calculate anythings | def load_path_list(image_path, gt_path, batch_size, train = True):
if train:
print("Image Load Started..")
path_list = os.listdir(gt_path)
image_size = len(path_list)
Train_size = image_size // batch_size * batch_size
Validation_size = image_size - Train_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_images(self, target = \"standard\", path=OMNIGLOT_DATAPATH):\n X = []\n Y = []\n folderName = {}\n if target == \"standard\":\n trainFolders = [\"images_background\"]\n testFolders = [\"images_evaluation\"]\n elif target == \"minimal\":\n ... | [
"0.6684847",
"0.6683883",
"0.6589205",
"0.65625405",
"0.63765746",
"0.6363556",
"0.6348563",
"0.63388854",
"0.6337652",
"0.6327962",
"0.63201123",
"0.6295828",
"0.62614954",
"0.6249649",
"0.6240495",
"0.6205724",
"0.6201576",
"0.61920756",
"0.61781734",
"0.6170997",
"0.615963... | 0.7551948 | 0 |
open clicked on file menu. | def file_menu_open_activate(self, widget, data=None):
self.open_chooser.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def menu_open_files(self, event=None):\n self.parentPanel.open(event)",
"def __openFile(self):\n itm = self.findList.selectedItems()[0]\n self.on_findList_itemDoubleClicked(itm, 0)",
"def file_popup(file) -> str:\n layout = [\n [sg.Text(f\"Select the action to perform on\... | [
"0.8423974",
"0.779811",
"0.7624728",
"0.76005363",
"0.75563484",
"0.7550147",
"0.7521476",
"0.7437061",
"0.7421713",
"0.7379829",
"0.73560226",
"0.73347485",
"0.73239565",
"0.7281468",
"0.7255037",
"0.7157373",
"0.71333176",
"0.71062523",
"0.70238024",
"0.6990758",
"0.6972",... | 0.8123093 | 1 |
Return chrome webdriver and open the initial webpage. | def __init__(self, url_address, type="Chrome"):
from webdriverwrapper import Chrome
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch_chrome():\r\n DRIVER_PATH = '/Users/User/Downloads/chromedriver_win32/chromedriver' #Location of chromedriver application\r\n chrome_options = webdriver.ChromeOptions()\r\n chrome_options.add_argument('--disable-blink-features=AutomationControlled') #Tells browser it is not controlled by automa... | [
"0.7316955",
"0.718539",
"0.7122876",
"0.7033356",
"0.6990807",
"0.6926203",
"0.6921011",
"0.68284255",
"0.6765437",
"0.67419064",
"0.6728078",
"0.6710789",
"0.66934687",
"0.6682299",
"0.66609067",
"0.66576225",
"0.6647915",
"0.66431236",
"0.6640616",
"0.66310877",
"0.6617421... | 0.70143574 | 4 |
Get the current state of a submission from the database. In the medium term, services that use this package will need to play well with legacy services that integrate with the classic database. For example, the moderation system does not use the event model implemented here, and will therefore cause direct changes to t... | def get_submission(submission_id: int, for_update: bool = False) \
-> Tuple[Submission, List[Event]]:
# Let the caller determine the transaction scope.
session = current_session()
original_row = session.query(models.Submission) \
.filter(models.Submission.submission_id == submission_id) \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n self.request_state()\n e = self.get_event()\n if e.id != ID_STATE:\n raise GrblEventError(e)\n return e.data",
"def get_current_state(self):\n candidate_queryset = self.candidates.all().select_related('relatedstudent')\n candidates = [ca... | [
"0.57558817",
"0.5480453",
"0.54673463",
"0.54232943",
"0.52968585",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",
"0.52679104",... | 0.55585825 | 1 |
Overwrite defaults specified in '__init__' and 'SetDefaults'. Object '__dict__' contains all variables of instance self | def initAnalysisOptions(self, analysisOptions = {}):
for key in analysisOptions:
self.__dict__[key] = analysisOptions[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetSelfWithDefaults( self ):\n self.__dict__.update( self._defDict )",
"def initDefaults(self, kwargs):\n \n for k,v in self.defaults.iteritems():\n if k in kwargs: # use assigned values\n setattr(self, k, kwargs[k])\n else: # use default values\n ... | [
"0.7940795",
"0.7539371",
"0.7492947",
"0.693514",
"0.6757059",
"0.6753493",
"0.673478",
"0.6709375",
"0.6708611",
"0.6700697",
"0.66967845",
"0.6664016",
"0.6662019",
"0.6651407",
"0.6651407",
"0.66419864",
"0.66419864",
"0.6608379",
"0.65787584",
"0.6565681",
"0.6537741",
... | 0.0 | -1 |
Sends a PATCH request. | def patch(url, data=None, **kwargs):
return request('patch', url, data=data, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def httpPatch(self, url='', data='', params={}, headers={}):\n\n return self.httpRequest('PATCH', url, data, params, headers)",
"def patch(self, *args, **kwargs):\n self.request(\"patch\", *args, **kwargs)",
"def test_client_can_do_patch_request(self):\n response = self.httpbin_4.test_requ... | [
"0.78879285",
"0.78840005",
"0.75265086",
"0.7525407",
"0.7426763",
"0.7426763",
"0.7426763",
"0.73790526",
"0.734557",
"0.7331408",
"0.7325037",
"0.7317369",
"0.72989714",
"0.7292885",
"0.7249458",
"0.7243931",
"0.7208896",
"0.7208896",
"0.7208896",
"0.7208896",
"0.7208896",... | 0.7294469 | 13 |
Create pie graph PNG of the current account holdings. Currently does not correctly format negative USD Cash | def get_holdings(self,account=None, verbose=False):
# Imply account
if account == None:
account = self.params['account']
account = int(account)
# Assemble URL
url = self.endpoints['base'] +\
'accounts/' +\
str(a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pieChart2():\n n = 4\n Z = np.ones(n)\n Z[-1] *= 2\n\n labels = 'A', 'B', 'C', 'D'\n plt.axes([0.025,0.025,0.95,0.95])\n\n plt.pie(Z, explode=Z*.05, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90)\n plt.gca().set_aspect('equal')\n plt.xticks([]), plt.yticks([])\n\n # sa... | [
"0.6193845",
"0.616957",
"0.6084392",
"0.605223",
"0.5889984",
"0.58671457",
"0.57516307",
"0.5747374",
"0.5724388",
"0.57022136",
"0.56929004",
"0.56882465",
"0.5684931",
"0.5679587",
"0.56759244",
"0.5625633",
"0.5602881",
"0.5584019",
"0.55832577",
"0.5550525",
"0.5536903"... | 0.0 | -1 |
Binary search of given element inside of list | def binary_search(element: int, my_list: list) -> int:
print(element, my_list)
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search(list, element):\n if list is None:\n raise TypeError(\"Search element must not be none\")\n first = 0\n last = len(list) - 1\n while first <= last:\n mid = (first + last) // 2\n if list[mid] == element:\n return mid\n if list[mid] < element:\n ... | [
"0.7931916",
"0.77473366",
"0.77315646",
"0.7651623",
"0.7588846",
"0.7556174",
"0.75301266",
"0.75105256",
"0.74625707",
"0.74452853",
"0.742219",
"0.73762274",
"0.73674095",
"0.7353753",
"0.7327274",
"0.7322763",
"0.7321466",
"0.7320891",
"0.7256662",
"0.7240929",
"0.723875... | 0.83601695 | 0 |
lower case the words in the sentence and remove all punctuation. | def lower_and_remove_punc(self):
table = str.maketrans('', '', punctuation)
return self.words.lower().translate(table) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanString(self, s):\r\n s = s.lower()\r\n for x in s: \r\n if x in punctuation:\r\n s = s.replace(x, '')\r\n return s",
"def simple_clean(sentence):\n return re.sub(f\"[{PUNCT}]\", ' ', remove_stopwords(sentence).strip().lower()).replace(' ', ' ')",
"def... | [
"0.7645257",
"0.76285577",
"0.7508894",
"0.7458962",
"0.74356705",
"0.74272287",
"0.74272287",
"0.74133277",
"0.7302705",
"0.72894204",
"0.72452253",
"0.7183777",
"0.7166164",
"0.7145225",
"0.7131206",
"0.71078736",
"0.70258874",
"0.70026433",
"0.7002412",
"0.70003295",
"0.69... | 0.7731092 | 0 |
convert the words in the sentence to tokens for NLP. | def tokenize(self):
return word_tokenize(self.lower_and_remove_punc()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(sentence):\n tokens = nltk.word_tokenize(sentence)\n return tokens",
"def tokenize(sentence):\n return nltk.word_tokenize(sentence)",
"def get_tokens(sent):\n return word_tokenize(sent)",
"def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()... | [
"0.7810328",
"0.770068",
"0.76580137",
"0.75562793",
"0.7543098",
"0.7535698",
"0.7361383",
"0.7337554",
"0.7313579",
"0.72543323",
"0.72319746",
"0.7166653",
"0.7163248",
"0.71368897",
"0.713624",
"0.71198577",
"0.7099754",
"0.7083242",
"0.7070837",
"0.70471907",
"0.7044818"... | 0.0 | -1 |
Move geometric center to the origin. | def center(self, center_mass=False):
if center_mass:
com = self.center_of_mass
self.xyz -= com
else:
self.xyz -= self.xyz.mean(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __moveCenterTo(self, x, y):\n x0, y0, w, h = self.currentBox\n x2, y2 = x - (w/2), y - (h/2)\n self.__moveTo(x2, y2)",
"def center(self, destination):\n self.move(destination=destination, origin=self.center)",
"def update_center(self): \r\n \r\n self.grfx[0].center = self.... | [
"0.78163993",
"0.75914127",
"0.7403669",
"0.735991",
"0.7359592",
"0.7182882",
"0.7052156",
"0.69846237",
"0.69846237",
"0.69418406",
"0.69418406",
"0.69418406",
"0.69329315",
"0.6921042",
"0.69180006",
"0.6853134",
"0.68307066",
"0.68179923",
"0.6800726",
"0.6798228",
"0.677... | 0.63200104 | 59 |
Returns the total mass of the molecule | def total_mass_au(self):
return np.sum(self.atomic_mass) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMolecularMass(self):\n dataDict = self.__dict__\n # get formula dictionary\n dd = {}\n for ca in self.chemAtoms:\n if isinstance(ca, ChemAtom):\n ss = ca.elementSymbol\n ii = dd.get(ss)\n if ii is None:\n dd[ss] = 1\n else:\n dd[ss] = ii + 1\n ... | [
"0.83596945",
"0.8314517",
"0.8314517",
"0.79538095",
"0.78342354",
"0.77976984",
"0.77976984",
"0.77586347",
"0.7587848",
"0.7557238",
"0.7537609",
"0.7527791",
"0.74724925",
"0.7412962",
"0.73552054",
"0.7346823",
"0.7306098",
"0.7297594",
"0.7225232",
"0.72096926",
"0.7202... | 0.74693066 | 13 |
Returns the total mass of the molecule | def total_mass_amu(self):
return np.sum(self.mass_amu) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMolecularMass(self):\n dataDict = self.__dict__\n # get formula dictionary\n dd = {}\n for ca in self.chemAtoms:\n if isinstance(ca, ChemAtom):\n ss = ca.elementSymbol\n ii = dd.get(ss)\n if ii is None:\n dd[ss] = 1\n else:\n dd[ss] = ii + 1\n ... | [
"0.83597964",
"0.83134925",
"0.83134925",
"0.79526806",
"0.7833864",
"0.7796884",
"0.7796884",
"0.7758695",
"0.75869536",
"0.7536331",
"0.75273913",
"0.7471608",
"0.746852",
"0.7411881",
"0.7353714",
"0.73456705",
"0.7305258",
"0.7297647",
"0.722441",
"0.7209111",
"0.72010857... | 0.75565916 | 9 |
Increade/decrease the current font size. | def _increase_font_factor(self, factor):
def increase_it(elem):
self._font_size += factor
return increase_it | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrease_font_size(window, delta=2):\n\n increase_font_size(window, delta=-2)\n \n return",
"def font_size(self, font_size):\n\n self._font_size = font_size",
"def set_font_size(window, size):\n\n font = window.GetFont()\n\n clone = clone_font(font)\n clone.SetPointSize(size)\n\n ... | [
"0.74035764",
"0.73222786",
"0.70873827",
"0.7055369",
"0.702756",
"0.6958784",
"0.6914409",
"0.68324214",
"0.6657606",
"0.6578601",
"0.6577812",
"0.65090543",
"0.6429592",
"0.6426329",
"0.62679404",
"0.62627876",
"0.6245753",
"0.61494917",
"0.61240613",
"0.6014274",
"0.60048... | 0.6354234 | 15 |
\n Turns list of lists into one list. | def flattenList(input_list):
return [item for sublist in input_list for item in sublist] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_str_breaks(lis):\r\n as_str = \"\"\r\n for item in lis:\r\n as_str += str(item) + \"\\n\"\r\n return as_str[:-1]",
"def newline_list(value):\n return value.strip().splitlines()",
"def break_line(lst):\n new_list = []\n for element in range(len(lst)):\n new_list.extend(l... | [
"0.7095406",
"0.7080337",
"0.66550046",
"0.6487162",
"0.6454435",
"0.6406992",
"0.6371681",
"0.6357522",
"0.6311943",
"0.62907904",
"0.6286506",
"0.6254553",
"0.62306833",
"0.622188",
"0.61776507",
"0.61495394",
"0.6145371",
"0.6134439",
"0.6092544",
"0.60797864",
"0.6071438"... | 0.56327057 | 73 |
\n Returns normal distribution, calculated by numbers in range of x. | def norm_dist(numbers, x):
m = np.mean(np.array(numbers))
s = np.std(np.array(numbers))
if s < 1e-5:
s = 1e-5
return np.array(norm.pdf(x, loc=m, scale=s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density_normal_dist(x):\n return ONE_OVER_SQRT_OF_TWO_PI * exp(-0.5 * x * x)",
"def normal_distr(x, mu, sigma, s=1):\n \n return s * 1/(sigma * torch.sqrt(torch.tensor(2 * np.pi))) * torch.exp((-1/2) * ((x - mu) / sigma) ** 2)",
"def approx_standard_normal_cdf(x):\n return 0.5 * (1.0 + torch.ta... | [
"0.7399116",
"0.7196172",
"0.71247387",
"0.7018298",
"0.6908695",
"0.6873358",
"0.68045354",
"0.67952704",
"0.67829573",
"0.6746419",
"0.67423326",
"0.6677611",
"0.66493416",
"0.6598005",
"0.6593824",
"0.6590863",
"0.6589196",
"0.6543085",
"0.6537728",
"0.652842",
"0.6525309"... | 0.71904427 | 2 |
Replaces current subtree with given tree instead. Returns self. | def replace_subtree(self, tree, update_tree=True):
if self.parent is None: # Changing the whole tree
self.__dict__ = tree.__dict__
else:
if self is self.parent.left_subtree:
self.parent.left_subtree = tree
else:
self.parent.right_subtre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _replace(self, x, y):\n y.parent = x.parent\n if x is self.root:\n self.root = y\n return\n elif x is x.parent.left:\n x.parent.left = y\n else:\n x.parent.right = y\n\n self.update(y, -1)",
"def remove_subtree(self, update_tree=T... | [
"0.6778925",
"0.66760296",
"0.66235435",
"0.6492744",
"0.6433623",
"0.63925683",
"0.62912023",
"0.62774307",
"0.62560153",
"0.61011475",
"0.60803413",
"0.6075068",
"0.6023766",
"0.60049546",
"0.599877",
"0.5997293",
"0.58921736",
"0.58870226",
"0.58870226",
"0.58870226",
"0.5... | 0.7889773 | 0 |
Makes a leaf into a node with two leaves as children. Returns self. | def split_leaf(self, update_tree=True):
if not self.is_leaf():
raise RuntimeError('Cannot split internal node.')
return self.replace_subtree(Tree(Tree(), Tree()), update_tree=update_tree) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_leaves(self):\n\n curr_leaf = self.root\n i = 1\n while i < self.length:\n next_leaf = Leaf(curr_leaf.val+1)\n curr_leaf.next = next_leaf\n curr_leaf = next_leaf\n i += 1",
"def build(self):\n # copy the leaves\n height, laye... | [
"0.75188047",
"0.64780974",
"0.63124007",
"0.6301707",
"0.61849195",
"0.6159218",
"0.6136615",
"0.6005124",
"0.59842896",
"0.594435",
"0.5901951",
"0.589319",
"0.58922935",
"0.58495337",
"0.5843481",
"0.5780015",
"0.5748967",
"0.5743258",
"0.57151645",
"0.57077676",
"0.567623... | 0.6344364 | 2 |
Transforms the subtree into a leaf. Returns self. | def remove_subtree(self, update_tree=True):
self.left_subtree = None
self.right_subtree = None
if update_tree:
self.update_tree()
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_to_leaf(self,\n x_row):\n node = self.tree[0]\n while True:\n if node.is_leaf:\n return node\n val = x_row[node.label]\n if np.isnan(val):\n node = self.tree[node.id_null]\n elif val <= node.cutoff:... | [
"0.6589667",
"0.6550329",
"0.65204364",
"0.64739823",
"0.64493686",
"0.62524825",
"0.62228703",
"0.6063728",
"0.6018339",
"0.60074323",
"0.58630705",
"0.57938564",
"0.5775554",
"0.5767596",
"0.5722958",
"0.5706055",
"0.5698407",
"0.56911445",
"0.5673534",
"0.5669684",
"0.5655... | 0.0 | -1 |
Returns a list of strings indicating to go 'left' or 'right' for each node starting from the root node. | def path_from_root(self):
path = []
parent = self.parent
child = self
while parent is not None:
if child is parent.left_subtree:
path.append('left')
else:
path.append('right')
child = parent
parent = parent.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _left(node):\n return 2 * node + 1",
"def left_or_right(self):\n #traversal\n left_total = 0\n left_count = 0\n right_total = 0\n right_count = 0\n self.scan()\n for ang, dist in self.scan_data.items():\n if ang < self.MIDPOINT:\n ... | [
"0.66583073",
"0.6358492",
"0.6301865",
"0.6289936",
"0.62477595",
"0.6131885",
"0.6047884",
"0.6009457",
"0.6002277",
"0.59954333",
"0.594818",
"0.5914742",
"0.59126085",
"0.59014595",
"0.5872872",
"0.58644366",
"0.5840676",
"0.58316004",
"0.5812415",
"0.57903665",
"0.579036... | 0.61300224 | 6 |
Return fiscalyear id for the period_id given. If period_id is nor given then return the current fiscalyear | def _get_fiscalyear(self, cr, uid, context={}, period_id=False):
if period_id:
period_obj = self.pool.get(
'account.period').browse(cr, uid, period_id)
fiscalyear_id = period_obj.fiscalyear_id.id
else:
fiscalyear_obj = self.pool.get('account.fiscalyea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_fiscal_year(self):\n current_date = datetime.today().date()\n for year in self.fiscal_years.all():\n if year.begin_date < current_date < year.end_date:\n return year\n return None",
"def get_fiscal_year(self):\n next_calendar_year_months = [10... | [
"0.661104",
"0.62281126",
"0.616947",
"0.6147302",
"0.6038177",
"0.5954263",
"0.57524735",
"0.56770015",
"0.5676597",
"0.5634972",
"0.547138",
"0.5410897",
"0.52582526",
"0.52322894",
"0.51365054",
"0.5108958",
"0.5067987",
"0.5064246",
"0.5036398",
"0.502765",
"0.49607745",
... | 0.8616426 | 0 |
Return a nice string representing a future datetime in english. If you need to explicitely set the reference that the future is relative to, just pass it in as a second datetime object. | def humanize(future, ref=None):
if not ref:
ref = datetime.now()
delta = future - ref
seconds = delta.seconds
days = delta.days
global_seconds = days * 24 * 60 * 60 + seconds
minutes = int(round(seconds/60.) % 60)
day_changes = (future - datetime(*ref.timetuple()[:3])).days
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def naturaltime(value, future=False, months=True):\r\n now = _now()\r\n date, delta = date_and_delta(value)\r\n if date is None:\r\n return value\r\n # determine tense by value only if datetime/timedelta were passed\r\n if isinstance(value, (datetime, timedelta)):\r\n future = date > n... | [
"0.65318906",
"0.6507618",
"0.6094985",
"0.598095",
"0.59121704",
"0.5879496",
"0.583347",
"0.5825895",
"0.57973194",
"0.579467",
"0.5787746",
"0.57675374",
"0.57622373",
"0.57164645",
"0.5706053",
"0.5695605",
"0.56943506",
"0.5693548",
"0.567792",
"0.567708",
"0.56463844",
... | 0.71599245 | 0 |
Compute gradient for logistic regression w.r.t. to the parameters theta. | def gradient_function(theta, X, y):
grad = None
#######################################################################
# TODO: #
# Compute the gradient for a particular choice of theta. #
# Compute the partial derivatives a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logit_cost_grad(self, theta, X, y):\n\n grad = np.zeros(len(theta))\n\n ### YOUR CODE HERE\n sig = utils.sigmoid(theta)\n # sig = np.subtract(sig, y)\n sig = sig - y\n grad = np.dot(X.T, sig) + 2 * self.params['lamb'] * self.regularizer[1](self.weights)\n ### EN... | [
"0.8392964",
"0.8262841",
"0.8262841",
"0.8215227",
"0.8010951",
"0.79753923",
"0.7866205",
"0.77759385",
"0.7620895",
"0.76000303",
"0.75743663",
"0.75418186",
"0.74505186",
"0.7448143",
"0.74479556",
"0.7445852",
"0.74144214",
"0.7402403",
"0.73875386",
"0.73441905",
"0.728... | 0.7903927 | 6 |
find a dict in a list with selected key | def get_dict_by_key(pcb_data: List[Dict[str, Any]], key: str) -> Dict[str, Any]:
for d in pcb_data:
if isinstance(d, dict) and key in d.keys():
return d
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _search_list_of_dictionaries(key, value, list_of_dictionaries):\n\n for element in list_of_dictionaries:\n if element.get(key) == value:\n return element\n return None",
"def lod_find(list_of_dict, key, val, return_val_if_false = False):\n for d in list_of_dict:\n ... | [
"0.79354215",
"0.78502715",
"0.7590244",
"0.7587258",
"0.738128",
"0.7196137",
"0.7124431",
"0.7120418",
"0.7061513",
"0.7039346",
"0.69954956",
"0.6924875",
"0.6922326",
"0.6838041",
"0.6825961",
"0.68152934",
"0.67847294",
"0.67472875",
"0.67423767",
"0.6678004",
"0.6665119... | 0.6772131 | 17 |
find all dicts in a list with selected key | def get_all_dicts_by_key(pcb_data: List[Dict[str, Any]], key: str) -> List[Dict[str, Any]]:
res: List[Dict[str, Any]] = list()
for d in pcb_data:
if isinstance(d, dict) and key in d.keys():
res.append(d)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(list_of_dict, key, value):\n return filter(lambda dictionary: dictionary[key] == value, list_of_dict)",
"def find_nested_in_dict(data, key_list):\n return reduce(lambda d, k: d[k], key_list, data)",
"def _search_list_of_dictionaries(key, value, list_of_dictionaries):\n\n for element in lis... | [
"0.69870794",
"0.6884246",
"0.68107665",
"0.675177",
"0.6649578",
"0.65573174",
"0.6433821",
"0.6417574",
"0.64085335",
"0.639808",
"0.6333439",
"0.62540406",
"0.6217448",
"0.6160826",
"0.61500376",
"0.611203",
"0.60861236",
"0.60631925",
"0.6056125",
"0.6053219",
"0.6031015"... | 0.7284967 | 0 |
converts str layer data to layer list | def convert_to_layers(layer_data: Union[List[str], str])-> List[Layer]:
if not isinstance(layer_data, List):
layer_data = [layer_data]
# change *. to F. and B.
star_layer = [layer for layer in layer_data if "*." in layer]
b_stars = [layer.replace("*", "B") for layer in star_layer]
f_stars = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layers(layer_data: Dict[str, Any]) -> List[Layer]:\n try:\n l_data = layer_data['kicad_pcb']\n l_data = get_dict_by_key(l_data, 'layers')\n res: List[Layer] = list()\n for layer in l_data['layers']:\n layer_data = list(layer.values())[0]\n new_layer = La... | [
"0.63018376",
"0.5687101",
"0.5587705",
"0.5571014",
"0.5571014",
"0.55506665",
"0.5520212",
"0.5445227",
"0.5434911",
"0.5379239",
"0.5352752",
"0.534245",
"0.53060395",
"0.5295245",
"0.52930194",
"0.52864754",
"0.5273486",
"0.5265711",
"0.525985",
"0.5258553",
"0.52038413",... | 0.75141305 | 0 |
create FpArc object from dict with arc data | def create_arc(arc_data: Dict[str, Any], arc_tag: str) -> FpArc:
fp_arc = arc_data[arc_tag]
# end in kicad is start point
start: Coords = [get_dict_by_key(fp_arc, 'end')['end'][0], get_dict_by_key(fp_arc, 'end')['end'][1]]
start[1] = str(-1 * float(start[1]))
end: Coords = [get_dict_by_key(fp_arc, '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_arcs(m_data: List[Dict[str, Any]], arc_tag: str) -> List[FpArc]:\n arcs: List[FpArc] = list()\n for arc in get_all_dicts_by_key(m_data, arc_tag):\n arcs.append(create_arc(arc, arc_tag))\n return arcs",
"def from_dict(cls, copula_dict):\n raise NotImplementedError",
"def _construc... | [
"0.62380487",
"0.614932",
"0.57996434",
"0.5745884",
"0.56286424",
"0.56075275",
"0.54422045",
"0.53187793",
"0.5306953",
"0.5294561",
"0.5269495",
"0.5261099",
"0.5252609",
"0.52030796",
"0.5179838",
"0.5174468",
"0.51514643",
"0.5120931",
"0.5117117",
"0.51157475",
"0.50510... | 0.73983 | 0 |
Convert a dlib 'rect' object to a plain tuple in (top, right, bottom, left) order | def _rect_to_css(rect):
return rect.top(), rect.right(), rect.bottom(), rect.left() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rect_to_css(rect):\n return rect.top(), rect.right(), rect.bottom(), rect.left()",
"def rect(coords : Tuple[int, int]) -> Tuple[int, int, int, int]:\n min_x = min([x for x, _ in coords])\n max_x = max([x for x, _ in coords])\n min_y = min([y for _, y in coords])\n max_y = max([y for _, y in c... | [
"0.72214955",
"0.70028174",
"0.67907625",
"0.67628485",
"0.6730566",
"0.6714316",
"0.6632175",
"0.66262114",
"0.6562478",
"0.65450835",
"0.6453258",
"0.6412691",
"0.639422",
"0.63780206",
"0.6309268",
"0.6277681",
"0.6265826",
"0.6254038",
"0.623716",
"0.6233299",
"0.621297",... | 0.7129482 | 1 |
Divide a cell, roughly in the middle. The division plane is perpendicular to the longest axis and goes through the barycenter of the cell. | def symmetrical_division(mesh, pos, cid):
utilities.check_pos(pos)
bary, V1, V2, V3 = cell_main_axes(mesh, pos, cid)
return bary, V1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faceDiv(self):\n if getattr(self, '_faceDiv', None) is None:\n n = self.vnC\n # Compute faceDivergence operator on faces\n if(self.dim == 1):\n D = ddx(n[0])\n elif(self.dim == 2):\n D1 = sp.kron(speye(n[1]), ddx(n[0]))\n ... | [
"0.6128121",
"0.6005141",
"0.58989793",
"0.5668021",
"0.56665295",
"0.5634569",
"0.5592361",
"0.55875325",
"0.55348337",
"0.5523731",
"0.5398349",
"0.53934675",
"0.53934675",
"0.53934675",
"0.5323978",
"0.5295961",
"0.5261789",
"0.52594334",
"0.52530235",
"0.5231543",
"0.5213... | 0.55641395 | 8 |
Indicates if the volume of a cell is above the threshold. | def volume_trigger(mesh, pos, cid, volume_threshold):
utilities.check_pos(pos)
volume = cell_volume(mesh, pos, cid)
return volume > volume_threshold | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lux_above_threshold(self) -> bool:\n if self.lux_sensor:\n value = self.hass.get_state(self.lux_sensor)\n if value not in [\"unavailable\", \"unknown\"]:\n return float(value) > self.lux_threshold\n\n return False",
"def threshold(self) -> float:\n re... | [
"0.6840039",
"0.6777767",
"0.656647",
"0.656647",
"0.6548233",
"0.6548233",
"0.6548233",
"0.65045065",
"0.65045065",
"0.65045065",
"0.65045065",
"0.65045065",
"0.64508253",
"0.6418231",
"0.6316565",
"0.62815434",
"0.62511706",
"0.62507015",
"0.623199",
"0.62292427",
"0.618099... | 0.6970466 | 0 |
Information about the mute status of this finding. | def __init__(
self_,
description: Union[str, UnsetType] = unset,
expiration_date: Union[int, UnsetType] = unset,
muted: Union[bool, UnsetType] = unset,
reason: Union[FindingMuteReason, UnsetType] = unset,
start_date: Union[int, UnsetType] = unset,
uuid: Union[str,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mute(self):\n return on_off_bool(self.get(COMMAND_UIC, 'GetMute')['mute'])",
"def status(self) -> dict:\n return {\"volume\": self.volume, \"mute\": self.mute}",
"def is_volume_muted(self):\n return self._mute",
"def is_volume_muted(self):\n return self._state.get(\"mute\"... | [
"0.72563213",
"0.71111053",
"0.65735465",
"0.6537731",
"0.64941686",
"0.64393294",
"0.6419801",
"0.6409305",
"0.6409305",
"0.6409305",
"0.637407",
"0.6371873",
"0.629078",
"0.6245062",
"0.6142726",
"0.6089631",
"0.6038584",
"0.6028381",
"0.6007166",
"0.5962199",
"0.592295",
... | 0.0 | -1 |
Create a list of random products with 3letter alphanumeric name. | def create_products(num):
return [''.join(random.choices('ABCDEFG123', k=3)) for _ in range(num)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_products(num_products=30):\n products = []\n for item in range(0, num_products):\n gen_name = str(random.choice(ADJECTIVES) + \" \" + random.choice(NOUNS))\n price = random.uniform(5, 100)\n weight = random.uniform(5, 100)\n flammability = random.uniform(0.0, 2.5)\n ... | [
"0.71001995",
"0.7048964",
"0.6962363",
"0.6810837",
"0.6734993",
"0.6579453",
"0.6428112",
"0.64103675",
"0.6364157",
"0.63393706",
"0.6315789",
"0.63092375",
"0.629463",
"0.6258441",
"0.6202982",
"0.6200593",
"0.61515754",
"0.6087428",
"0.60668504",
"0.6066595",
"0.6047842"... | 0.75126034 | 0 |
This loss function returns the root mean square error between the predictions and the true interactions. | def rmse_loss(tf_prediction, tf_y, **kwargs):
return tf.sqrt(tf.reduce_mean(tf.square(tf_y - tf_prediction))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(self, y_true, y_pred):\n\n return mean_squared_error(y_true, y_pred)",
"def mean_squared_error(y_true, y_pred):\n y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)\n y_true = math_ops.cast(y_true, y_pred.dtype)\n return backend.mean(math_ops.squared_difference(y_pred, y_tr... | [
"0.780547",
"0.76440257",
"0.7545025",
"0.7511193",
"0.7457148",
"0.7373135",
"0.7373135",
"0.7322414",
"0.72588664",
"0.722694",
"0.7198003",
"0.71463513",
"0.71382177",
"0.71054095",
"0.71042794",
"0.710106",
"0.70928645",
"0.709",
"0.70337737",
"0.7022063",
"0.70171636",
... | 0.67162883 | 56 |
Implodes delim Str items List Str | def implode(delim, items):
return delim.join(items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_item_list(items, pad=\"'\", sep=', ', end_sep=' and '):\n result = ''\n items = [pad + item + pad for item in items]\n if items:\n if len(items) != 1:\n result = sep.join(items[:-1]) + end_sep + items[-1]\n else:\n result = items[0]\n return result",
"d... | [
"0.7118994",
"0.69800484",
"0.64462245",
"0.6334126",
"0.6270062",
"0.6262962",
"0.6188824",
"0.6137539",
"0.6108553",
"0.60889477",
"0.6053968",
"0.59600025",
"0.5946044",
"0.59383106",
"0.5923106",
"0.5913039",
"0.58841497",
"0.5848218",
"0.58111036",
"0.57968915",
"0.57856... | 0.764565 | 0 |
GMT date format Str stamp Int Str | def gmdate(format, stamp = None):
if stamp is None:
stamp = time.time()
dt = datetime.datetime.utcfromtimestamp(stamp)
return dt.strftime(format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plastic_date():\n return 'Zun, 99 Zun 9999 99:61:61'",
"def _create_date(self):\n return strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime())",
"def time_stamper() :\n\treturn datetime.now().strftime(\"%Y-%m-%d-%H-%M-%S\")",
"def httpdate(date_obj):\n return date_obj.strftime(\"%a, %d %b %Y %H:... | [
"0.66509706",
"0.66062546",
"0.6522119",
"0.6462181",
"0.6375269",
"0.6327647",
"0.6313485",
"0.6309325",
"0.62253547",
"0.61967427",
"0.6189698",
"0.6163785",
"0.615566",
"0.6144489",
"0.6135446",
"0.6116611",
"0.61095333",
"0.60844314",
"0.60729134",
"0.60644346",
"0.605989... | 0.65110546 | 3 |
Creates the Inception Resnet V1 model. | def LeNet(inputs, is_training=True,
dropout_keep_prob=0.8,
bottleneck_layer_size=128,
reuse=None,
scope='LeNet'):
end_points = {}
with tf.variable_scope(scope, 'LeNet', [inputs], reuse=reuse):
with slim.arg_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_model_inception_v3():\n base_model = tf.keras.applications.InceptionV3(\n include_top=False,\n input_shape=(IMG_SIZE, IMG_SIZE, IMG_CHANNELS)\n )\n model = tf.keras.models.Sequential([\n base_model,\n tf.keras.layers.GlobalAveragePooling2D(),\n tf.keras.laye... | [
"0.6873107",
"0.674192",
"0.6490674",
"0.643851",
"0.6358225",
"0.62815815",
"0.62722355",
"0.6250022",
"0.62305635",
"0.6203257",
"0.6203257",
"0.6203257",
"0.6203257",
"0.6203257",
"0.6198921",
"0.617983",
"0.6169398",
"0.61628735",
"0.614066",
"0.61383784",
"0.6129245",
... | 0.0 | -1 |
opens a text file, converts each line into a list of strings of each element in line | def payment_info_and_status(report):
order_data = open(report)
for line in order_data:
order = lines_into_list(line) # function will split each line by '|' and get a list of strings
# each order has 4 strings
order[0:1] = []
name = order.pop(0)
order_as_floats = convert_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_to_list(file_name):\r\n fr = open(file_name, encoding = 'utf-8')\r\n l = [line.strip() for line in fr]\r\n fr.close()\r\n return l",
"def readStrings(filename):\n txtlist = []\n f = open(filename)\n for line in f.readlines():\n txtlist.extend(line.split())\n return txtlist... | [
"0.7652507",
"0.7537436",
"0.75141644",
"0.74525636",
"0.73815095",
"0.7366669",
"0.7358465",
"0.7287714",
"0.7153505",
"0.71310204",
"0.710965",
"0.7108428",
"0.71054256",
"0.7017043",
"0.699118",
"0.69901913",
"0.6956131",
"0.6948919",
"0.693207",
"0.6916772",
"0.6913105",
... | 0.0 | -1 |
Determines output length of a transposed convolution given input length. | def deconv_output_length(input_length,
filter_size,
padding,
output_padding=None,
stride=0,
dilation=1):
assert padding in {'same', 'valid', 'full'}
if input_length is None:
return None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_conv1d_output_size(input_size, kernel_size, stride):\n return ((input_size - kernel_size)//stride) + 1",
"def get_conv1d_output_size(input_size, kernel_size, stride):\n return ((input_size - kernel_size)//stride) + 1",
"def get_output_length(padded_input_length, input_lengths, padded_output_lengt... | [
"0.6587841",
"0.6587841",
"0.6444032",
"0.6378278",
"0.6366401",
"0.62707245",
"0.62707245",
"0.62707245",
"0.613198",
"0.6109229",
"0.6097532",
"0.6052339",
"0.6032256",
"0.59874773",
"0.589819",
"0.57942617",
"0.56916547",
"0.56909186",
"0.5669995",
"0.5658779",
"0.5646712"... | 0.6462485 | 2 |
Tensorflow placeholders to manage cumulants data | def _tf_placeholders(self):
tf = self.tf
d = self.n_nodes
if self._tf_feed_dict is None:
with self._tf_graph.as_default():
L = tf.placeholder(tf.float64, d, name='L')
C = tf.placeholder(tf.float64, (d, d), name='C')
K_c = tf.placeholder... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_placeholders(self):\n \n with tf.name_scope(\"data\"):\n self.X = tf.placeholder(tf.float32, shape=[None, self.dim_inputs], name='X')\n self.value = tf.placeholder(tf.float32, shape=[None], name='value')\n self.cost = tf.placeholder(tf.float32,... | [
"0.70749587",
"0.70651793",
"0.68327427",
"0.6712424",
"0.66559345",
"0.66182685",
"0.6566491",
"0.6509345",
"0.6503262",
"0.64547104",
"0.6433345",
"0.6393248",
"0.6377645",
"0.6313418",
"0.6310495",
"0.6297564",
"0.6296928",
"0.6289214",
"0.62239736",
"0.61954826",
"0.61737... | 0.6019122 | 41 |
Inverted Residual Block This function defines a sequence of 1 or more identical layers. Arguments | def inverted_residual_block(inputs, filters, kernel, t, strides, n, alpha, block_id, train_bn=False):
x = bottleneck(inputs, filters, kernel, t, strides, False, alpha, block_id, train_bn)
for i in range(1, n):
block_id += 1
x = bottleneck(x, filters, kernel, t, 1, True, alpha, block_id, train_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_layer(self, out_channels, num_blocks):\n layers = []\n for i in range(num_blocks):\n stride = 2 if i == 0 else 1\n layers.append(InvertedResidual(in_channels=self.in_channels, out_channels=out_channels, stride=stride, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act... | [
"0.6717466",
"0.6475339",
"0.63575125",
"0.6192982",
"0.61108077",
"0.60318065",
"0.58997923",
"0.58931625",
"0.5851161",
"0.5827282",
"0.5768704",
"0.57652074",
"0.5761624",
"0.5755392",
"0.57512003",
"0.57388943",
"0.5733231",
"0.573243",
"0.5662537",
"0.56578296",
"0.56480... | 0.6434296 | 2 |
split texts to sentences | def split2sent(abstract):
abstract = re.sub(r'\s+', ' ', abstract)
return sent_tokenize(abstract) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences",
"def get_sentences(text):\n \n return text.split('.')",
"def sentence_split(self, text):\n return split_into_sentences(text)",
"def split_sentences(text):\n # sentenc... | [
"0.83710414",
"0.8329",
"0.8225964",
"0.8067661",
"0.7961425",
"0.77993125",
"0.7655894",
"0.75687385",
"0.75445944",
"0.7494124",
"0.7491019",
"0.7440767",
"0.74174595",
"0.73331475",
"0.73321724",
"0.7322262",
"0.7224225",
"0.7171182",
"0.7153319",
"0.71324617",
"0.7129685"... | 0.65137774 | 54 |
Check created article in the database | def test_article_created(self):
response = self.client.post(reverse('add_article'),
{'title': 'Test title', 'description': 'Some description', 'author': 'Roman'}
)
self.assertEqual(response.status_code, 302) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_article(article):\r\n\tcollection=create_database_connection()\r\n\tinsert_article(collection,article)",
"def test_article_exist(self):\n\n article = Article.objects.get(title='Test title')\n self.assertEqual(article.author, 'Roman')",
"def NewArticleCheck(self, article):\n\t\ttry:\n... | [
"0.767113",
"0.7255894",
"0.70880735",
"0.67282665",
"0.6630522",
"0.6486169",
"0.6451488",
"0.63115585",
"0.6127866",
"0.60886985",
"0.6054756",
"0.6035617",
"0.6029565",
"0.59948635",
"0.59824014",
"0.59824014",
"0.5979267",
"0.5933839",
"0.5921532",
"0.59165037",
"0.590937... | 0.6934458 | 3 |
From the given options and style number create a sku sku starts with the style number | def populate_sku(self):
options = dict()
for option in self.option_combo:
for k, v in option.items():
options[k] = v
if (self.style_number != None and
'Size' in options and
'Color' in options):
self.sku = generate_sku(self.style_nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sku(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"sku\")",
"def sku(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"sku\")",
"def build_options(slot, snacks):\n \n if slot == 'Fast':\n return [\n {'text': 'Pizza', 'value': 'Pizza'}... | [
"0.5323145",
"0.5323145",
"0.5223577",
"0.50608057",
"0.49972093",
"0.49972093",
"0.49972093",
"0.49828446",
"0.49502248",
"0.49136004",
"0.4891539",
"0.48842356",
"0.48835248",
"0.48835248",
"0.4862627",
"0.4859636",
"0.48177874",
"0.48041248",
"0.47956222",
"0.47931084",
"0... | 0.69283646 | 0 |
Returns list of distributed objects with matching str in value. | def doFind(self, str):
for value in self.doId2do.values():
if repr(value).find(str) >= 0:
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doFindAllMatching(self, str):\n matches = []\n for value in self.doId2do.values():\n if re.search(str,repr(value)):\n matches.append(value)\n return matches",
"def get_values(self, value):\n return [\n obj for obj in self if obj == value\n ... | [
"0.5921968",
"0.58979887",
"0.5833267",
"0.57318395",
"0.57160556",
"0.5702525",
"0.56580293",
"0.5366401",
"0.53330785",
"0.5303784",
"0.5288114",
"0.5242727",
"0.52316344",
"0.52217627",
"0.52116925",
"0.51828766",
"0.51767546",
"0.5142366",
"0.5108283",
"0.5072347",
"0.506... | 0.49383354 | 28 |
Returns list of distributed objects with matching str in value. | def doFindAll(self, str):
matches = []
for value in self.doId2do.values():
if repr(value).find(str) >= 0:
matches.append(value)
return matches | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doFindAllMatching(self, str):\n matches = []\n for value in self.doId2do.values():\n if re.search(str,repr(value)):\n matches.append(value)\n return matches",
"def get_values(self, value):\n return [\n obj for obj in self if obj == value\n ... | [
"0.59227085",
"0.58972275",
"0.5833337",
"0.5716301",
"0.5701346",
"0.56586784",
"0.5368005",
"0.53320444",
"0.5304357",
"0.52873915",
"0.52421695",
"0.52314204",
"0.5221849",
"0.5211868",
"0.5184318",
"0.51766294",
"0.51435876",
"0.51078254",
"0.5072023",
"0.50649804",
"0.50... | 0.5732173 | 3 |
Returns list of distributed objects with matching str in value. | def doFindAllMatching(self, str):
matches = []
for value in self.doId2do.values():
if re.search(str,repr(value)):
matches.append(value)
return matches | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_values(self, value):\n return [\n obj for obj in self if obj == value\n ]",
"def by_label_contains(self, value: str) -> RegistryType:\n return {k: v for k, v in self.items() if value in k}",
"def doFindAll(self, str):\n matches = []\n for value in self.doId... | [
"0.58972275",
"0.5833337",
"0.5732173",
"0.5716301",
"0.5701346",
"0.56586784",
"0.5368005",
"0.53320444",
"0.5304357",
"0.52873915",
"0.52421695",
"0.52314204",
"0.5221849",
"0.5211868",
"0.5184318",
"0.51766294",
"0.51435876",
"0.51078254",
"0.5072023",
"0.50649804",
"0.504... | 0.59227085 | 0 |
Getter method for returning dragon's name. | def get_name(self) -> str:
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_name(self):\n return self.name",
"def get_name(self):\n\t\treturn self.name",
"def get_name(self):\n\t\treturn self.name",
"def get_name(self):\n\t\treturn self.name",
"def get_name(self):\n return self._name",
"def get_name(self) -> str:\n return self.__name",
"def get_name(self)... | [
"0.7468487",
"0.7427669",
"0.7427669",
"0.7427669",
"0.74273026",
"0.73620844",
"0.73572934",
"0.7353043",
"0.7338089",
"0.73084176",
"0.7304532",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",
"0.7282159",... | 0.7338208 | 10 |
Getter method for returning dragon's color. | def get_color(self) -> str:
return self.color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self):\n return self.color",
"def get_color(self):\r\n return self.__color",
"def get_color(self):\r\n return self._color",
"def get_color(self):\n return self._color",
"def get_color(self):\n return self._color",
"def _get_color(self):\n return self.__... | [
"0.8203044",
"0.81861544",
"0.81617385",
"0.8095049",
"0.8095049",
"0.8074423",
"0.8074423",
"0.8074423",
"0.8074423",
"0.80591226",
"0.8045481",
"0.8027125",
"0.791138",
"0.791138",
"0.791138",
"0.7891775",
"0.78662777",
"0.78417546",
"0.7818662",
"0.7818662",
"0.7794021",
... | 0.7817898 | 20 |
Getter method for returning dragon's rider name. | def get_rider(self) -> str:
return self.rider | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_name(self):\n return self.name",
"def get_name(self) -> str:\n return self.__name",
"def _getName(self):\n return self.id().split('.')[-2]",
"def get_name(self):\n\t\treturn self.name",
"def get_name(self):\n\t\treturn self.name",
"def get_name(self):\n\t\treturn self.name",
"... | [
"0.634643",
"0.63225734",
"0.62924564",
"0.62777346",
"0.62777346",
"0.62777346",
"0.62722576",
"0.6261951",
"0.6261685",
"0.6261685",
"0.6261685",
"0.6254772",
"0.6216818",
"0.6207773",
"0.6207773",
"0.6207773",
"0.6207773",
"0.6207773",
"0.6207773",
"0.6207773",
"0.6207773"... | 0.76943666 | 0 |
Convert a MAC address to a readable/printable string | def mac_addr(address):
return ':'.join('%02x' % compat_ord(b) for b in address) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))",
"def _mac_addr(address):\n return ':'.join('%02x' % ord(b) for b in address)",
"def mac_addr(address):\n\tprint(':'.join('%02x' % compat_ord(b) for b in address))\n\treturn ':'.join('%s' % format(compat_ord(b), '0>8... | [
"0.8273255",
"0.78195935",
"0.7803563",
"0.77997285",
"0.73939216",
"0.72593844",
"0.7243189",
"0.7214005",
"0.71748275",
"0.7039925",
"0.6994018",
"0.698195",
"0.69813216",
"0.69136333",
"0.6732875",
"0.67174894",
"0.6641035",
"0.6640394",
"0.6631645",
"0.66150683",
"0.65944... | 0.7411975 | 7 |
List all neutron agents. This simple scenario tests the "neutron agentlist" command by listing all the neutron agents. | def run(self, agent_args=None):
agent_args = agent_args or {}
self.neutron.list_agents(**agent_args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_agents(self):\n admin_resource_id = self.agent['id']\n with (self.override_role_and_validate_list(\n admin_resource_id=admin_resource_id)) as ctx:\n ctx.resources = self.agents_client.list_agents(\n id=admin_resource_id)[\"agents\"]",
"def list... | [
"0.73231936",
"0.6868263",
"0.6479189",
"0.63822645",
"0.63694865",
"0.63333315",
"0.6229072",
"0.6179095",
"0.61598563",
"0.60768783",
"0.5998408",
"0.59750897",
"0.5962263",
"0.59334254",
"0.5910436",
"0.58926314",
"0.5876416",
"0.5760547",
"0.5751562",
"0.5736388",
"0.5698... | 0.75959206 | 0 |
Transform a string underscore separated words to concatenated camel case. | def transform_to_camelcase(key):
return Jsonifiable.lower_first(
''.join(c.capitalize() or '_' for c in key.split('_'))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_underscore_to_camel_case(text):\n words = text.split('_')\n words = [word.capitalize() for word in words]\n return ''.join(words)",
"def underscore_to_camelcase(underscore_str):\n # Count leading and trailing '_' characters\n n_leading = re.search(r'[^_]', underscore_str)\n if n_lea... | [
"0.83221126",
"0.793683",
"0.7901321",
"0.7747062",
"0.7615975",
"0.7602556",
"0.7595627",
"0.7590738",
"0.7586403",
"0.75348145",
"0.75092083",
"0.75092083",
"0.74697006",
"0.74586874",
"0.7444299",
"0.74422896",
"0.74323833",
"0.7342745",
"0.72943294",
"0.72865486",
"0.7271... | 0.70812744 | 28 |
Tranform a string from concatenated camel case to underscore separated words. | def transform_from_camelcase(key):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', key)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_underscore_to_camel_case(text):\n words = text.split('_')\n words = [word.capitalize() for word in words]\n return ''.join(words)",
"def camelcase_to_underscore(text):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', text)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()",
"... | [
"0.7848101",
"0.7803973",
"0.7521705",
"0.75214237",
"0.7491522",
"0.74801034",
"0.74511695",
"0.7441275",
"0.74139977",
"0.73979986",
"0.7327715",
"0.7319531",
"0.72812897",
"0.72614264",
"0.720159",
"0.7151142",
"0.71477616",
"0.71005505",
"0.708255",
"0.7053543",
"0.702367... | 0.66668075 | 36 |
Returns a JSON string of the properties of this object. | def to_json(self):
properties = self.to_dict()
if isinstance(self, db.Model):
properties['id'] = unicode(self.key().id())
return json.dumps(properties) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self):\n return _convert_list_to_json(self.properties)",
"def json(self):\n return json.dumps(self, default=lambda o: o.__dict__,\n sort_keys=True, indent=4)",
"def to_json(self) -> str:\n return JSONEncoder().encode(vars(self))",
"def to_json(self):\... | [
"0.801932",
"0.78940535",
"0.78693193",
"0.7828171",
"0.7798398",
"0.776443",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77122074",
"0.77108085",
"0.77108085",
"0.77108085",
"0.768942",
"0.768942",
"0.765... | 0.77808 | 5 |
Reads requirements.txt and preprocess it to be feed into setuptools. This is the only possible way (we found) how requirements.txt can be reused in setup.py using dependencies from private github repositories. Links must be appendend by `{StringWithAtLeastOneNumber}` or something like that, so e.g. `9231` works as well... | def install_deps():
with open('requirements.txt', 'r') as f:
packages = f.readlines()
new_pkgs = []
for resource in packages:
new_pkgs.append(resource.strip())
return new_pkgs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_deps():\n default = open('requirements.txt', 'r').readlines()\n new_pkgs = []\n links = []\n for resource in default:\n if 'git+https' in resource:\n pkg = resource.split('#')[-1]\n links.append(resource.strip())\n new_pkgs.append(pkg.replace('egg=', ... | [
"0.69384056",
"0.68714464",
"0.67864317",
"0.67318934",
"0.6722779",
"0.66511077",
"0.662555",
"0.6607011",
"0.65807784",
"0.6577082",
"0.648006",
"0.64291275",
"0.6373021",
"0.6369665",
"0.636897",
"0.63055646",
"0.6283874",
"0.6283131",
"0.62589055",
"0.62418413",
"0.621587... | 0.6527681 | 10 |
Find the unique elements of an array. Returns the unique elements of an array, sorted if the values are integers. | def unique(
pda: groupable,
return_groups: bool = False,
assume_sorted: bool = False,
return_indices: bool = False,
) -> Union[
groupable, Tuple[groupable, pdarray, pdarray, int] # type: ignore
]: # type: ignore
from arkouda.categorical import Categorical as Categorical_
if not return_gro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uniques(array):\n uniques = []\n for element in array:\n if element not in uniques:\n uniques.append(element)\n return uniques",
"def unique_of_an_array(an_array):\n temp_array=an_array.copy()\n u=[]\n for i in range(temp_array.shape[0]):\n for j in range(temp_a... | [
"0.8038059",
"0.7883416",
"0.7624046",
"0.7316546",
"0.70729923",
"0.70690817",
"0.694963",
"0.6932527",
"0.654732",
"0.65094984",
"0.6479904",
"0.64608985",
"0.6433607",
"0.63479453",
"0.6322649",
"0.6317957",
"0.6312079",
"0.6294689",
"0.62838095",
"0.6250893",
"0.6221376",... | 0.0 | -1 |
Using the permutation stored in the GroupBy instance, group another array of values and return the location of the first minimum of each group's values. | def argmin(self, values: pdarray) -> Tuple[groupable, pdarray]:
k, v = self.aggregate(values, "argmin")
return k, cast(pdarray, v) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self, values: pdarray, skipna: bool = True) -> Tuple[groupable, pdarray]:\n if values.dtype == bool:\n raise TypeError(\"min is only supported for pdarrays of dtype float64, uint64, and int64\")\n k, v = self.aggregate(values, \"min\", skipna)\n return k, cast(pdarray, v)",
... | [
"0.64385456",
"0.6347722",
"0.62624",
"0.6164361",
"0.6151797",
"0.61464036",
"0.60271263",
"0.59045887",
"0.59003156",
"0.5885844",
"0.5872609",
"0.5853685",
"0.57962614",
"0.5745266",
"0.57272196",
"0.5690612",
"0.56418973",
"0.5636432",
"0.562964",
"0.5610488",
"0.5603355"... | 0.69330215 | 0 |
Using the permutation stored in the GroupBy instance, group another array of values and return the number of unique values in each group. | def nunique(self, values: groupable) -> Tuple[groupable, pdarray]:
# TO DO: defer to self.aggregate once logic is ported over to Chapel
# return self.aggregate(values, "nunique")
togroup = self._nested_grouping_helper(values)
# Find unique pairs of (key, val)
g = GroupBy(togroup)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution_2(arr):\n total = 0\n for group in arr:\n group_list = []\n for person in group:\n group_list = group_list + person\n group_table = Counter(''.join(group_list))\n for k, v in group_table.items():\n if v == len(group):\n total += 1\... | [
"0.6692056",
"0.6514736",
"0.6279726",
"0.60444146",
"0.6031069",
"0.5973661",
"0.5922462",
"0.5840128",
"0.57812256",
"0.5724044",
"0.57236016",
"0.57113916",
"0.5701299",
"0.56983083",
"0.56564033",
"0.5594766",
"0.5575654",
"0.5517981",
"0.5427025",
"0.5399754",
"0.5363425... | 0.6545248 | 1 |
Broadcast a dense column vector to the rows of a sparse matrix or grouped array. | def broadcast(
segments: pdarray,
values: Union[pdarray, Strings],
size: Union[int, np.int64, np.uint64] = -1,
permutation: Union[pdarray, None] = None,
):
if segments.size != values.size:
raise ValueError("segments and values arrays must be same size")
if segments.size == 0:
rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rowvec(x):\n return _colvec(x).transpose()",
"def _colvec(x):\n x = np.atleast_1d(x)\n return x[:, None]",
"def to_row_vec(x):\n assert x.ndim == 1\n return jnp.expand_dims(x, 0)",
"def vectorize(self):\n return vectorize(self)",
"def matvec(self, x):\n return self * x",
... | [
"0.5757964",
"0.5752052",
"0.54606235",
"0.537277",
"0.5359915",
"0.5346009",
"0.53247625",
"0.531777",
"0.5277394",
"0.52340806",
"0.52258193",
"0.522147",
"0.5201537",
"0.5190513",
"0.5175882",
"0.51431966",
"0.514184",
"0.5111938",
"0.50977606",
"0.5071325",
"0.50695527",
... | 0.0 | -1 |
Return today's datetime, just here for easier mocking. | def get_today():
return datetime.today() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_today() -> datetime.date:\n return datetime.date.today()",
"def today():\n return datetime.today()",
"def today():\n today = datetime.utcnow() \n return datetime(today.year, today.month, today.day)",
"def _today() -> datetime.date:\n return datetime.today().date()",
"def get_today... | [
"0.8491076",
"0.8480861",
"0.8419845",
"0.8414558",
"0.83412594",
"0.79689896",
"0.7936523",
"0.78593624",
"0.7788308",
"0.7763568",
"0.7742245",
"0.7731458",
"0.7717004",
"0.7698055",
"0.76805043",
"0.7675574",
"0.76437294",
"0.7593918",
"0.74716413",
"0.74687356",
"0.745812... | 0.8706547 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.