query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
r""" True if elements of this space are represented exactly, i.e., there is no precision loss when doing arithmetic. As this is never true for overconvergent modular forms spaces, this returns False. | def is_exact(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isnonnegative(self):\n if not self.__nonzero__():\n return True\n for x in self.mantissa:\n if not x >= 0:\n return False\n return True",
"def is_valid(self):\n all_qubits = []\n for gate in self.__history:\n if gate[0] != 'm'... | [
"0.66268116",
"0.6553215",
"0.6464635",
"0.6435382",
"0.6418163",
"0.63849956",
"0.6337853",
"0.628492",
"0.6270318",
"0.626731",
"0.626731",
"0.62614775",
"0.623849",
"0.6226627",
"0.62071943",
"0.6206554",
"0.6202382",
"0.6145645",
"0.61361605",
"0.6136017",
"0.6135934",
... | 0.0 | -1 |
r""" Return the character of self. For overconvergent forms, the weight and the character are unified into the concept of a weightcharacter, so this returns exactly the same thing as self.weight(). | def character(self):
return self._wtchar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_character(self):\n return self.character",
"def weight(self):\n return self._wtchar",
"def get_weight(self) -> WeightStr:\n return WEIGHT.inverse[self.weight()]",
"def char(character):\n return char(character)",
"def _coerce_in_wtchar(self, x):\n if isinstance(x, ... | [
"0.74555355",
"0.7175677",
"0.6547986",
"0.6476929",
"0.63863826",
"0.61837",
"0.61459523",
"0.61459523",
"0.61193484",
"0.60521674",
"0.60352737",
"0.599538",
"0.5993574",
"0.5993574",
"0.5983965",
"0.59404486",
"0.59287643",
"0.59270644",
"0.58858824",
"0.58700055",
"0.5812... | 0.731793 | 1 |
r""" Return the character of self. For overconvergent forms, the weight and the character are unified into the concept of a weightcharacter, so this returns exactly the same thing as self.character(). | def weight(self):
return self._wtchar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_character(self):\n return self.character",
"def character(self):\n return self._wtchar",
"def char(character):\n return char(character)",
"def get_char(self):\n return self.element.get_char()",
"def getChar(self,char):\n if char not in self.charGlyphInfo:\n ... | [
"0.786718",
"0.727616",
"0.68709755",
"0.6295346",
"0.6221182",
"0.6102407",
"0.60745823",
"0.60745823",
"0.596369",
"0.59526366",
"0.59463334",
"0.5945085",
"0.59389895",
"0.5812005",
"0.57847404",
"0.569043",
"0.5680708",
"0.56694233",
"0.5647846",
"0.5629182",
"0.5593744",... | 0.6297976 | 3 |
r""" The normalising factor `c` such that `g = c f` is a parameter for the `r`overconvergent disc in `X_0(p)`, where `f` is the standard uniformiser. | def normalising_factor(self):
return self._const | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __truediv__(self, c):\n return 1./c * self",
"def f_2(c):\n Ri = calc_R(c)\n return Ri - Ri.mean()",
"def normalize(x):\n return (x + 1e-10) / (K.sqrt(K.mean(K.square(x))) + 1e-10)",
"def normc_fn(m):\n if m.__class__.__name__.find('Linear') != -1:\n m.weight.data.normal_(0, 1)\... | [
"0.6138679",
"0.6082742",
"0.60182697",
"0.6001914",
"0.59879977",
"0.59479886",
"0.5921914",
"0.59137607",
"0.5912382",
"0.5912382",
"0.5912382",
"0.5901986",
"0.58861434",
"0.5863338",
"0.58537596",
"0.5842031",
"0.58419096",
"0.5818565",
"0.5807338",
"0.57941973",
"0.57539... | 0.64638776 | 0 |
r""" Return a string representation of self. | def _repr_(self):
return "Space of %s-adic %s-overconvergent modular forms of weight-character %s over %s" % (self.prime(), self.radius(), self.weight(), self.base_ring()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n return self.__str__()",
"def to_string(self):\r\n return self.__str__()",
"def __repr__(self) -> str:\n return str(self)",
"def __repr__(self) -> str:\n return str(self)",
"def __repr__(self) -> str:\n return str(self)",
"def __str__(self):\n ... | [
"0.8839418",
"0.87165326",
"0.85472554",
"0.85472554",
"0.85472554",
"0.8536172",
"0.8536172",
"0.8536172",
"0.8536172",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.8476279",
"0.84312046",
"0.84149945... | 0.0 | -1 |
r""" The radius of overconvergence of this space. | def radius(self):
return self._radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accretion_radius(self) -> float:\n return self._accretion_radius",
"def radius_of_curvature(self):\n numerator = (\n 1 + (2 * self.params_meter[0] +\n self.params_meter[1]) ** 2) ** 1.5\n denom = np.abs(2 * self.params_meter[0])\n return numerator / deno... | [
"0.75196743",
"0.74867946",
"0.74854314",
"0.74031574",
"0.73046297",
"0.72777253",
"0.7179713",
"0.71776783",
"0.7083185",
"0.7083185",
"0.70799667",
"0.70600426",
"0.7051938",
"0.703315",
"0.7003741",
"0.69132346",
"0.6908549",
"0.6894629",
"0.6871712",
"0.685741",
"0.68117... | 0.7145472 | 17 |
r""" Return a generator object that iterates over the (infinite) set of basis vectors of self. | def gens(self):
i = 0
while True:
yield self.gen(i)
i += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n if not self.is_finite():\n raise NotImplementedError(\"object does not support iteration\")\n V = self.zero().vector().parent()\n for v in V:\n yield self(v)",
"def basisVectors(self):\n return self.__basisVectors",
"def iterator(self):\n ... | [
"0.7066651",
"0.66947377",
"0.65214735",
"0.6370765",
"0.62702394",
"0.62385154",
"0.6231584",
"0.6152308",
"0.6145858",
"0.61133623",
"0.6037204",
"0.6017216",
"0.595385",
"0.59406424",
"0.5878369",
"0.5869626",
"0.58547014",
"0.58512545",
"0.58429897",
"0.5833402",
"0.58196... | 0.5911285 | 14 |
r""" Given a `q`expansion, converts it to a vector in the basis of this space, to the maximum possible precision (which is the minimum of the `q`adic precision of the `q`expansion and the precision of self). | def _convert_to_basis(self, qexp):
n = min(qexp.prec(), self.prec())
x = qexp
g = self._gsr.gen()
answer = self._gsr(0)
for i in range(n):
assert(x.valuation() >= i)
answer += (x[i] / self._basis_cache[i][i])*g**i
x = x - self._basis_cache[i] *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def q_expansion(self, prec=None):\n if prec is None:\n return self._qexp\n elif prec > self.prec():\n raise ValueError\n else:\n return self._qexp.add_bigoh(prec)",
"def multiply(self, q):\n\n return Quat(q.v.multiplyByScalar(self.w).add(self.v.multipl... | [
"0.6488882",
"0.6135032",
"0.6132276",
"0.6026327",
"0.59484076",
"0.5837133",
"0.57216406",
"0.5674949",
"0.5666613",
"0.5649775",
"0.5606714",
"0.55126494",
"0.55126494",
"0.5508597",
"0.54888415",
"0.54830915",
"0.5451402",
"0.5347772",
"0.53212225",
"0.5296588",
"0.527904... | 0.6001051 | 4 |
r""" Calculate the matrix of the `T_m` operator in the basis of this space, truncated to an `n \times n` matrix. Conventions are that operators act on the left on column vectors (this is the opposite of the conventions of the sage.modules.matrix_morphism class!) Uses naive `q`expansion arguments if use_recurrence=False... | def hecke_matrix(self, m, n, use_recurrence = False, exact_arith = False):
if exact_arith and not self.base_ring().is_exact():
return self.change_ring(QQ).hecke_matrix(m, n, use_recurrence)
M = MatrixSpace(self.base_ring(), n)
mat = M(0)
for j in range(min(n, self.prime()))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def q_expansion(self, n=20):\n eta = qexp_eta(ZZ[['q']], n)\n R = eta.parent()\n q = R.gens()[0]\n res = R(1)\n prefak = 0\n for i in range(len(self._arguments)):\n res = res * eta.subs({q: q**self._arguments[i]})**self._exponents[i]\n prefak = prefak... | [
"0.5325909",
"0.53132457",
"0.52931744",
"0.5281793",
"0.5225564",
"0.5151845",
"0.5134575",
"0.50395685",
"0.5015814",
"0.4939349",
"0.4926475",
"0.49063155",
"0.48766714",
"0.48569486",
"0.48294377",
"0.48287806",
"0.48221046",
"0.47840914",
"0.47673845",
"0.472675",
"0.472... | 0.6458657 | 0 |
r""" Compute the slopes of the `U_p` operator acting on self, using an n x n matrix. | def slopes(self, n, use_recurrence=False):
if self.base_ring() == QQ:
slopelist=self.cps_u(n).truncate().newton_slopes(self.prime())
elif is_pAdicField(self.base_ring()):
slopelist=self.cps_u(n).truncate().newton_slopes()
else:
print("slopes are only defined f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_slope(*args):\n \n \n xs = [el[0] for el in args]\n ys = [el[1] for el in args]\n \n xs_squared = [el[0]*el[0] for el in args]\n xys = [el[0]*el[1] for el in args]\n n = len(args)\n \n \n num = n*sum(xys) - sum(xs)*sum(ys)\n denom = n*sum(xs_squared)- sum(xs)*sum(xs)\... | [
"0.59140635",
"0.58115685",
"0.5718408",
"0.5717085",
"0.5604565",
"0.558515",
"0.5570238",
"0.5562789",
"0.555945",
"0.55247784",
"0.55103695",
"0.5490756",
"0.5467227",
"0.5425508",
"0.5414859",
"0.5412692",
"0.537262",
"0.5372158",
"0.5363153",
"0.5360153",
"0.5326952",
... | 0.57525325 | 2 |
r""" Compute the characteristic power series of `U_p` acting on self, using an n x n matrix. | def cps_u(self, n, use_recurrence=False):
m = self.hecke_matrix(self.prime(), n, use_recurrence)
A = PowerSeriesRing(self.base_ring(),'T')
# From a conversation with David Loeffler, apparently self.base_ring()
# is either the field of rational numbers or some p-adic field. In the
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __pow__(self, p):\n return Matrix(*[Vector(*i) for i in\n np.linalg.matrix_power(self._columns, p).T])",
"def calc_power(qd, u):\n T = u.shape[0]\n return qd[:T,2].dot(u[:,1])/T",
"def _fp_coeff(u):\r\n n = u.shape[1]\r\n\r\n return np.trace(u.dot(u.T)) / float(n)"... | [
"0.6932802",
"0.64837146",
"0.61312604",
"0.6101858",
"0.60615444",
"0.5990048",
"0.5941109",
"0.5877538",
"0.5853234",
"0.5852126",
"0.5832558",
"0.58323777",
"0.5826384",
"0.5791816",
"0.57755524",
"0.5768316",
"0.57501316",
"0.57460517",
"0.57241553",
"0.57230383",
"0.5714... | 0.5935779 | 7 |
r""" Return True if this is an eigenform. At present this returns False unless this element was explicitly flagged as an eigenform, using the _notify_eigen function. | def is_eigenform(self):
return self._is_eigen | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_eigen_compatible_arg(self):\n return any(arg in (\"matrix\", \"vector\", \"row_vector\") for arg in self.stan_args)",
"def is_stable(self):\n\n eigvals = self.get_eigs()\n\n eig_max = np.abs(eigvals).max()\n if eig_max < 1:\n return True\n else:\n ... | [
"0.7218269",
"0.6478022",
"0.63569266",
"0.62845093",
"0.6142582",
"0.6098341",
"0.5990361",
"0.59898645",
"0.59063196",
"0.58543444",
"0.5834159",
"0.5822451",
"0.58079624",
"0.58074045",
"0.5787479",
"0.5724743",
"0.57207114",
"0.56755424",
"0.56513137",
"0.5651244",
"0.564... | 0.8818925 | 0 |
r""" Return the slope of this eigenform, i.e. the valuation of its `U_p`eigenvalue. Raises an error unless this element was explicitly flagged as an eigenform, using the _notify_eigen function. | def slope(self):
if not self.is_eigenform(): raise TypeError("slope only defined for eigenfunctions")
return self._slope | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slope(self):\n s = self.start\n e = self.end\n deltaX = e.x - s.x\n deltaY = e.y - s.y\n\n try:\n slope = deltaY/deltaX\n unc = abs(1.0/deltaX)*(s.yUnc + e.yUnc) + abs(slope/deltaX)*(s.xUnc + e.xUnc)\n return NumericUtils.t... | [
"0.68256515",
"0.6277688",
"0.6233339",
"0.61019623",
"0.6090355",
"0.6064671",
"0.58965814",
"0.57602507",
"0.5692589",
"0.56715995",
"0.56533855",
"0.5636085",
"0.55559796",
"0.54999685",
"0.5453908",
"0.5405117",
"0.53901243",
"0.5372903",
"0.5334795",
"0.52468973",
"0.520... | 0.7873444 | 0 |
r""" Return the coordinates of this modular form in terms of the basis of this space. | def coordinates(self, prec=None):
if prec > self.prec(): raise ValueError("Precision too large for space")
if prec is None: prec = self.prec()
return self._gexp.padded_list(prec) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basis(self):\n top_mid = (self.corners[0] + self.corners[1]) / 2\n right_mid = self.side_middle_pt(\"right\")\n basis_x = right_mid\n basis_y = top_mid\n return (basis_x, basis_y)",
"def xyz(self):\n return self._pnt.Coord()",
"def pos(self):\n minx, miny, m... | [
"0.7080426",
"0.64844704",
"0.648089",
"0.6476391",
"0.64233214",
"0.64168274",
"0.64161015",
"0.6408524",
"0.63774157",
"0.6349311",
"0.63454247",
"0.63372874",
"0.633412",
"0.63310087",
"0.6329236",
"0.6320556",
"0.63127226",
"0.6292641",
"0.62815285",
"0.62794214",
"0.6273... | 0.0 | -1 |
r""" String representation of self. | def _repr_(self):
return "%s-adic overconvergent modular form of weight-character %s with q-expansion %s" % (self.prime(), self.weight(), self.q_expansion()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n return self.__str__()",
"def to_string(self):\r\n return self.__str__()",
"def __str__(self):\n return repr(self)",
"def __str__(self):\n return repr(self)",
"def __str__(self):\n return repr(self)",
"def __str__(self):\n return repr(self)",... | [
"0.88217205",
"0.8612693",
"0.8503645",
"0.8503645",
"0.8503645",
"0.8503645",
"0.8432539",
"0.8417963",
"0.8417963",
"0.8417963",
"0.84021807",
"0.83740306",
"0.83382237",
"0.83382237",
"0.83382237",
"0.83382237",
"0.83382237",
"0.83382237",
"0.83382237",
"0.83382237",
"0.83... | 0.0 | -1 |
r""" Return the `p`adic valuation of this form (i.e. the minimum of the `p`adic valuations of its coordinates). | def valuation(self):
if is_pAdicField(self.parent().base_ring()):
v = lambda u: u.normalized_valuation()
else:
v = lambda u: u.valuation(self.parent().prime())
return min([v(x) for x in self.gexp().list()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minx(self):\n return min(self.p_1[0], self.p[0], self.p1[0])",
"def p_min(self):\n return self._p_min",
"def miny(self):\n return min(self.p_1[1], self.p[1], self.p1[1])",
"def getPMin(self):\n return self._pmin",
"def min(self):\n return Point(min(step.min()[0] for s... | [
"0.7670619",
"0.73955333",
"0.7262645",
"0.71077746",
"0.69427234",
"0.6919709",
"0.68099123",
"0.6766749",
"0.6740747",
"0.66247404",
"0.659032",
"0.65323573",
"0.6514079",
"0.650766",
"0.6505931",
"0.6468656",
"0.6448488",
"0.6448488",
"0.6448488",
"0.6448488",
"0.6437752",... | 0.69982094 | 4 |
r""" The degree of the series term with largest norm on the `r`overconvergent region. | def governing_term(self, r):
p = self.prime()
F = self.parent().base_ring()
if not is_pAdicField(F):
F = pAdicField(p)
s = self.parent().radius()
p = self.prime()
for i in range(self.gexp().prec()):
if 12/ZZ(p - 1)*i*(r - s) - F(self.gexp()[i]).no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_degree(self):\n n = self.n\n ret = 0\n\n for i in range(n):\n deg_Si = self.component_function(1<<i).algebraic_normal_form().degree()\n if deg_Si > ret:\n ret = deg_Si\n return ret",
"def boundary_corrected_degree(self):\n # Prepare... | [
"0.69969743",
"0.6607051",
"0.6384025",
"0.63589877",
"0.6326355",
"0.6214188",
"0.61558956",
"0.6133597",
"0.6100754",
"0.60808134",
"0.6065155",
"0.60140586",
"0.5995499",
"0.5966749",
"0.59474677",
"0.5944618",
"0.59140104",
"0.589716",
"0.58853406",
"0.5856079",
"0.582336... | 0.57607347 | 25 |
Set the metadata on Animal, either using a dict of structured metadata from BioSamples, or optionally fetching that from the BioSamples API. | def refresh_structureddata(self, structured_metadata: dict = None):
if not structured_metadata:
metadata = get_sample_structured_data(self.accession)
else:
metadata = structured_metadata
for metadata_type, metadata_content in metadata.items():
if not metadata... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metadata(self, **kwargs):\n if self._traceme and kwargs:\n self._traceme.SetMetadata(**kwargs)",
"def load_metadata(self, **kwargs):\n meta = self.metadata(**kwargs)\n self.Metadata = meta",
"def setMetadata(self, metadata):\n pass",
"def metadata(self, metadata):\n ... | [
"0.65449375",
"0.6530153",
"0.6497581",
"0.62390655",
"0.62390655",
"0.6106785",
"0.6106785",
"0.6106785",
"0.6106785",
"0.6106785",
"0.6106785",
"0.6106785",
"0.6106785",
"0.5914022",
"0.5868813",
"0.57997996",
"0.5788014",
"0.5768767",
"0.5756953",
"0.5743003",
"0.57042897"... | 0.50129735 | 92 |
Gets the appropriate chrome webdriver | def setup():
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.maximize_window()
yield driver
driver.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browser_chrome():\n from selenium import webdriver\n\n options = base_chrome_capabilities()\n this_driver = webdriver.Chrome(options=options)\n return this_driver",
"def browser(self):\n if self.site_type:\n return webdriver.Chrome()",
"def GetWebDriver_Chrome(chromedriver=Non... | [
"0.7912863",
"0.7490567",
"0.7414774",
"0.7378669",
"0.73085266",
"0.7111866",
"0.70362866",
"0.7014435",
"0.698489",
"0.696957",
"0.6920056",
"0.68925154",
"0.6868258",
"0.6859508",
"0.68251413",
"0.6796021",
"0.6782698",
"0.67413914",
"0.67197126",
"0.6700709",
"0.666557",
... | 0.580725 | 65 |
Implement pre gradient descent update modification to the image. If preprocessing is not desired, simply ignore the implementation. It returns the unmodified `img` by default. Properties `self.channel_idx`, `self.row_idx`, `self.col_idx` can be used to handle 'th'/'tf' image dim ordering differences. | def pre(self, img):
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepro(self, img, prev_img):\n # Resize image using interpolation\n # img = cv2.resize(img, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)\n\n # downsample by factor of 2 ##choose colour 2 to improve visibility in most games\n img = img[::2, ::2, 2]\n\n # img[img == 17] ... | [
"0.62774074",
"0.605969",
"0.60452074",
"0.59135157",
"0.57415724",
"0.5688709",
"0.56816065",
"0.5638846",
"0.5636223",
"0.5620329",
"0.5579759",
"0.556872",
"0.5490964",
"0.54808843",
"0.5464646",
"0.54459006",
"0.5418985",
"0.5415867",
"0.5387804",
"0.53834426",
"0.5373869... | 0.5744513 | 4 |
Implement post gradient descent update modification to the image. If postprocessing is not desired, simply ignore the implementation. It returns the unmodified `img` by default. Properties `self.channel_idx`, `self.row_idx`, `self.col_idx` can be used to handle 'th'/'tf' image dim ordering differences. | def post(self, img):
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postprocess(img, dataset=None, net_type=None):\r\n\ttemp = img.clone()\r\n\r\n\tif net_type==\"inception\":\r\n\t\ttemp = (temp * 128.0) + 127.5\r\n\t\r\n\telif dataset==\"multi-pie\":\t\t\r\n\t\ttemp[:, 0] *= 1.0\r\n\t\ttemp[:, 1] *= 1.0\r\n\t\ttemp[:, 2] *= 1.0\r\n\t\ttemp[:, 0] += 131.0912\r\n\t\ttemp[:, 1]... | [
"0.6051507",
"0.57294595",
"0.5446656",
"0.54318917",
"0.5359234",
"0.53433794",
"0.5285777",
"0.5270428",
"0.5253265",
"0.52479714",
"0.52294654",
"0.5217303",
"0.51734275",
"0.5130094",
"0.5124612",
"0.51236695",
"0.5121801",
"0.50919247",
"0.50731146",
"0.50539434",
"0.504... | 0.48259035 | 50 |
Implements an image modifier that introduces random jitter in `pre` and undoes in `post`. Jitter has been shown to produce crisper activation maximization images. | def __init__(self, jitter=16):
super(Jitter, self).__init__()
self.jitter = jitter
self.jx = 0
self.jy = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _jitter(self, img, jitter=32):\n s, c, w, h = utils.get_img_indices()\n ox, oy = np.random.randint(-jitter, jitter+1, 2)\n return np.roll(np.roll(img, ox, w), oy, h)",
"def augment_ops(self, image):\n\n image_aug = tf.cast(tf.identity(image), tf.float32)\n image_aug.set_sha... | [
"0.5931123",
"0.5764727",
"0.5573754",
"0.55647844",
"0.5512371",
"0.54850423",
"0.5480192",
"0.54197216",
"0.53852177",
"0.53750014",
"0.53591734",
"0.5342278",
"0.53001535",
"0.52438545",
"0.52350324",
"0.5199476",
"0.51850456",
"0.51463354",
"0.5144005",
"0.5140581",
"0.51... | 0.48756477 | 62 |
Returns a static page. The decorator .route('/') tells Flask which URL should trigger our function. In this case, '/' is our index.html | def index():
return render_template('index.html') # Renders index.html | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_page():\n return flask.render_template(\"index.html\")",
"def index():\n return flask.send_from_directory(\"static\", \"main.html\")",
"def index():\n return send_from_directory(app.static_folder, 'index.html')",
"def Index(*args, **kwargs):\n return app.send_static_file('index.html')",... | [
"0.8059508",
"0.8034907",
"0.79676515",
"0.79337394",
"0.79233795",
"0.79104334",
"0.790505",
"0.79036045",
"0.78668875",
"0.78527087",
"0.7802335",
"0.7775252",
"0.77560765",
"0.7749415",
"0.7712595",
"0.7678288",
"0.76345366",
"0.7617248",
"0.75745547",
"0.7571137",
"0.7522... | 0.7267594 | 67 |
Returns the about page, which for now is just index.html | def about():
return render_template('about.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n return render_template(\"about.html\")",
"def about():\n logger.info(\"About page accessed\")\n return render_template('about.html')",
"def abou... | [
"0.84743357",
"0.8395524",
"0.82942444",
"0.82796526",
"0.82796526",
"0.826133",
"0.82571673",
"0.82571673",
"0.8243954",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857",
"0.8243857"... | 0.80877066 | 40 |
Computes the negative log likelihood between the target and the estimated values. | def compute_loss_LG(y, tx, w):
N = y.shape[0]
estim = tx@w
return np.sum(np.logaddexp(0,estim)-y*estim)/N | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negative_log_likelihood(self, y):\n return -T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]), y])",
"def negative_log_likelihood(self, y):\r\n # y.shape[0] is (symbolically) the number of rows in y, i.e.,\r\n # number of examples (call it n) in the minibatch\r\n # T.arange(y.sh... | [
"0.7662479",
"0.74039197",
"0.73727286",
"0.73727286",
"0.7366935",
"0.731725",
"0.71057534",
"0.70257497",
"0.70062155",
"0.6975369",
"0.6957282",
"0.6939287",
"0.6888633",
"0.6884539",
"0.68347704",
"0.68060905",
"0.67904717",
"0.6775763",
"0.67537034",
"0.67116416",
"0.668... | 0.6251507 | 62 |
Convert the given unicode string to a bytestring, using the standard encoding, unless it's already a bytestring | def to_bytestring(s):
if s:
if isinstance(s, str):
return s
else:
return s.encode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_bytes(s):\n if isinstance(s, unicode):\n return s.encode(DEFAULT_ENCODING)\n else:\n return s",
"def str_to_bytes(s):\r\n if isinstance(s, unicode):\r\n return s.encode(sys.getfilesystemencoding())\r\n else:\r\n return s",
"def ... | [
"0.83153003",
"0.8156366",
"0.8110425",
"0.7985334",
"0.7982522",
"0.7980034",
"0.793189",
"0.7896653",
"0.7828612",
"0.78264713",
"0.78197175",
"0.7755039",
"0.7746559",
"0.7698474",
"0.7696973",
"0.768228",
"0.7657281",
"0.76534843",
"0.7557924",
"0.7500937",
"0.7487891",
... | 0.8080651 | 3 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
return [correct[:k].reshape(-1).float().sum(0) / batch_size for k in topk] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actual.size(0)\n\n _, pred = y_pred.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(y_actual.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).floa... | [
"0.8284951",
"0.82642335",
"0.821002",
"0.8209656",
"0.81915003",
"0.81795454",
"0.81754273",
"0.8175146",
"0.8170536",
"0.8168537",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.81622696",
"0.... | 0.80019224 | 63 |
Function to compute all the combinations of a lists of parameters | def expand_grid(params):
# list of parameters
keys = list(params.keys())
# get all combinations of parameters
comb = []
for param in params:
comb.append(params[param])
comb = list(product(*comb))
# list to store all dicts containing all combinations of parameters
grid = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculatecombinations(self):\n index=0\n thedict={}\n #I have to traverse each value between x_min, x_max. Create a list seperating rounding value.\n for i,j in zip(self.x_min,self.x_max):\n a=np.arange(i, j+0.000001, 10**(-1*self.rounding[index]))\n a=np.round... | [
"0.73576635",
"0.7024328",
"0.69209087",
"0.6874434",
"0.6872805",
"0.6869246",
"0.68639225",
"0.68479425",
"0.6827582",
"0.6806742",
"0.67982864",
"0.67945445",
"0.67896223",
"0.6780431",
"0.6777554",
"0.6776548",
"0.6776366",
"0.6767177",
"0.6766119",
"0.67624027",
"0.67611... | 0.0 | -1 |
Encode coordinates, with respect to (2d + n choose n) interpolant basis, of some basis for (n, d) polynomials as columns in a tall matrix. This basis is declared implicitly through the point evaluations (coordinates) at the unisolvent points. L(x) = P'diag(gx)P for some domain restriction g(x) >= 0 where L() is the can... | def Pmat(dData):
pts = UnisolventPoints(dData.n, dData.d2)
V = ChebyVandermonde(pts, dData.d)
[P, R] = np.linalg.qr(V)
return P | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_poly(x, degree):\n \n tx = np.ones([len(x),1])\n for col in range(x.shape[1]):\n for i in range(degree):\n tx = np.hstack([tx, x[:,col][:,np.newaxis] ** (i+1)])\n return tx",
"def build_poly(x, degree):\n if degree < 2:\n return None\n tiled = np.tile(np.vstac... | [
"0.5971909",
"0.58255893",
"0.574829",
"0.5677596",
"0.5614613",
"0.55689704",
"0.55343944",
"0.5487918",
"0.5485097",
"0.545155",
"0.5414806",
"0.54032737",
"0.53892577",
"0.5388262",
"0.53832275",
"0.5363133",
"0.5327017",
"0.53251576",
"0.5324702",
"0.53203636",
"0.5306829... | 0.0 | -1 |
Build a network that maps state > action values. | def forward(self, state):
x = F.relu(self.conv1(x))
x = F.relu(self.conv2(x))
x = F.relu(self.conv3(x))
x = x.view(-1, 32 * 7 * 7)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _network_template(self, state):\n weights_initializer = slim.variance_scaling_initializer(\n factor=1.0 / np.sqrt(3.0), mode='FAN_IN', uniform=True)\n\n net = tf.cast(state, tf.float32)\n net = tf.subtract(net, tf.reduce_min(net))\n net = tf.div(net, tf.reduce_max(net))\n net = slim.conv2... | [
"0.63946366",
"0.63886064",
"0.63507026",
"0.6328887",
"0.6328887",
"0.63190526",
"0.62626165",
"0.6228537",
"0.6205531",
"0.61980116",
"0.61628056",
"0.6102542",
"0.6077717",
"0.6031706",
"0.60232824",
"0.59831923",
"0.59382755",
"0.5907368",
"0.5839515",
"0.5820617",
"0.582... | 0.0 | -1 |
Extract a multiscale single image tensor from a multiscale batch tensor based on batch index. | def select_single_mlvl(mlvl_tensors, batch_id, detach=True):
assert isinstance(mlvl_tensors, (list, tuple))
num_levels = len(mlvl_tensors)
if detach:
mlvl_tensor_list = [
mlvl_tensors[i][batch_id].detach() for i in range(num_levels)
]
else:
mlvl_tensor_list = [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch(self, batch_index: int):\n if batch_index < self.batch_num:\n begin = batch_index * self.batch_size\n end = (batch_index + 1) * self.batch_size\n return self._images[begin:end], self._labels[begin:end]\n raise IndexError(\"batch index out of range\")",
"de... | [
"0.6767374",
"0.65502113",
"0.6516359",
"0.65136987",
"0.6494668",
"0.6483761",
"0.6447336",
"0.63429433",
"0.62992996",
"0.62919235",
"0.6245529",
"0.6200133",
"0.6187767",
"0.61693877",
"0.6146135",
"0.61223876",
"0.6115525",
"0.6022608",
"0.59824896",
"0.59761864",
"0.5928... | 0.0 | -1 |
Guided backprop ReLU forward function. | def forward(ctx, input):
ctx.save_for_backward(input)
return input.clamp(min=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relu_forward(x):\n out = None\n #############################################################################\n # TODO: Implement the ReLU forward pass. #\n #############################################################################\n out = np.maximum(x, 0)\n ########... | [
"0.7244633",
"0.72148126",
"0.7160915",
"0.7105274",
"0.70633864",
"0.7056583",
"0.70475453",
"0.7021532",
"0.6912617",
"0.69049007",
"0.6879216",
"0.66783977",
"0.66761094",
"0.66619766",
"0.6623186",
"0.66087747",
"0.6600698",
"0.65984625",
"0.6573956",
"0.6571143",
"0.6544... | 0.0 | -1 |
Load the builder naming schema from the JSON file. | def _LoadSchema():
def _UnicodeToStr(obj):
""" Convert all unicode strings in obj to Python strings. """
if isinstance(obj, unicode):
return str(obj)
elif isinstance(obj, dict):
return dict(map(_UnicodeToStr, obj.iteritems()))
elif isinstance(obj, list):
return list(map(_UnicodeToSt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_schema(self):\n with open(self.schema_filename, \"r\") as fh:\n self.schema = json.load(fh)\n self.schema_defaults = {}\n self.schema_params = []\n log.debug(f\"JSON file loaded: {self.schema_filename}\")",
"def _load_json_schema(filename):\n\n relative_path = j... | [
"0.7310292",
"0.6738724",
"0.6459045",
"0.6335756",
"0.6311872",
"0.62796026",
"0.62484765",
"0.6200976",
"0.61557186",
"0.611944",
"0.6072519",
"0.59578896",
"0.58895963",
"0.5848285",
"0.5787976",
"0.5749197",
"0.5686891",
"0.56598634",
"0.5634833",
"0.5616949",
"0.5592667"... | 0.794725 | 0 |
Returns true if builder_name refers to a trybot (as opposed to a waterfall bot). | def IsTrybot(builder_name):
return builder_name.endswith(TRYBOT_NAME_SUFFIX) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TrybotName(builder_name): # pragma: no cover\n if builder_name.endswith(TRYBOT_NAME_SUFFIX):\n return builder_name\n return builder_name + BUILDER_NAME_SEP + TRYBOT_NAME_SUFFIX",
"def should_process_on_builder(pkg_def_file, py_venv, builder):\n if not builder:\n return True\n builders = read_yaml(... | [
"0.7078168",
"0.67024416",
"0.6681799",
"0.6372126",
"0.63609195",
"0.61799634",
"0.59848607",
"0.59194106",
"0.5916962",
"0.58549154",
"0.5826064",
"0.5809826",
"0.57684994",
"0.57545716",
"0.5698054",
"0.56894237",
"0.5683936",
"0.5646683",
"0.56081086",
"0.5561172",
"0.552... | 0.8791112 | 0 |
Makes a dictionary containing details about the builder from its name. | def DictForBuilderName(builder_name):
split_name = builder_name.split(BUILDER_NAME_SEP)
def pop_front():
try:
return split_name.pop(0)
except: # pragma: no cover
raise ValueError('Invalid builder name: %s' % builder_name)
result = {'is_trybot': False}
if split_name[-1] == TRYBOT_NAME_SUF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def builder_key(self):\n return self.cat + '/' + self.name",
"def GetBuilderName(builders, keyval):\n errstring = 'string \\'%s\\' matches' % keyval\n return OnlyGetOne(builders, 'name', errstring)",
"def get_builder(builder_file_name):\n # Look for the ui file that describes the user interface.\n u... | [
"0.69286394",
"0.63273793",
"0.6091383",
"0.5950776",
"0.59178174",
"0.5848174",
"0.5824038",
"0.580026",
"0.569234",
"0.568002",
"0.56574833",
"0.5652275",
"0.5640839",
"0.56213444",
"0.5546209",
"0.551249",
"0.5512323",
"0.55028063",
"0.54840016",
"0.5472321",
"0.54310477",... | 0.71839374 | 0 |
Returns a client with attached credentials of the `user`. Represents an unauthorized user if `user` is None. | def _client(self, user):
client = APIClient()
if user:
credentials = f"{user.username}:testpswd"
credentials = credentials.encode()
client.credentials(
HTTP_AUTHORIZATION=f"Basic {base64.b64encode(credentials).decode()}"
)
return cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_client(db, user):\n client = Client()\n client.login(username=user.email, password=\"secret\")\n return client",
"def client():\n return Client(**common_data.AUTH_ARGS)",
"def jwt_credentials(client, user):\n\tif not isinstance(client, APIClient):\n\t\traise Exception(\"client should be in... | [
"0.7460048",
"0.64496064",
"0.620211",
"0.6113598",
"0.6047414",
"0.6019912",
"0.5994228",
"0.59807026",
"0.5976858",
"0.59679365",
"0.59084463",
"0.5904698",
"0.5879776",
"0.5779625",
"0.57752335",
"0.5743373",
"0.57412285",
"0.5731694",
"0.5707182",
"0.5697908",
"0.5659055"... | 0.7588971 | 0 |
Set the filter of this mask | def set_filter(self, color: Optional[HsvColor]):
self.filter.set(color=color)
self.config.filter(**self.filter.config.to_dict()) # todo: otherwise, mask config is not updated! | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_filter(self, filter_):\n self._filter = filter_",
"def set_filter(self, f):\n self._filter = f\n if f == 0: # Red\n s2 = 0\n s3 = 0\n elif f == 1: # Green\n s2 = 1\n s3 = 1\n elif f == 2: # Blue\n s2 = 0\n ... | [
"0.7469036",
"0.72934216",
"0.7151636",
"0.6813135",
"0.6648915",
"0.6626668",
"0.66148007",
"0.6565124",
"0.6558637",
"0.6558637",
"0.6543391",
"0.65041065",
"0.6502861",
"0.6479863",
"0.6463106",
"0.6463106",
"0.6459707",
"0.64114577",
"0.63748205",
"0.63748205",
"0.6363399... | 0.70901966 | 3 |
This mask's row slice | def rows(self):
return slice(self._rect[0], self._rect[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def src_row_slice(self) -> slice:\n return slice(self.src_window[0], self.src_window[2] + 1)",
"def dst_row_slice(self) -> slice:\n return slice(self.dst_window[0], self.dst_window[2] + 1)",
"def slice(x, turn):\r\n return x[:, turn, :, :]",
"def slice(x, turn):\r\n return... | [
"0.7238642",
"0.71559024",
"0.6683136",
"0.6683136",
"0.63839096",
"0.6364088",
"0.6321095",
"0.62694573",
"0.61596686",
"0.6142774",
"0.6100004",
"0.6090522",
"0.6076686",
"0.60239995",
"0.60038507",
"0.5972333",
"0.58623517",
"0.5859697",
"0.5841973",
"0.582677",
"0.5782072... | 0.6672377 | 4 |
This mask's column slice | def cols(self):
return slice(self._rect[2], self._rect[3]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dst_col_slice(self) -> slice:\n return slice(self.dst_window[1], self.dst_window[3] + 1)",
"def src_col_slice(self) -> slice:\n return slice(self.src_window[1], self.src_window[3] + 1)",
"def slice(x, turn):\r\n return x[:, turn, :, :]",
"def slice(x, turn):\r\n return... | [
"0.7114475",
"0.7109421",
"0.6971764",
"0.6971764",
"0.65253764",
"0.6485611",
"0.6369717",
"0.6326465",
"0.63147205",
"0.62420726",
"0.6142735",
"0.6014465",
"0.5999116",
"0.59868246",
"0.5974851",
"0.59641063",
"0.59525305",
"0.5926354",
"0.5911093",
"0.5904487",
"0.5902446... | 0.621043 | 10 |
Get the total time of the video in seconds | def get_total_time(self) -> float:
return self.video.get_total_time() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def totalSeconds(self):\n return self.leadout.getFrames()//75 - self.cdtoc[0].getFrames()//75",
"def get_time(self):\n playback = self.sp.current_playback()\n if playback:\n return playback['progress_ms']",
"def getFileDuration(self):\n time = 0\n command = ['ffmpeg', ... | [
"0.779533",
"0.759965",
"0.7474815",
"0.74520737",
"0.74463755",
"0.74073327",
"0.7398523",
"0.7390781",
"0.7330401",
"0.729319",
"0.7270673",
"0.72399956",
"0.71945447",
"0.7147148",
"0.71375406",
"0.70498633",
"0.7019689",
"0.70194393",
"0.6976774",
"0.6958312",
"0.6954782"... | 0.8602394 | 0 |
Creates a object from a dictionary. | def dict_to_obj(dictionary):
class Struct(object):
def __init__(self, d):
for a, b in d.items():
if isinstance(b, (list, tuple)):
setattr(self, a, [Struct(x) if isinstance(x, dict) else x for x in b])
else:
setattr(self, a,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_dict(cls, d):\n return cls(**d)",
"def from_dict(cls, dict_):\n obj = cls.__new__(cls)\n obj.__dict__.update(dict_)\n return obj",
"def fr... | [
"0.8404",
"0.8404",
"0.8204553",
"0.8198354",
"0.81813323",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.8069947",
"0.806... | 0.0 | -1 |
Generator returning numbers from n 1 to 0 decreasing by 1. | def backward(n):
for i in range(n - 1, -1, -1):
yield i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def a_generator(n):\n yield -1\n\n for i in range(n):\n yield i * 2\n\n yield -1",
"def lazy_range(n):\n\ti = 0\n\twhile(i<n):\n\t\tyield i\n\t\ti += 1",
"def revlex_partitions(n):\n if n == 0:\n yield []\n return\n for p in revlex_partitions(n - 1):\n if len(p) == 1 ... | [
"0.7603397",
"0.72647876",
"0.70207685",
"0.70207685",
"0.6990893",
"0.68854386",
"0.68355775",
"0.6812501",
"0.681081",
"0.68083817",
"0.6808211",
"0.67502725",
"0.6690009",
"0.6657493",
"0.6648414",
"0.6614341",
"0.6596618",
"0.6528151",
"0.65159667",
"0.6511618",
"0.649189... | 0.7180559 | 2 |
Check if the input if the the expected size. | def check_sizes(input_tensor, input_name, expected):
condition = [input_tensor.ndimension() == len(expected)]
for i, size in enumerate(expected):
if size.isdigit():
condition.append(input_tensor.size(i) == int(size))
assert(all(condition)),\
"wrong size for {}, expected {}, got ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_size(self):\n\t\tif len(self.buffer) > self.min_size:\n\t\t\treturn True\n\t\treturn False",
"def _check_size(self, new_shape):\n if self._shape != new_shape:\n if not (self._shape == (1,) and new_shape == ()):\n return True\n return False",
"def _checkSizes(se... | [
"0.7543863",
"0.7339585",
"0.7243516",
"0.7204945",
"0.7125648",
"0.7125648",
"0.7100648",
"0.7036631",
"0.6999629",
"0.694611",
"0.69364065",
"0.6894021",
"0.6775287",
"0.67646825",
"0.6729601",
"0.66773623",
"0.6671383",
"0.6662637",
"0.6660544",
"0.6612498",
"0.6591128",
... | 0.77936023 | 0 |
Appends the specified transition to the memory. | def append(self, state, action, reward, done):
assert state.shape == self._state_shape, \
'Invalid state shape (required: %s, got: %s)' % (self._state_shape, state.shape)
self._states[self._pos] = state
self._actions[self._pos] = action
self._rewards[self._pos] = rewar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_transition_to_memory(self, transition):\n self.memory.add(*transition)",
"def add(self, transition):\n self.memory.append(transition)",
"def push(self,transition):\n self.memory.append(transition)",
"def _add_transition_to_memory(self, transition: Tuple[np.ndarray, ...]):\n ... | [
"0.8583855",
"0.83773386",
"0.83384824",
"0.82647526",
"0.82577616",
"0.8179176",
"0.8109698",
"0.7681637",
"0.76483",
"0.73003614",
"0.7295037",
"0.701833",
"0.69586957",
"0.69571155",
"0.69158286",
"0.68732476",
"0.68137914",
"0.6547647",
"0.6507922",
"0.65038633",
"0.64051... | 0.60845506 | 29 |
Return the specified state with the replay memory. A state consists of the last `history_length` perceptions. | def get_state(self, index):
if self._count == 0:
raise IndexError('Empty Memory')
index %= self._count
history_length = self._history_length
# If index > history_length, take from a slice
if index >= history_length:
return self._states[(index - ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self, index):\n if self._count == 0:\n raise IndexError('Empty Memory')\n\n index %= self._count\n history_length = self._history_length\n\n # If index > history_length, take from a slice\n if index >= history_length:\n return self._states[(ind... | [
"0.67585677",
"0.58068424",
"0.5788829",
"0.57529914",
"0.5737957",
"0.5668262",
"0.56526023",
"0.56415635",
"0.56182736",
"0.56036055",
"0.5602585",
"0.5506032",
"0.5485977",
"0.5435383",
"0.5424393",
"0.53935176",
"0.53790605",
"0.53427756",
"0.5334954",
"0.5315149",
"0.530... | 0.6729959 | 1 |
Underlying buffer with N previous states stacked along first axis | def value(self):
return self._buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filled_buffer3x3_history():\n observation_space = gym.spaces.Box(low=0, high=255, shape=(2, 2, 2, 1), dtype=int)\n action_space = gym.spaces.Box(low=-1.0, high=1.0, shape=(2, 2, 2), dtype=float)\n\n buffer = CircularBufferBackend(20, observation_space=observation_space, action_space=action_space)\... | [
"0.70463556",
"0.69145757",
"0.6665838",
"0.6655098",
"0.6592745",
"0.6274756",
"0.62676495",
"0.60133076",
"0.5998929",
"0.5962655",
"0.5897424",
"0.585425",
"0.58275384",
"0.5779461",
"0.57642204",
"0.5756381",
"0.57133126",
"0.57096744",
"0.56939024",
"0.56843424",
"0.5683... | 0.0 | -1 |
Return a randomly chosen list of n positive integers summing to total. Each such list is equally likely to occur. | def constrained_sum_sample_pos(n, total):
sample = random.sample(range(1, total), n - 1)
dividers = sorted(sample)
return [a - b for a, b in zip(dividers + [total], [0] + dividers)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_numbers_totaling(total, count):\n # inspired from <http://umusebo.com/generate-n-random-numbers-whose>\n # divide [0, total] in count random subranges\n fenceposts = sorted(random.choice(range(total+1)) for _ in range(count-1))\n # return the lengths of these subranges\n return [b - a for... | [
"0.7389275",
"0.71870804",
"0.6759722",
"0.66075087",
"0.66033196",
"0.6601024",
"0.6596684",
"0.6559611",
"0.6520665",
"0.6473426",
"0.6471025",
"0.643975",
"0.6415345",
"0.64145076",
"0.63510764",
"0.6342921",
"0.63295025",
"0.63036436",
"0.63027036",
"0.62882346",
"0.62827... | 0.82178205 | 0 |
Close the database connection when the API is no longer used. | def close(self):
self.con.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n self.db.close()",
"def close_db(self):\n self.con.close()",
"def db_close_connection(self):\r\n if self.connection:\r\n self.connection.close_connection()",
"def close(self):\n self.db_connection.close()",
"def end_connection(self):\n ... | [
"0.8489821",
"0.84685004",
"0.84393805",
"0.8424451",
"0.8224497",
"0.8190959",
"0.81809646",
"0.8111985",
"0.80982995",
"0.80740017",
"0.80587906",
"0.80508065",
"0.80477506",
"0.80317235",
"0.7990879",
"0.79537207",
"0.7930905",
"0.7928198",
"0.7928198",
"0.79093415",
"0.79... | 0.73654187 | 72 |
Get serialization of descriptor containing the basic information about the API. Returns dict | def service_descriptor(self):
return self.serialize.service_descriptor(
name=self.name,
version=self.version
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_descriptor():\n return jsonify(api.service_descriptor)",
"def get_api_dict(self) -> dict:\n\n d = {\n \"schemaVersion\": self.schema_version,\n \"label\": self.label,\n \"message\": self._formatValue(self.message, self.format),\n \"cacheSeconds\":... | [
"0.68644863",
"0.66802233",
"0.65614986",
"0.6557756",
"0.64943355",
"0.63712883",
"0.63712883",
"0.6350428",
"0.63264316",
"0.6258091",
"0.62502533",
"0.61219865",
"0.61120254",
"0.60977",
"0.60805935",
"0.60494894",
"0.60304177",
"0.6019326",
"0.60109615",
"0.5995215",
"0.5... | 0.56761736 | 82 |
Return the engine API version. Returns string | def version(self):
return '0.1.0' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_version(self) -> str:\n return pulumi.get(self, \"api_version\")",
"def api_version(self) -> Optional[str]:\n return pulumi.get(self, \"api_version\")",
"def api_version(self) -> Optional[str]:\n return pulumi.get(self, \"api_version\")",
"def get_api_version(self):\n\n re... | [
"0.8509993",
"0.80541235",
"0.80541235",
"0.8005539",
"0.7996327",
"0.7945458",
"0.79192907",
"0.79192907",
"0.79023594",
"0.78848606",
"0.7815786",
"0.7815786",
"0.7815138",
"0.7815138",
"0.781333",
"0.7790304",
"0.7758127",
"0.76857257",
"0.7672312",
"0.76371366",
"0.762121... | 0.0 | -1 |
Returns the dict as a model | def from_dict(cls, dikt) -> 'ModelFlowChartNode':
return util.deserialize_model(dikt, cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'Model':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'ModelOutput':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'ModelStat':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt):\n ... | [
"0.73100865",
"0.7226481",
"0.68927467",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67388964",
"0.66993856",
"0.6698291",
"0.6698291",
"0.6698291",
"0.6650225",
"... | 0.5921776 | 79 |
Gets the id of this ModelFlowChartNode. | def id(self) -> str:
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self._node_id",
"def get_id(self):\n return self._edge_id",
"def get_id(self):\n return self.id_nodo",
"def id(self):\n # type: () -> str\n return self._get_model_data().id",
"def graph_id(self):\n return self._graph_id",
"def node_id(s... | [
"0.7468152",
"0.70238566",
"0.69089186",
"0.6880102",
"0.68007016",
"0.6794472",
"0.67721146",
"0.6728551",
"0.6728551",
"0.6728551",
"0.6728551",
"0.67270166",
"0.6653505",
"0.6653505",
"0.6653505",
"0.66343796",
"0.66219175",
"0.6600008",
"0.65984803",
"0.65880847",
"0.6578... | 0.6435764 | 87 |
Sets the id of this ModelFlowChartNode. | def id(self, id: str):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, id):\n self.id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._... | [
"0.7065625",
"0.67825633",
"0.67825633",
"0.67825633",
"0.67825633",
"0.67825633",
"0.6731481",
"0.6731481",
"0.6731481",
"0.6731481",
"0.6731481",
"0.67094994",
"0.67094994",
"0.67094994",
"0.67094994",
"0.67094994",
"0.67094994",
"0.67094994",
"0.67094994",
"0.67094994",
"0... | 0.0 | -1 |
Gets the fixed_config of this ModelFlowChartNode. | def fixed_config(self) -> object:
return self._fixed_config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixed_mode_config(self) -> ConfigType:\n if not self.is_strategy_supported(CalculationStrategy.FIXED):\n raise UnsupportedStrategy(\n f\"Strategy fixed is not supported by model: {self._model}\"\n )\n fixed_config = self._json_data.get(\"fixed_config\")\n ... | [
"0.7194715",
"0.603472",
"0.5874748",
"0.5855518",
"0.57846713",
"0.575687",
"0.57567",
"0.5603879",
"0.5505917",
"0.5505917",
"0.5474261",
"0.5458632",
"0.53993237",
"0.53817195",
"0.5352201",
"0.5342513",
"0.53406847",
"0.53396666",
"0.5328987",
"0.53257936",
"0.53192997",
... | 0.78020835 | 0 |
Sets the linked_edges of this ModelFlowChartNode. | def linked_edges(self, linked_edges: List[ModelFlowChartNodeLinkedEdges]):
self._linked_edges = linked_edges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setEdges(self, edges, log=None):\r\n setAttribute(self, 'edges', edges, log)",
"def edges(self, edges):\n\n self._edges = edges",
"def linked_edges(self) -> List[ModelFlowChartNodeLinkedEdges]:\n return self._linked_edges",
"def edges(self, e):\n self._edges = e",
"def links... | [
"0.65701586",
"0.65466875",
"0.64480793",
"0.6291613",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.59113175",
"0.58888143",
"0.5854794",
"0.5831445",
"0.57792455",
... | 0.8756409 | 0 |
Gets the contained_components_id of this ModelFlowChartNode. | def contained_components_id(self) -> str:
return self._contained_components_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_containing_component_ref(self):\n comp = self.get_containing_component()\n return AbstractModelReference.find_ref_for_obj(comp)",
"def contained_components_id(self, contained_components_id: str):\n\n self._contained_components_id = contained_components_id",
"def get_containing_comp... | [
"0.5534141",
"0.5390616",
"0.53893465",
"0.5370437",
"0.5220828",
"0.52003944",
"0.5147253",
"0.51053554",
"0.50846267",
"0.49856713",
"0.48803526",
"0.48728245",
"0.48684642",
"0.4826779",
"0.47879034",
"0.4766815",
"0.4734612",
"0.47317868",
"0.47315627",
"0.46851638",
"0.4... | 0.7397963 | 0 |
Sets the contained_components_id of this ModelFlowChartNode. | def contained_components_id(self, contained_components_id: str):
self._contained_components_id = contained_components_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contained_components_id(self) -> str:\n return self._contained_components_id",
"def components(self, components):\n\n self._components = components",
"def __init__(self, id: str=None, fixed_config: object=None, linked_edges: List[ModelFlowChartNodeLinkedEdges]=None, contained_components_id: s... | [
"0.5393642",
"0.47938073",
"0.47165456",
"0.43232316",
"0.43232316",
"0.43038324",
"0.42607456",
"0.4164824",
"0.41475657",
"0.41475657",
"0.40843123",
"0.40235704",
"0.398948",
"0.39885604",
"0.398619",
"0.398619",
"0.398619",
"0.398619",
"0.398619",
"0.398619",
"0.398619",
... | 0.76362187 | 0 |
Generate a custom or generic temporary filename in the correct directory | def tempfile(self, base=None, ext=None):
if base and ext:
output = os.path.join(self._tempdir(), base + '_' + self._random_char(3) + ext)
elif base and not ext:
output = os.path.join(self._tempdir(), base + '_' + self._random_char(3))
elif not base and ext:
os... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_temp_file():\n return tempfile.mktemp()",
"def _GenerateTempLogFile() -> str:\n now = datetime.datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n logfile = tempfile.NamedTemporaryFile(\n mode='a',\n prefix=f'dftimewolf-run-{now}_',\n suffix='.log',\n delete=False)\n log_filename = logfil... | [
"0.76051784",
"0.755848",
"0.73444194",
"0.7342209",
"0.72845745",
"0.72757614",
"0.72342634",
"0.7221405",
"0.72120756",
"0.72015035",
"0.72001404",
"0.7186232",
"0.71798766",
"0.71794885",
"0.71633995",
"0.7131899",
"0.7120303",
"0.7115247",
"0.711237",
"0.7104182",
"0.7065... | 0.72012734 | 10 |
Generator that splits list a evenly into n pieces | def split_list(a, n):
if IS_PY3:
xrange = range
k, m = divmod(len(a), n)
return (a[i * k + min(i, m):(i + 1) * k + min(i + 1, m)] for i in xrange(n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk_list(ls, n):\n for i in range(0, n):\n yield ls[i::n]",
"def chunks(l : list, n : int):\n for i in range(0, n):\n yield l[i::n]",
"def divide_into_chunks(l: List, n: int):\n for i in range(0, len(l), n):\n yield l[i : i + n]",
"def _split_into_chunks(lst, n):\n for ... | [
"0.8233122",
"0.8174823",
"0.8137751",
"0.80694854",
"0.804856",
"0.8038899",
"0.803486",
"0.80324394",
"0.80285513",
"0.80285513",
"0.8017273",
"0.8016342",
"0.8016152",
"0.8016152",
"0.80066776",
"0.79986906",
"0.7996711",
"0.79691243",
"0.79691243",
"0.7969012",
"0.7958674... | 0.0 | -1 |
This is the parse CLI arguments function. It parses command line arguments. | def parse_cli_args(indexname):
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--rootdir", metavar='ROOTDIR', default=".",
help="Directory to start crawling from (default: .)")
parser.add_argument("-m", "--mtime", metavar='DAYS', default=0, type=int,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_command_line():\n parser = argparse.ArgumentParser()\n\n # Optional Argument\n parser.add_argument('-l', '--length', metavar='length', type=float,\n default=2, help='length (meter)')\n parser.add_argument('-k', '--conductivity', metavar='conductivity', type=float,\n ... | [
"0.7651207",
"0.7548609",
"0.7528794",
"0.75056314",
"0.75032824",
"0.75010216",
"0.74999565",
"0.7491463",
"0.7488835",
"0.7486741",
"0.74779546",
"0.7474293",
"0.7473265",
"0.7466643",
"0.7459247",
"0.74539536",
"0.74480164",
"0.7429673",
"0.74110454",
"0.7410909",
"0.74101... | 0.0 | -1 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(InteractiveMarkerControl, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.name is None:
self.name = ''
if self.orientation is None:
self.orientation = geom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(BasicSafetyMessage, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.communication_header is ... | [
"0.806142",
"0.80587703",
"0.7872186",
"0.7872186",
"0.7872186",
"0.7872186",
"0.7601677",
"0.76000494",
"0.7524568",
"0.75007737",
"0.75007737",
"0.74567354",
"0.74496144",
"0.7443776",
"0.7426577",
"0.73908865",
"0.7355341",
"0.7333042",
"0.7324639",
"0.73181033",
"0.729167... | 0.0 | -1 |
serialize message with numpy array types into buffer | def serialize_numpy(self, buff, numpy):
try:
_x = self.name
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_get_struct_4d3B().pack(_x.orientation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_numpy(self, buff, numpy):\n self.serialize(buff)",
"def serialize_numpy(self, buff, numpy):\n try:\n pass\n except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(locals().get('_x', self)))))\n except TypeError as te: ... | [
"0.7951979",
"0.7894134",
"0.78557587",
"0.7778328",
"0.7766659",
"0.77637404",
"0.77593005",
"0.77540714",
"0.77539235",
"0.7737562",
"0.767685",
"0.76748276",
"0.7668616",
"0.7664322",
"0.76045257",
"0.75880057",
"0.7567481",
"0.7564311",
"0.7557121",
"0.7555019",
"0.754482... | 0.71518767 | 99 |
Returns True if segments are overlapping. Arguments | def is_overlapped(end1, start2):
if start2 > end1:
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_overlapping(segment_time, existing_segments):\n\n segment_start, segment_end = segment_time\n\n overlap = False\n for existing_start, existing_end in existing_segments:\n if segment_start <= existing_end and segment_end >= existing_start:\n overlap = True\n \n return overlap... | [
"0.79617226",
"0.7912079",
"0.7658801",
"0.75664514",
"0.75044924",
"0.7439506",
"0.7409675",
"0.73982716",
"0.73723453",
"0.7275772",
"0.7249635",
"0.72317636",
"0.7160907",
"0.7120858",
"0.71166235",
"0.71099603",
"0.710318",
"0.71026015",
"0.7093321",
"0.7045736",
"0.70257... | 0.7786555 | 2 |
Modify the sign of vectors for reproducibility. Flips the sign of elements of all the vectors (rows of u) such that the absolute maximum element of each vector is positive. Arguments | def _deterministic_vector_sign_flip(u):
max_abs_rows = np.argmax(np.abs(u), axis=1)
signs = np.sign(u[range(u.shape[0]), max_abs_rows])
u *= signs[:, np.newaxis]
return u | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deterministic_vector_sign_flip(u):\n max_abs_rows = np.argmax(np.abs(u), axis=1)\n signs = np.sign(u[range(u.shape[0]), max_abs_rows])\n u *= signs[:, np.newaxis]\n return u",
"def vectorize_Relu(x):\n\n return np.maximum(x, 0)",
"def sign_renormalization(vec, sum_plus, sum_minus):\n pos... | [
"0.829292",
"0.6530587",
"0.6433965",
"0.63281566",
"0.6154793",
"0.61244106",
"0.6093746",
"0.6058286",
"0.603079",
"0.6030063",
"0.59872997",
"0.5967294",
"0.59593403",
"0.5940798",
"0.5936979",
"0.5857954",
"0.5847453",
"0.58184373",
"0.575757",
"0.5756724",
"0.5729625",
... | 0.82755286 | 1 |
Returns the unnormalized laplacian for the given affinity matrix. Arguments | def get_laplacian(self, M):
M[np.diag_indices(M.shape[0])] = 0
D = np.sum(np.abs(M), axis=1)
D = np.diag(D)
L = D - M
return L | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_normalized_laplacian(adj):\r\n adj = sp.coo_matrix(adj)\r\n d = np.array(adj.sum(1))\r\n d_inv_sqrt = np.power(d, -0.5).flatten()\r\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\r\n d_mat_inv_sqrt = sp.diags(d_inv_sqrt)\r\n normalized_laplacian = sp.eye(adj.shape[0]) - adj.dot(d_mat_inv_s... | [
"0.63472587",
"0.6331758",
"0.6300029",
"0.6300029",
"0.6256558",
"0.6230243",
"0.61837393",
"0.6121976",
"0.60943645",
"0.6059773",
"0.5972472",
"0.59383655",
"0.5851446",
"0.5848725",
"0.5834981",
"0.5823539",
"0.5763721",
"0.57382053",
"0.5725751",
"0.5691034",
"0.5691034"... | 0.55584514 | 25 |
Yield successive nsized chunks from l. | def _chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i+n]",
"def _chunks(self, l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]",
"def chunk(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(l, n):\n ... | [
"0.80763406",
"0.79780173",
"0.7848591",
"0.7818154",
"0.7764843",
"0.7764843",
"0.7740603",
"0.76803994",
"0.7677509",
"0.7673566",
"0.765864",
"0.7655856",
"0.7655856",
"0.7655856",
"0.76458347",
"0.7615106",
"0.75838816",
"0.7557435",
"0.7542004",
"0.7537881",
"0.7537881",... | 0.7549177 | 21 |
Give a list of points that lie within a circle. | def cluster(center, radius, theta):
x = center[0] + radius * np.cos(theta)
y = center[1] + radius * np.sin(theta)
return np.concatenate((x, y), axis = None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_positions(center, radius):\n x_center, y_center = center\n return [(x, y)\n for x in range(x_center - radius, x_center + radius + 1)\n for y in range(y_center - radius, y_center + radius + 1)\n if distance((x, y), center) <= radius]",
"def get_circle(radius, poin... | [
"0.73077786",
"0.72781",
"0.7175513",
"0.7163063",
"0.71351385",
"0.7100604",
"0.70566136",
"0.6994052",
"0.69368684",
"0.6930246",
"0.6924367",
"0.688867",
"0.6857996",
"0.6849362",
"0.6848247",
"0.6801446",
"0.67874",
"0.6762878",
"0.6753975",
"0.67063403",
"0.66978735",
... | 0.0 | -1 |
Public method to turn off the device asynchronously. | async def set_power_off(self):
await self._set_value(FUNCTION_ONOFF, POWER_OFF) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_turn_off(self, **kwargs):\n await self._device.set_off()",
"async def async_turn_off(self, **kwargs): # pylint: disable=unused-argument\n # await self.coordinator.api.async_change_something(False)\n await self.coordinator.api.async_device_off(self.devicename)\n await ... | [
"0.8786126",
"0.8487621",
"0.84386075",
"0.8398287",
"0.8338621",
"0.8304715",
"0.8080018",
"0.8074004",
"0.8066193",
"0.80350274",
"0.79694444",
"0.7966917",
"0.79439306",
"0.7922102",
"0.7917519",
"0.7913033",
"0.7877265",
"0.77685684",
"0.77626085",
"0.772487",
"0.76728296... | 0.64720106 | 95 |
Public method to turn on the device asynchronously. | async def set_power_on(self):
await self._set_value(FUNCTION_ONOFF, POWER_ON) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_turn_on(self, **kwargs): # pylint: disable=unused-argument\n await self.coordinator.api.async_device_on(self.devicename)\n await self.coordinator.async_request_refresh()",
"async def async_turn_on(self, **kwargs):\n await self._async_send(self._device.send_on)\n self.... | [
"0.85717475",
"0.8174096",
"0.81139547",
"0.799237",
"0.7955821",
"0.79111946",
"0.78412503",
"0.77984565",
"0.7757747",
"0.7714493",
"0.7593647",
"0.75805837",
"0.7532005",
"0.74180484",
"0.740762",
"0.7394389",
"0.7383606",
"0.7366721",
"0.73349106",
"0.72287416",
"0.721593... | 0.5989045 | 92 |
Return true if the controlled device is turned on | def is_on(self) -> bool:
return self._device.get(FUNCTION_ONOFF) == POWER_ON | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on(self) -> bool:\n return self.device.level == \"on\"",
"def is_on(self) -> bool:\n return self.device.is_on",
"def is_on(self):\n return bool(getattr(self.device, self.variable))",
"def is_on(self) -> bool:\n if (self._device.status == self._device.STATUS_ON) or (\n ... | [
"0.83137184",
"0.82437795",
"0.8134098",
"0.8003761",
"0.7941737",
"0.79064745",
"0.78272754",
"0.78046626",
"0.77103394",
"0.76839906",
"0.75404596",
"0.75090116",
"0.7447021",
"0.74136055",
"0.72701603",
"0.7261361",
"0.72383213",
"0.72244024",
"0.7216944",
"0.7192421",
"0.... | 0.79256797 | 5 |
Public method returns the target temperature. | def setpoint(self) -> float:
setpoint = self._device.get(FUNCTION_SETPOINT)
if setpoint:
setpoint = int(setpoint) / 10
return setpoint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_temperature(self):\n return self._target_temp",
"def target_temperature(self):\n return self._target_temp",
"def target_temperature(self):\n return self._target_temperature",
"def target_temperature(self):\n return self._target_temperature",
"def target_temperature(se... | [
"0.899683",
"0.899683",
"0.89281344",
"0.89281344",
"0.89281344",
"0.89281344",
"0.89281344",
"0.89281344",
"0.89281344",
"0.89281344",
"0.88944936",
"0.8891069",
"0.88605696",
"0.8775641",
"0.8768373",
"0.8700853",
"0.8700449",
"0.8645146",
"0.8573295",
"0.85187864",
"0.8510... | 0.0 | -1 |
Public method returns the current temperature. | def ambient_temperature(self) -> float:
temperature = self._device.get(FUNCTION_AMBTEMP)
if temperature:
temperature = self.twos_complement_16bit(int(temperature)) / 10
return temperature | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_temp(self) -> float:\n command = Command(\"get-current-temperature\")\n value = self.scheme_manager.execute([command])\n return self.parser.parse_temp(value)",
"def current_temperature(self):\n return self._current_temp",
"def current_temperature(self):\n return self.... | [
"0.8864703",
"0.88610744",
"0.88610744",
"0.88610744",
"0.88493145",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8806912",
"0.8792848",
"0.87833744",
"0.87739176",
"0.87247884",
"0.86537516",
"0.86255664",
"0.8625... | 0.0 | -1 |
Public method returns the current maximum target temperature. | def max_setpoint(self) -> float:
return self._setpoint_maximum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_temp(self):\n return self.device.target_temperature_max",
"def max_temp(self):\n return self.target_temperature_high or DEFAULT_MAX_TEMP",
"def max_temp(self):\n try:\n maximum_temp = self._api._ariston_data[\"dhwTemp\"][\"max\"]\n except:\n maximum_tem... | [
"0.8869912",
"0.87942314",
"0.8485963",
"0.8413087",
"0.8349491",
"0.8349491",
"0.8349491",
"0.8349491",
"0.8349491",
"0.8333666",
"0.82808304",
"0.82747114",
"0.8244835",
"0.8241043",
"0.8241043",
"0.8119611",
"0.8089082",
"0.80772287",
"0.8053565",
"0.8053565",
"0.79632694"... | 0.0 | -1 |
Public method returns the current minimum target temperature. | def min_setpoint(self) -> float:
return self._setpoint_minimum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_temp(self):\n return self.device.target_temperature_min",
"def min_temp(self):\n return self.target_temperature_low or DEFAULT_MIN_TEMP",
"def min_temp(self):\n return MIN_TEMP",
"def min_temp(self):\n return self._min_temp",
"def min_temp(self):\n return self._mi... | [
"0.89349014",
"0.88547623",
"0.8417905",
"0.84124964",
"0.84124964",
"0.84124964",
"0.84124964",
"0.84124964",
"0.83366114",
"0.83366114",
"0.8221068",
"0.813851",
"0.8065455",
"0.80139047",
"0.79862654",
"0.79485685",
"0.79140264",
"0.7893415",
"0.78687125",
"0.78501445",
"0... | 0.0 | -1 |
Public method returns the current vertical vane setting. | def vertical_swing(self) -> str:
return self._device.get(FUNCTION_VANEUD) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def set_vertical_vane(self, vane: str):\n await self._set_value(FUNCTION_VANEUD, vane)",
"def CanvasPanGetV() -> int:\n pass",
"def getVgap(self):\n return (getLayout()).getVgap()",
"def _reflection_in_vertical(self, cell):\n\n x, y = cell\n return BOARD_SIZE - x - 1, y",... | [
"0.6164349",
"0.6084527",
"0.57896054",
"0.57518303",
"0.5666401",
"0.5666401",
"0.56220263",
"0.5618625",
"0.5572159",
"0.5553421",
"0.55443",
"0.55269027",
"0.55234754",
"0.55143166",
"0.5448349",
"0.54456204",
"0.54385614",
"0.5416713",
"0.54024583",
"0.5356319",
"0.533244... | 0.59759533 | 2 |
Returns the last error message, or None if there were no errors. | def error_message(self) -> str:
return self._errorMessage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_error(self):\n return self.last_error",
"def get_message(self):\r\n cond = self.condition_name\r\n if cond in STANZA_ERRORS:\r\n return STANZA_ERRORS[cond][0]\r\n else:\r\n return None",
"def get_error_message(self) -> str:\n return self._er... | [
"0.73531777",
"0.71044606",
"0.6983705",
"0.69620985",
"0.69521296",
"0.6926166",
"0.6903435",
"0.6839401",
"0.6815257",
"0.67645586",
"0.67645586",
"0.6726285",
"0.6726285",
"0.6721229",
"0.67103344",
"0.67100537",
"0.67050695",
"0.67028743",
"0.66839004",
"0.66769886",
"0.6... | 0.65653 | 28 |
Convert master key to two dimensional array Convert char in array to binary with length=8 | def convert_master_key(self, K):
if len(K) < 32:
return False
else:
K = [format(ord(x), '08b') for x in K]
return [[K[i + 7*j] for i in range(8)] for j in range(4)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_key_into_bytes(fullKey):\n subKeys = []\n for i in range(7, -1, -1):\n subKeys.append((fullKey & (0xFF << 8 * i)) >> 8 * i)\n return subKeys",
"def make_all_keys(key):\n\n\tif len(key) != 32:\n\t\traise Exception(\"The key must be 32 bytes\")\n\n\tbits_ar = chars_to_bits(key)\n\tfor i ... | [
"0.6581909",
"0.6177967",
"0.6130356",
"0.6047553",
"0.6035433",
"0.60120225",
"0.59814787",
"0.5830373",
"0.58212245",
"0.5795414",
"0.57855314",
"0.5771952",
"0.5749236",
"0.573007",
"0.57128966",
"0.5669316",
"0.5650268",
"0.56323373",
"0.55969095",
"0.5581032",
"0.5567671... | 0.75443107 | 0 |
padding = 'none' | 'zero' | def GenerateTimeseries(data,labels,
look_back_data=0,look_back_labels=0,look_forward_data=0,look_forward_labels=0,
stride=1,
start = 0, end = 0,
sampling_rate_data=1,sampling_rate_labels=1,
padding = 'non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(offset, align):\n return (align - (offset % align)) % align",
"def zero_pad(number, padding=_DEFAULT_PADDING):\n return str(number).zfill(padding)",
"def pad_to_length(s, n, padding = ' '):\n\tres = None\n\tif n == 0:\n\t\tres = ''\n\telif n > 0:\n\t\tl = len(s)\n\t\tif l < n:\n\t\t\td = n - l\n\t\... | [
"0.6890527",
"0.6889464",
"0.6886399",
"0.68545836",
"0.684305",
"0.68197846",
"0.6790729",
"0.6731874",
"0.6678652",
"0.6670381",
"0.66448224",
"0.6618162",
"0.6565082",
"0.6564545",
"0.6552428",
"0.65254843",
"0.6521724",
"0.6490452",
"0.6484809",
"0.647006",
"0.64612466",
... | 0.0 | -1 |
true iff the given pos has space for a robot, so it must be on the map and not on a wall and possibly not already containing a robot | def _isFree(self, pos:ndarray):
map = self._state.getMap()
return map.isInside(pos) and map.get(pos) != "*" \
and (self._parameters['allow_robot_overlap'] or not(self._isRobot(pos))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPositionInRoom(self, pos):\r\n return 0 <= pos.getX() < self.width and 0 <= pos.getY() < self.height",
"def _isRobot(self, position:ndarray): \n for robot in self._state.robots:\n if (position == robot.getPosition()).all():\n return True\n return False"... | [
"0.71904016",
"0.71769565",
"0.7056053",
"0.6875975",
"0.6846072",
"0.68146896",
"0.6800306",
"0.67236495",
"0.6712183",
"0.6624722",
"0.65853006",
"0.6546117",
"0.6543922",
"0.6527133",
"0.65251267",
"0.6509214",
"0.64735365",
"0.6461881",
"0.6448376",
"0.6400719",
"0.639968... | 0.76558685 | 0 |
Create and save a User with the given email and password. | def _create_user(self, email, password, **extra_fields):
if not email:
raise ValueError('The given email must be set')
email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('User must have an email address')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self.... | [
"0.8576618",
"0.854839",
"0.85340667",
"0.8503592",
"0.8502744",
"0.8502744",
"0.8502744",
"0.8502744",
"0.84976333",
"0.8494317",
"0.8489252",
"0.8488378",
"0.8483397",
"0.8481909",
"0.8477503",
"0.8477503",
"0.8466008",
"0.84617215",
"0.84571445",
"0.84571445",
"0.84571445"... | 0.84757453 | 30 |
Create and save a regular User with the given email and password. | def create_user(self, email, password=None, **extra_fields):
extra_fields.setdefault('is_staff', False)
extra_fields.setdefault('is_superuser', False)
return self._create_user(email, password, **extra_fields) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password) \n user.save(using=self._d... | [
"0.85969466",
"0.8596859",
"0.8596859",
"0.8596859",
"0.8596859",
"0.859567",
"0.8567796",
"0.8553771",
"0.8537802",
"0.8521645",
"0.8521518",
"0.85175407",
"0.851551",
"0.85106146",
"0.84978193",
"0.84978193",
"0.8493227",
"0.8493227",
"0.8493227",
"0.8493227",
"0.8493227",
... | 0.0 | -1 |
Create and save a SuperUser with the given email and password. | def create_superuser(self, email, password, **extra_fields):
extra_fields.setdefault('is_staff', True)
extra_fields.setdefault('is_superuser', True)
if extra_fields.get('is_staff') is not True:
raise ValueError('Superuser must have is_staff=True.')
if extra_fields.get('is_su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, email, password, **extra_fields):\n return self._create_user(email, password, True, True,\n **extra_fields)",
"def create_superuser(self, email, password, **extra_fields):\r\n extra_fields.setdefault('is_staff', True)\r\n extra_field... | [
"0.8043827",
"0.79976124",
"0.7940567",
"0.7940567",
"0.7940567",
"0.7940567",
"0.7940385",
"0.7934291",
"0.79319674",
"0.79319674",
"0.79319674",
"0.79070127",
"0.7881482",
"0.7877954",
"0.7876131",
"0.7868004",
"0.7862509",
"0.7859833",
"0.78422713",
"0.7815067",
"0.7813831... | 0.77888155 | 34 |
Ensure that independentVariables added to a case move with it. | def test_independentVariables(self):
geom = geometry.SystemLayoutInput()
geom.readGeomFromStream(io.StringIO(GEOM_INPUT))
bp = blueprints.Blueprints.load(BLUEPRINT_INPUT)
cs = settings.Settings(ARMI_RUN_PATH)
cs["verbosity"] = "important"
baseCase = cases.Case(cs, bp=bp, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_variables(t_vars, d_vars, g_vars):\n shared_vars = set(d_vars) & set(g_vars)\n if shared_vars:\n raise ValueError(\"Shared trainable variables: %s\" % shared_vars)\n unused_vars = set(t_vars) - set(d_vars) - set(g_vars)\n if unused_vars:\n raise ValueError(\"Unused trainable var... | [
"0.5564774",
"0.5242929",
"0.5226708",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
"0.51977366",
... | 0.6668996 | 0 |
on_setattr of make_class gets forwarded. | def test_make_class(self):
C = attr.make_class("C", {"x": attr.ib()}, on_setattr=setters.frozen)
c = C(1)
with pytest.raises(FrozenAttributeError):
c.x = 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setattr__(self, *args, **kwargs):\n ...",
"def __setattr__(self, *args, **kwargs):\n ...",
"def __setattr__(self, *args, **kwargs):\n ...",
"def __setattr__(self, *args, **kwargs):\n ...",
"def __setattr__(self, *args, **kwargs):\n ...",
"def __setattr__(self, *ar... | [
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785",
"0.75135785"... | 0.0 | -1 |
.s(on_setattr=X, frozen=True) raises an ValueError. | def test_frozen_on_setattr_class_is_caught(self):
with pytest.raises(ValueError) as ei:
@attr.s(frozen=True, on_setattr=setters.validate)
class C(object):
x = attr.ib()
assert "Frozen classes can't use on_setattr." == ei.value.args[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_frozen_on_setattr_attribute_is_caught(self):\n\n with pytest.raises(ValueError) as ei:\n\n @attr.s(frozen=True)\n class C(object):\n x = attr.ib(on_setattr=setters.validate)\n\n assert \"Frozen classes can't use on_setattr.\" == ei.value.args[0]",
"def ... | [
"0.7427716",
"0.6581195",
"0.65661246",
"0.65621984",
"0.65621984",
"0.65621984",
"0.65621984",
"0.65621984",
"0.65621984",
"0.65621984",
"0.65621984",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431144",
"0.6431... | 0.7201729 | 1 |
attr.ib(on_setattr=X) on a frozen class raises an ValueError. | def test_frozen_on_setattr_attribute_is_caught(self):
with pytest.raises(ValueError) as ei:
@attr.s(frozen=True)
class C(object):
x = attr.ib(on_setattr=setters.validate)
assert "Frozen classes can't use on_setattr." == ei.value.args[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_frozen_on_setattr_class_is_caught(self):\n with pytest.raises(ValueError) as ei:\n\n @attr.s(frozen=True, on_setattr=setters.validate)\n class C(object):\n x = attr.ib()\n\n assert \"Frozen classes can't use on_setattr.\" == ei.value.args[0]",
"def test... | [
"0.84900814",
"0.7442395",
"0.72254765",
"0.72160023",
"0.69295514",
"0.66737777",
"0.6618278",
"0.6591255",
"0.628163",
"0.62415683",
"0.6202844",
"0.6200645",
"0.6194546",
"0.61706126",
"0.61706126",
"0.61706126",
"0.61706126",
"0.61706126",
"0.61706126",
"0.61706126",
"0.6... | 0.82360464 | 1 |
If a class with an active setattr is subclassed and no new setattr is generated, the __setattr__ is set to object.__setattr__. We do the double test because of Python 2. | def test_setattr_reset_if_no_custom_setattr(self, slots):
def boom(*args):
pytest.fail("Must not be called.")
@attr.s
class Hooked(object):
x = attr.ib(on_setattr=boom)
@attr.s(slots=slots)
class NoHook(WithOnSetAttrHook):
x = attr.ib()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setattr_restore_respects_auto_detect(self, slots):\n\n @attr.s(auto_detect=True, slots=slots)\n class CustomSetAttr:\n def __setattr__(self, _, __):\n pass\n\n assert CustomSetAttr.__setattr__ != object.__setattr__",
"def test_setattr_auto_detect_if_no_cust... | [
"0.7215358",
"0.70829225",
"0.68756443",
"0.6873539",
"0.67965156",
"0.663648",
"0.6626538",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
"0.6605866",
... | 0.7059272 | 2 |
If we inherit a __setattr__ that has been written by the user, we must not reset it unless necessary. | def test_setattr_inherited_do_not_reset(self, slots):
class A(object):
"""
Not an attrs class on purpose to prevent accidental resets that
would render the asserts meaningless.
"""
def __setattr__(self, *args):
pass
@attr.s(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setattr__(self, name, value):\n if name == \"_wrapped\":\n self.__dict__.clear()\n else:\n self.__dict__.pop(name, None)\n super().__setattr__(name, value)",
"def __setattr__(self, attr, value):\n object.__setattr__(self, attr, value)",
"def __setattr__(s... | [
"0.7736343",
"0.7325019",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"0.7244765",
"... | 0.0 | -1 |
A slotted class can define a custom setattr and it doesn't get overwritten. Regression test for 680. | def test_slotted_class_can_have_custom_setattr(self):
@attr.s(slots=True)
class A(object):
def __setattr__(self, key, value):
raise SystemError
with pytest.raises(SystemError):
A().x = 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setattr__(self, *args, **kwargs): # real signature unknown\n pass",
"def __setattr__(self, *args, **kwargs): # real signature unknown\n pass",
"def __setattr__(self, *args, **kwargs): # real signature unknown\n pass",
"def __setattr__(self, *args, **kwargs): # real signature unknow... | [
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994",
"0.74784994"... | 0.77926064 | 0 |
It's possible to remove the on_setattr hook from an attribute and therefore write a custom __setattr__. | def test_setattr_auto_detect_if_no_custom_setattr(self, slots):
assert 1 == WithOnSetAttrHook(1).x
@attr.s(auto_detect=True, slots=slots)
class RemoveNeedForOurSetAttr(WithOnSetAttrHook):
x = attr.ib()
def __setattr__(self, name, val):
object.__setattr__... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setattr_auto_detect_on_setattr(self, slots):\n with pytest.raises(\n ValueError,\n match=\"Can't combine custom __setattr__ with on_setattr hooks.\",\n ):\n\n @attr.s(auto_detect=True, slots=slots)\n class HookAndCustomSetAttr(object):\n ... | [
"0.7754424",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"0.7723645",
"... | 0.0 | -1 |
If __setattr__ should be restored but the user supplied its own and set auto_detect, leave is alone. | def test_setattr_restore_respects_auto_detect(self, slots):
@attr.s(auto_detect=True, slots=slots)
class CustomSetAttr:
def __setattr__(self, _, __):
pass
assert CustomSetAttr.__setattr__ != object.__setattr__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setattr_auto_detect_if_no_custom_setattr(self, slots):\n assert 1 == WithOnSetAttrHook(1).x\n\n @attr.s(auto_detect=True, slots=slots)\n class RemoveNeedForOurSetAttr(WithOnSetAttrHook):\n x = attr.ib()\n\n def __setattr__(self, name, val):\n objec... | [
"0.695707",
"0.6845797",
"0.62764406",
"0.6213462",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
"0.61506325",
... | 0.7709364 | 0 |
frozen=True together with a detected custom __setattr__ are rejected. | def test_setattr_auto_detect_frozen(self, slots):
with pytest.raises(
ValueError, match="Can't freeze a class with a custom __setattr__."
):
@attr.s(auto_detect=True, slots=slots, frozen=True)
class CustomSetAttr(Frozen):
def __setattr__(self, _, __):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_frozen_on_setattr_attribute_is_caught(self):\n\n with pytest.raises(ValueError) as ei:\n\n @attr.s(frozen=True)\n class C(object):\n x = attr.ib(on_setattr=setters.validate)\n\n assert \"Frozen classes can't use on_setattr.\" == ei.value.args[0]",
"def ... | [
"0.7861203",
"0.78149474",
"0.7353042",
"0.7302878",
"0.7241568",
"0.71656793",
"0.7090705",
"0.70095104",
"0.6961865",
"0.6901539",
"0.68841916",
"0.6617415",
"0.6609766",
"0.6583796",
"0.6515383",
"0.6495135",
"0.64747363",
"0.63636965",
"0.63587326",
"0.62765646",
"0.61455... | 0.8166674 | 0 |
on_setattr attributes together with a detected custom __setattr__ are rejected. | def test_setattr_auto_detect_on_setattr(self, slots):
with pytest.raises(
ValueError,
match="Can't combine custom __setattr__ with on_setattr hooks.",
):
@attr.s(auto_detect=True, slots=slots)
class HookAndCustomSetAttr(object):
x = attr.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setattr_auto_detect_if_no_custom_setattr(self, slots):\n assert 1 == WithOnSetAttrHook(1).x\n\n @attr.s(auto_detect=True, slots=slots)\n class RemoveNeedForOurSetAttr(WithOnSetAttrHook):\n x = attr.ib()\n\n def __setattr__(self, name, val):\n objec... | [
"0.76693106",
"0.7432043",
"0.7431414",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
"0.70932937",
... | 0.7997586 | 0 |
A userprovided intermediate __setattr__ is not reset to object.__setattr__. This only can work on Python 3+ with auto_detect activated, such that attrs can know that there is a userprovided __setattr__. | def test_setattr_inherited_do_not_reset_intermediate(
self, a_slots, b_slots, c_slots
):
@attr.s(slots=a_slots)
class A(object):
x = attr.ib(on_setattr=setters.frozen)
@attr.s(slots=b_slots, auto_detect=True)
class B(A):
x = attr.ib(on_setattr=setter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setattr_restore_respects_auto_detect(self, slots):\n\n @attr.s(auto_detect=True, slots=slots)\n class CustomSetAttr:\n def __setattr__(self, _, __):\n pass\n\n assert CustomSetAttr.__setattr__ != object.__setattr__",
"def test_setattr_auto_detect_if_no_cust... | [
"0.77814865",
"0.7495043",
"0.7462191",
"0.7026276",
"0.68651897",
"0.68569106",
"0.68569106",
"0.68569106",
"0.68569106",
"0.68569106",
"0.68569106",
"0.68569106",
"0.68569106",
"0.6846083",
"0.6846083",
"0.6846083",
"0.6846083",
"0.6846083",
"0.6846083",
"0.6846083",
"0.684... | 0.6858657 | 5 |
Generated __setattr__ has a useful docstring. | def test_docstring(self):
assert (
"Method generated by attrs for class WithOnSetAttrHook."
== WithOnSetAttrHook.__setattr__.__doc__
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setattr__(self, *args, **kwargs): # real signature unknown\n pass",
"def __setattr__(self, *args, **kwargs): # real signature unknown\n pass",
"def __setattr__(self, *args, **kwargs): # real signature unknown\n pass",
"def __setattr__(self, *args, **kwargs): # real signature unknow... | [
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.843117",
"0.84311... | 0.0 | -1 |
Constrainted Laplacian of Gaussian filter. Takes as input a grayscale nuclear image and binary mask of cell nuclei, and uses the distance transform of the nuclear mask to constrain the LoG filter response of the image for nuclear seeding. Returns a LoG filter image of type float. Local maxima are used for seeding cells... | def cLoG(I, Mask, SigmaMin=30*1.414, SigmaMax=50*1.414):
# convert intensity image type to float if needed
if I.dtype == np.uint8:
I = I.astype(np.float)
# generate distance map
Distance = sp.ndimage.morphology.distance_transform_edt(Mask)
# initialize constraint
Constraint = np.maxim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcn(img, thresh, gfilt):\n avg_img = np.empty(img.shape, dtype=np.float64)\n scipy.ndimage.filters.convolve(img, gfilt, avg_img)\n centered = img - avg_img\n sq_img = np.empty(img.shape, dtype=np.float64)\n scipy.ndimage.filters.convolve(np.square(centered), gfilt, sq_img)\n root = np.sqrt(sq_img)\n m =... | [
"0.6204083",
"0.60610914",
"0.58216476",
"0.5777091",
"0.5712492",
"0.5710392",
"0.5610931",
"0.55194986",
"0.551566",
"0.54477483",
"0.54334116",
"0.5385634",
"0.5357108",
"0.53319645",
"0.5304594",
"0.53042614",
"0.5285089",
"0.5263812",
"0.52260673",
"0.5215801",
"0.518726... | 0.64931256 | 0 |
1. A bar chart with the same color and labeled without data. | def draw_bar1(self, x, y):
self.fig.clf()
self.axes = self.fig.add_subplot(111)
self.axes.set_title('1.The cost of patients choosing different pathways')
self.axes.barh(x, y)
font_size = 6
self.axes.tick_params(labelsize=font_size)
self.draw() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bar(data: Union[pd.DataFrame, pd.Series],\n value_column=None, label_column=None,\n color_column=None, cmap=None, color=None,\n xlabel=None, ylabel=None, title=None,\n figsize=(10, 4), pad=1, pos=(0, 0), rowspan=1, colspan=1,\n file_name=None, file_dpi=300):\n\n if isinsta... | [
"0.74000317",
"0.72542155",
"0.71665883",
"0.7078172",
"0.68889624",
"0.6844603",
"0.68371",
"0.6836461",
"0.6784205",
"0.67773545",
"0.67771155",
"0.67512256",
"0.6721565",
"0.6666821",
"0.66483825",
"0.66345704",
"0.6617605",
"0.66004235",
"0.6598137",
"0.6576764",
"0.65703... | 0.0 | -1 |
2. A bar chart with different colors and labeled with each data. | def draw_bar2(self, x, y):
self.fig.clf()
self.axes = self.fig.add_subplot(111)
self.axes.set_title('2.The cost of patients choosing different pathways')
self.axes.barh(x, y, color=self.color_list)
font_size = 6
self.axes.tick_params(labelsize=font_size)
b ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bar(data: Union[pd.DataFrame, pd.Series],\n value_column=None, label_column=None,\n color_column=None, cmap=None, color=None,\n xlabel=None, ylabel=None, title=None,\n figsize=(10, 4), pad=1, pos=(0, 0), rowspan=1, colspan=1,\n file_name=None, file_dpi=300):\n\n if isinsta... | [
"0.74289125",
"0.7392536",
"0.722034",
"0.720537",
"0.7200412",
"0.71163076",
"0.70647323",
"0.7047128",
"0.7032189",
"0.6995194",
"0.69897014",
"0.69702876",
"0.6877032",
"0.6859369",
"0.68486077",
"0.6804653",
"0.67660093",
"0.67579967",
"0.6725358",
"0.67028886",
"0.669300... | 0.0 | -1 |
3.A bar charts with different colors without labeled data | def draw_bar3(self, x, y):
self.fig.clf()
self.axes = self.fig.add_subplot(111)
self.axes.set_title('3.The cost of patients choosing different pathways')
self.axes.barh(x, y, color=self.color_list)
font_size = 6
self.axes.tick_params(labelsize=font_size)
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bar(data: Union[pd.DataFrame, pd.Series],\n value_column=None, label_column=None,\n color_column=None, cmap=None, color=None,\n xlabel=None, ylabel=None, title=None,\n figsize=(10, 4), pad=1, pos=(0, 0), rowspan=1, colspan=1,\n file_name=None, file_dpi=300):\n\n if isinsta... | [
"0.7202175",
"0.6913581",
"0.6909191",
"0.68925446",
"0.6669512",
"0.6642995",
"0.66204244",
"0.6586149",
"0.6562707",
"0.6478913",
"0.64720976",
"0.64704615",
"0.6443984",
"0.64294785",
"0.6396952",
"0.6360426",
"0.6346596",
"0.63410693",
"0.6326271",
"0.6323252",
"0.6317655... | 0.0 | -1 |
Sets the pedestrian_comfort_map of this WindComfort. | def pedestrian_comfort_map(self, pedestrian_comfort_map):
self._pedestrian_comfort_map = pedestrian_comfort_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_map(self, map):\n self.map = map",
"def setMap(self, map):\n if isinstance(map, ConfigMap):\n self.map = map",
"def setMap(self, map):\n if isinstance(map, ConfigMap):\n self.map = map",
"def SetMap(self,a):\r\n self.Map = a",
"def map(self, map):\n... | [
"0.6312768",
"0.612383",
"0.612383",
"0.5837033",
"0.57142717",
"0.556214",
"0.5506135",
"0.54019105",
"0.5372365",
"0.52832156",
"0.5277147",
"0.5130105",
"0.50886357",
"0.5063968",
"0.50252503",
"0.50073653",
"0.4996778",
"0.49863505",
"0.49726117",
"0.49269974",
"0.4910486... | 0.84702694 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.