query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
enables or disables the entry widgets in options window based on options radio button | def entryToggle(self):
status = "normal" if self.optionVar.get() == 4 else "disabled"
for i in range(3):
self.entry[i].configure(state=status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options(self):\n self.checkVar.set(self.menuVar.get())\n #create window then set window size & title\n self.optionsWindow = tk.Toplevel(self)\n self.optionsWindow.grab_set()\n self.optionsWindow.title(\"Options\")\n windowWidth = \"225\"\n windowHeight = \"175\"... | [
"0.6961108",
"0.6948476",
"0.6607761",
"0.6417804",
"0.64009446",
"0.6353846",
"0.63352275",
"0.6329018",
"0.62202984",
"0.6120723",
"0.60597855",
"0.596447",
"0.5951331",
"0.5947885",
"0.5934519",
"0.59198403",
"0.59019685",
"0.5898794",
"0.5886318",
"0.58863086",
"0.5884564... | 0.7068373 | 0 |
Gets the ocpc of this Brand. Open Cannabis Product Code for the brand. | def ocpc(self):
return self._ocpc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_occr(self):\n return self._occr_array",
"def getObcType(): \n return simuConfig[\"OBC\"]",
"def getC(self):\n\t\treturn self.c",
"def _get_cbase(self):\n from PSCalib.CalibParsBasePnccdV1 import CalibParsBasePnccdV1\n return CalibParsBasePnccdV1()",
"def brand(self) -> objec... | [
"0.62935966",
"0.6091956",
"0.58740455",
"0.5798331",
"0.5681632",
"0.5631757",
"0.55966634",
"0.558785",
"0.558676",
"0.5518612",
"0.54687154",
"0.5444637",
"0.5432168",
"0.5428139",
"0.5394201",
"0.53779477",
"0.5367507",
"0.53472936",
"0.52756715",
"0.5263588",
"0.5236587"... | 0.7520303 | 0 |
Sets the ocpc of this Brand. Open Cannabis Product Code for the brand. | def ocpc(self, ocpc):
self._ocpc = ocpc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ocpc(self):\n return self._ocpc",
"def cci(self, cci: float):\n\n self._cci = cci",
"def set_c(self, c):\n self.c = c",
"def set_cpe(self, cpe_model):\n self.cpe_model = cpe_model",
"def getObcType(): \n return simuConfig[\"OBC\"]",
"def oclc_uri(marc_record: pymarc.rec... | [
"0.64819264",
"0.5569003",
"0.54588693",
"0.51602656",
"0.51474535",
"0.5130254",
"0.51200026",
"0.5089867",
"0.5015226",
"0.5015226",
"0.5015226",
"0.5014385",
"0.49917543",
"0.49719885",
"0.4937376",
"0.49258742",
"0.4871183",
"0.4865334",
"0.48471576",
"0.48377594",
"0.480... | 0.7510026 | 0 |
Sets the qr of this Brand. URL for QR that leads to page on Cannabis Reports. | def qr(self, qr):
self._qr = qr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qrcode(self):\n\n if not HAS_QRCODE:\n raise AttributeError('QR Code functionality is not enabled. Please add the qrcode '\n 'library to this environment')\n\n return qrcode.make(self.local_config)",
"def set_qr_data(self, qr_data: Sequence[Decoded]):\... | [
"0.5993275",
"0.5985283",
"0.54421943",
"0.5390959",
"0.5306285",
"0.5193873",
"0.5183114",
"0.5134523",
"0.5026647",
"0.49453598",
"0.49438182",
"0.49417466",
"0.49301583",
"0.4922631",
"0.49054387",
"0.48905766",
"0.48594776",
"0.48203534",
"0.478166",
"0.47167686",
"0.4687... | 0.6674546 | 0 |
Gets the flowers of this Brand. OCPCs of the flowers from this brand. | def flowers(self):
return self._flowers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def funnels(self):\r\n return resources.Funnels(self)",
"def getScatterers(self):\n return self.scatterers",
"def travelers(self):\n return self._travelers",
"def flowers(self, flowers):\n\n self._flowers = flowers",
"def fcvs(self): \n return self._link_reg.fcvs",... | [
"0.6138125",
"0.5807703",
"0.54127574",
"0.5399067",
"0.5316327",
"0.5261371",
"0.52180266",
"0.5177034",
"0.51683444",
"0.50811946",
"0.49370635",
"0.49328735",
"0.4917407",
"0.49171916",
"0.49171916",
"0.49038213",
"0.49015483",
"0.4899251",
"0.48930192",
"0.48838463",
"0.4... | 0.7915461 | 0 |
Sets the flowers of this Brand. OCPCs of the flowers from this brand. | def flowers(self, flowers):
self._flowers = flowers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flowers(self):\n return self._flowers",
"def flows(self, flows):\n\n self._flows = flows",
"def travelers(self, travelers):\n\n self._travelers = travelers",
"def brands(self, brands):\n\n self._brands = brands",
"def set_thruster_values(self, values):\n self.thruster... | [
"0.6286461",
"0.59785575",
"0.59650105",
"0.54660434",
"0.5426391",
"0.54213387",
"0.5248241",
"0.520174",
"0.51438886",
"0.5066561",
"0.497986",
"0.4968117",
"0.4878492",
"0.4867621",
"0.48621327",
"0.4842074",
"0.4787131",
"0.47476414",
"0.47450688",
"0.47389582",
"0.472608... | 0.80202395 | 0 |
Gets the extracts of this Brand. OCPCs of the extracts from this brand. | def extracts(self):
return self._extracts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract(self):\n pass",
"def extract(self) -> Entries:\n raise NotImplementedError('This method must be implemented by subclasses')",
"def docExtract(self):\n\n self.fv = []\n for doc in self.documents:\n self.fv.append(self.featureSet.extract(doc))\n\n # Conve... | [
"0.57091737",
"0.5493332",
"0.5355976",
"0.5308664",
"0.527625",
"0.5262795",
"0.5224808",
"0.51906633",
"0.5173061",
"0.5153938",
"0.5153916",
"0.5119628",
"0.5085625",
"0.50793606",
"0.5076042",
"0.5073633",
"0.5030286",
"0.4993764",
"0.497434",
"0.4949473",
"0.4939414",
... | 0.74892557 | 0 |
Sets the extracts of this Brand. OCPCs of the extracts from this brand. | def extracts(self, extracts):
self._extracts = extracts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extracts(self):\n return self._extracts",
"def run_extraction(self):\n self.background_estimator = ReflectedRegionsBackgroundEstimator(\n observations=self.observations, **self.config[\"background\"]\n )\n self.background_estimator.run()\n\n self.extraction = Spe... | [
"0.5561792",
"0.5235037",
"0.5122618",
"0.5065962",
"0.4858689",
"0.4837116",
"0.48006856",
"0.4736323",
"0.47359043",
"0.46972084",
"0.4598676",
"0.45915288",
"0.45594144",
"0.45588872",
"0.45516175",
"0.4539661",
"0.45346084",
"0.4530291",
"0.44973975",
"0.4475857",
"0.4456... | 0.7489454 | 0 |
Gets the edibles of this Brand. OCPCs of the edibles from this brand. | def edibles(self):
return self._edibles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self) -> list:\n return self.__expedition",
"def get_escobas(self):\n return self.escobas",
"def escobas(self):\n return self._escobas",
"def edibles(self, edibles):\n\n self._edibles = edibles",
"def energies(self) -> np.ndarray:\n return np.array([item.energy fo... | [
"0.6675802",
"0.661738",
"0.66034377",
"0.62080145",
"0.6023536",
"0.5934542",
"0.5931936",
"0.58610815",
"0.5732703",
"0.5711136",
"0.56978786",
"0.5690391",
"0.5612935",
"0.55846983",
"0.55846983",
"0.55751747",
"0.5565897",
"0.55330265",
"0.5528248",
"0.55117154",
"0.54840... | 0.7684369 | 0 |
Sets the edibles of this Brand. OCPCs of the edibles from this brand. | def edibles(self, edibles):
self._edibles = edibles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edibles(self):\n return self._edibles",
"def diabetes(self, diabetes):\n\n self.logger.debug(\"In 'diabetes' setter.\")\n\n self._diabetes = diabetes",
"def set(self, episodes):\n self.episode_set = episodes",
"def set_parameters(self, *args, **kwargs):\n super(DAEM, se... | [
"0.6503128",
"0.53816485",
"0.5341736",
"0.5276346",
"0.5155568",
"0.5078174",
"0.5073542",
"0.5073542",
"0.5060536",
"0.50315374",
"0.4993845",
"0.4909943",
"0.49020875",
"0.4885647",
"0.4885031",
"0.48756042",
"0.48724318",
"0.4863869",
"0.4851659",
"0.4823056",
"0.48116922... | 0.818293 | 0 |
Gets the products of this Brand. OCPCs of the products from this brand. | def products(self):
return self._products | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_products(self):\n return self._make_get_request(self._urls['products'])",
"def ListProducts(self):\n return copy.deepcopy(self._products)",
"def products(self):\r\n return products.Products(self)",
"def products(self):\n return list(Product.select())",
"def get(self):\n... | [
"0.76241523",
"0.7566509",
"0.7565762",
"0.756514",
"0.7535659",
"0.751238",
"0.7440312",
"0.7398282",
"0.7388195",
"0.72041655",
"0.71844614",
"0.71142894",
"0.71076566",
"0.7074467",
"0.7047273",
"0.7024207",
"0.69793373",
"0.6892202",
"0.67760795",
"0.6706479",
"0.6648986"... | 0.7824494 | 0 |
Sets the products of this Brand. OCPCs of the products from this brand. | def products(self, products):
self._products = products | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(self, product):\n self._product = product",
"def product(self, product):\n\n self._product = product",
"def product(self, product):\n\n self._product = product",
"def product_groups(self, product_groups):\n\n self._product_groups = product_groups",
"def products(self... | [
"0.661774",
"0.6568006",
"0.6568006",
"0.65407103",
"0.64364976",
"0.6406533",
"0.63383055",
"0.6323213",
"0.6307473",
"0.6213368",
"0.6169101",
"0.6024144",
"0.6013564",
"0.59371376",
"0.59202284",
"0.591889",
"0.58627635",
"0.5844896",
"0.58155435",
"0.5800325",
"0.58000284... | 0.8054498 | 1 |
Gets the created_at of this Brand. Date and time record was created, UTC. | def created_at(self):
return self._created_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_at(self) -> datetime.datetime:\n return self._created_at",
"def created_at(self):\n return self.getattr('created_at')",
"def created_at(self) -> \"datetime\":\n return self._attrs.get(\"createdAt\")",
"def created_at(self) -> \"datetime\":\n return self._attrs.get(\"cr... | [
"0.83030766",
"0.82845074",
"0.82037127",
"0.82037127",
"0.82037127",
"0.81389177",
"0.81389177",
"0.81389177",
"0.8138423",
"0.7994378",
"0.79931575",
"0.7978305",
"0.79707175",
"0.79177344",
"0.7915649",
"0.7915649",
"0.7915649",
"0.7847033",
"0.7847033",
"0.7847033",
"0.78... | 0.83646435 | 1 |
Return a string representation of this priority queue. | def __repr__(self):
return 'PriorityQueue({} items, front={})'.format(self.size(), self.front()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return str(self._queue_items)",
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"QUEUE { \" + \", \".join(data_str) + \" }\"",
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"QUEUE { \" + \", \".join(data_... | [
"0.80490476",
"0.76343757",
"0.76343757",
"0.7606811",
"0.7515623",
"0.74697816",
"0.7391219",
"0.72890997",
"0.72077906",
"0.71557087",
"0.7066766",
"0.7015214",
"0.69701236",
"0.69701236",
"0.69701236",
"0.69171065",
"0.69171065",
"0.69171065",
"0.69171065",
"0.69171065",
"... | 0.7990086 | 1 |
Insert the given item into this priority queue in order according to the given priority. | def enqueue(self, item, priority):
# TODO: Insert given item into heap
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, item, priority=0) -> None:\n if item in self.entry_finder:\n self.remove(item)\n count = next(self.counter)\n entry = (priority, count, [item])\n self.entry_finder[item] = entry\n heapq.heappush(self.priority_queue, entry)",
"def push(self, priority: fl... | [
"0.80786383",
"0.7865082",
"0.78041065",
"0.77141374",
"0.7674754",
"0.73016906",
"0.7278352",
"0.71895283",
"0.71843404",
"0.71743834",
"0.7151005",
"0.70398396",
"0.70398396",
"0.6892338",
"0.6884585",
"0.6837504",
"0.680479",
"0.68006176",
"0.67287093",
"0.67193216",
"0.67... | 0.8348072 | 0 |
Return the item at the front of this priority queue without removing it, or None if this priority queue is empty. | def front(self):
if self.size() < 1:
return None
else:
# TODO: Return min item from heap, if any
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def top(self): # O(1)\n if not self.queue:\n return None\n return self.queue[0]",
"def peek_front(self):\n\n if self.items:\n return self.items[0]\n return Non... | [
"0.83861667",
"0.812015",
"0.79910254",
"0.7972703",
"0.79355526",
"0.79029673",
"0.7864357",
"0.7844265",
"0.76888186",
"0.7597412",
"0.75942206",
"0.7568451",
"0.7565252",
"0.75484496",
"0.7531286",
"0.75137365",
"0.75074184",
"0.7491985",
"0.74702764",
"0.74702764",
"0.746... | 0.83011127 | 1 |
Remove and return the item at the front of this priority queue, or raise ValueError if this priority queue is empty. | def dequeue(self):
if self.size() < 1:
raise ValueError('Priority queue is empty and has no front item')
else:
# TODO: Remove and return min item from heap, if any
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n if len(self.priority_queue.values()):\n nextkey = 0\n while nextkey not in self.priority_queue:\n nextkey += 1\n up_next = self.priority_queue[nextkey][0]\n self.priority_queue[nextkey] = self.priority_queue[nextkey][1:]\n ... | [
"0.7618411",
"0.7553011",
"0.7513481",
"0.7512028",
"0.7495574",
"0.74546635",
"0.74098784",
"0.73618776",
"0.7308423",
"0.7285029",
"0.7266011",
"0.72317827",
"0.72248465",
"0.72198665",
"0.71959704",
"0.71899134",
"0.7139653",
"0.7117217",
"0.71051884",
"0.7096878",
"0.7091... | 0.7974448 | 0 |
Remove and return the item at the front of this priority queue, and insert the given item in order according to the given priority. | def push_pop(self, item, priority):
if self.size() < 1:
raise ValueError('Priority queue is empty and has no front item')
else:
# TODO: Replace and return min item from heap, if any
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue(self, item, priority):\n # TODO: Insert given item into heap\n ...",
"def push(self, priority: float, item):\n heappush(self._heap, (-1 * priority, item))",
"def add(self, item, priority=0) -> None:\n if item in self.entry_finder:\n self.remove(item)\n ... | [
"0.7093361",
"0.70350254",
"0.6742636",
"0.6527571",
"0.6505629",
"0.645512",
"0.626797",
"0.6210028",
"0.61004966",
"0.60370773",
"0.60328144",
"0.60213953",
"0.6011833",
"0.5995145",
"0.59813595",
"0.59383404",
"0.59279823",
"0.5927908",
"0.59254074",
"0.5917036",
"0.590679... | 0.78216314 | 0 |
Create a line from a point (x, y) and some angle in radians. | def from_angle(x1, y1, angle, length):
x2 = x1 + length * sin(angle)
y2 = y1 + length * cos(angle)
return Line(((x1, y1), (x2, y2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createFromLine(cls, line, **kwargs):\n angle = line.angle\n x, y = cls.cartesian([1, angle])\n return cls(x, y, **kwargs)",
"def getLine(self, **kwargs):\n return Line(self.p1, self.angle, **kwargs)",
"def line_equation_ap(angle, (x1, y1)):\n \n # get second point on the l... | [
"0.6920295",
"0.6459677",
"0.63838017",
"0.6383747",
"0.62899935",
"0.6254749",
"0.6232047",
"0.6193431",
"0.61365706",
"0.6101261",
"0.6090885",
"0.60878295",
"0.60768676",
"0.60122246",
"0.593856",
"0.5925338",
"0.5848339",
"0.58428526",
"0.58347046",
"0.5824384",
"0.582351... | 0.7692889 | 0 |
Returns the domain of X values for this line. | def domain(self):
lower, upper = sorted((self.x1, self.x2))
return FloatRange(lower=lower, upper=upper) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domain(self) -> NDArrayFloat:\n\n return ndarray_copy(self._domain)",
"def _axes_domain(self, *args, **kwargs):\n # See _add_gridline_label for detials\n lon_0 = self.axes.projection.proj4_params.get('lon_0', 0)\n x_range, y_range = type(self)._axes_domain(self, *args, **kwargs)\n x_range ... | [
"0.7240038",
"0.670912",
"0.6480548",
"0.644691",
"0.6432765",
"0.64078355",
"0.63080204",
"0.6278737",
"0.6278737",
"0.6257812",
"0.62101346",
"0.6198268",
"0.61593205",
"0.61583245",
"0.61583245",
"0.6129598",
"0.61284596",
"0.61077106",
"0.60557747",
"0.6044892",
"0.603960... | 0.73572046 | 0 |
Return the Intersection between this line and `other`. Don't take the domain or range of either line into account; assume the lines extend to infinity. | def intersection_with(self, other):
if self.gradient == other.gradient:
# Lines of the same gradient never intersect.
return None
# Calculate the X and Y values of this intersection using linear algebra.
x = (other.y_intercept - self.y_intercept) / (self.gradient - othe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection_with(self, other):\n i = self.line_intersection_with(other)\n if i is None:\n return None# parallel lines\n\n if self.contains(i) and other.contains(i) and not (i in self.endpoints and i in other.endpoints):\n return i\n return None",
"def inter... | [
"0.80653363",
"0.7543367",
"0.75131035",
"0.71969223",
"0.71900284",
"0.7076571",
"0.7005486",
"0.6964363",
"0.68594927",
"0.68334734",
"0.68170583",
"0.68019235",
"0.67605364",
"0.6682999",
"0.6666026",
"0.6607942",
"0.65651965",
"0.65284467",
"0.6512001",
"0.6498432",
"0.64... | 0.7800287 | 1 |
Yields a Line for each pair of points in the polygon. | def lines(self):
for pair in pairs(self.points):
yield Line(pair, shape=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _lines_from_points(points, points_form_closed_loop=False):\n if points_form_closed_loop:\n return list(zip(points[:-1],points[1:]))\n return list(zip(points, tuple(points[1:])+(points[0],)))",
"def line(x1, y1, x2, y2):\r\n\r\n x1 = normalize(x1)\r\n y1 = normalize(y1)\r\n x2 = normaliz... | [
"0.68208283",
"0.6730272",
"0.66045207",
"0.6540537",
"0.6299681",
"0.6237254",
"0.61816174",
"0.6175961",
"0.61647254",
"0.6123132",
"0.60234046",
"0.60123557",
"0.6010977",
"0.5986616",
"0.5942319",
"0.5904839",
"0.58956665",
"0.5895638",
"0.5843104",
"0.5839472",
"0.583947... | 0.79969424 | 0 |
Hidden instance method to append the object to the class attribute __category_list | def __append_to_category_list(self):
Category.get_category_list().append(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_category(self, category):\n raise NotImplementedError()",
"def get_category_list(cls):\n if Category.__category_list is None:\n Category.__category_list = []\n return Category.__category_list",
"def getCategory():",
"def categories(self):\n pass",
"def add_cat... | [
"0.67628896",
"0.66002876",
"0.6432391",
"0.63346964",
"0.625796",
"0.6200853",
"0.6176452",
"0.6161858",
"0.61149013",
"0.60869795",
"0.6050243",
"0.5962307",
"0.5923157",
"0.5906014",
"0.58910406",
"0.5843478",
"0.5798613",
"0.5784067",
"0.578279",
"0.5780437",
"0.57749104"... | 0.83716774 | 0 |
Override the save method to resize the image on category.save() and notify all registered users that a new category has been added | def save(self, *args, **kwargs):
self.image = self.resizeImage(self.image)
self.__append_to_category_list()
super(Category, self).save(*args, **kwargs)
if settings.EMAIL_HOST_USER:
self.send_email_notification_to_users(
subject=f"[Portfolio App Demo] New Categ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, *args, **kwargs):\n if not self.pk: # on create\n image = Image.open(self.file)\n image.thumbnail((400, 400), Image.ANTIALIAS)\n\n thumb = io.BytesIO()\n image.save(\n thumb, format=\"jpeg\", quality=80, optimize=True, progressive=Tr... | [
"0.6385444",
"0.62491363",
"0.6205879",
"0.60539657",
"0.5842181",
"0.5778853",
"0.57606965",
"0.5692971",
"0.56885064",
"0.5646007",
"0.55873954",
"0.55335635",
"0.5482986",
"0.54811686",
"0.5468032",
"0.5459336",
"0.53800124",
"0.535844",
"0.53266585",
"0.53228825",
"0.5319... | 0.82570636 | 0 |
Override magic method to return a userfriendly string representation of the object on str(category_object) | def __str__(self):
return self.category_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n \n return \"Category ID: %s %s\" % (self.category_id, self.name)",
"def __repr__(self):\n return f\"Category=(id={self.id},category_name={self.category_name},category_slug={self.category_slug})\"",
"def __str__(self):\n return self.cat_name",
"def __repr__(sel... | [
"0.75058025",
"0.7413164",
"0.740318",
"0.7380656",
"0.71459764",
"0.70923764",
"0.7047891",
"0.7046232",
"0.7028249",
"0.69508773",
"0.6937812",
"0.692393",
"0.6880881",
"0.6708073",
"0.66840637",
"0.66094226",
"0.652625",
"0.64997977",
"0.6481348",
"0.6481348",
"0.6469661",... | 0.7669583 | 0 |
Override magic method to return a developerfriendly string representation of the object on repr(category_object) | def __repr__(self):
return f"Category=(id={self.id},category_name={self.category_name},category_slug={self.category_slug})" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return '{}:{}:{}'.format(self.category, self.name, self.id)",
"def __repr__(self):\n\n return f'<Category cat_code={self.cat_code} name={self.name}>'",
"def __repr__(self):\n\n return f\"<Cat id={self.cat_id} name={self.name}\"",
"def __repr__(self):\n\n retu... | [
"0.7909407",
"0.76931256",
"0.7598569",
"0.75420475",
"0.7461687",
"0.7396662",
"0.73540694",
"0.7169469",
"0.71685416",
"0.7161115",
"0.7109059",
"0.70717186",
"0.7037763",
"0.7030703",
"0.69059324",
"0.6898647",
"0.6874442",
"0.6865749",
"0.67619854",
"0.67369884",
"0.67369... | 0.7837578 | 1 |
Hidden instance method to append the object to the class attribute __item_list | def __append_to_item_list(self):
Item.get_item_list().append(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append (self, item):\n pass",
"def append(self, item: Any) -> BaseList:\n super().append(item)\n return self",
"def append(self, item):\n # type: (Any) -> None\n list.append(self, self.ref(item))",
"def append(self, item):\n self.update([item])",
"def append(self, ... | [
"0.7601781",
"0.7582431",
"0.7336355",
"0.7185622",
"0.71147776",
"0.7101685",
"0.70831436",
"0.69715333",
"0.6935735",
"0.6905822",
"0.6859141",
"0.6827798",
"0.682628",
"0.682628",
"0.67792153",
"0.67779654",
"0.67643386",
"0.66602784",
"0.66271436",
"0.6626822",
"0.6584660... | 0.8207385 | 0 |
Instance method to increment the views variable | def increment_views(self):
self.views += 1
self.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_view_count(self):\n try:\n self.view_counter += 1\n self.save(update_fields=['view_counter'])\n except:\n warnings.warn(\"Unable to increase view count for advert {}\".format(self.pk))",
"def count_view(self):\n self.count_views += 1\n sel... | [
"0.77704555",
"0.76575696",
"0.70364726",
"0.6700548",
"0.6661522",
"0.658473",
"0.65695125",
"0.65456796",
"0.6533949",
"0.6532441",
"0.6521893",
"0.65049404",
"0.64822143",
"0.6479589",
"0.642222",
"0.640727",
"0.6284937",
"0.6231589",
"0.6199503",
"0.61729074",
"0.61685324... | 0.8641375 | 0 |
Overrides the save method to notify all registered users that a new item has been added | def save(self, *args, **kwargs):
if self not in Item.objects.all() and settings.EMAIL_HOST_USER:
# Send notification for newly created item
self.send_email_notification_to_users(
subject="[Portfolio App Demo] New Item added!",
message=f"A new item '{self.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_user(self):\n\n User.user_list.append(self)",
"def save_user(self):\n User.user_list.append(self)",
"def save_user(self):\n User.user_list.append(self)",
"def save_users(self):\n\n User.user_list.append(self)",
"def save_user(self):\n\n User.user_list.append(sel... | [
"0.7319862",
"0.71779156",
"0.71779156",
"0.71767735",
"0.7166091",
"0.70460325",
"0.6611724",
"0.6498972",
"0.6498972",
"0.6496938",
"0.6492612",
"0.6447528",
"0.6414119",
"0.6330929",
"0.63212955",
"0.63116044",
"0.62686855",
"0.6263381",
"0.6255758",
"0.6254118",
"0.624526... | 0.79123265 | 0 |
Adds the greater or eq than behavior to compare two Item objects based on the number of views. This allows to sort items by their number of views with items.sort(). | def __ge__(self, value):
if not isinstance(value, Item):
raise ValueError("Can't compare Item to non-Item type")
return self.views >= value.views | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, value):\n if not isinstance(value, Item):\n raise ValueError(\"Can't compare Item to non-Item type\")\n return self.views < value.views",
"def OnCompareItems(self, item1, item2):\r\n\r\n return cmp(self.GetItemText(item1), self.GetItemText(item2))",
"def OnCompa... | [
"0.64193386",
"0.61247426",
"0.6124245",
"0.60153514",
"0.6006596",
"0.5853002",
"0.58411884",
"0.5817707",
"0.5793101",
"0.5789319",
"0.57873005",
"0.5785609",
"0.57840955",
"0.57810473",
"0.5768118",
"0.5753078",
"0.5646922",
"0.5607596",
"0.5600079",
"0.55931616",
"0.55870... | 0.6777125 | 0 |
Adds the less than behavior to compare two Item objects based on the number of views. This allows to sort items by their number of views with items.sort(). | def __lt__(self, value):
if not isinstance(value, Item):
raise ValueError("Can't compare Item to non-Item type")
return self.views < value.views | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, value):\n if not isinstance(value, Item):\n raise ValueError(\"Can't compare Item to non-Item type\")\n return self.views >= value.views",
"def __lt__(self, other):\n return self.weight() < other.weight()",
"def __lt__(self, other):\n return less(self, ot... | [
"0.6530827",
"0.63083875",
"0.6215421",
"0.6153583",
"0.6152962",
"0.6097981",
"0.60503787",
"0.6007392",
"0.5985073",
"0.5960501",
"0.58917093",
"0.58641857",
"0.58614886",
"0.58559823",
"0.5845405",
"0.5823928",
"0.5821346",
"0.58023506",
"0.5794721",
"0.5771494",
"0.576231... | 0.7062926 | 0 |
Read cookies file, copypasted from chrome debugger, and return in a form suitable for requests.get. | def get_cookies():
home = expanduser('~')
with open(home + '/config/edx-tools/cookie.txt') as f:
lines = f.readlines()
lines = [line.strip(' \t\n\r') for line in lines if '✓' not in line]
d = {}
count = 0
for line in lines:
if count == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cookies_chrome(domain):\n cookpath = os.path.expanduser(udata.srcs['chrome']+'/Cookies')\n\n # copy DB to prevent 'database is locked' error\n cookcopy = cookpath+'.copy'\n shutil.copy(cookpath, cookcopy)\n\n # open SQLite3 database and execute query\n jar = sqlite3.connect(cookcopy)\n ... | [
"0.69890016",
"0.69329166",
"0.6925964",
"0.6896501",
"0.6833431",
"0.6477234",
"0.6418898",
"0.6413974",
"0.62408906",
"0.6213005",
"0.6211943",
"0.61870146",
"0.61656386",
"0.61045116",
"0.6030387",
"0.60081345",
"0.59826857",
"0.5955835",
"0.59539086",
"0.5894847",
"0.5893... | 0.7160028 | 0 |
minimal html unescape function for quotes, , and &. | def unescape(s):
s = s.replace("&", "&")
s = s.replace("<", "<")
s = s.replace(">", ">")
s = s.replace(""", '"')
s = s.replace("'", "'")
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape(t):\r\n return (t\r\n .replace(\"&\", \"&\").replace(\"<\", \"<\").replace(\">\", \">\")\r\n .replace(\"'\", \"´\").replace(\""\", '\"').replace(''',\"'\")\r\n )",
"def html_unescape(text):\n return html.unescape(text)",
"def unescape(s):\n\n\... | [
"0.79410106",
"0.7851378",
"0.77472293",
"0.76925045",
"0.76480716",
"0.7613853",
"0.759237",
"0.75842106",
"0.754697",
"0.75264806",
"0.74689436",
"0.74556875",
"0.7431712",
"0.7344698",
"0.73413193",
"0.7225569",
"0.718302",
"0.7119962",
"0.70668316",
"0.70210046",
"0.69743... | 0.79456407 | 0 |
Get the deconv configs using presets | def _get_deconv_cfg(self, deconv_kernel):
if deconv_kernel == 4:
padding = 1
output_padding = 0
elif deconv_kernel == 3:
padding = 1
output_padding = 1
elif deconv_kernel == 2:
padding = 0
output_padding = 0
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_deconv_cfg(deconv_kernel):\n if deconv_kernel == 4:\n padding = 1\n output_padding = 0\n elif deconv_kernel == 3:\n padding = 1\n output_padding = 1\n elif deconv_kernel == 2:\n padding = 0\n output_padding = 0\n ... | [
"0.6020298",
"0.59467304",
"0.59467304",
"0.59467304",
"0.59467304",
"0.59467304",
"0.56355107",
"0.53508013",
"0.5306479",
"0.52967423",
"0.5278897",
"0.521289",
"0.5203198",
"0.51874495",
"0.5179428",
"0.51582676",
"0.51260453",
"0.51042265",
"0.50966513",
"0.5086822",
"0.5... | 0.6031522 | 0 |
Make deconv layers using the configs | def _make_deconv_layer(self, num_filters, num_kernels):
assert len(num_kernels) == len(num_filters), \
'Deconv filters and kernels number mismatch: {} vs. {}'.format(
len(num_filters), len(num_kernels))
layers = nn.HybridSequential('deconv_')
with warnings.catch_warn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deconv_layer(self, inputs, field_size, channels_size,\n initializer_type, name, act_func=tf.nn.relu):\n batch, height, width, in_channels = inputs.get_shape().as_list()\n #shape = tf.shape(inputs)\n assert in_channels == channels_size[0], (\n 'Number of input... | [
"0.70237195",
"0.69309855",
"0.68351084",
"0.6832376",
"0.671199",
"0.67101246",
"0.66220206",
"0.6619228",
"0.6604463",
"0.6599641",
"0.65911293",
"0.6588114",
"0.65853435",
"0.65623236",
"0.6389578",
"0.63730615",
"0.6334144",
"0.63175875",
"0.6274826",
"0.6265299",
"0.6259... | 0.75099677 | 0 |
Get resnet with deconv layers. | def get_deconv_resnet(base_network,
pretrained=False,
**kwargs):
net = DeconvResnet(
base_network=base_network,
pretrained_backbone=pretrained,
**kwargs)
return net | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50_v1b_deconv(**kwargs):\n return get_deconv_resnet('resnet50_v1b', **kwargs)",
"def resnet18_v1b_deconv(**kwargs):\n return get_deconv_resnet('resnet18_v1b', **kwargs)",
"def resnet101_v1b_deconv(**kwargs):\n return get_deconv_resnet('resnet101_v1b', **kwargs)",
"def resnet():\n return... | [
"0.7195827",
"0.6876899",
"0.6849386",
"0.6753572",
"0.62811035",
"0.622978",
"0.6229372",
"0.6033808",
"0.60275984",
"0.5997466",
"0.5986289",
"0.5975139",
"0.5969439",
"0.5949569",
"0.59469706",
"0.5941289",
"0.59397143",
"0.59260434",
"0.5917289",
"0.59127927",
"0.5904779"... | 0.8153153 | 0 |
Resnet18 v1b model with deconv layers. Returns HybridBlock A Resnet18 v1b model with deconv layers. | def resnet18_v1b_deconv(**kwargs):
return get_deconv_resnet('resnet18_v1b', **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet18(pretrained=False, **kwargs):\n model = ResNetFeatures(BasicBlock, [2, 2, 2, 2], **kwargs)\n if pretrained:\n _load_pretrained(model, model_zoo.load_url(model_urls['resnet18']))\n return model",
"def resnet18(pretrained=False, **kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], *... | [
"0.62846977",
"0.6198227",
"0.6192097",
"0.6112437",
"0.61038554",
"0.60721475",
"0.60721475",
"0.60721475",
"0.60721475",
"0.60721475",
"0.6058464",
"0.59820086",
"0.59820086",
"0.59615123",
"0.59469116",
"0.5931862",
"0.5890543",
"0.5742647",
"0.5706555",
"0.5705783",
"0.57... | 0.6445889 | 0 |
Resnet50 v1b model with deconv layers. Returns HybridBlock A Resnet50 v1b model with deconv layers. | def resnet50_v1b_deconv(**kwargs):
return get_deconv_resnet('resnet50_v1b', **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learn_deblurring_model(num_res_blocks=5, quick_mode=False):\n model = build_nn_model(16, 16, 32, num_res_blocks)\n if quick_mode:\n train_model(model, sol5_utils.images_for_deblurring(),\n _motion_blur_for_learn_deblurring_model,\n 10, 3, 2, 30)\n retur... | [
"0.5999963",
"0.5938829",
"0.5738903",
"0.5721558",
"0.5713137",
"0.5692295",
"0.56700504",
"0.56655633",
"0.56542367",
"0.5653041",
"0.5642231",
"0.5638073",
"0.56156534",
"0.56155646",
"0.5600691",
"0.5598976",
"0.5593832",
"0.5579433",
"0.55768794",
"0.5557143",
"0.555273"... | 0.6533484 | 0 |
Resnet101 v1b model with deconv layers. Returns HybridBlock A Resnet101 v1b model with deconv layers. | def resnet101_v1b_deconv(**kwargs):
return get_deconv_resnet('resnet101_v1b', **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50_v1b_deconv(**kwargs):\n return get_deconv_resnet('resnet50_v1b', **kwargs)",
"def resnet18_v1b_deconv(**kwargs):\n return get_deconv_resnet('resnet18_v1b', **kwargs)",
"def get_deconv_resnet(base_network,\n pretrained=False,\n **kwargs):\n net = D... | [
"0.6411092",
"0.6288105",
"0.6117896",
"0.58658695",
"0.5787724",
"0.57668394",
"0.57667327",
"0.57633877",
"0.5757062",
"0.57168233",
"0.5690354",
"0.56773686",
"0.56585187",
"0.56361216",
"0.5624006",
"0.5623314",
"0.5622369",
"0.5622369",
"0.5622369",
"0.5622369",
"0.56223... | 0.66662174 | 0 |
Get a center net instance. | def get_center_net(model_name,
classes,
pretrained=False,
ctx=mx.cpu(),
root=os.path.join('~', '.mxnet', 'models'),
**kwargs):
heads = OrderedDict([
('heatmap', {'num_output': classes, 'bias': -2.19}), # use bias... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInstance():\n return net()",
"def get_net(con):\n try:\n return con.virtual_network_read(fq_name=conf.get('default_net', 'UNEXPECTED_VALUE'))\n except NoIdError:\n log.debug('Unable to find net.')\n return None",
"def get_instance (self):\n instances = self.data[... | [
"0.7030677",
"0.5973064",
"0.5955322",
"0.59289825",
"0.58522224",
"0.5824274",
"0.56849664",
"0.5666703",
"0.56177497",
"0.5609592",
"0.55093485",
"0.5500398",
"0.5492306",
"0.54684716",
"0.54643327",
"0.54516166",
"0.54325414",
"0.54325414",
"0.54325414",
"0.54325414",
"0.5... | 0.60560864 | 1 |
main function for inserting gateways | def main():
insert_gateway_values("hermes/bin/gateways.txt")
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n if len(sys.argv) != 5:\n print ('usage: %s <SRC_USER::SRC_PASSWD@@SRC_HOST> '\n '<DEST_USER:DEST_PASSWD@DEST_HOST> SRC_GW DEST_GW\\n'\n ' where\\n'\n ' HOST Aviatrix Controller hostname or IP\\n'\n ' USER Aviatrix Controller log... | [
"0.616866",
"0.58173704",
"0.57266355",
"0.5699523",
"0.5562407",
"0.5561937",
"0.5531044",
"0.5519377",
"0.5519377",
"0.5514505",
"0.55023265",
"0.55012304",
"0.5470605",
"0.5431577",
"0.54253876",
"0.5411088",
"0.5408261",
"0.5388444",
"0.538794",
"0.53809285",
"0.53729486"... | 0.74428517 | 0 |
Only defining here because simply including list_display_links = [] above does not work; it defaults to linking from items in AccessTime col | def __init__(self, *args, **kwargs):
super(AccessTimeAdmin, self).__init__(*args, **kwargs)
# There's no need to show the page for an individual AccessTime, so no field should link to it.
self.list_display_links = (None, ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_display(self, request):\n list_display = self.list_display\n\n if 'admin_created' not in list_display:\n list_display += ('admin_created', )\n if 'admin_modified' not in list_display:\n list_display += ('admin_modified', )\n\n return list_display",
"... | [
"0.61103547",
"0.57638454",
"0.5698465",
"0.5654802",
"0.55889523",
"0.5581935",
"0.55087066",
"0.54733235",
"0.5446723",
"0.5401263",
"0.5352148",
"0.5347162",
"0.53248256",
"0.52955914",
"0.5181165",
"0.5177439",
"0.5163127",
"0.5143022",
"0.5088965",
"0.5075256",
"0.506267... | 0.70390844 | 0 |
matplotlib key press event. Close all figures when q is pressed | def press(self, event):
if event.key == "q":
self.exit_event.set()
if event.key == " ":
self.plot_paused = not self.plot_paused
print("Plot is paused:", self.plot_paused) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _quit_figure(event):\n\tif event.key == 'q':\n\t\tplt.close(event.canvas.figure)",
"def qpressed(): #QUITTNG FUNCTION\n #print(\"q pressed\")\n sys.exit()",
"def end(self, event):\n plt.close()",
"def kill(self):\r\n plt.close(self.fig)",
"def on_key_press(self, key):\n if ke... | [
"0.84586275",
"0.6683859",
"0.65130144",
"0.6340119",
"0.6235164",
"0.62336737",
"0.6173516",
"0.61614585",
"0.6143306",
"0.6141613",
"0.6122026",
"0.609293",
"0.609293",
"0.60200125",
"0.6017953",
"0.60134417",
"0.60088164",
"0.59827036",
"0.5974096",
"0.59326994",
"0.592426... | 0.70938265 | 1 |
Interpolate between two arrays by taking the mean of the two arrays. | def interpolation_array(a1, a2):
return (a1+a2)/2. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate_and_average(xs, ys, interop_points=None, confidence_interval=False):\n # Get the xs of shortest curve\n max_min_x = max(x.min() for x in xs)\n min_max_x = min(x.max() for x in xs)\n if interop_points is None:\n # Interop points according to curve with \"least resolution\"\n ... | [
"0.68202096",
"0.6288764",
"0.61606866",
"0.6074447",
"0.60347766",
"0.5936755",
"0.59121615",
"0.5846344",
"0.5794967",
"0.5777938",
"0.576445",
"0.57544976",
"0.5718352",
"0.56939507",
"0.5673777",
"0.5601805",
"0.5579589",
"0.5571771",
"0.55689275",
"0.55656314",
"0.555603... | 0.71933377 | 0 |
Use duration and PTratio to cluster into RS and FS neurons | def cluster_rsfs(durations, PTratio):
iter=1000
# cluster for FS and RS neurons according to duration of spike and PTratio
waveform_k = kmeans2(np.vstack((durations/np.max(durations),PTratio/np.max(PTratio))).T,
2, iter=iter, thresh=5e-6,minit='random')
labels = waveform_k[1]
return labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clusterMonitor():\n node = os.environ['DIM_DNS_NODE']\n xml = XMLTaskList.TransformXmlToObjects()\n xml.load('../xml/TaskInventory.xml') # loads the Task Inventory\n xml.load('../xml/HLTD01.xml') # loads the Node List\n xml.load('../xml/HLTD02.xml') # loads the Node List\n xml.load('../x... | [
"0.55085295",
"0.5444285",
"0.5415583",
"0.5309192",
"0.5286226",
"0.5262705",
"0.5232784",
"0.52248675",
"0.5181988",
"0.51781946",
"0.5170047",
"0.51646507",
"0.5155263",
"0.5151695",
"0.5144661",
"0.5142094",
"0.5134443",
"0.5127981",
"0.51168716",
"0.51157445",
"0.5111512... | 0.6637513 | 0 |
Plot example traces for rs and fs. Plot mean waveform. | def plot_rsfs_waveforms(peak_waveform, durations, labels):
if np.mean(durations[np.where(labels==0)[0]]) < np.mean(durations[np.where(labels==1)[0]]):
fs_k = 0;rs_k = 1
waveform_class_ids = [1,0]
else:
rs_k = 0;fs_k = 1
waveform_class_ids = [0,1]
waveform_class = [waveform_cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self, show=True):\n xs, ys = zip(*[(float(ix)/self.sample_rate, val)\n for ix, val in enumerate(self.samples)])\n plt.plot(xs, ys)\n if show:\n plt.show()",
"def show_waveform(self, peaks=[]):\n if peaks is None:\n peaks = []\n ... | [
"0.6366105",
"0.6343887",
"0.6251174",
"0.62412655",
"0.6195293",
"0.6167033",
"0.61656606",
"0.61597526",
"0.6135713",
"0.6123626",
"0.60824937",
"0.6050469",
"0.605036",
"0.60355365",
"0.60064894",
"0.60045254",
"0.5998158",
"0.59978235",
"0.59749985",
"0.59437656",
"0.5919... | 0.6464803 | 0 |
Converts offset+length coordinates to sentence_id and token_id. Returns (sentence_start, token_start), (sentence_end, token_end) | def offset_to_tokens(self, offset, length):
first_sent_id = None
first_tok_id = None
#print offset
#print length
for sent_id, (sent_json, sent_conll) in enumerate(
zip(self.tokenized['sentences'], self.conll)):
#print first_sent_id
for t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_positions(separation):\n offsets = (-separation, 0, separation)\n for x_pos in offsets:\n for y_pos in offsets:\n yield x_pos, y_pos",
"def get_text_positions(self, node, padded):\n # type: (AstNode, bool) -> Tuple[Tuple[int, int], Tuple[int, int]]\n if not hasattr(node, '... | [
"0.6784497",
"0.64283454",
"0.6420033",
"0.6386695",
"0.6348043",
"0.6061477",
"0.60567343",
"0.6041508",
"0.6039938",
"0.5996507",
"0.5840656",
"0.57864076",
"0.5765366",
"0.5730394",
"0.5728136",
"0.5719357",
"0.57179654",
"0.56979686",
"0.5688681",
"0.56320363",
"0.5586682... | 0.71816325 | 0 |
Convert existing RADIUS usernames in profiles to AuthenticationDataentries. | def convert_radius_username(apps, schema_editor):
Profile = apps.get_model("organization", "Profile")
AuthenticationData = apps.get_model("organization", "AuthenticationData")
for profile in Profile.objects.exclude(radius_username=""):
a = AuthenticationData(backend=RADIUS_BACKEND_NAME, username=pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_convert_radius_username(apps, schema_editor):\n Profile = apps.get_model(\"organization\", \"Profile\")\n AuthenticationData = apps.get_model(\"organization\", \"AuthenticationData\")\n for auth_data in AuthenticationData.objects.filter(backend=RADIUS_BACKEND_NAME):\n auth_data.user.pro... | [
"0.68432105",
"0.59266603",
"0.5753227",
"0.56977576",
"0.53878903",
"0.52764636",
"0.52312744",
"0.5185261",
"0.51774687",
"0.5167766",
"0.51212883",
"0.51203704",
"0.51151085",
"0.51099247",
"0.50854266",
"0.5081361",
"0.5063556",
"0.504079",
"0.5025078",
"0.5009595",
"0.49... | 0.70934486 | 0 |
Create a notification where the notifier is the user. If the user is the owner, then do nothing Hrefs can be 1) Link to post, e.g. /post/postid 2) Link to comment or nested comment, e.g. /post/postidcommentcommentid 3) Link to reaction, e.g. /post/postidreactionreactionid | def create_notification(self, notifying_href, notifying_action, notified_href, owner):
if self.id == owner.id:
return
new_notification = Notification()
new_notification.eid = make_uuid()
new_notification.notifier = self
new_notification.notifying_href = notifying_href
new_notification.no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply_this(self, user, text):\n parent = self.get_parent()\n reply_news = News.objects.create(\n user=user, content=text, reply=True, parent=parent\n )\n notification_handler(\n user,\n parent.user,\n Notification.REPLY,\n actio... | [
"0.6424427",
"0.63672864",
"0.6204566",
"0.619281",
"0.5919673",
"0.5777313",
"0.5768302",
"0.5762613",
"0.5619914",
"0.5582401",
"0.55254275",
"0.5516454",
"0.548841",
"0.5461826",
"0.54616433",
"0.5460863",
"0.5425252",
"0.54158276",
"0.5414549",
"0.54036623",
"0.5383166",
... | 0.69772345 | 0 |
Mark a notification as read | def mark_notification_as_read(self, notification_id):
n = Notification.objects.get(eid=notification_id)
if self.id != n.owner.id:
return False
if not n.unread:
return True
n.unread = False
n.save()
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_read(self):\n # Obviously remove the exception when Kippt says the support it.\n raise NotImplementedError(\n \"The Kippt API does not yet support marking notifications as read.\"\n )\n\n data = json.dumps({\"action\": \"mark_seen\"})\n r = requests.post(\n ... | [
"0.8075644",
"0.74416107",
"0.6954183",
"0.6929599",
"0.68651927",
"0.6858649",
"0.6849861",
"0.66907734",
"0.6574252",
"0.65078586",
"0.647467",
"0.64699465",
"0.6376799",
"0.632871",
"0.6303812",
"0.6294918",
"0.62934786",
"0.6202659",
"0.60688096",
"0.6044562",
"0.6039973"... | 0.744433 | 1 |
Mark all user's notifications as read | def mark_all_notifications_as_read(self):
for n in Notification.objects(owner=self, unread=True):
n.unread = False
n.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_all_read(self):\n caller = self.caller\n player = caller.player_ob\n all_msgs = Journal.white_journals.all_unread_by(player)\n # we'll do a bulk create of the through-model that represents how journals are marked as read\n ReadJournalModel = Journal.db_receivers_accounts... | [
"0.74910504",
"0.7462836",
"0.7359577",
"0.73337513",
"0.7281608",
"0.7210877",
"0.7019616",
"0.69373256",
"0.6911804",
"0.6884166",
"0.64511365",
"0.6383615",
"0.6305257",
"0.61974895",
"0.6158948",
"0.61453354",
"0.60896534",
"0.6042512",
"0.60403097",
"0.59861183",
"0.5946... | 0.866048 | 0 |
the main loop of the data server | def main(self):
while True:
if not self.data_server_command.empty():
command_data_server = self.data_server_command.get()
if command_data_server[0] == 4:
thread.start_new_thread(self.get_file, (command_data_server[1],))
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_loop(self):\n # main loop...don't ever exit\n while True:\n # collect data\n # get the time...the local clock is set with NTP regularly\n self._get_time()\n \n # get the latest metar data from the closest location\n self._get_metar()\n \n # get the latest fenc... | [
"0.7505039",
"0.74601567",
"0.7351386",
"0.7342225",
"0.7342225",
"0.73240626",
"0.7100712",
"0.70430654",
"0.7006645",
"0.6992665",
"0.69915676",
"0.6894115",
"0.68917155",
"0.6885587",
"0.68853796",
"0.6882698",
"0.6868027",
"0.68606335",
"0.6837757",
"0.68368477",
"0.68202... | 0.78023845 | 0 |
Find vertices in neighborhood of peak vertices. | def peak_neighborhood(apsp, peak, n_size):
dpeaks = apsp[peak, :]
nhood = np.where(dpeaks < n_size)[0]
return nhood | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peak_indices(self, **kwargs):\n kwarg_defaults = {\n 'width': 5, # ensure small spikes are ignored\n }\n kwarg_defaults.update(kwargs)\n return signal.find_peaks(self.ys, **kwarg_defaults)",
"def find_delaunay_with_max_vertices(bbox, nvertex):\n # find bracketing va... | [
"0.6164366",
"0.6151801",
"0.6076451",
"0.6051318",
"0.6048757",
"0.60092044",
"0.6003077",
"0.59836006",
"0.5955315",
"0.5863139",
"0.58380353",
"0.58234304",
"0.58089036",
"0.58047277",
"0.57400477",
"0.57065547",
"0.56949335",
"0.56949335",
"0.5683954",
"0.5674413",
"0.565... | 0.64697915 | 0 |
Compute the Kernel Density Estimate, in target coordinate space, of the mapped vertices. Each target vertex will be smoothed using an isotropic Gaussian kernel of width ```sigma```. We compute, for each target vertex, the number of mapped source vertices. The transformed value of each target is the convolution of the i... | def kde(sregion, tregion, tdist, mapping, index_map, sigma=1.5):
tinds = index_map[tregion]
# mapping of target indices to 0 : # targets
t2i = dict(zip(tinds, np.arange(len(tinds))))
# determine number of source vertices mapping to each target
counts = np.zeros((len(tinds),))
for i in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeGaussianKernel(sigma: float) -> np.ndarray:\n\n # Your code here.\n kernel_size = 8*sigma+1\n kernel = np.zeros([kernel_size,kernel_size], dtype=float)\n center = kernel_size//2\n \n \n s = 2*(sigma**2)\n sum_val = 0\n for i in range(0,kernel_size):\n for j in range(0,kern... | [
"0.62467575",
"0.60877776",
"0.60786873",
"0.60424685",
"0.6018096",
"0.5949306",
"0.5885207",
"0.5851151",
"0.5841302",
"0.58193064",
"0.58002514",
"0.5785205",
"0.576055",
"0.57541895",
"0.5740346",
"0.5706156",
"0.5704515",
"0.5691362",
"0.56588477",
"0.5651872",
"0.563313... | 0.69313246 | 0 |
Returns a Keyword object from keyword_set corresponding to the given string. | def get_keyword(arg: str, keyword_set: set) -> Keyword or None:
arg = arg.lower().lstrip('-')
for keyword in keyword_set:
if arg == keyword.keyword or arg in keyword.aliases:
return keyword
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyword(self, keyword):\r\n return keywords.Keyword(self, keyword)",
"def from_str ( cls, vstr ):\n return cls ( cls.OV_KEYWORDS[vstr] )",
"def from_string(cls, str_value):\n for m in cls:\n if m.value == str_value:\n return m\n else:\n return ... | [
"0.617394",
"0.5931612",
"0.54410845",
"0.5338358",
"0.53138894",
"0.5306772",
"0.5240785",
"0.5178541",
"0.51635635",
"0.51292783",
"0.511156",
"0.50753915",
"0.49567872",
"0.4942246",
"0.49277085",
"0.49002466",
"0.48902506",
"0.48736504",
"0.48280266",
"0.4818104",
"0.4777... | 0.6735547 | 0 |
Parses a list of strings into a dictionary whose keys are the keys in keyword_dict, and such that the value at the key K is a list of the next keyword_dict[K] strings after K in the list args. All keys in keyword_dict should be lowercase; keywords are not parsed casesensitively. The returned dict holds a list of args t... | def parse(args: list, keyword_set: set) -> dict:
parsed_dict = {'': []}
while args:
keyword = get_keyword(arg=args[0], keyword_set=keyword_set)
if keyword is not None:
args.pop(0)
keyword_name = keyword.keyword_name
if keyword_name in parsed_dict:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_kwargs(kwargs_list: List[str]) -> Dict[str, Any]:\n\n kwargs_dict = {}\n\n for kwarg in kwargs_list:\n key = kwarg[2:].split('=')[0]\n value = '='.join(kwarg.split('=')[1:])\n\n try:\n if re.match(r'^(-)?[0-9]+$', value):\n value = int(value)\n\n ... | [
"0.617602",
"0.60784173",
"0.6058244",
"0.5894706",
"0.5815839",
"0.57707494",
"0.57487035",
"0.57175565",
"0.56887645",
"0.5618045",
"0.56060874",
"0.55750597",
"0.553328",
"0.5478511",
"0.54528874",
"0.5370976",
"0.530249",
"0.5263757",
"0.5255872",
"0.523665",
"0.5228101",... | 0.6823548 | 0 |
The API has a schema route that answers. | def test_api_schema(self):
response = self.client.get("/api/schema/")
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.get("Content-Type"), "application/vnd.oai.openapi; charset=utf-8"
)
self.assertEqual(
response.get("Content-Disposi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_view(request):\n generator = schemas.SchemaGenerator(title='Experiment Data Depot')\n return response.Response(generator.get_schema(request=request))",
"def schema(self):",
"def routes(self, body):\n pass",
"def api():\n from gluon.contrib.hypermedia import Collection\n rules = ... | [
"0.5833563",
"0.5763245",
"0.5693397",
"0.5690656",
"0.5690656",
"0.5690656",
"0.56629115",
"0.5609442",
"0.5589248",
"0.5574372",
"0.5463491",
"0.54347056",
"0.54218733",
"0.5400311",
"0.5400095",
"0.53853744",
"0.5339836",
"0.5331879",
"0.52693224",
"0.5267477",
"0.523229",... | 0.5968774 | 0 |
Test the `clean_permission` expected behavior. | def test_clean_permission(self):
for permission, expected_string in [
(
PermissionA & PermissionB,
" **(** PermissionA **AND** PermissionB **)** ",
),
(
PermissionA | PermissionB,
" **(** PermissionA **OR** Permi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_permission(self):\r\n self.assertFalse(self.creator_admin.has_delete_permission(self.request))",
"def test_get_permissions(self):\n pass",
"async def permission_valid_check(cls):\n pass",
"def test_permission(self):\n response = self._get()\n self.assertEqua... | [
"0.69687974",
"0.6870181",
"0.6782665",
"0.6718146",
"0.6718146",
"0.6688817",
"0.6600725",
"0.6581123",
"0.6561051",
"0.6554503",
"0.6521542",
"0.65094894",
"0.65094894",
"0.64864784",
"0.6462128",
"0.64617753",
"0.64537555",
"0.64529544",
"0.64493746",
"0.64291537",
"0.6425... | 0.8311579 | 0 |
Test the `extract_permission_docstring` expected behavior. | def test_extract_permission_docstring(self):
for permission, expected_dict in [
(
PermissionA & PermissionB,
{
"PermissionA": "Permission A.",
"PermissionB": "Permission B.",
},
),
(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_format_permissions_and_docstring(self):\n self.assertEqual(\n format_permissions_and_docstring(\n [\"permission formatted string\"],\n {\"some\": \"docstring\"},\n ),\n (\n \"## Permissions\\n\\n\"\n \"perm... | [
"0.7750301",
"0.63256484",
"0.61832505",
"0.6159631",
"0.60564035",
"0.59957445",
"0.5964562",
"0.5904991",
"0.59038615",
"0.58144975",
"0.58118314",
"0.58020514",
"0.5793214",
"0.5759372",
"0.5753072",
"0.57528716",
"0.57407355",
"0.57407355",
"0.57407355",
"0.57407355",
"0.... | 0.8519844 | 0 |
Test the `format_permissions_and_docstring` expected behavior. | def test_format_permissions_and_docstring(self):
self.assertEqual(
format_permissions_and_docstring(
["permission formatted string"],
{"some": "docstring"},
),
(
"## Permissions\n\n"
"permission formatted string\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_extract_permission_docstring(self):\n for permission, expected_dict in [\n (\n PermissionA & PermissionB,\n {\n \"PermissionA\": \"Permission A.\",\n \"PermissionB\": \"Permission B.\",\n },\n )... | [
"0.77590525",
"0.63539076",
"0.6225805",
"0.6169162",
"0.6058129",
"0.59855884",
"0.596356",
"0.5924213",
"0.58999294",
"0.5832375",
"0.5824305",
"0.58180207",
"0.5810781",
"0.58056927",
"0.58020186",
"0.5790352",
"0.5752622",
"0.57435054",
"0.5739238",
"0.57340395",
"0.57254... | 0.9066155 | 0 |
Base command for SpoilerChannel. | async def spoilerchannel(self, ctx):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command(self):\n raise NotImplementedError",
"def send_command(self, cmd, shell=None, silent=False):",
"def command():\n pass",
"def send_command_line(self, command):\n raise NotImplementedError",
"def _setup_command(self):\r\n raise NotImplementedError",
"def _command(self, *... | [
"0.6149058",
"0.61001325",
"0.60898775",
"0.58528775",
"0.581973",
"0.5755966",
"0.57535255",
"0.5715783",
"0.5669034",
"0.5654281",
"0.56286776",
"0.56231105",
"0.56219894",
"0.56180894",
"0.5612029",
"0.5612029",
"0.5612029",
"0.5612029",
"0.55656666",
"0.54957414",
"0.5493... | 0.6587875 | 0 |
Add a channel to the list of spoiler channels. | async def add(self, ctx, channel: discord.TextChannel):
config = await self.config.guild(ctx.guild).channels()
if channel.id in config:
return await ctx.send("This channel is already a spoiler channel.")
await ctx.send("Channel added to the spoiler channel list.")
config.appe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_channel(self, channel):\n if channel in self.clients:\n return False\n self.clients[channel] = []\n return True",
"def add_channel(self, channel):\n self._channels[channel.fileno] = channel\n self._poller.add(channel.fileno, channel._events)",
"async def ad... | [
"0.72365296",
"0.7023313",
"0.6736699",
"0.6601461",
"0.65783",
"0.6487989",
"0.6431095",
"0.6341024",
"0.63276815",
"0.6260294",
"0.62081283",
"0.6052182",
"0.5912715",
"0.58898664",
"0.57825136",
"0.577486",
"0.57667595",
"0.5757747",
"0.57558197",
"0.5752964",
"0.57452536"... | 0.83342344 | 0 |
Remove a channel from the list of spoiler channels. | async def remove(self, ctx, channel: discord.TextChannel):
config = await self.config.guild(ctx.guild).channels()
if not channel.id in config:
return await ctx.send("This channel is not a spoiler channel.")
config.remove(channel.id)
await self.config.guild(ctx.guild).channels... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_channel(self, channel):\n self._channels.pop(channel.fileno, None)\n\n try:\n self._poller.remove(channel.fileno, channel._events)\n except (IOError, OSError):\n log.exception(\"Error while removing %r.\" % channel)",
"def remove_channel(self, channel):\n ... | [
"0.69637007",
"0.6853917",
"0.6657176",
"0.6604634",
"0.65927154",
"0.654691",
"0.64287716",
"0.6404131",
"0.63939744",
"0.6344553",
"0.6340599",
"0.63152224",
"0.6293544",
"0.6290537",
"0.60735846",
"0.59953487",
"0.5956108",
"0.5943499",
"0.58851695",
"0.58548623",
"0.58102... | 0.80995065 | 0 |
Clear the spoiler channel list. | async def clear(self, ctx):
await self.config.guild(ctx.guild).channels.clear()
await ctx.send("Spoiler channel list cleared.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def spoilerchannel(self, ctx):\n pass",
"async def remove(self, ctx, channel: discord.TextChannel):\n config = await self.config.guild(ctx.guild).channels()\n if not channel.id in config:\n return await ctx.send(\"This channel is not a spoiler channel.\")\n config.rem... | [
"0.65423995",
"0.64471906",
"0.64198625",
"0.6385896",
"0.6345822",
"0.6259973",
"0.6207083",
"0.6160827",
"0.6145606",
"0.6049271",
"0.59991276",
"0.5911955",
"0.58956164",
"0.57868534",
"0.5777718",
"0.57751626",
"0.5747458",
"0.57456756",
"0.57445383",
"0.573946",
"0.57380... | 0.8602701 | 0 |
user mobility func update users' location in every frame. mobility range comes from user mobility type. Meanwhile, user should only move in the cell range, restricted by the MARGIN. | def user_mobility(user_list):
new_user_list = list()
for user in user_list:
# update loc according to user mobility type
ii = random.randint(-user[3], user[3])
print("user[3]= ", user[3])
print("ii= ", ii)
user[0] += random.randint(-user[3], user[3])
user[1] += r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _move_user(self):\n self.terminal = False\n mobility_speed = 1\n\n for i in range(self.num_user):\n move_x = random.randint(-mobility_speed, mobility_speed)\n user_x_tmp = self.users[i][0] + move_x\n move_y = random.randint(-mobility_speed, mobility_speed)\n u... | [
"0.6258764",
"0.5653074",
"0.5542158",
"0.5471045",
"0.5376977",
"0.53672373",
"0.5281903",
"0.5248371",
"0.521853",
"0.51883197",
"0.5184659",
"0.5160175",
"0.515324",
"0.51410437",
"0.5134581",
"0.5125037",
"0.5112508",
"0.50968057",
"0.50905675",
"0.5066284",
"0.50647473",... | 0.69230926 | 0 |
draw cell square and paint color according to cell location and outrage ratio. outrage ratio denotes the balance between cell resources and cell load. Color in each cell is chosen according to the outrage ratio. Dark color means the cell is highburden, opposite otherwise. Black color means ratio is lager than 1, meanin... | def draw_cells(cell_list):
outrage_ratio = [x[4]/x[3] for x in cell_list]
# print(cell_list)
# print(outrage_ratio)
outrage_ratio = [min(x, 1) for x in outrage_ratio] # larger than 1 is outrage, use black color directly
# print_list = [round(x, 2) for x in outrage_ratio]
# print(print_list)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def green_cell(self, x, y):\n r = self.rect_area(x, y) # gets rect area for cell\n pygame.draw.rect(self.screen, (0, 255, 0), r, 3)\n pygame.display.update(r) # updates screen to showcase green rect",
"def draw_grid(self):\n\n screen.fill(GREY)\n\n for row in self.grid:\n ... | [
"0.61169076",
"0.60230124",
"0.5847452",
"0.58186793",
"0.5788967",
"0.57456297",
"0.5700501",
"0.5635756",
"0.56212103",
"0.5600866",
"0.55408627",
"0.5493554",
"0.54904616",
"0.5441999",
"0.5429428",
"0.54221565",
"0.5420412",
"0.5406437",
"0.5404276",
"0.5400624",
"0.53915... | 0.70212466 | 0 |
calculate cell load according to the sum of users in its range. | def cal_cell_load(cell_list, user_list):
# count users in each cell
cell_load = [0] * CELL_COLUMN * CELL_ROW
for user in user_list:
cell_load[user[2] - 1] += 1
# print(cell_load)
# update the load of each cell in cell list
for i in range(len(cell_list)):
cell_list[i][4] = cell_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_load(userloads, user_ids, period):\n series = [userloads[user][period[0]:period[1]] for user in user_ids]\n total = series[0].copy()\n for single_series in series[1:]:\n total += single_series\n return total",
"def total_load_in_experiment_periods(userloads, user_ids):\n periods =... | [
"0.64571244",
"0.5781821",
"0.5779872",
"0.57753253",
"0.56961805",
"0.56795824",
"0.55291647",
"0.5336819",
"0.5334902",
"0.5319453",
"0.5313331",
"0.52933884",
"0.5156394",
"0.51557285",
"0.515272",
"0.51381844",
"0.5076189",
"0.5056973",
"0.50533557",
"0.5039493",
"0.50256... | 0.71235216 | 0 |
Detects local maxima in a 3D array | def local_maxima_3D(data, order=3):
size = 1 + 2 * order
footprint = np.ones((size, size, size))
footprint[order, order, order] = 0
filtered = ndi.maximum_filter(data, footprint=footprint)
mask_local_maxima = data > filtered
coords = np.asarray(np.where(mask_local_maxima)).T
values = data[m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_max(img, size=(70,100,100)):\n # Apply a maximum filter.\n max_f = ndi.maximum_filter(img, size=size)\n # Find pixels that are local maxima.\n local_max = np.where(max_f == img, 1, 0)\n return(local_max)",
"def find_local_maxima(self, arr):\n\n # walks through array, finding local... | [
"0.74168485",
"0.7036359",
"0.700396",
"0.6864814",
"0.6845005",
"0.66943693",
"0.6628028",
"0.6617119",
"0.6600229",
"0.6450245",
"0.6397976",
"0.6194478",
"0.6130189",
"0.60908407",
"0.6077834",
"0.60268056",
"0.5982528",
"0.595608",
"0.5951729",
"0.5951729",
"0.59401405",
... | 0.70661926 | 1 |
Function to build an HTML report of number of games per category | def gamecategory_list(request):
if request.method == 'GET':
# Connect to project database
with sqlite3.connect(Connection.db_path) as conn:
conn.row_factory = sqlite3.Row
db_cursor = conn.cursor()
# Query for all games, with related rating info.
db_cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_count_grouped_by_genre():\n dict_of_genre = reports.count_grouped_by_genre(filename)\n print(\"Game grouped by genre:\")\n for genre, value in dict_of_genre.items():\n print(\"{}: {}\".format(genre, value))\n print()",
"def PrintCategoryScore(Cat):\r\n print()\r\n print(\"###... | [
"0.6554664",
"0.6068233",
"0.5920364",
"0.56900066",
"0.5659495",
"0.5643938",
"0.56211424",
"0.5558111",
"0.55319446",
"0.5501326",
"0.5473281",
"0.5464325",
"0.53525615",
"0.53275794",
"0.5317448",
"0.5313982",
"0.5292075",
"0.5285532",
"0.5283213",
"0.5224503",
"0.52075994... | 0.6814326 | 0 |
Determine if value is only a partial url and needs to be a full url. | def partial_url(row, index):
if len(row[index]) != 0:
if row[index][0] == '/':
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_short_url(self, value: str) -> str:\n url_id = self.context.get(\"url_id\") # just in update mode we have id.\n\n if url_id: # for update step old and new short_value could be same.\n try:\n old_short_url = URL.objects.get(id=url_id).short_url\n exc... | [
"0.6601381",
"0.6435911",
"0.637825",
"0.6365589",
"0.63523203",
"0.6233559",
"0.623043",
"0.6205113",
"0.61700535",
"0.6157163",
"0.61503124",
"0.6121164",
"0.61019105",
"0.6038575",
"0.5991075",
"0.59017664",
"0.588379",
"0.588122",
"0.5857775",
"0.5825847",
"0.58074635",
... | 0.7026639 | 0 |
Script for updating url fields in CSV file. | def main(script):
original_file = open('data/customers_original.csv')
original_object = csv.reader(original_file)
output_csv = []
for row in original_object:
if partial_url(row, 4):
full_url = prepend_url(row[4])
row[4] = full_url
if partial_url(row, 5):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_to_field_Urls(entity, value):\n if value is None or value == '':\n return\n splitter = re.compile(url_splitter)\n entity.string = splitter.split(value)",
"def csv_url(self, csv_url):\n\n self._csv_url = csv_url",
"def csv_url(self, csv_url):\n\n self._csv_url = csv_url",
... | [
"0.6645071",
"0.65307665",
"0.65307665",
"0.618359",
"0.6104837",
"0.60744625",
"0.59018284",
"0.5862033",
"0.57731605",
"0.5760353",
"0.5751486",
"0.574974",
"0.5711782",
"0.5708614",
"0.56546396",
"0.5644092",
"0.5479853",
"0.54011136",
"0.5396848",
"0.5350193",
"0.5342484"... | 0.6833886 | 0 |
Reads the commandline parameters checks to make sure they seem right and returns them Returns | def parse_and_validate_cmd_line():
if len(sys.argv) != 4:
print USAGE_STR.format(sys.argv[0])
sys.exit()
# attempt to parse the parameters tell the user and exit if we can't
num_segments = parse_and_validate_num_segs(sys.argv[1])
# try to parse numThreads
num_threads = parse_and_vali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_cmd_args():\n\n # Check if argument count is correct.\n if len(sys.argv) != 5:\n print(\"[ERR] Invalid number of command line arguments!\")\n _usage()\n sys.exit(1)\n\n # Get path to config file\n configfile = sys.argv[1]\n if not os.path.exists(configfile):\n p... | [
"0.7394097",
"0.7226845",
"0.7086163",
"0.7039422",
"0.69269073",
"0.68884903",
"0.6864421",
"0.6826465",
"0.67924505",
"0.6779108",
"0.67746884",
"0.6754019",
"0.67359424",
"0.667076",
"0.66613334",
"0.6638034",
"0.65763146",
"0.65523595",
"0.65419203",
"0.6500828",
"0.64675... | 0.7317521 | 1 |
Attempts to parse the number of threads passed in on the command line | def parse_and_validate_num_threads(thread_str):
num_threads = 0
try:
num_threads = int(thread_str)
if num_threads < 1:
raise ValidationError(NUMTHREAD_ERR_SMALL_VAL)
elif num_threads > mp.cpu_count():
err_str = NUMMTHREAD_ERR_BIG_VAL.format(mp.cpu_count())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_threads(self, args):\n try:\n threads = int(args[\"threads\"])\n except KeyError:\n raise ValueError(\"Must specify the number of threads the crawler should work with.\")\n except ValueError:\n raise ValueError(\"Threads must be an integer.\")\n ... | [
"0.7095453",
"0.7019208",
"0.66536057",
"0.6259861",
"0.6224292",
"0.61977744",
"0.6061552",
"0.59712",
"0.5954642",
"0.5913753",
"0.5911587",
"0.590257",
"0.5894001",
"0.5893401",
"0.5878691",
"0.5852902",
"0.5841035",
"0.58334404",
"0.58245236",
"0.57961905",
"0.57697976",
... | 0.73970425 | 0 |
Attempts to parse the number of segments passed in on the command line | def parse_and_validate_num_segs(segment_str):
# try to parse numSegments
num_segments = 0
try:
num_segments = int(segment_str)
divs = math.log(num_segments, 2)
if num_segments < 2:
raise ValidationError(NUMSEG_ERR_SMALL_VAL)
elif int(divs) != divs:
rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_segments(s):\n s = s.strip().split()\n return len(s)",
"def parse_and_validate_cmd_line():\n if len(sys.argv) != 4:\n print USAGE_STR.format(sys.argv[0])\n sys.exit()\n # attempt to parse the parameters tell the user and exit if we can't\n num_segments = parse_and_validate_... | [
"0.6515386",
"0.65148354",
"0.62029254",
"0.58394164",
"0.57485616",
"0.5623078",
"0.56027424",
"0.55949765",
"0.5576298",
"0.5547596",
"0.5544452",
"0.55239826",
"0.55036634",
"0.5494106",
"0.54743",
"0.54707456",
"0.54546857",
"0.54324806",
"0.5409895",
"0.5401737",
"0.5392... | 0.6938135 | 0 |
Return all articles if no audience specified, otherwise only those from that Audience | def articles(self, audience_filter=None):
articles = ArticlePage.objects.live().descendant_of(self)
if audience_filter is not None:
articles = articles.filter(audience__name=audience_filter)
articles = articles.order_by('-date')
return articles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles(self):\n return self.get_queryset().filter(content_type__model='article').order_by('-articles__published_at')",
"def articles(self, subject_filter=None):\n articles = ArticlePage.objects.live().descendant_of(self)\n if subject_filter is not None:\n articles = articles... | [
"0.53986216",
"0.53402317",
"0.53081733",
"0.5305304",
"0.5211257",
"0.5153814",
"0.5101621",
"0.50824296",
"0.50327814",
"0.5030341",
"0.50282896",
"0.5019423",
"0.49807727",
"0.4972056",
"0.49614388",
"0.49547437",
"0.4866086",
"0.48600337",
"0.48344988",
"0.4825311",
"0.48... | 0.68878406 | 0 |
Return all articles if no subject specified, otherwise only those from that Subject | def articles(self, subject_filter=None):
articles = ArticlePage.objects.live().descendant_of(self)
if subject_filter is not None:
articles = articles.filter(
Q(subject_1=subject_filter) | Q(subject_2=subject_filter))
articles = articles.order_by('-date')
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_subjects(self):\n return self.filter_nodes('//Subjects/Subject')",
"def get_queryset(self):\n return filter_subjects(Subject.objects.all(), self.request.user)",
"def list_courses_subjects(self, all=False):\n q = {'facet': 'true',\n 'facet.field': 'course_subject',\n... | [
"0.68461657",
"0.65303606",
"0.6318721",
"0.6296977",
"0.6280416",
"0.6242551",
"0.6236301",
"0.616833",
"0.5941876",
"0.58910584",
"0.585484",
"0.5786363",
"0.57801485",
"0.5764462",
"0.57628167",
"0.57169193",
"0.57076377",
"0.570699",
"0.5700736",
"0.5694488",
"0.5654827",... | 0.72850305 | 0 |
Get all articles by this author | def author_articles(self):
return ArticlePage.objects.live().filter(author=self).order_by('-date') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_authors(cls):\n authors = from_cache('AuthorsList')\n if not authors:\n authors = SuiAuthor.all().order('name').fetch(400)\n to_cache('AuthorsList', authors)\n return authors",
"def queryset(self, request, queryset):\n # 返回文章queryset里面 所有指定作者的文章\n ... | [
"0.7249089",
"0.7019884",
"0.6874972",
"0.67850435",
"0.6751636",
"0.67413604",
"0.671379",
"0.67041487",
"0.6664029",
"0.6659049",
"0.665358",
"0.66036725",
"0.6585151",
"0.6580827",
"0.65239894",
"0.64984363",
"0.6492107",
"0.647211",
"0.64664465",
"0.6441173",
"0.64372087"... | 0.8193258 | 0 |
Switches to displaying the given group of layers. When group is None, the default CircuitPython terminal will be shown. | def show(self, group):
self._current_group = group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_group_tree(builder, group: ServerGroup, show: bool):\n tree_component_name = group_tree_component[group]\n show_ui_component(builder, tree_component_name, show)\n header_component_name = group_header_component[group]\n show_ui_component(builder, header_component_name, show)",
"def do_standal... | [
"0.5787579",
"0.56785434",
"0.5654656",
"0.5551346",
"0.55173004",
"0.5352051",
"0.52590203",
"0.51855826",
"0.5174819",
"0.5154698",
"0.51135373",
"0.5072139",
"0.506285",
"0.5051473",
"0.5040139",
"0.5034684",
"0.5029226",
"0.50125265",
"0.4989949",
"0.49824473",
"0.4977673... | 0.6218714 | 0 |
Adjust the rectangle coordinates based on rotation | def _apply_rotation(self, rectangle):
if self._rotation == 90:
return Rectangle(
self._height - rectangle.y2,
rectangle.x1,
self._height - rectangle.y1,
rectangle.x2,
)
if self._rotation == 180:
return Re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self):\r\n # Rotate the image.\r\n self.image = pg.transform.rotozoom(self.orig_image, -self.angle, 1)\r\n # Rotate the offset vector.\r\n offset_rotated = self.offset.rotate(self.angle)\r\n print(\"offset_rotated:\", offset_rotated)\r\n # Create a new rect with... | [
"0.7102181",
"0.6861608",
"0.6767532",
"0.65712",
"0.6486802",
"0.643363",
"0.6404822",
"0.626136",
"0.6259617",
"0.62278646",
"0.621917",
"0.6212888",
"0.6200598",
"0.6192391",
"0.61897737",
"0.6155825",
"0.6155825",
"0.61425966",
"0.6127783",
"0.61275494",
"0.6120775",
"0... | 0.7782071 | 0 |
True when the display brightness is adjusted automatically, based on an ambient light sensor or other method. Note that some displays may have this set to True by default, but not actually implement automatic brightness adjustment. `auto_brightness` is set to False if `brightness` is set manually. | def auto_brightness(self):
return self._auto_brightness | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_brightness(self):\n orig_brightness, prev_brightness = self.brightness, self.brightness\n self.make_ui_group(False, 'Brightness:', self.brightness)\n\n while True:\n action_left, action_right = (self.button_left.action(),\n self.but... | [
"0.67415977",
"0.67098176",
"0.65921164",
"0.6376667",
"0.6299181",
"0.62167054",
"0.5999217",
"0.58982825",
"0.58737326",
"0.58720344",
"0.5764444",
"0.5740519",
"0.5720143",
"0.56394523",
"0.5623431",
"0.5605068",
"0.5605068",
"0.5605068",
"0.5605068",
"0.5605068",
"0.56050... | 0.7451231 | 0 |
Merge the processed datasets with the name input | def data_merge(path, dataset_name="processed_data"):
files = glob.glob(path+"**//"+dataset_name+".json")
logger.info("Found {} files under the path {}".format(len(files),path))
final_data = []
for file in files:
assert dataset_name in file
data = json.load(open(file,"r",encoding="utf-8"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_datasets(dslist):\n # We use a variant of our fast stitching routine\n # So first create a sorted list of angles and source files\n container = []\n print 'Passed %d datasets for merging ' % len(dslist)\n proc_info = \"\"\"This dataset was created by collating points from multiple datasets... | [
"0.6107001",
"0.6097907",
"0.60682017",
"0.60533506",
"0.6005032",
"0.58872175",
"0.5818851",
"0.5814989",
"0.5780272",
"0.5769151",
"0.5763386",
"0.5752234",
"0.5731635",
"0.57059276",
"0.5699131",
"0.56304216",
"0.56119347",
"0.5592348",
"0.5589795",
"0.5583951",
"0.5565674... | 0.7037669 | 0 |
Deploy new versions of all Lambda functions | def deploy(options, config):
processor = options.processor
# Terraform apply only to the module which contains our lambda functions
targets = set()
packages = []
def _publish_version(packages):
"""Publish Lambda versions"""
for package in packages:
if package.package_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_deploy():\n client = boto3.client(\"lambda\")\n\n def upload_build():\n if function_exists(client):\n update_lambda_function(client)\n else:\n create_lambda_function(client)\n\n return {\"actions\": [upload_build], \"file_dep\": [f\"{DIST_DIR}/build.zip\"]}",
... | [
"0.7347401",
"0.67256033",
"0.66800237",
"0.6473388",
"0.6435472",
"0.6272753",
"0.62598175",
"0.6169625",
"0.61490303",
"0.6129791",
"0.6049756",
"0.6026856",
"0.6001714",
"0.59440047",
"0.5925443",
"0.59033215",
"0.58928",
"0.58922964",
"0.58777225",
"0.5875698",
"0.5875698... | 0.6987193 | 1 |
Create Rule Processor package and publish versions | def _deploy_rule_processor():
rule_package = RuleProcessorPackage(config=config, version=current_version)
rule_package.create_and_upload()
return rule_package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deploy_alert_processor():\n alert_package = AlertProcessorPackage(config=config, version=current_version)\n alert_package.create_and_upload()\n return alert_package",
"def package_build_process(name, url, branch, path_to_missile=None,\n domain=None, stack=None):... | [
"0.57952726",
"0.5456674",
"0.53661186",
"0.5360605",
"0.5353057",
"0.53490925",
"0.5340909",
"0.5304026",
"0.52926666",
"0.52684975",
"0.5263543",
"0.5253568",
"0.5247544",
"0.52424407",
"0.524119",
"0.5240253",
"0.52080166",
"0.5200726",
"0.5174414",
"0.51352537",
"0.512737... | 0.76288223 | 0 |
Create Alert Processor package and publish versions | def _deploy_alert_processor():
alert_package = AlertProcessorPackage(config=config, version=current_version)
alert_package.create_and_upload()
return alert_package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _provision_package(self):",
"def create(index):\n # Get the project root\n project_root = get_project_root()\n package_name = os.path.basename(project_root)\n logging.info(\"Creating package for current project: \" + package_name)\n Packager(package_name, project_root).create(index)",
"def _... | [
"0.6084183",
"0.59676665",
"0.57402325",
"0.5731163",
"0.5620225",
"0.56090224",
"0.5588369",
"0.55562985",
"0.5465473",
"0.544694",
"0.5439961",
"0.5364832",
"0.5348297",
"0.53421897",
"0.5295498",
"0.52798015",
"0.5262978",
"0.52464217",
"0.5217506",
"0.52039903",
"0.519355... | 0.77806085 | 0 |
Create Athena Partition Refresh package and publish | def _deploy_athena_partition_refresh():
athena_package = AthenaPackage(config=config, version=current_version)
athena_package.create_and_upload()
return athena_package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_deploy():\n refresh_cts()\n push_mockups()\n deploy()",
"def deploy():\n update_treesheets()\n restart_treesheets()",
"def deploy():\n test()\n if not env.is_staging:\n backup()\n prepare()\n restart_api()",
"def _provision_package(self):",
"def test_feathr_online_store_agg... | [
"0.52746564",
"0.52375937",
"0.5230696",
"0.5223075",
"0.5196875",
"0.51740795",
"0.51623076",
"0.51501435",
"0.51136917",
"0.5090603",
"0.50678575",
"0.50417167",
"0.5035841",
"0.49755764",
"0.4975141",
"0.49224213",
"0.4905247",
"0.48547333",
"0.48272827",
"0.48148355",
"0.... | 0.7906745 | 0 |
Create app integration package and publish versions | def _deploy_apps_function():
app_integration_package = AppIntegrationPackage(config=config, version=apps_version)
app_integration_package.create_and_upload()
return app_integration_package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_with_populated_format_versions(scope=\"package\"):\n app = create_app(\"test\")\n with app.app_context():\n db.create_all()\n\n storage_service = test_helpers.create_test_storage_service()\n storage_location = test_helpers.create_test_storage_location(\n storage_servic... | [
"0.64178437",
"0.6273049",
"0.6126758",
"0.6119737",
"0.61063516",
"0.60995317",
"0.60610634",
"0.60608906",
"0.60279197",
"0.6006815",
"0.6002025",
"0.5996725",
"0.59186065",
"0.5889281",
"0.58661443",
"0.5863472",
"0.5857245",
"0.5812294",
"0.580601",
"0.58002794",
"0.57939... | 0.7573291 | 0 |
Create Threat Intel downloader package and publish version | def _deploy_threat_intel_downloader():
threat_intel_package = ThreatIntelDownloaderPackage(
config=config,
version=ti_downloader_version
)
threat_intel_package.create_and_upload()
return threat_intel_package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_pack():\n\n local(\"mkdir -p versions\")\n current = dt.now()\n current = current.now()\n tgz = \"web_static_{}.tgz\".format(current.strftime(\"%Y%m%d%H%M%S\"))\n working = local(\"tar -cavf versions/{} web_static\".format(tgz))\n\n if working.failed:\n return None\n else:\n ... | [
"0.68054",
"0.6779139",
"0.6761292",
"0.6759235",
"0.6692559",
"0.6660694",
"0.6659605",
"0.663814",
"0.6613684",
"0.65913004",
"0.65760773",
"0.65745074",
"0.6542268",
"0.6528658",
"0.6519053",
"0.6510979",
"0.6508965",
"0.64934427",
"0.64717263",
"0.64318633",
"0.64158547",... | 0.71114427 | 0 |
Converts an integer to the string representation of an IP address. | def int2ip(n: int) -> str:
return socket.inet_ntoa(struct.pack("!I", n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_2_ip_str(ip_int):\n return socket.inet_ntoa(struct.pack(\"!I\", ip_int))",
"def int2ip(ipint: int) -> str:\n try:\n return socket.inet_ntoa(struct.pack(\"!I\", ipint))\n except struct.error:\n return socket.inet_ntop(\n socket.AF_INET6,\n struct.pack(\"!QQ\", ... | [
"0.8371373",
"0.8149403",
"0.81202126",
"0.76974213",
"0.7516056",
"0.73901826",
"0.7243528",
"0.72142303",
"0.71925503",
"0.71764463",
"0.7035509",
"0.7021221",
"0.6959364",
"0.6925901",
"0.6877639",
"0.68566036",
"0.65964144",
"0.6507255",
"0.6496198",
"0.6474135",
"0.64451... | 0.824994 | 1 |
Generates SSH server keys using RSA, writes them to the correct files, then returns the bytes that were written. This will overwrite any existing key files. | def generate_rsa_server_keys() -> Tuple[bytes, bytes]:
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend as crypto_default_backend
# Generate the key
key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generateSSHKey(self, private_filepath, public_filepath):\n self.log.debug(\"Writing SSH keys to: \" + private_filepath + \" and \" + public_filepath)\n\n (ssh_dir, filename) = os.path.split(os.path.expanduser(private_filepath))\n if not os.path.exists(ssh_dir):\n self.log.debug(\"SSH Directory d... | [
"0.7006498",
"0.6714016",
"0.6606957",
"0.6420449",
"0.62895983",
"0.62841547",
"0.6251957",
"0.624364",
"0.62175035",
"0.62054116",
"0.62047213",
"0.615605",
"0.6127582",
"0.612011",
"0.61119735",
"0.61077297",
"0.6107519",
"0.6101342",
"0.6089132",
"0.60842407",
"0.59800094... | 0.7349047 | 0 |
Aborts the given connections. | def abort_many(self, connections: typing.Iterable[twisted.conch.ssh.transport.SSHServerTransport]):
for conn in connections:
conn.transport.connectionLost(self.connectionAborted) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abortConnection():\n pass",
"def killall(connections):\n for connection in connections:\n try: connection.close()\n except: pass",
"def abort(self) -> None:\n self._connector.abort_transaction()",
"def terminate(self):\r\n for call in self._deathCandidates.itervalues... | [
"0.72578377",
"0.66971624",
"0.64351416",
"0.6316366",
"0.63013047",
"0.6207053",
"0.6194674",
"0.61273026",
"0.61273026",
"0.61241126",
"0.608286",
"0.6022746",
"0.5989",
"0.59806645",
"0.5919448",
"0.5896091",
"0.5892902",
"0.5887989",
"0.5864397",
"0.58221346",
"0.57808983... | 0.7448409 | 0 |
Starts the watchdog thread. | def start(self):
self._watchdog_thread.start() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\r\n monitor_thread = Thread(target = self.monitor)\r\n monitor_thread.setDaemon(True)\r\n monitor_thread.start()\r\n\r\n main_thread = Thread(target = self.run)\r\n main_thread.setDaemon(True)\r\n main_thread.start()",
"def start(self) -> None:\n ... | [
"0.71217984",
"0.69169587",
"0.6903784",
"0.6872781",
"0.67613095",
"0.6656482",
"0.66208094",
"0.66070104",
"0.65288895",
"0.6528326",
"0.65111154",
"0.6494165",
"0.64625794",
"0.64450014",
"0.64385915",
"0.6376325",
"0.6373174",
"0.63639104",
"0.6355011",
"0.633504",
"0.630... | 0.85973275 | 0 |
Shuts down the watchdog thread. | def stop(self):
self._watchdog_flag.set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown():\n os.kill(os.getpid(), signal.SIGTERM)",
"def stop(self):\n if self.is_running():\n self._stdin_queue.put_nowait(None) # Ask to stop the stdin_thread\n try:\n self._popen.terminate() # Send SIGTERM to the player, asking to stop\n log... | [
"0.67894304",
"0.6773918",
"0.66595274",
"0.66030633",
"0.6601126",
"0.6601126",
"0.65712124",
"0.65464056",
"0.65464056",
"0.6538498",
"0.6519675",
"0.6505519",
"0.6490607",
"0.6484351",
"0.6484351",
"0.6484351",
"0.6464716",
"0.64617556",
"0.6446465",
"0.64330095",
"0.64229... | 0.7268581 | 0 |
Called when the factory is starting up. Starts the watchdog thread. | def startFactory(self):
self.watchdog.start()
super().startFactory() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n self._watchdog_thread.start()",
"def watchdog(self):\n pass",
"def starting(self) -> None:\n self._prepopulate_runnables()\n self._loop_handler = threading.Thread(target=self._loop)\n self._loop_handler.daemon = True\n self._loop_handler.start()",
... | [
"0.79512626",
"0.67765105",
"0.6722657",
"0.648831",
"0.6435419",
"0.6422165",
"0.63980657",
"0.627728",
"0.62633985",
"0.6260767",
"0.622428",
"0.6201285",
"0.62006295",
"0.6145395",
"0.61417264",
"0.61376876",
"0.6122323",
"0.60849005",
"0.60740936",
"0.6072932",
"0.6068418... | 0.7969129 | 0 |
Called when the factory is being shut down. Ends the watchdog thread. | def stopFactory(self):
self.watchdog.stop()
super().stopFactory() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown(self):\n logger.info(\"Shutting down the factory\")\n self.to_shutdown = True",
"def shutdown(self) -> None:",
"def shutdown(self) -> None:",
"def shutdown(self):\n\n pass",
"def shutdown(self):\n ...",
"def shutdown(self):\n pass",
"def shutdown(self):\n... | [
"0.7936102",
"0.74216986",
"0.74216986",
"0.7417915",
"0.7410274",
"0.7405886",
"0.7405886",
"0.7405886",
"0.73579687",
"0.7253566",
"0.71567553",
"0.7110801",
"0.71059704",
"0.7041802",
"0.70151883",
"0.6975538",
"0.6938473",
"0.6936065",
"0.6928262",
"0.6928152",
"0.6919136... | 0.76305586 | 1 |
Return dictionary with primes number. Reads prime numbers from OpenSSH compatible moduli file. | def getPrimes(self):
try:
primes_file = open(self.primes_path, 'r')
except FileNotFoundError:
logger.warning(f"Unable to open moduli file '{self.primes_path}'. This will reduce the number of"
f"available key exchange algorithms, and may affect compatibi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_prime_numbers():\n print('Loading prime numbers...')\n path_to_primes_file = f'{os.getcwd()}{os.sep}PrimeNumbers.txt'\n primes = list(loadtxt(path_to_primes_file, dtype=str, comments=\"#\", delimiter=\", \", unpack=False))\n return [int(p) for p in primes]",
"def get_prime_array(number_of_pr... | [
"0.72578806",
"0.60250926",
"0.57705534",
"0.5733895",
"0.57035697",
"0.56756115",
"0.56674397",
"0.5618918",
"0.55990535",
"0.559901",
"0.55590177",
"0.5556551",
"0.5540792",
"0.552214",
"0.5515603",
"0.54981625",
"0.5493559",
"0.54897684",
"0.54535276",
"0.54260296",
"0.539... | 0.7742141 | 0 |
Bans a host from connecting. | def ban_host(self, host, hard=False, duration=None):
# TODO: Timed bans?
logger.verbose("Banning IP {0}".format(host))
self.ip_bans.add(host, hard) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban(sock, user):\r\n chat(sock, \"/ban {}\".format(user))",
"def connect(self, host):\n return False",
"def handle_ping(self, host):\n self.send(\"PONG :{}\".format(host))",
"def k(self, irc, msg, args, nicks):\n\n if(self._checkCPO(irc, msg)):\n \n hostmasks... | [
"0.6156989",
"0.59887886",
"0.59198314",
"0.569596",
"0.56383455",
"0.5601381",
"0.5566465",
"0.5516461",
"0.550819",
"0.54816896",
"0.5463091",
"0.54218864",
"0.5382467",
"0.5342919",
"0.5336694",
"0.53214467",
"0.53200334",
"0.5309691",
"0.52745163",
"0.5259725",
"0.5251533... | 0.6886727 | 0 |
Return 10 feeds with custom query params | def get_custom_feeds(request):
start = int(request.paginate_number) * 10
end = start + 10
feeds = Feed.objects.all().order_by('-id')[start: end]
return get_feed_list(feeds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all(self, start_at, limit, order=None):",
"def _paginatedRequest(allPages, *args):\n data = []\n currentPage = 0\n while True:\n newData = Gw2Spidy._request(*(args + (str(currentPage),)))\n if not allPages:\n return newData['results']\n ... | [
"0.6454365",
"0.63795257",
"0.6170948",
"0.6094697",
"0.6044983",
"0.59835553",
"0.5974764",
"0.596247",
"0.5931192",
"0.59081125",
"0.5877002",
"0.5860104",
"0.585344",
"0.5846139",
"0.58022046",
"0.5781544",
"0.5773379",
"0.57530355",
"0.574533",
"0.57441443",
"0.5736443",
... | 0.7382841 | 0 |
Create a new bookmark to a feed | def create_bookmark_for_feed(request):
try:
feed = Feed.objects.get(id=request.feed.id)
Bookmarked.objects.create(
user=request.user.username,
feed=feed,
)
except (ValidationError, Feed.DoesNotExist) as e:
exc = e
logger(__name__, "Could not add Bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createBookmark(self, address: ghidra.program.model.address.Address, category: unicode, note: unicode) -> ghidra.program.model.listing.Bookmark:\n ...",
"def bookmark_entry(request, entry_id):\n entry = get_object_or_404(Entry, id=entry_id)\n entry.bookmarks.add(request.user)\n return redirect... | [
"0.7388493",
"0.7282241",
"0.726063",
"0.6870702",
"0.68682045",
"0.6795213",
"0.64987797",
"0.644406",
"0.6403909",
"0.6362326",
"0.6347653",
"0.6318558",
"0.62411666",
"0.6172005",
"0.6101691",
"0.6096739",
"0.6004369",
"0.5997753",
"0.5956816",
"0.5872486",
"0.5831158",
... | 0.7652424 | 0 |
Validate and Create new Feed Source | def create_new_feed_source(link):
try:
response = parse_new_feeds(link)
if response["status"]:
if "logo" in response["details"]:
logo_link = response["details"]["logo"]
elif "image" in response["details"]:
logo_link = response["details"]["image... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_feed(feed, source):\n try:\n with transaction.atomic():\n slug = feed.get(\"id\") + feed.get('title')\n new_feed = Feed.objects.create(\n feed_id=feed.get(\"id\"),\n title=feed.get(\"title\"),\n summary=feed.get(\"summary\"... | [
"0.7013951",
"0.64773726",
"0.62411964",
"0.5868654",
"0.5822305",
"0.5581811",
"0.5531281",
"0.55312055",
"0.55255294",
"0.5506018",
"0.54661417",
"0.5444872",
"0.54306674",
"0.53630376",
"0.5349686",
"0.53175807",
"0.52853334",
"0.52751404",
"0.5265009",
"0.52596027",
"0.52... | 0.75302297 | 0 |
Update Feed Source Active Status | def update_feed_source(request):
try:
feed = FeedSource.objects.get(id=request.id)
feed.status = not feed.status
feed.save()
except (ValidationError, FeedSource.DoesNotExist) as e:
exc = e
logger(__name__, "Could not update Feed Source due to {}".format(str(exc)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateStatus(self, status):\n pass",
"def _update_on_active(self):\n pass",
"def _update_status(self):\n self._db_update({'status': self.status})",
"def update_from_latest_data(self) -> None:\n self._attr_is_on = self.coordinator.data[self.entity_description.uid][\"active\"]",... | [
"0.64761364",
"0.64385563",
"0.6301665",
"0.627237",
"0.6260324",
"0.6197054",
"0.61570495",
"0.6132218",
"0.5923778",
"0.589606",
"0.5825407",
"0.5817488",
"0.57928306",
"0.5789204",
"0.578507",
"0.5777448",
"0.57570195",
"0.57291734",
"0.5704006",
"0.5671347",
"0.5657238",
... | 0.65877944 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.