query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Sets the next node | def setNext(self, nextNode):
self.__next = nextNode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_next(self, node):\r\n self.__next = node",
"def set_next(self, node):\n self.__next = node",
"def set_next(node, value):\n node['next'] = value",
"def setNext(self, next_node):\n self.__nextListNode = next_node",
"def setNext(self, next):\n\t\t\tself.next = next",
... | [
"0.8843889",
"0.8778931",
"0.8473048",
"0.84528697",
"0.83532506",
"0.8179302",
"0.7554658",
"0.7554658",
"0.7426825",
"0.7420493",
"0.72977376",
"0.7261368",
"0.722911",
"0.6976248",
"0.6957795",
"0.6923199",
"0.6881684",
"0.67661965",
"0.67643106",
"0.66787094",
"0.6670903"... | 0.88359255 | 1 |
Create a new CommandManager with the specified commands. Each argument is a pair containing the name, attrib pairs, as the __setitem__ method is called on each element. | def __init__(self, *commands):
self.cmds = dict()
for nm, attr in commands:
self[nm] = attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, command_list: list = None) -> None:\n if command_list is None:\n command_list = implemented_commands\n for command in command_list:\n setattr(self, command.get(\"name\").replace(\" \", \"_\"), self._SingleCommand(command))",
"def set_commands(self, commands,... | [
"0.70388836",
"0.6526105",
"0.6514899",
"0.65065366",
"0.6475493",
"0.6474638",
"0.6471777",
"0.6467955",
"0.6325269",
"0.62973154",
"0.6256178",
"0.62097096",
"0.6202347",
"0.6164374",
"0.6151688",
"0.61034733",
"0.60576606",
"0.6051253",
"0.60477805",
"0.60348785",
"0.60159... | 0.7571806 | 0 |
Create and register a command with the name item. This is a shortcut for constructing a Command and registering it with the register method. attribs is a list containing arguments to be sent to Command's constructor. Raises TypeError if attribs is not a list. | def __setitem__(self, name, attribs):
assert(type(attribs) is list)
self.register(Command(*([name] + attribs))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, name, command):",
"def register_command(\n self, func, name=None, description=None, show_if=True, args_opts=None\n ):\n name = name or func.__name__\n if name in self._commands:\n raise NameError(\"This command already exists\")\n self._commands[name] = Com... | [
"0.60257137",
"0.5921839",
"0.5862189",
"0.58104455",
"0.5772847",
"0.5719808",
"0.56287426",
"0.5623136",
"0.56083953",
"0.555473",
"0.5527089",
"0.54834545",
"0.54792297",
"0.5476723",
"0.5469289",
"0.5455345",
"0.5449943",
"0.5447708",
"0.54236454",
"0.53810966",
"0.536488... | 0.76530105 | 0 |
Create a new command description. name is the name of the command that the user must type at the prompt. switches is a dictionary that maps from the allowed command line switch keys to the type of their values. | def __init__(self, name, switches = dict()):
self.name = name
self.data = CmdData()
self.data.switches = switches | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generic(self, switches=[\"--help\"]):\n return self._command_template(switches)",
"def add_command(self, name, command):\n if command['type'] == 'topic':\n if 'deadman_buttons' not in command:\n command['deadman_buttons'] = []\n command['buttons'] = command[... | [
"0.5894565",
"0.5829862",
"0.58222437",
"0.57666796",
"0.57283145",
"0.5709916",
"0.56761897",
"0.56290853",
"0.54858685",
"0.53589696",
"0.535696",
"0.5352396",
"0.5328115",
"0.53232706",
"0.53141785",
"0.52954423",
"0.52918684",
"0.52891374",
"0.52443874",
"0.5243947",
"0.5... | 0.7299439 | 0 |
return point subtraction PQ | def sub(self, P, Q):
if not (isinstance(P, list) and isinstance(Q, list)):
raise ValueError("point P (resp. Q) must be [px, py] (resp. [qx, qy])")
#if not (self.whetherOn(P) and self.whetherOn(Q)):
# raise ValueError("either points must not be point on curve.")
if (P != s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distPlusProche(p,pts):\r\n\tpoints=pts[::]\r\n\r\n\t#on enleve p de la liste des points en cas de répétition\r\n\tif p in points:\r\n\t\tpoints.remove(p)\r\n\t#on initialise mini avec la distance au premier point de la liste des points\r\n\tmini=sqrt((p[0]-points[0][0])**2+(p[1]-points[0][1])**2)\r\n\t#on comp... | [
"0.6209783",
"0.61296666",
"0.6119025",
"0.60799325",
"0.601719",
"0.60124487",
"0.5937315",
"0.589836",
"0.5858705",
"0.5838884",
"0.58062047",
"0.5790279",
"0.5783874",
"0.5770873",
"0.5753462",
"0.57291937",
"0.56820744",
"0.5646534",
"0.56439734",
"0.5640057",
"0.56353885... | 0.6233835 | 0 |
create ECoverGF object. coefficient must be length 5 or 2 list(represent as Weierstrass form), any coefficient is in basefield. basefield must be FiniteField subclass object (i.e. FinitePrimeField or FiniteExtendedField object.) | def __init__(self, coefficient, basefield=None):
# parameter parse
try:
character = basefield.getCharacteristic()
field = basefield
except AttributeError:
# backward compatibility
if isinstance(basefield, int):
field = finitefield.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, coefficient, basefield=None):\n\n try:\n character = basefield.getCharacteristic()\n self.basefield = basefield\n except:\n # backward compatibility support\n if isinstance(basefield, rational.RationalField) or (not basefield):\n ... | [
"0.7700947",
"0.7550249",
"0.5849628",
"0.57276404",
"0.5529813",
"0.54793984",
"0.5438513",
"0.5421472",
"0.5373099",
"0.53684545",
"0.5364152",
"0.53532964",
"0.53478926",
"0.5296262",
"0.5295814",
"0.5292675",
"0.5222808",
"0.5217962",
"0.5138603",
"0.51261836",
"0.5115176... | 0.77263165 | 0 |
Return (E(F_q) mod 2, 2). char(F_q) > 3 is required. For odd characteristic > 3, t = E(F_q) mod 2 is determined by gcd(self.cubic, X^q X) == 1 t = 1 mod 2. | def _Schoof_mod2(self):
if not self.b:
result = 0
_log.debug("(%d, 2) #" % result)
else:
linearfactors = UniVarPolynomial({card(self.basefield):self.basefield.one, 1:-self.basefield.one}, self.basefield)
if GCD(self.cubic, linearfactors).degree() == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cdq2(f, x, h=1e-5):\n return (f(x+h)-f(x-h))/(2*h)\n raise NotImplementedError(\"Problem 2 Incomplete\")",
"def fdq2(f, x, h=1e-5):\n return (-3*f(x) + 4*f(x+h) - f(x+2*h))/(2*h)\n raise NotImplementedError(\"Problem 2 Incomplete\")",
"def _qod_func(self, q):\n if self.qodulus is None:\n... | [
"0.62949723",
"0.6072696",
"0.6047673",
"0.60077405",
"0.5969821",
"0.58834136",
"0.5818508",
"0.5785059",
"0.5768946",
"0.57607234",
"0.57607234",
"0.5751263",
"0.57377785",
"0.56866693",
"0.5677456",
"0.56761426",
"0.5631534",
"0.55737287",
"0.5560761",
"0.55440897",
"0.554... | 0.6415687 | 0 |
Return q + 1 E(F_q) mod l. | def _Schoof_mod_l(self, l):
if l == 2:
return self._Schoof_mod2()
E = self.cubic
D = self.division_polynomials
lth_div = self.division_polynomials[l]
field = self.basefield
bfsize = card(field)
x = UniVarPolynomial({1:field.one}, field)
k = bfs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _qod_func(self, q):\n if self.qodulus is None:\n return q\n else:\n return q % self.qodulus",
"def get_Lfrac_lam(Lfrac, Lstar_10, qlf):\n D = np.tile(qlf.c_B*Lstar_10**qlf.k_B, [len(Lfrac),1])\n Lfrac_2D = np.tile(Lfrac, [len(qlf.c_B),1]).T\n return np.sum(D,axis=... | [
"0.63242245",
"0.6048697",
"0.604789",
"0.60234493",
"0.6019692",
"0.59919757",
"0.5964788",
"0.5957644",
"0.5908941",
"0.58902335",
"0.58847684",
"0.58826154",
"0.5871628",
"0.58220357",
"0.5778957",
"0.5749423",
"0.57393897",
"0.5737276",
"0.568636",
"0.56816006",
"0.564642... | 0.7297415 | 0 |
Return the Frobenius trace t = q + 1 E(F_q), where q is basefield cardinality. If index is an integer greater than 1, then return the trace t = q^r + 1 E(F_q^r) for a subfield curve defined over F_q. | def trace(self, index=None):
bfsize = card(self.basefield)
if not self.ord:
if bfsize == self.ch: # prime field
# special cases
if bfsize == 2 or bfsize == 3:
trace = self._order_to_trace(self.order())
# trace main block
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fib(index):\n return round((GR**index)/R5)",
"def get_quad_trace(self, quad_idx):\n if quad_idx >= self.num_quads or quad_idx < 0:\n raise I2CException(\"Illegal quad index {} specified\".format(quad_idx))\n\n return self.__quad_traces[quad_idx]",
"def fir(X, y, trial_index, win... | [
"0.5615964",
"0.54338056",
"0.5380275",
"0.53494614",
"0.5307276",
"0.52833897",
"0.51446927",
"0.5138274",
"0.513018",
"0.5049757",
"0.5013984",
"0.500352",
"0.49888217",
"0.4975394",
"0.49607137",
"0.49477506",
"0.49375767",
"0.4933698",
"0.49302754",
"0.4928633",
"0.492608... | 0.6860514 | 0 |
Return E(F_q) or E(F_{q^r}). E is defined over F_q. If the method is called as E.order(), the result is E(F_q). If the method is called as E.order(r), the result is E(F_{q^r}). | def order(self, index=None):
bfsize = card(self.basefield)
if not self.ord:
if self.ch in (2, 3):
if bfsize == self.ch == 2:
self.ord = self._order_2()
elif bfsize == self.ch == 3:
self.ord = self._order_3()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def E(q, r0, x, y):\n den = np.hypot(x - r0[0], y - r0[1]) ** 3\n return q * (x - r0[0]) / den, q * (y - r0[1]) / den",
"def order(self):\n if self.rank == 0:\n return S.One\n else:\n return S.Infinity",
"def order(self):\n if self._order is not None:\n ... | [
"0.55480236",
"0.5491219",
"0.5490189",
"0.546878",
"0.5363571",
"0.53605866",
"0.5355352",
"0.5297144",
"0.52107143",
"0.51803726",
"0.51718414",
"0.5158498",
"0.5098094",
"0.5098094",
"0.50961256",
"0.5086906",
"0.5086257",
"0.50722677",
"0.5063549",
"0.5031349",
"0.5021625... | 0.550242 | 1 |
find point order of P and return order. | def pointorder(self, P, ord=None, f=None):
# parameter ord and f are extension for structre.
if ord:
N = ord
else:
N = self.order()
if f:
l = f
else:
l = factor_methods.factor(N)
o = 1
for p, e in l:
B = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_point_order(point, field, a_value, b_value):\n order = int(2)\n try:\n s_point = add_points(point, point, field, a_value, b_value)\n except ValueError:\n return order\n while True:\n try:\n s_point = add_points(s_point, point, field, a_value, b_value)\n ... | [
"0.71685904",
"0.6964563",
"0.67810553",
"0.64402294",
"0.6379234",
"0.63468045",
"0.631201",
"0.6015451",
"0.5895901",
"0.5851597",
"0.5826416",
"0.571477",
"0.5679976",
"0.56701523",
"0.5660304",
"0.56364566",
"0.56116635",
"0.5606401",
"0.5592746",
"0.5569785",
"0.556012",... | 0.7694008 | 0 |
computing the TateLichetenbaum pairing with Miller's algorithm. parameters satisfies that mul(m,P)==[0]. | def TatePairing(self, m, P, Q):
O = self.infpoint
if self.mul(m, P) != O:
raise ValueError("sorry, not mP=[0].")
if P == O or Q == O:
return self.basefield.one
forbidden = [O, P, self.mul(-1, Q), self.sub(P, Q)]
R = self.add(P, Q)
T = False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Langmuir_Knudsen_mdot(D, T_p, Psat, Re, mu_g, cp_g, lambda_g, P_g, R_g, Sc_g, R_v, Yinf):\n Pr_g = mu_g * cp_g / lambda_g # Gas Prandtl Number\n Sh = 2.0 + 0.552 * math.sqrt(Re) * Sc_g ** (1.0/3.0) \n Re_b = 0.0 #Blowing Reynolds number \n Re_b0 = Re_b \n Xseq = min(Psat / P_g, 1.0) ... | [
"0.62009764",
"0.6168753",
"0.598084",
"0.5918141",
"0.5906334",
"0.590612",
"0.5900798",
"0.5865663",
"0.5837559",
"0.56921166",
"0.5651081",
"0.5643009",
"0.5626161",
"0.5586395",
"0.5570056",
"0.5568218",
"0.5552037",
"0.5544669",
"0.5534943",
"0.5525335",
"0.5522545",
"... | 0.6256162 | 0 |
computing the Weil pairing with Miller's algorithm. we assume point P and Q that be in different mtortion group . | def WeilPairing(self, m, P, Q):
O = self.infpoint
if self.mul(m, P) != O or self.mul(m, Q) != O:
raise ValueError("sorry, not mP=[0] or mQ=[0].")
if P == O or Q == O or P == Q:
return self.basefield.one
T = U = False
forbidden = [O, P, Q, self.sub(Q, P)]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TatePairing(self, m, P, Q):\n O = self.infpoint\n if self.mul(m, P) != O:\n raise ValueError(\"sorry, not mP=[0].\")\n\n if P == O or Q == O:\n return self.basefield.one\n\n forbidden = [O, P, self.mul(-1, Q), self.sub(P, Q)]\n R = self.add(P, Q)\n ... | [
"0.64339936",
"0.6327372",
"0.60780907",
"0.58735853",
"0.5789274",
"0.5718296",
"0.5703921",
"0.56716573",
"0.5662825",
"0.5588504",
"0.55884796",
"0.55807567",
"0.55518264",
"0.55494714",
"0.55421656",
"0.55327725",
"0.55300945",
"0.55287695",
"0.55058295",
"0.5497134",
"0.... | 0.7943096 | 0 |
calculate gamma passing rate as percentage of voxels with gamma index >= 1.0 Optionally, a mask may be provided which excludes all voxels with mask==0 | def gamma_passing_rate(gamma_map, mask=None):
if mask is None:
passing = np.count_nonzero(gamma_map<=1.0)
total = gamma_map.size
else:
mask = mask.astype(bool)
masked_gamma_map = gamma_map[mask]
try:
passing = np.count_nonzero(masked_gamma_map<=1.0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gamma(x):\n return 0.0",
"def get_gamma(self, conv_op):",
"def general_gamma_binary(uv, wavel, sep, PA, contrast):\n x, y = uv[:, 0], uv[:, 1]\n k = 2 * np.pi / wavel\n beta = mas2rad(sep)\n th = np.deg2rad(PA)\n i2 = 1\n i1 = 1 / contrast\n phi1 = k * x * beta * np.cos(th)/2\n... | [
"0.6066738",
"0.5949536",
"0.5939618",
"0.59219104",
"0.5909373",
"0.5858351",
"0.5855014",
"0.5844399",
"0.5783322",
"0.577106",
"0.56844586",
"0.5661877",
"0.5652896",
"0.56257683",
"0.5585807",
"0.55354697",
"0.55228657",
"0.5496603",
"0.54677624",
"0.54339266",
"0.5406796... | 0.7279056 | 0 |
Get the KML note label, use tag if exists or content otherwise | def getLabel(self):
return self.content[:12] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLabel(self):\n result = self.content[:12]\n if result == \"\":\n if self.tags:\n result = str(self.tags.first)\n return result",
"def bb_label(hit):\n try:\n labelid = hit.group(1)\n label = Label.objects.get(id=labelid)\n T = loader.g... | [
"0.68905085",
"0.60365885",
"0.60078704",
"0.5971835",
"0.592358",
"0.5905867",
"0.5823123",
"0.58201313",
"0.58201313",
"0.57901335",
"0.57656944",
"0.5765235",
"0.5754746",
"0.57501554",
"0.5739777",
"0.57387817",
"0.57319796",
"0.57198286",
"0.57072467",
"0.5698205",
"0.56... | 0.61446136 | 1 |
Get the KML note label, use tag if exists or content otherwise | def getLabel(self):
result = self.content[:12]
if result == "":
if self.tags:
result = str(self.tags.first)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLabel(self):\n return self.content[:12]",
"def bb_label(hit):\n try:\n labelid = hit.group(1)\n label = Label.objects.get(id=labelid)\n T = loader.get_template('webview/t/label.html')\n C = Context({ 'L' : label })\n return T.render(C)\n except:\n # U... | [
"0.61443484",
"0.6037176",
"0.6007812",
"0.5971338",
"0.59226274",
"0.5905204",
"0.5823537",
"0.58204675",
"0.58204675",
"0.5789757",
"0.57661796",
"0.5764314",
"0.575489",
"0.5750842",
"0.5740014",
"0.5737503",
"0.57311463",
"0.5720551",
"0.57075447",
"0.56981486",
"0.569814... | 0.6890144 | 0 |
Overrides default queryset to only display parent items | def get_queryset(self, request):
query = super(GipsyMenu, self).get_queryset(request)
return query.filter(parent__isnull=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queryset(self, request, queryset):\r\n # Compare the requested value to decide how to filter the queryset.\r\n if self.value():\r\n return queryset.filter(parent_id=self.value())\r\n return queryset",
"def get_children_queryset(self):\n pass",
"def get_query_set(self)... | [
"0.7645417",
"0.69569004",
"0.68567455",
"0.6710352",
"0.6638177",
"0.6477407",
"0.63991666",
"0.63664937",
"0.62955433",
"0.6254188",
"0.6236161",
"0.6217325",
"0.6079583",
"0.6017169",
"0.59940475",
"0.58996534",
"0.58132213",
"0.57855225",
"0.5774182",
"0.5771834",
"0.5758... | 0.75941396 | 1 |
Context manager that ignores all of the specified exceptions. This will be in the standard library starting with Python 3.4. | def ignored(*exceptions):
try:
yield
except exceptions:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suppress(*exceptions):\n try:\n yield\n except exceptions:\n pass",
"def suppress(*exceptions):\n try:\n yield\n except exceptions:\n pass",
"def try_safety():\n try:\n yield\n except Exception as e:\n pass",
"def ignored(*except... | [
"0.70430624",
"0.7007877",
"0.69663656",
"0.68010443",
"0.6427322",
"0.6322548",
"0.62421846",
"0.62271523",
"0.61808586",
"0.60907197",
"0.6061941",
"0.60145235",
"0.5924392",
"0.59193337",
"0.58716965",
"0.5760053",
"0.57316",
"0.57221574",
"0.56928086",
"0.56844944",
"0.56... | 0.7026229 | 1 |
Create a Grid2DIterate (see Grid2DIterate.__new__) from a mask, where only unmasked pixels are included in the grid (if the grid is represented in 2D masked values are (0.0, 0.0)). The mask's pixel_scales and origin properties are used to compute the grid (y,x) coordinates. | def from_mask(
cls,
mask: Mask2D,
fractional_accuracy: float = 0.9999,
relative_accuracy: Optional[float] = None,
sub_steps: Optional[List[int]] = None,
) -> "Grid2DIterate":
grid_slim = grid_2d_util.grid_2d_slim_via_mask_from(
mask_2d=mask, pixe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_grid(self):\n xg, yg = self._build_grid()\n mask = self._build_mask(xg, yg)\n mask = mask.reshape(xg.shape)\n\n return xg, yg, mask",
"def via_mask_from(self, mask: Mask2D) -> Visuals2D:\r\n origin = self.origin_via_mask_from(mask=mask)\r\n mask_visuals = self.... | [
"0.640892",
"0.62864256",
"0.617731",
"0.6063297",
"0.6046105",
"0.5762346",
"0.5672607",
"0.5672142",
"0.55856997",
"0.5567239",
"0.5490645",
"0.5472396",
"0.5471098",
"0.5451633",
"0.5439843",
"0.54312015",
"0.542528",
"0.54130954",
"0.5345164",
"0.5322865",
"0.5314616",
... | 0.7251152 | 0 |
Setup a blurringgrid from a mask, where a blurring grid consists of all pixels that are masked (and therefore have their values set to (0.0, 0.0)), but are close enough to the unmasked pixels that their values will be convolved into the unmasked those pixels. This when computing images from light profile objects. See G... | def blurring_grid_from(
cls,
mask: Mask2D,
kernel_shape_native: Tuple[int, int],
fractional_accuracy: float = 0.9999,
relative_accuracy: Optional[float] = None,
sub_steps: Optional[List[int]] = None,
) -> "Grid2DIterate":
blurring_mask = mask.derive_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_grid(self):\n xg, yg = self._build_grid()\n mask = self._build_mask(xg, yg)\n mask = mask.reshape(xg.shape)\n\n return xg, yg, mask",
"def blurred_image_2d_from_grid_and_psf(self, grid, psf, blurring_grid):\r\n\r\n if not self.has_light_profile:\r\n return ... | [
"0.6808554",
"0.6480119",
"0.60403734",
"0.5912199",
"0.5645802",
"0.5559395",
"0.555485",
"0.555485",
"0.5522488",
"0.5516855",
"0.5453732",
"0.5431576",
"0.5390356",
"0.5356915",
"0.5345018",
"0.5330812",
"0.53234375",
"0.53123385",
"0.5288054",
"0.5263885",
"0.52208006",
... | 0.6980832 | 0 |
Return a ``Grid2D`` where the data is stored its ``slim`` representation, which is an ndarray of shape [total_unmasked_pixels sub_size2, 2]. If it is already stored in its ``slim`` representation it is returned as it is. If not, it is mapped from ``native`` to ``slim`` and returned as a new ``Grid2D``. | def slim(self) -> "Grid2DIterate":
return Grid2DIterate(
values=self,
mask=self.mask,
fractional_accuracy=self.fractional_accuracy,
sub_steps=self.sub_steps,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padded_grid_from(self, kernel_shape_native: Tuple[int, int]) -> \"Grid2DIterate\":\r\n shape = self.mask.shape\r\n\r\n padded_shape = (\r\n shape[0] + kernel_shape_native[0] - 1,\r\n shape[1] + kernel_shape_native[1] - 1,\r\n )\r\n\r\n padded_mask = Mask2D.all_... | [
"0.5512386",
"0.54331136",
"0.52063835",
"0.5182092",
"0.51143974",
"0.4989602",
"0.48805118",
"0.4852229",
"0.4849482",
"0.481266",
"0.48116904",
"0.48049447",
"0.4779547",
"0.47336814",
"0.4730924",
"0.47078955",
"0.4703412",
"0.46861225",
"0.46810302",
"0.46566904",
"0.464... | 0.5710812 | 0 |
Returns a new Grid2DIterate from this grid, where the (y,x) coordinates of this grid have a grid of (y,x) values, termed the deflection grid, subtracted from them to determine the new grid of (y,x) values. This is used by PyAutoLens to perform grid raytracing. | def grid_2d_via_deflection_grid_from(
self, deflection_grid: np.ndarray
) -> "Grid2DIterate":
return Grid2DIterate(
values=self - deflection_grid,
mask=self.mask,
fractional_accuracy=self.fractional_accuracy,
sub_steps=self.sub_steps,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid(self) -> aa.Grid2D:\r\n return self.analysis.dataset.grid",
"def slim(self) -> \"Grid2DIterate\":\r\n return Grid2DIterate(\r\n values=self,\r\n mask=self.mask,\r\n fractional_accuracy=self.fractional_accuracy,\r\n sub_steps=self.sub_steps,\r\n ... | [
"0.6189202",
"0.6080999",
"0.600252",
"0.5957412",
"0.5948264",
"0.5944243",
"0.58593035",
"0.5677554",
"0.56470937",
"0.5636628",
"0.5587175",
"0.5562993",
"0.5488128",
"0.54877734",
"0.54263955",
"0.54227567",
"0.53559494",
"0.5355037",
"0.53536683",
"0.53376454",
"0.533128... | 0.794933 | 0 |
Returns the blurring grid from a grid and create it as a Grid2DIterate, via an input 2D kernel shape. For a full description of blurring grids, checkout blurring_grid_from. | def blurring_grid_via_kernel_shape_from(
self, kernel_shape_native: Tuple[int, int]
) -> "Grid2DIterate":
return Grid2DIterate.blurring_grid_from(
mask=self.mask,
kernel_shape_native=kernel_shape_native,
fractional_accuracy=self.fractional_accuracy,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blurred_image_2d_from_grid_and_psf(self, grid, psf, blurring_grid):\r\n\r\n if not self.has_light_profile:\r\n return np.zeros(shape=grid.shape_slim)\r\n\r\n image = self.image_2d_from_grid(grid=grid)\r\n\r\n blurring_image = self.image_2d_from_grid(grid=blurring_grid)\r\n\r\n ... | [
"0.7138937",
"0.7138747",
"0.69914216",
"0.63918656",
"0.6009551",
"0.5876295",
"0.5850692",
"0.5623698",
"0.5560852",
"0.5542704",
"0.5464336",
"0.54251134",
"0.5424638",
"0.5364959",
"0.5306676",
"0.52881783",
"0.5256264",
"0.5230065",
"0.5176634",
"0.51338965",
"0.506968",... | 0.7158281 | 0 |
Returns the resulting iterated array, by mapping it to 1D and then passing it back as an ``Array2D`` structure. | def return_iterated_array_result(self, iterated_array: Array2D) -> Array2D:
iterated_array_1d = array_2d_util.array_2d_slim_from(
mask_2d=self.mask, array_2d_native=iterated_array, sub_size=1
)
return Array2D(values=iterated_array_1d, mask=self.mask.derive_mask.sub_1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getArray2d(self):\n\t\treturn self.array2d",
"def to_2d_array(self):\n return reshape_fns.to_2d(self._obj, raw=True)",
"def transform(self, x: Array2D) -> Array2D:",
"def getIntArray2D(self) -> typing.List[typing.List[int]]:\n ...",
"def getShortArray2D(self) -> typing.List[typing.List[in... | [
"0.68928725",
"0.67711896",
"0.6701381",
"0.6635095",
"0.61929125",
"0.61611664",
"0.6145428",
"0.61135894",
"0.6046715",
"0.6029555",
"0.6016695",
"0.5990024",
"0.59658796",
"0.59533745",
"0.59407365",
"0.5928865",
"0.5895125",
"0.5891846",
"0.58794075",
"0.5870737",
"0.5867... | 0.7220839 | 0 |
Iterate over a function that returns a grid of values until the it meets a specified fractional accuracy. The function returns a result on a pixelgrid where evaluating it on more points on a higher resolution subgrid followed by binning lead to a more precise evaluation of the function. For the fractional accuracy of t... | def iterated_grid_from(
self, func: Callable, cls: object, grid_lower_sub_2d: Grid2D
) -> Grid2D:
if not np.any(grid_lower_sub_2d):
return grid_lower_sub_2d.slim
iterated_grid = np.zeros(shape=(self.shape_native[0], self.shape_native[1], 2))
threshold_mask_low... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exercise_1():\n a, b = 5, 0\n fvals = []\n grid = np.linspace(-3, 4)\n for value in grid:\n fvals.append(get_test_function(value, a, b))\n plt.plot(grid, fvals)",
"def defint(func, start, stop, accuracy=0.0001, strict=False):\n if strict:\n step = accuracy\n endpoi... | [
"0.5490733",
"0.51834524",
"0.51618934",
"0.51331407",
"0.5127401",
"0.5124928",
"0.50899917",
"0.5055024",
"0.50248444",
"0.49940372",
"0.49591714",
"0.49212068",
"0.4916253",
"0.48678684",
"0.4826238",
"0.48227394",
"0.48163268",
"0.48041344",
"0.4802279",
"0.47982275",
"0.... | 0.58399826 | 0 |
Load a image as a grayscale image. | def read_gray_scale_image(data_path):
return cv2.imread(data_path, cv2.IMREAD_GRAYSCALE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_gray_scale(img):\r\n #reading image\r\n im = Image.open(\"filename\")\r\n\r\n if im.mode != \"L\":\r\n im = im.convert(\"L\")\r\n\r\n return img",
"def grayscale(filename):\r\n image = SimpleImage(filename)\r\n for pixel in image:\r\n luminosity = compute_luminosity... | [
"0.7677413",
"0.72421336",
"0.7167619",
"0.71243984",
"0.70681775",
"0.70260924",
"0.7020777",
"0.7017632",
"0.6979911",
"0.6973627",
"0.6949091",
"0.69090724",
"0.6899337",
"0.6897582",
"0.68768406",
"0.6867652",
"0.68171",
"0.6773599",
"0.6762041",
"0.6756517",
"0.6756517",... | 0.72882986 | 1 |
Create the test context by specifying expectation and function. | def __init__(self, expected, test_func):
self._f = test_func
self._exp = expected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context():\n\n class FakeContext:\n function_name = \"FUNCTION_NAME\"\n memory_limit_in_mb = 1024\n invoked_function_arn = \"INVOKED_FUNCTION_ARN\"\n aws_request_id = \"AWS_REQUEST_ID\"\n log_group_name = \"LOG_GROUP_NAME\"\n log_stream_name = \"LOG_STREAM_NAME\"\n\... | [
"0.64805484",
"0.5710913",
"0.55915433",
"0.55788904",
"0.5570544",
"0.5555014",
"0.5532453",
"0.55062556",
"0.545592",
"0.5408811",
"0.53556156",
"0.53464824",
"0.5333984",
"0.5333984",
"0.5314075",
"0.53116554",
"0.53097886",
"0.52955264",
"0.52648",
"0.52648",
"0.5262759",... | 0.5939782 | 1 |
Takes as input two dictionaries containing node>infection time and filter only the items that correspond to observer nodes, up to the max number of observers | def filter_diffusion_data(infected, obs, max_obs=np.inf):
### Filter only observer nodes
obs_time = dict((k,v) for k,v in infected.items() if k in obs)
### If maximum number does not include every observer, we pick the max_obs closest ones
if max_obs < len(obs_time):
### Sorting according to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _FilterMMarks(self):\n\n to_remove = []\n tplus1 = datetime.datetime.now() - datetime.timedelta(hours=1)\n\n for (i, (m1, m2)) in enumerate(self._mmarks):\n if (m1.starttime < tplus1):\n to_remove.append(i)\n\n to_remove.reverse()\n for i in to_remov... | [
"0.5169515",
"0.5160301",
"0.5146102",
"0.50290227",
"0.50263584",
"0.50080407",
"0.49891952",
"0.49636072",
"0.4950326",
"0.49214664",
"0.48818153",
"0.48559263",
"0.4845422",
"0.48023024",
"0.47504705",
"0.47441253",
"0.47315213",
"0.4721948",
"0.47171888",
"0.4712595",
"0.... | 0.6450988 | 0 |
Contructor. Sets up the eyepoint, lookat and up arrays. | def __init__(self):
self.eyepoint = np.array([*self.eyepoint], dtype=np.float32)
self.lookat = np.array([*self.lookat], dtype=np.float32)
self.up = np.array([*self.up], dtype=np.float32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.location = [(0, 0), (0, 1)]\n self.hit = (0, 0)",
"def setUp(self):\n\n self.eps = 0.001 # Accept 0.1 % relative error\n\n self.RSISE = Point(-35.27456, 149.12065)\n self.Home = Point(-35.25629, 149.12494) # 28 Scrivener Street, ACT\n self.... | [
"0.683656",
"0.65527457",
"0.64761674",
"0.64761674",
"0.6473272",
"0.63640285",
"0.6351586",
"0.62831527",
"0.625638",
"0.6231856",
"0.6194024",
"0.61840737",
"0.61764055",
"0.61608475",
"0.6154139",
"0.6148525",
"0.6146855",
"0.61170983",
"0.6087394",
"0.60697556",
"0.60492... | 0.80508184 | 0 |
Calculates the view matrix and passes it to a given shader program. | def setup_view(self, shader_program):
n = self.normalize(self.eyepoint - self.lookat)
u = self.normalize(np.cross(self.normalize(self.up), n))
v = self.normalize(np.cross(n, u))
view_mat = np.array([u[0], v[0], n[0], 0.0,
u[1], v[1], n[1], 0.0,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_shader(self):\r\n self.attrib_locs = {\r\n \"mc_vertex\": -1,\r\n \"vert_tex_coord\": -1,\r\n }\r\n self.uniform_locs = {\r\n \"model_matrix\": -1,\r\n \"view_matrix\": -1,\r\n \"proj_matrix\": -1,\r\n }\r\n vert_pro... | [
"0.63088703",
"0.59239346",
"0.584722",
"0.58375233",
"0.57614106",
"0.5694943",
"0.5689576",
"0.56452876",
"0.5627314",
"0.5600046",
"0.55844826",
"0.5583802",
"0.54889846",
"0.546197",
"0.5442606",
"0.54422736",
"0.5416303",
"0.5368626",
"0.5350518",
"0.5317088",
"0.5310312... | 0.7835183 | 0 |
Calculates the projection matrix and passes it to a given shader program. | def setup_projection(self, shader_program):
projection_mat = np.array([(2.0*self.near)/(self.right-self.left), 0.0, 0.0, 0.0,
0.0, ((2.0*self.near)/(self.top-self.bottom)), 0.0, 0.0,
((self.right+self.left)/(self.right-self.left)),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_view(self, shader_program):\n n = self.normalize(self.eyepoint - self.lookat)\n u = self.normalize(np.cross(self.normalize(self.up), n))\n v = self.normalize(np.cross(n, u))\n\n view_mat = np.array([u[0], v[0], n[0], 0.0,\n u[1], v[1], n[1], 0.0,\n ... | [
"0.608692",
"0.60102975",
"0.57958746",
"0.5765427",
"0.5765062",
"0.572129",
"0.5591015",
"0.54633194",
"0.5393662",
"0.53903425",
"0.5371064",
"0.5305471",
"0.5304222",
"0.52888876",
"0.5282101",
"0.5274056",
"0.5265391",
"0.52569264",
"0.52486914",
"0.5241514",
"0.5236431"... | 0.7891201 | 0 |
Returns a given vector in normalized form. | def normalize(vector):
return vector / np.linalg.norm(vector) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_normalized_vector(vector):\n # WARN: Zero length may cause problems!\n vector_lenght = get_vector_length(vector)\n if vector_lenght != 0:\n return np.divide(vector, get_vector_length(vector))\n else:\n return [0, 0]",
"def normalizeVector(v):\n normalizer = 1.0 / sum(v)\n\n ... | [
"0.8575221",
"0.83980185",
"0.8287421",
"0.8287125",
"0.82777345",
"0.82405454",
"0.81163174",
"0.81054735",
"0.8068462",
"0.80491674",
"0.79364955",
"0.78791",
"0.7850027",
"0.7793986",
"0.7793986",
"0.7793986",
"0.77850926",
"0.77850926",
"0.77850926",
"0.77850926",
"0.7785... | 0.8422281 | 1 |
Calculate the Planck function for given frequency range and temperature in units of W sr^1 m^2 Hz^1 | def planck_f(nu, T):
return ((2*h*nu**3)/(c**2))*(1./(np.exp((h*nu)/(k*T))-1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planckian(temp, wavelength):\n if wavelength==560: return 100.0\n if temp<60: temp=60 # For simplicity, in very low temperature\n num = wavelength**(-5)\n try:\n v=num / (math.exp(0.0143877687750393/(wavelength*(10**(-9))*temp)) - 1)\n except:\n print(temp)\n print(wavelength)\n ... | [
"0.6799455",
"0.61881703",
"0.618216",
"0.6136792",
"0.6080317",
"0.6044308",
"0.59986985",
"0.5993096",
"0.5970151",
"0.5967164",
"0.59125924",
"0.5905185",
"0.5874795",
"0.58429915",
"0.58087075",
"0.5794045",
"0.5765954",
"0.5755308",
"0.5753622",
"0.5728672",
"0.57057214"... | 0.63436884 | 1 |
Update position of car according to the path | def update_pos(self):
self.imgx=self.pathX[min(self.x,len(self.pathX)-1)]\
[min(self.y,len(self.pathX[self.x])-1)]
self.imgy=self.pathY[min(self.x,len(self.pathY)-1)]\
[min(self.y,len(self.pathY[self.x])-1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, path):\n self.current_location = (path[1][1], path[1][0])",
"def updatePos(self):\n self.timeDriving +=1\n self.pos[0] += self.vx\n self.pos[1] += self.vy",
"def update(self):\n # Move left/right=====\n self.rect.x += self.change_x\n self.rect.y +... | [
"0.6872859",
"0.6630316",
"0.6528707",
"0.6485087",
"0.6460367",
"0.63058037",
"0.6304079",
"0.626132",
"0.6236285",
"0.6215101",
"0.62078655",
"0.6150422",
"0.6096822",
"0.6092482",
"0.6079556",
"0.60738695",
"0.6034675",
"0.6032831",
"0.60220134",
"0.600705",
"0.5996151",
... | 0.68087614 | 1 |
Creates a PlatformParameterModel instance. | def create(
cls,
param_name: str,
rule_dicts: List[platform_parameter_domain.PlatformParameterRuleDict],
rule_schema_version: int,
default_value: platform_parameter_domain.PlatformDataTypes
) -> PlatformParameterModel:
return cls(
id=param_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createParameter(self):\n return _libsbml.Model_createParameter(self)",
"def createParameter(self, name, value):\r\n parameter = Parameter(self)\r\n self.callRemote('createParameter', name, value).chainDeferred(parameter)\r\n return parameter",
"def remote_createParameter(self, n... | [
"0.6038443",
"0.5898745",
"0.57178617",
"0.54691094",
"0.5428996",
"0.52719665",
"0.52563184",
"0.5229282",
"0.5225646",
"0.5200385",
"0.5198576",
"0.5181845",
"0.5179588",
"0.517855",
"0.5129397",
"0.51045793",
"0.5091119",
"0.50768375",
"0.50669825",
"0.5065463",
"0.5036845... | 0.76449805 | 0 |
Get Map of each word count in a string | def get_word_count(my_str):
my_list = my_str.split(" ")
my_map = {}
for word in my_list:
# Strip the word from any character
word = word.strip(".")
word = word.strip(",")
# Convert word to all lowercase
word = word.lower()
if word not in my_map:
my... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_count(input_str):\n counts = dict()\n words = input_str.split()\n for word in words:\n if word in counts:\n counts[word] += 1\n else:\n counts[word] = 1\n\n return counts",
"def word_count(poem):\n lines = [line for line in poem.split(\"\\n\") if line]\... | [
"0.8051829",
"0.7836102",
"0.76682496",
"0.76395476",
"0.76118475",
"0.7599304",
"0.75386703",
"0.7518596",
"0.75086623",
"0.74244153",
"0.7382403",
"0.7335036",
"0.729379",
"0.72932726",
"0.72677284",
"0.726587",
"0.725742",
"0.72382796",
"0.7232885",
"0.7225221",
"0.7218572... | 0.79201156 | 1 |
Holds the neccessary content for the dockerfile for nginx | def get_dockerfile_content(self):
dockerfile_content: List[str] = [
'FROM nginx:latest',
'# Update and install required packages',
'RUN apt-get update',
'RUN apt-get install vim -y',
'',
'COPY ./.docker/config/nginx.conf /etc/nginx/conf.d/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_nginx_config(nginx_root: str, nginx_webroot: str, http_port: int, https_port: int,\n other_port: int, default_server: bool, key_path: Optional[str] = None,\n cert_path: Optional[str] = None, wtf_prefix: str = 'le') -> str:\n key_path = key_path i... | [
"0.64565045",
"0.6387392",
"0.6265688",
"0.6264885",
"0.6121652",
"0.6046972",
"0.5944196",
"0.5906597",
"0.59064484",
"0.58702147",
"0.5849548",
"0.5765242",
"0.56611687",
"0.5653609",
"0.5642426",
"0.56414825",
"0.56217706",
"0.5584245",
"0.5574183",
"0.55173683",
"0.549974... | 0.7623629 | 0 |
Holds the neccessary content for the config file for nginx with phpfpm support commented out | def get_config_file_content(self):
config_content: List[str] = [
'server {',
' listen {};'.format(self.port),
'',
' ##',
' # PHP-FPM',
' ##',
' #location ~ \.php$ {',
' #include /etc/nginx/fastcgi_params;',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration():",
"def construct_nginx_config(nginx_root: str, nginx_webroot: str, http_port: int, https_port: int,\n other_port: int, default_server: bool, key_path: Optional[str] = None,\n cert_path: Optional[str] = None, wtf_prefix: str = 'le') -> str:\... | [
"0.58595735",
"0.5857228",
"0.5824042",
"0.5811135",
"0.5811135",
"0.58059853",
"0.5765053",
"0.5761889",
"0.57487726",
"0.5743518",
"0.57283866",
"0.5719833",
"0.5708684",
"0.5700183",
"0.56810653",
"0.5675398",
"0.56663287",
"0.56349885",
"0.5631693",
"0.56010985",
"0.55980... | 0.72823024 | 0 |
A somewhat more scalable way to get the max episode lengths. | def get_max_episode_len(path):
path = path.replace('data/', '')
path = path.replace('goals/', '')
task = tasks.names[path]()
max_steps = task.max_steps - 1 # Remember, subtract one!
return max_steps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _max_periods(self):\n return self.data.shape[0]",
"def get_max_time_steps (self):\n return self.degreedays.thawing.num_timesteps",
"def getEvolutionMax(self):\n \n return [self.getMaximumAtGivenTime(timeIndex) for timeIndex in range(self.numberOfTimes - 1)]",
"def get_movie_lon... | [
"0.67602694",
"0.65362716",
"0.6483145",
"0.64574337",
"0.6382647",
"0.6372196",
"0.6358692",
"0.6329625",
"0.62262315",
"0.6209432",
"0.6173282",
"0.6164478",
"0.6163113",
"0.6134469",
"0.61204875",
"0.6057055",
"0.6035286",
"0.60185933",
"0.6007308",
"0.60014915",
"0.598440... | 0.7456747 | 0 |
Add an episode to the dataset. | def add(self, episode, last_stuff=None):
color, depth, action, info = [], [], [], []
for obs, act, i in episode:
color.append(obs['color'])
depth.append(obs['depth'])
action.append(act)
info.append(i)
color = np.uint8(color)
depth = np.flo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_episode(self, ep):\n #make da season\n ses = self._add_season(ep)\n dvdses = self._add_season(ep, dvd=True) \n self._add_episode(ep, ses)\n self._add_episode(ep, dvdses, dvd=True)",
"def add(self, episodes: Union[List[\"_Episode\"], \"_Episode\"]):\n if is... | [
"0.7943587",
"0.68175185",
"0.6635185",
"0.6529123",
"0.63753206",
"0.6367",
"0.60311574",
"0.5871607",
"0.5834273",
"0.58265716",
"0.5808693",
"0.5798912",
"0.5786846",
"0.57109386",
"0.5707757",
"0.5678602",
"0.5658988",
"0.5596643",
"0.55840445",
"0.5557425",
"0.55429876",... | 0.69033957 | 1 |
Depending on the env, make changes to image suffix `suff`. | def _change_name(self, suff, info_extra):
if 'cable-ring' in self.path:
i1 = info_extra['convex_hull_area']
i2 = info_extra['best_possible_area']
f = i1 / i2
suff = suff.replace('.png',
f'-area-{i1:0.3f}-best-{i2:0.3f}-FRAC-{f:0.3f}.png')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_base_image_labels(driver, user_disk, img_name, branch, target):\n\n dashes = [i for i, c in enumerate(img_name) if c=='-']\n cf_version = img_name[dashes[0]+1:dashes[3]]\n build_id = img_name[dashes[-1]+1:]\n\n driver.ex_set_volume_labels(user_disk,\n {'cf_version': cf_version, 'branch':... | [
"0.5632567",
"0.55875903",
"0.51115805",
"0.4960264",
"0.49135855",
"0.4792716",
"0.476165",
"0.47523832",
"0.47510242",
"0.47409478",
"0.4703219",
"0.46628687",
"0.46209535",
"0.4608203",
"0.45926276",
"0.4582887",
"0.45757735",
"0.45634633",
"0.45632792",
"0.4560272",
"0.45... | 0.5841067 | 0 |
To get more finegrained analysis of environment performance. Many of these require the last_info, which is not saved in info_l, which has all the time steps BEFORE that. For cablering and bagaloneopen, we terminate based on a fraction. Use `info_l[0]['extras']` to get the dict at the start. The `last_info` is already t... | def _track_data_statistics(self, info_l, last_info, episode_len,
all_stats, maxlen_stats):
maxlen = get_max_episode_len(self.path)
start = info_l[0]['extras']
last_ex = last_info['extras']
if 'cable-shape' in self.path or 'cable-line-notarget' in self.path:
nb_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_more_info(model):# pragma: no cover\n\n group_time = model.meta.exposure.group_time\n nframes_used = model.meta.exposure.nframes\n saturated_flag = dqflags.group['SATURATED']\n jump_flag = dqflags.group['JUMP_DET']\n\n return (group_time, nframes_used, saturated_flag, jump_flag)",
"def inf... | [
"0.58495504",
"0.58472466",
"0.5484478",
"0.53190255",
"0.5158806",
"0.5147971",
"0.50936896",
"0.50092375",
"0.49753112",
"0.4957122",
"0.49444202",
"0.493542",
"0.49158955",
"0.47993928",
"0.4793157",
"0.47781986",
"0.4762298",
"0.47620896",
"0.47439304",
"0.4739045",
"0.47... | 0.6225882 | 0 |
For each item (timestep) in this episode, save relevant images. | def _save_images(self, episode_len, color_l, depth_l, info_l, outdir, i_ep):
for t in range(episode_len):
assert color_l[t].shape == (3, 480, 640, 3), color_l[t].shape
assert depth_l[t].shape == (3, 480, 640), depth_l[t].shape
# Recall that I added 'extras' to the info dict... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_images(self, step, images):\n\n # Save\n with self.summary_writer.as_default():\n for name, batch in images.items():\n image = batch[0]\n image = tf.expand_dims(image, axis=0)\n tf.summary.image(name, image, step)",
"def save_images(s... | [
"0.64021105",
"0.6391139",
"0.6146052",
"0.6066712",
"0.6050973",
"0.60094845",
"0.5998496",
"0.59843314",
"0.58776593",
"0.58635044",
"0.5851753",
"0.5802809",
"0.57339936",
"0.5727365",
"0.57036406",
"0.56863064",
"0.56863064",
"0.56473136",
"0.56447446",
"0.56397223",
"0.5... | 0.6513759 | 0 |
Routine for determining the index mu such that t_mu <= x < t_mu+1. If x is larger than t[1], then the last index is returned, for convenience sake. If x is smaller than t[0], then the first index is returned, for convenience sake. | def index(x, t):
if x < t[0]:
return 0
for i in range(len(t) - 1):
if t[i] <= x < t[i + 1]:
return i
return len(t) - 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(self, u):\n if u == self.grid[-1]: # check if u equals last knot\n# index = len(self.grid) - 2 # pick next to last index\n index = (self.grid < u).argmin() - 1\n else:\n index = (self.grid > u).argmax() - 1\n return index",
"def _get_indx(self... | [
"0.6467503",
"0.6289578",
"0.62218434",
"0.60289025",
"0.59865326",
"0.59564394",
"0.5892032",
"0.5744281",
"0.57170856",
"0.5653306",
"0.5653306",
"0.5596471",
"0.5575372",
"0.5501344",
"0.5484174",
"0.5461618",
"0.54523337",
"0.5445007",
"0.5395855",
"0.5392234",
"0.5381911... | 0.7450273 | 0 |
Routine for computing the polynomial curve q of degree p that interpolates the points c. | def algorithm_1_1(p, c, t, x):
q = np.array(c, dtype=np.float64)
for k in range(1, p + 1):
for j in range(0, p - k + 1):
q[j] = (t[j + k] - x) / (t[j + k] - t[j]) * q[j] + (x - t[j]) / (
t[j + k] - t[j]) * q[j + 1]
return q[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def algorithm_1_2(p, c, x):\n\n q = np.array(c, dtype=np.float64)\n\n for k in range(1, p + 1):\n for j in range(0, p - k + 1):\n q[j] = (1 - x) * q[j] + x * q[j + 1]\n return q[0]",
"def cubic_interpol(X_P, Y_P):\r\n y_derivs = derivatives( X_P, Y_P ).flatten() # flatten as FB_sub ... | [
"0.7042587",
"0.6690117",
"0.65926915",
"0.65250105",
"0.6340643",
"0.6208526",
"0.6072516",
"0.6010707",
"0.59581405",
"0.58640903",
"0.5849673",
"0.5834013",
"0.58218116",
"0.5818799",
"0.5810743",
"0.58106756",
"0.58082443",
"0.5802335",
"0.57814616",
"0.5777239",
"0.57760... | 0.67014515 | 1 |
Routine for computing the Bezier curve q of degree p defined by the points c. | def algorithm_1_2(p, c, x):
q = np.array(c, dtype=np.float64)
for k in range(1, p + 1):
for j in range(0, p - k + 1):
q[j] = (1 - x) * q[j] + x * q[j + 1]
return q[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qCurveTo(self, *points: Tuple[float, float]) -> None:\n raise NotImplementedError",
"def qspline_params(self):\n b = np.zeros(self.n-1)\n c = np.zeros(self.n-1)\n dx = np.zeros(self.n-1)\n p = np.zeros(self.n-1)\n\n # Calculate x-interval and slope\n for j in ... | [
"0.6601559",
"0.64687204",
"0.6417432",
"0.6127228",
"0.609416",
"0.594592",
"0.59145063",
"0.5885624",
"0.5851079",
"0.58369726",
"0.5807348",
"0.58004904",
"0.5773123",
"0.5691614",
"0.56837523",
"0.5677718",
"0.5676558",
"0.5676219",
"0.5674574",
"0.56641537",
"0.56488764"... | 0.65151274 | 1 |
last_week=datetime.date.today()timedelta(days=7) import pdb;pdb.set_trace() fans_list = ["wwwttshow", "ttshowpet", "draw.fans", "TTShowMusic", "GoodNews.FANS"] fans_pages = FansPage.objects.filter(fans_type=fans_type, date__gte=last_week, date__lte=datetime.date.today()).order_by("date") start = fans_pages[0] last = fa... | def week_report_handle(fans_type):
#import pdb;pdb.set_trace()
last_day = datetime.date.today()-timedelta(days=datetime.datetime.today().weekday() + 1)
today = datetime.date.today()
fans_pages = FansPage.objects.filter(fans_type=fans_type, date__gte=last_day, date__lte=today).order_by("date")
start = fans_pages[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month_report_handle(fans_type):\n\tstart = datetime.date.today() - timedelta(days=datetime.date.today().day - 1)\n\ttoday = datetime.date.today()\n\t#import pdb;pdb.set_trace()\n\t#fans_list = [\"wwwttshow\", \"ttshowpet\", \"draw.fans\", \"TTShowMusic\", \"GoodNews.FANS\"]\n\tfans_pages = FansPage.objects.fil... | [
"0.6388377",
"0.5429181",
"0.5272578",
"0.52141297",
"0.51466364",
"0.51412165",
"0.5139298",
"0.51343983",
"0.50914544",
"0.50841016",
"0.500031",
"0.49782017",
"0.49781772",
"0.49575546",
"0.49335107",
"0.49260718",
"0.49128708",
"0.48942697",
"0.48925683",
"0.48861113",
"0... | 0.7329774 | 0 |
last_week=datetime.date.today()timedelta(days=30) import pdb;pdb.set_trace() fans_list = ["wwwttshow", "ttshowpet", "draw.fans", "TTShowMusic", "GoodNews.FANS"] fans_pages = FansPage.objects.filter(fans_type=fans_type, date__gte=last_week, date__lte=datetime.date.today()).order_by("date") start = fans_pages[0] last = f... | def month_report_handle(fans_type):
start = datetime.date.today() - timedelta(days=datetime.date.today().day - 1)
today = datetime.date.today()
#import pdb;pdb.set_trace()
#fans_list = ["wwwttshow", "ttshowpet", "draw.fans", "TTShowMusic", "GoodNews.FANS"]
fans_pages = FansPage.objects.filter(fans_type=fans_type, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week_report_handle(fans_type):\n\t#import pdb;pdb.set_trace()\n\tlast_day = datetime.date.today()-timedelta(days=datetime.datetime.today().weekday() + 1)\n\ttoday = datetime.date.today()\n\n\tfans_pages = FansPage.objects.filter(fans_type=fans_type, date__gte=last_day, date__lte=today).order_by(\"date\")\n\n\t... | [
"0.7132085",
"0.54012233",
"0.5325321",
"0.52955115",
"0.5279257",
"0.5191531",
"0.5127942",
"0.51076037",
"0.5076983",
"0.5066421",
"0.5050685",
"0.5035277",
"0.5031984",
"0.5012764",
"0.50095993",
"0.5009432",
"0.49920762",
"0.4978632",
"0.49514946",
"0.49369985",
"0.492433... | 0.6392885 | 1 |
Get a range of pages from the Solr index. | def getPageRange(base_url, node, page_range, page_size, from_date=None, to_date=None, delay=None):
docs = None
for p in page_range:
print "Getting page %d" % (p)
page_result = getPage(base_url, node, p, from_date=from_date, to_date=to_date)
if docs is None:
docs = page_result
else:
docs = docs.append... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_page_range(self):\r\n return list(range(1, self.num_pages + 1))",
"def __pages_range(self):\n return range(1, self.total_pages + 1)",
"def index_range(page: int, page_size: int) -> tuple:\n start: int = (page - 1) * page_size\n end: int = page_size * page\n return (start, end)",... | [
"0.72033846",
"0.7023521",
"0.6755472",
"0.6510711",
"0.6369775",
"0.62843007",
"0.6226141",
"0.60758966",
"0.6063477",
"0.6036647",
"0.59961975",
"0.59557724",
"0.5939197",
"0.59337556",
"0.59254843",
"0.5922733",
"0.590334",
"0.58724624",
"0.580953",
"0.5803111",
"0.5793469... | 0.73851967 | 0 |
Get the directory the script is being run from | def getScriptDirectory():
return os.path.dirname(os.path.realpath(__file__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_script_directory():\n return os.path.dirname(__file__)",
"def getScriptPath():\n\treturn os.path.dirname(os.path.realpath(sys.argv[0]))",
"def get_current_directory():\n\treturn os.path.dirname(os.path.abspath(__file__))",
"def _current_script_dir(self):\n if self._script_dir:\n ... | [
"0.9032008",
"0.85514134",
"0.84030205",
"0.8204221",
"0.8180877",
"0.79245794",
"0.79154485",
"0.7863617",
"0.78479075",
"0.7799003",
"0.77155125",
"0.77155006",
"0.7712691",
"0.7662973",
"0.76583695",
"0.7639003",
"0.7633195",
"0.7625982",
"0.7607391",
"0.7600444",
"0.75781... | 0.8963206 | 1 |
Regresa una lista con los archivos .pyx del path dado Si abspath es true, la lista de archivos es el path absoluto de lo contrario es solo el nombre de los mismos | def get_pyx_files(path, abspath=True):
path = os.path.normpath(os.path.abspath(path))
to_compile = []
for name in os.listdir(path):
if name.endswith(".pyx"):
pyx = os.path.join(path,name)
if os.path.isfile(pyx):
to_compile.append(pyx if abspath else nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_files(path):\r\n files_list=[]\r\n path = os.path.abspath(path)\r\n\r\n #if the path is a file name, returns a list of a single file name\r\n if os.path.isfile(path):\r\n files_list.append(path)\r\n #if the path is a directory name, returns a list of all the file names anded with ... | [
"0.63147795",
"0.61795086",
"0.616547",
"0.6125532",
"0.60973084",
"0.6002462",
"0.59990036",
"0.59049416",
"0.5877905",
"0.5865475",
"0.5860523",
"0.58581746",
"0.57794094",
"0.5762498",
"0.57599723",
"0.5751733",
"0.5741181",
"0.5737314",
"0.5728935",
"0.5725836",
"0.571683... | 0.6943939 | 0 |
Funcion para cythonize todos los .pyx del path dado inplace | def compile_dir(path):
to_compile = get_pyx_files(path)
print("De:",path)
if to_compile:
print("Se compilaran:", list(map(os.path.basename,to_compile)))
Cythonize.main( ['-a', '-i'] + to_compile )
else:
print("Nada para compilar") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_cutils():\r\n\r\n types = ['npy_' + t for t in ['int8', 'int16', 'int32', 'int64', 'int128',\r\n 'int256', 'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256',\r\n 'float16', 'float32', 'float64', 'float80', 'float96', 'float128',\r\n 'float256']]\r\n\r\n complex_type... | [
"0.66523314",
"0.6544092",
"0.65063745",
"0.6070866",
"0.6070866",
"0.6048853",
"0.6015238",
"0.5894381",
"0.58778536",
"0.5804054",
"0.57061064",
"0.5672842",
"0.56022316",
"0.5536645",
"0.5529895",
"0.5502436",
"0.54587775",
"0.5413615",
"0.5393308",
"0.534646",
"0.53356946... | 0.6816537 | 0 |
Funcion para cythonize todos los .pyx del path dado inplace incluyendo numpy | def compile_dir_with_numpy(path, cleanup=True):
from distutils.core import setup
import numpy
path = os.path.normpath(os.path.abspath(path))
temp = os.path.join(path,".temp_build")
with redirect_sys_argv(os.path.join(path,"make_virtual_script.py"), "build_ext", "--inplace", "-t", temp):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_cutils():\r\n\r\n types = ['npy_' + t for t in ['int8', 'int16', 'int32', 'int64', 'int128',\r\n 'int256', 'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256',\r\n 'float16', 'float32', 'float64', 'float80', 'float96', 'float128',\r\n 'float256']]\r\n\r\n complex_type... | [
"0.6818972",
"0.6327408",
"0.63241965",
"0.6169207",
"0.5705685",
"0.565066",
"0.563825",
"0.5581065",
"0.5533468",
"0.5440001",
"0.53392947",
"0.5276428",
"0.52711195",
"0.52364916",
"0.52364916",
"0.51878566",
"0.5183364",
"0.5174798",
"0.5170791",
"0.5147748",
"0.5139927",... | 0.63986754 | 1 |
Display a digit. number the number (09) to display offset the leftmost column of the displayed digit color the RGB color to use to display the digit force_zero whether to leave a 0 blank (False) or display it | def display_digit(number, offset, color, force_zero):
bits = number_patterns[number]
for row in range(4):
for col in range(3):
if bits[row][col] == " " or (number == 0 and not force_zero):
trellis.pixels[col + offset, row] = (0, 0, 0)
else:
trellis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_number(number, color):\n if number >= 500 or number < 0:\n return False\n display_digit(number % 10, 5, color, True)\n display_digit((number // 10) % 10, 1, color, number >= 100)\n hundreds = number // 100\n for h in range(4):\n if h + 1 == hundreds:\n trellis.pi... | [
"0.695156",
"0.6788571",
"0.66527975",
"0.6614041",
"0.6437634",
"0.6332502",
"0.61967576",
"0.6093905",
"0.60627466",
"0.6041989",
"0.599062",
"0.5990346",
"0.5939854",
"0.5918779",
"0.59041363",
"0.5903598",
"0.588926",
"0.58889186",
"0.58847225",
"0.58732307",
"0.5850803",... | 0.8424535 | 0 |
Perform an animation (displaying random numbers) before displaying the requested number. number the number to eventually display color the color to use (indicates the type of dice used) | def animate_to(number, color):
for _ in range(10):
trellis.pixels.fill((0, 0, 0))
display_number(random.randint(10, 99), color)
time.sleep(0.1)
trellis.pixels.fill((0, 0, 0))
display_number(number, color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_number(number, color):\n if number >= 500 or number < 0:\n return False\n display_digit(number % 10, 5, color, True)\n display_digit((number // 10) % 10, 1, color, number >= 100)\n hundreds = number // 100\n for h in range(4):\n if h + 1 == hundreds:\n trellis.pi... | [
"0.64256155",
"0.6405366",
"0.6212849",
"0.59545386",
"0.5949734",
"0.58733165",
"0.58445084",
"0.5805371",
"0.57400924",
"0.57233775",
"0.5666692",
"0.56376994",
"0.5635846",
"0.5585724",
"0.5536559",
"0.5530062",
"0.55047804",
"0.54716986",
"0.5459184",
"0.5436751",
"0.5429... | 0.77046764 | 0 |
Generate a random dice roll. Returns the total of the roll. number the number of dice to roll sides the number of side on dice to roll (4, 6, 8, 10, 12, 20) | def roll(number, sides):
total = 0
for _ in range(number):
total += random.randint(1, sides + 1)
return total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll_die(number_of_rolls: int, number_of_sides: int) -> int:\r\n if number_of_rolls <= 0 or number_of_sides <= 0:\r\n return 0\r\n\r\n max_total = number_of_sides * number_of_rolls\r\n\r\n return random.randint(number_of_rolls, max_total)",
"def roll_dice(self):\r\n return randint(1,se... | [
"0.8306328",
"0.80792737",
"0.8031863",
"0.79754895",
"0.7949489",
"0.78290707",
"0.77576977",
"0.77334857",
"0.7669618",
"0.7665575",
"0.7655441",
"0.7631616",
"0.76303476",
"0.7616661",
"0.75856316",
"0.7581803",
"0.75760746",
"0.7549325",
"0.7533779",
"0.7507938",
"0.74926... | 0.8385434 | 0 |
Detect when the Trellis is shaken. | def shaken():
global previous_reading
result = False
x, y, z = accelerometer.acceleration
if previous_reading[0] is not None:
result = (math.fabs(previous_reading[0] - x) > bound and
math.fabs(previous_reading[1] - y) > bound and
math.fabs(previous_reading[2] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def always_touching(self):\n assert int(self.snake[0].real - self.snake[1].real) in [1, 0, -1] and int(\n self.snake[0].real - self.snake[1].real) in [1, 0, -1]",
"def take_turn(self):\n if self.fired:\n return None\n\n self.tick_needs()\n # TODO: Currently dropp... | [
"0.6046966",
"0.5901135",
"0.58888614",
"0.5877499",
"0.5703894",
"0.5684475",
"0.56534463",
"0.56150085",
"0.5550172",
"0.55474705",
"0.5539146",
"0.55061305",
"0.545888",
"0.5455816",
"0.545385",
"0.54346234",
"0.5419669",
"0.54050684",
"0.5394224",
"0.5392888",
"0.5390452"... | 0.65306956 | 0 |
Create a user with a random email. Perfect for tests where you just need to set a user on some data model, but the user is not used for anything. | def create_random_user():
try:
user = get_user_model().objects.create(
email='{}@example.com'.format(uuid.uuid4()))
except IntegrityError:
return create_random_user()
else:
user.set_password('test')
user.save()
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_user_dynamic_email(email):\n return get_user_model().objects.create_user(email=email,\n password=\"password123\",\n name=\"some name\")",
"def sample_user(email=user_v['email'], password=user_v['password']... | [
"0.83424205",
"0.81030285",
"0.8037546",
"0.8030638",
"0.7968194",
"0.7859456",
"0.7846218",
"0.7839635",
"0.7839635",
"0.7839635",
"0.78273344",
"0.78226376",
"0.78000873",
"0.77878624",
"0.77727425",
"0.7754782",
"0.77377146",
"0.7733991",
"0.7668458",
"0.7652283",
"0.76155... | 0.8454943 | 0 |
Roll the die once and insure the value is in possibleValues | def test_roll_once(self):
self.assertIn(self.new_die.roll(), self.possible_values, "Rolled value was not in possible die values") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll(self):\n self.currentValue = choice(self.possibleValues)\n self.value = AngryDie.ANGRY_VALUES[self.currentValue]\n return self.currentValue",
"def roll(self):\n #dieValue = [] \n self._value = random.randrange(Die.SIDES) + 1\n self._update()\n #dieValue.appe... | [
"0.6406445",
"0.6295456",
"0.58946204",
"0.58158296",
"0.5748856",
"0.56759375",
"0.5639539",
"0.56361294",
"0.5632964",
"0.558092",
"0.55762345",
"0.55376804",
"0.5525275",
"0.54982567",
"0.54963",
"0.5475915",
"0.54747736",
"0.54597336",
"0.5452825",
"0.543778",
"0.5421019"... | 0.7380792 | 0 |
Make sure the Die's currentValue is updated to match what is rolled | def test_currentValue_is_updated_to_roll_value(self):
rolled_value = self.new_die.roll()
if rolled_value == self.new_die.currentValue:
self.assertTrue(True, "currentValue {} matches the rolled value".format(self.new_die.currentValue))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_roll_value_changes(self):\n\n holding_value = self.new_die.roll()\n for i in range(10):\n if self.new_die.roll() != holding_value:\n print(\"Rolled die value {} is different from Holding Value {}\".format(self.new_die.currentValue, holding_value))\n s... | [
"0.7680647",
"0.74207294",
"0.7323546",
"0.72374326",
"0.63809884",
"0.63557065",
"0.6267854",
"0.62388927",
"0.6197402",
"0.6189299",
"0.61681074",
"0.60864174",
"0.6065291",
"0.6056789",
"0.6015279",
"0.6010526",
"0.5958524",
"0.5958524",
"0.5948918",
"0.59019583",
"0.58753... | 0.81208175 | 0 |
Returns the pair (symbols, positions) where symbols is a row major array of images and positions is the corresponding centers of those images relative to the input image. | def get_symbol_images_and_positions(im):
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
_, threshold = cv2.threshold(gray, 100, 255, 0)
threshold = 255 - threshold
# show(threshold)
contours, hierarchy = cv2.findContours(threshold, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
contours = [cv2.approxPolyD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coords_in(self, frame_size=None, shape=None, img=None):\n w, h = _to_frame_size(frame_size=frame_size, shape=shape, img=img)\n return [(int(round(x * w)), int(round(y * h))) for x, y in self.points]",
"def get_coords_by_label_2D(image, label):\n coords = np.argwhere(image == label)\n y = ... | [
"0.57239145",
"0.56765956",
"0.5582602",
"0.5538157",
"0.55075634",
"0.54908365",
"0.54908365",
"0.546828",
"0.5440452",
"0.5436629",
"0.53986806",
"0.53672814",
"0.5325077",
"0.53231037",
"0.53162026",
"0.53007215",
"0.5292834",
"0.5292581",
"0.5284873",
"0.527916",
"0.52665... | 0.74972606 | 0 |
commandline frontend to portcheck | def portcheck_main(args=sys.argv[1:]):
ports = portcheck(*args)
for i in ports:
print '%s: %s' % (i, ports[i])
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_port(args):",
"def main():\n import getopt\n\n try:\n options, remainder = getopt.getopt(\n sys.argv[1:], '',\n ['help', # Print usage msg, exit\n 'short', # Output is shortened\n 'pid', # Output only pid of listenig process\n ... | [
"0.7720498",
"0.73162156",
"0.7220862",
"0.7017648",
"0.693446",
"0.69314975",
"0.66068625",
"0.6573738",
"0.6537948",
"0.64890003",
"0.6484347",
"0.64464116",
"0.64462745",
"0.6400242",
"0.634724",
"0.62326765",
"0.62326765",
"0.62326765",
"0.62326765",
"0.62326765",
"0.6232... | 0.8002637 | 0 |
commandline frontend to portkill | def portkill_main(args=sys.argv[1:]):
# Probably should use optparse or some such.
kw = {}
if '-v' in args:
kw['verbose'] = True
args = [a for a in args if a != '-v']
if '-s' in args:
index = args.index('-s')
kw['sleeptime'] = args[index + 1]
args = args[:index] +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_kill():",
"def cmd_port(args):",
"def GET_kill(self):\n sys.exit(0)",
"def main():\n import getopt\n\n try:\n options, remainder = getopt.getopt(\n sys.argv[1:], '',\n ['help', # Print usage msg, exit\n 'short', # Output is shortened\n ... | [
"0.7240684",
"0.7052073",
"0.65952784",
"0.63656825",
"0.62713367",
"0.6178196",
"0.6129385",
"0.6117073",
"0.61063033",
"0.60440135",
"0.6033156",
"0.60245794",
"0.5999834",
"0.5967886",
"0.5967886",
"0.5951784",
"0.5946233",
"0.5944419",
"0.5938858",
"0.59301466",
"0.591776... | 0.77358234 | 0 |
Hotfix for exporting mixed precision model as float32. | def export_model_as_float32(temporary_model, checkpoint_path, export_path):
checkpoint = tf.train.Checkpoint(model=temporary_model)
manager = tf.train.CheckpointManager(
checkpoint=checkpoint, directory=checkpoint_path, max_to_keep=3
)
checkpoint.restore(manager.latest_checkpoint).expec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_float32(elem):\n return elem.astype(np.float32)",
"def write_float32(self, f: float) -> None:\n self.buffer += struct.pack(\"<f\", f)",
"def data_convert2float32 (self, data):\r\n data = data.astype(np.float32)\r\n\r\n return data",
"def to_fp32(self, params: Union[Dict, Frozen... | [
"0.6170572",
"0.60380393",
"0.60296834",
"0.59463894",
"0.59329",
"0.58766335",
"0.5724392",
"0.5597414",
"0.5592186",
"0.55823284",
"0.5563138",
"0.5558887",
"0.5557625",
"0.55393016",
"0.5500251",
"0.54938865",
"0.5477756",
"0.54765797",
"0.54673815",
"0.5465686",
"0.545568... | 0.6395869 | 0 |
Generate a denormalized Catalog of matches This is intended for writing matches in a convenient way. | def denormalizeMatches(matches, matchMeta=None):
if len(matches) == 0:
raise RuntimeError("No matches provided.")
refSchema = matches[0].first.getSchema()
srcSchema = matches[0].second.getSchema()
refMapper, srcMapper = lsst.afw.table.SchemaMapper.join([refSchema, srcSchema], ["ref_", "src_"])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _matches_to_components(self, matches):\n subcomponents = []\n for match in matches:\n subcomponents.append(match.get_component())\n return subcomponents",
"def generate_complex_catalog(stem: str = '') -> cat.Catalog:\n group_a = generators.generate_sample_model(cat.Group, T... | [
"0.5617624",
"0.53872037",
"0.53387195",
"0.5322842",
"0.52577996",
"0.5231398",
"0.52225256",
"0.5212459",
"0.5200561",
"0.50921756",
"0.5079429",
"0.5012638",
"0.501046",
"0.4984634",
"0.4966179",
"0.4954377",
"0.4953587",
"0.4943859",
"0.49416387",
"0.49314514",
"0.4904986... | 0.64208984 | 0 |
Returns photon energy in keV if specified in eV or keV | def keV(E):
if np.min(E) >= 100:
return E / 1000
else:
return E | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def V2E(V):\n# for v in m/s returns energy in meV\n return 5.227e-6*V*V",
"def E2V(E):\n# for energy in mev returns velocity in m/s\n return sqrt(E/5.227e-6)",
"def energy(e: float) -> float:\n\n return (1/np.sqrt(2))*(gamma(-e/2+1/2)/(gamma(-e/2+3/4)))",
"def energyK(k):\r\n C1 = 9.7846113e-07... | [
"0.6925107",
"0.67266333",
"0.6649382",
"0.6463622",
"0.6386686",
"0.63505965",
"0.6302297",
"0.6284374",
"0.6248313",
"0.62413824",
"0.6190136",
"0.6178548",
"0.61690694",
"0.616394",
"0.6122586",
"0.61173284",
"0.6104944",
"0.60898596",
"0.6080368",
"0.60786605",
"0.607754"... | 0.6767055 | 1 |
Calculate the attenuation length (m) at given energies E in keV (vectorized) density in g/cm3, None=default density | def attenuationLength(matID, keV, density=None):
return 1.0 / mu(matID, keV, density) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debye_length_m(electron_density, electron_temperature):\n return 0.069 * np.sqrt(electron_temperature / electron_density)",
"def energy(e: float) -> float:\n\n return (1/np.sqrt(2))*(gamma(-e/2+1/2)/(gamma(-e/2+3/4)))",
"def debye_length(eps_0, electron_temperature, electron_density, elementary_charg... | [
"0.69875747",
"0.683513",
"0.68281406",
"0.64340115",
"0.640952",
"0.6275915",
"0.6182579",
"0.6081061",
"0.60733867",
"0.59705806",
"0.59496653",
"0.59434277",
"0.59365296",
"0.590933",
"0.5900445",
"0.5885812",
"0.58835375",
"0.5881771",
"0.5863816",
"0.58308667",
"0.582880... | 0.6993646 | 0 |
Calculate the eV/atom at given energies with mu_en | def eVatom_en(matID, keV, mJ, rms_mm, density=None):
if density == None:
density = defaultDensity(matID)
attL = 1.0 / mu_en(matID, keV, density)
EdensityJcm3 = mJ/1000 / (2 * np.pi * attL*u['cm'] * (rms_mm*0.1)**2)
atomVolcm3 = atomWeight(matID) / c['NA'] / density
return EdensityJcm3 * atom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def V2E(V):\n# for v in m/s returns energy in meV\n return 5.227e-6*V*V",
"def _calc_energy( self, V_a, eos_d ):\n pass",
"def get_o_energies(mol):\n try:\n ev_to_hartree = 1./convertor(1,'hartree','eV')\n g=hack_parser.Gaussian(mol.calc.log, loglevel=50)\n d=g.parse()\n ... | [
"0.70589775",
"0.677859",
"0.6765921",
"0.67600095",
"0.6704203",
"0.6699837",
"0.6672238",
"0.664315",
"0.66347003",
"0.66338253",
"0.6538472",
"0.6527403",
"0.6355422",
"0.63233757",
"0.63145655",
"0.6307296",
"0.62996507",
"0.6297362",
"0.62903994",
"0.62738526",
"0.625709... | 0.68466586 | 1 |
Return the material drill speed (mm/s) based on vaporization heat | def drillSpeed(matID, W, FWHM_mm):
vaporH = { # kJ/mol
# spec heat from room temperature to melting + latent heat of fusion + spec heat from melting to boiling + latent heat of vaporization
# refer https://webbook.nist.gov/chemistry/ for heat capacity, this tool also has some data in specificHeatPa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v(self):\n\n # TODO This translation formula works, but needs simplified.\n\n # PWM duration can go from 0 to 4095 with 4095 representing max rpm\n# print(\"MuleBot.v MuleBot.dcMotorPWMDurationLeft:\", MuleBot.dcMotorPWMDurationLeft)\n speed_percentage = float(MuleBot.dcMotorPWMDurationLef... | [
"0.7335393",
"0.7025321",
"0.6622663",
"0.6536985",
"0.65128434",
"0.6388492",
"0.6367922",
"0.6348878",
"0.62760735",
"0.62732047",
"0.62524635",
"0.624983",
"0.6247133",
"0.62403464",
"0.6176493",
"0.6170497",
"0.6143984",
"0.6113371",
"0.6113371",
"0.6112807",
"0.6112807",... | 0.73165506 | 1 |
Return the material drill time based on vaporization heat | def drillTime(matID, thickness_mm, W, FWHM_mm):
return thickness_mm / drillSpeed(matID, W, FWHM_mm) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_specific_heat() -> float:\n return 1006.0",
"def drillSpeed(matID, W, FWHM_mm):\n vaporH = { # kJ/mol\n # spec heat from room temperature to melting + latent heat of fusion + spec heat from melting to boiling + latent heat of vaporization\n # refer https://webbook.nist.gov/chemistry/... | [
"0.62291473",
"0.6129261",
"0.58999515",
"0.5889212",
"0.5879499",
"0.58049667",
"0.57781595",
"0.5736014",
"0.5695776",
"0.56671214",
"0.56644464",
"0.5662342",
"0.5658931",
"0.56068385",
"0.55981326",
"0.5557203",
"0.55318046",
"0.55170333",
"0.550636",
"0.5491459",
"0.5489... | 0.6740698 | 0 |
Cut spectrum to a given energy range; return [0,0] if out of range | def spectrum_cut(spectrum, eVrange=(0.0, 0.0)):
if eVrange[1] == 0.0:
return spectrum
else:
if spectrum[-1,0] <= eVrange[0] or spectrum[0,0] >= eVrange[1]:
return np.array([[0, 0]], dtype=np.float)
else:
idx1 = np.argmax(spectrum[:,0] >= eVrange[0])
id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cut_spectrum(input_spectrum, desired_frequency_range):\n channels_ip = []\n for ip in input_spectrum.GetChannels():\n channel_ip = []\n channel_op = []\n for n, i in enumerate(ip):\n if n > desired_frequency_range[0] / input_spectrum.GetResolution() and n < desired_frequen... | [
"0.6825761",
"0.5779064",
"0.5748746",
"0.5698457",
"0.56758094",
"0.5662627",
"0.56557333",
"0.56557333",
"0.56524175",
"0.5537704",
"0.5531709",
"0.55142623",
"0.54934263",
"0.54912776",
"0.54783106",
"0.5407424",
"0.5381168",
"0.5365206",
"0.53605443",
"0.5358346",
"0.5313... | 0.791948 | 0 |
Computes the Bragg angle (deg) of the specified material, reflection and photon energy | def BraggAngle(ID,hkl,E=None):
E = eV(E)
d = dSpace(ID,hkl)
theta = asind(lam(E)/2/d)
return theta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comp_angle_magnet(self):\n Rbo = self.get_Rbo()\n W0 = self.comp_W0m()\n Harc = self.comp_H_arc()\n if self.is_outwards():\n return float(2 * arctan(W0 / (2 * (Rbo + self.H1 - Harc))))\n else:\n return float(2 * arctan(W0 / (2 * (Rbo - self.H1 - Harc))))\n\n # if self.W0_is_rad:... | [
"0.6266474",
"0.58636326",
"0.581911",
"0.579827",
"0.57421386",
"0.5730155",
"0.57119465",
"0.56873935",
"0.5686968",
"0.5686968",
"0.5686968",
"0.56705695",
"0.56380606",
"0.55969983",
"0.55962616",
"0.5550515",
"0.5547123",
"0.5540648",
"0.55189204",
"0.551004",
"0.551004"... | 0.60041696 | 1 |
Computes the structure factor | def StructureFactor(ID,f,hkl,z=None):
ID=goodID(ID)
i=complex(0,1)
h=hkl[0]
k=hkl[1]
l=hkl[2]
L=latticeType[ID]
if L=='fcc':
F=f*(1+np.exp(-i*np.pi*(k+l))+np.exp(-i*np.pi*(h+l))+np.exp(-i*np.pi*(h+k)))
elif L=='bcc':
F=f*(1+np.exp(-i*np.pi*(h+k+l)))
elif L=='cubic':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_factors():",
"def get_structure_factor(\n scalar_field: ScalarField,\n smoothing: Union[None, float, str] = \"auto\",\n wave_numbers: Union[Sequence[float], str] = \"auto\",\n add_zero: bool = False,\n) -> Tuple[np.ndarray, np.ndarray]:\n logger = logging.getLogger(__name__)\n\n if not ... | [
"0.6150205",
"0.56703275",
"0.5611402",
"0.5582101",
"0.5568",
"0.55506617",
"0.5549934",
"0.55357444",
"0.5386212",
"0.5341239",
"0.5322685",
"0.53065836",
"0.53054816",
"0.529132",
"0.5288285",
"0.52503294",
"0.5247208",
"0.5234449",
"0.5224676",
"0.5212955",
"0.5189034",
... | 0.5964732 | 1 |
Computes the Darwin width for a specified crystal reflection (degrees) | def DarwinWidth(ID, hkl, E, T=293):
ID = goodID(ID)
E = eV(E)
theta = BraggAngle(ID,hkl,E)
l = lam(E)
f = FF(ID,2*theta,E)
F = StructureFactor(ID,f,hkl)
V = UnitCellVolume(ID)
dw=(2*c['eRad']*l**2*np.abs(F))/(np.pi*V*sind(2*theta))/u['rad']
return dw | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diffusion_width(conversion_depth): #Return value in PIXELS!!!\n return sqrt((drift_time(maximum(conversion_depth, undepleted_thickness)) *\n 2 * k * temp * low_field_mobility / e) + #depleted\n where(conversion_depth < undepleted_thickness,\n ... | [
"0.59558606",
"0.5946997",
"0.5920999",
"0.5686786",
"0.5665531",
"0.56501627",
"0.56482404",
"0.5642907",
"0.56321955",
"0.559535",
"0.5512421",
"0.55015284",
"0.54587156",
"0.5456422",
"0.5454967",
"0.5450522",
"0.54350805",
"0.53960043",
"0.5390877",
"0.5385902",
"0.538273... | 0.6186894 | 0 |
Returns the momentum transfer in Ang^1 from xraylib [sin(2theta)/lam] E is the photon energy (eV or KeV) twotheta is the scattering angle in degrees | def MomentumTransfer(E,twotheta):
E = keV(E)
th = np.deg2rad(twotheta)
p = xl.MomentTransf(E, th)
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_theta_delta_v_trans_MOND(M1, M2, a, e, M, Omega, omega, inc):\n\n # Acceleration constant for MOND\n a0 = 1.2e-8\n\n # From Scarpa et al. (2017), MOND acts at separations larger than 7000 AU\n a_limit = 7000.0 * c.AU_to_cm\n\n # Calculate f's\n num_sys = len(M1)\n f = np.zeros(num_sys... | [
"0.6113359",
"0.5922858",
"0.5920171",
"0.587831",
"0.5770723",
"0.5753359",
"0.5733947",
"0.57266885",
"0.57000864",
"0.5698715",
"0.5668702",
"0.55332893",
"0.55264103",
"0.5521733",
"0.5514887",
"0.55147564",
"0.5503037",
"0.55001146",
"0.5495225",
"0.5492762",
"0.54698634... | 0.71416765 | 0 |
Gets the writable of this SkillPropertyModel. | def writable(self) -> bool:
return self._writable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Writable(self):\n return self._get_attr('Writable')",
"def get_property(self):\r\n _get = lambda slf: self.getval()\r\n _set = lambda slf, val: self.setval(val)\r\n _del = lambda slf: self.delval()\r\n\r\n if self.column.can_delete:\r\n return property(_get, _set... | [
"0.7035221",
"0.5944507",
"0.59027547",
"0.59027547",
"0.59027547",
"0.59027547",
"0.58960843",
"0.58916765",
"0.5811473",
"0.58107597",
"0.5795605",
"0.57830673",
"0.5729404",
"0.5729404",
"0.5719634",
"0.5717049",
"0.5712049",
"0.5704419",
"0.5677743",
"0.5675228",
"0.56705... | 0.6624925 | 1 |
Sets the writable of this SkillPropertyModel. | def writable(self, writable: bool):
if writable is None:
raise ValueError("Invalid value for `writable`, must not be `None`") # noqa: E501
self._writable = writable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writable(self):\n return True",
"def writable(self) -> bool:\n return self._writable",
"def __init__(self, writable: bool = None): # noqa: E501\n self.swagger_types = {\n 'writable': bool\n }\n \n self.attribute_map = {\n 'writable': 'writabl... | [
"0.59215254",
"0.59071964",
"0.5861543",
"0.57983047",
"0.5595328",
"0.557937",
"0.5561954",
"0.55557615",
"0.54962236",
"0.5457732",
"0.5410007",
"0.539612",
"0.53701144",
"0.5273163",
"0.5265374",
"0.524871",
"0.5225597",
"0.5134648",
"0.50857335",
"0.5045085",
"0.5008741",... | 0.6848805 | 0 |
Test whether a MARWILAlgorithm can be built with all frameworks. Learns from a historicdata file. | def test_marwil_compilation_and_learning_from_offline_file(self):
rllib_dir = Path(__file__).parent.parent.parent.parent
print("rllib dir={}".format(rllib_dir))
data_file = os.path.join(rllib_dir, "tests/data/cartpole/large.json")
print("data_file={} exists={}".format(data_file, os.path.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_maya():\n return \"maya.bin\" in sys.argv[0]",
"def test_marwil_compilation(self):\n config = marwil.DEFAULT_CONFIG.copy()\n config[\"num_workers\"] = 0 # Run locally.\n num_iterations = 2\n\n # Test for all frameworks.\n for _ in framework_iterator(config):\n ... | [
"0.6046675",
"0.572271",
"0.55824965",
"0.55451214",
"0.54947644",
"0.54622614",
"0.5452598",
"0.5437318",
"0.54144233",
"0.5404908",
"0.5300404",
"0.5271665",
"0.5248322",
"0.52429456",
"0.5239995",
"0.52355534",
"0.5219218",
"0.52116257",
"0.52109",
"0.518551",
"0.51845616"... | 0.6203485 | 0 |
Test whether MARWIL runs with cont. actions. Learns from a historicdata file. | def test_marwil_cont_actions_from_offline_file(self):
rllib_dir = Path(__file__).parent.parent.parent.parent
print("rllib dir={}".format(rllib_dir))
data_file = os.path.join(rllib_dir, "tests/data/pendulum/large.json")
print("data_file={} exists={}".format(data_file, os.path.isfile(data_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_data_by_filename(fname):\n return \"Run2017\" in fname",
"def test_rawdata(data):\n base = list(data)[0]\n if base in [\"tv\",\"leftovers\",\"tv short\",\"movie\",\"OVA / ONA / Special\"]:\n return True\n return False",
"def test_marwil_compilation_and_learning_from_offline_file(self)... | [
"0.54971373",
"0.53127843",
"0.52745575",
"0.5235069",
"0.5188993",
"0.5121418",
"0.509365",
"0.50501126",
"0.50026417",
"0.49532452",
"0.4941224",
"0.49351087",
"0.49332222",
"0.49167177",
"0.4914973",
"0.48895016",
"0.48684993",
"0.486381",
"0.4858225",
"0.48537436",
"0.483... | 0.5548691 | 0 |
Returns True if setHook has been called, else False. | def hooked(self):
return hasattr(self, 'hook') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hooked(self):\n return hasattr(self, \"hook\")",
"def is_hooked(self):\n return self.is_hook",
"def has_hookscript ( self ):\n return self.hook_script_ref is not None",
"def __bool__(self):\n return any(\n getattr(self, hook_trigger, None) for hook_trigger in self._ho... | [
"0.8287972",
"0.78261894",
"0.71733844",
"0.68210393",
"0.6275487",
"0.61548287",
"0.6046052",
"0.60282415",
"0.58755386",
"0.58091587",
"0.5783909",
"0.577299",
"0.57432944",
"0.57335156",
"0.5725817",
"0.57083863",
"0.5678062",
"0.56624424",
"0.56512415",
"0.5643167",
"0.56... | 0.82772356 | 1 |
Triggers traffic to be sent asynchronously. This is not a blocking function. | def send_traffic_async(self, traffic, function):
raise NotImplementedError(
"The TrafficController does not implement",
"the \"send_traffic_async\" function.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def send(self):",
"async def async_send(self, **kwargs):\n return await super().async_send(address=self._address, **kwargs)",
"def send_traffic_async(self, traffic, function):\n self._logger.debug('send_traffic_async with ' +\n str(self._traffic_gen_class))\n\n ... | [
"0.70518446",
"0.658749",
"0.64080757",
"0.61358184",
"0.6126272",
"0.59462124",
"0.59020275",
"0.5884106",
"0.5869222",
"0.5818092",
"0.57891905",
"0.576021",
"0.5733072",
"0.57246214",
"0.57081556",
"0.5699909",
"0.5676819",
"0.5673217",
"0.5659739",
"0.5647509",
"0.5610203... | 0.7024093 | 1 |
Calcule le prix total en fonction du nombre de CD et de DVD | def prix(n_cd=0, n_dvd=0):
if n_cd < SEUIL_CD:
prix_cd = n_cd * PRIX_CD
else:
prix_cd = n_cd * PRIX_CD_SOLDE
if n_dvd < SEUIL_DVD:
prix_dvd = n_dvd * PRIX_DVD
else:
prix_dvd = n_dvd * PRIX_DVD_SOLDE
return prix_cd + prix_dvd # prix total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_volume(self):",
"def subtotal(self):\n return self.cantidad * self.precio",
"def subtotal(self):\n return self.precio_unitario * self.cantidad",
"def get_total(self):\n\n self.base_price = self.get_base_price()\n\n if self.species == \"christmas melon\":\n sel... | [
"0.65616846",
"0.65148675",
"0.63571846",
"0.6325566",
"0.6288623",
"0.628783",
"0.62849903",
"0.62757003",
"0.62676924",
"0.61933535",
"0.6179521",
"0.60922796",
"0.60887057",
"0.60808444",
"0.60640484",
"0.6055469",
"0.60517925",
"0.60244316",
"0.6010513",
"0.59640276",
"0.... | 0.79513353 | 0 |
Testing the sum function with a list of integers | def test_sum_list_int(self):
list_of_int = [1, 2, 3]
result = sum(list_of_int)
self.assertEqual(result, 6) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_int(self):\n data = [1, 2, 3]\n result = sum(data)\n self.assertEqual(result, 6)",
"def sum_of_numbers(numbers):\r\n return sum(numbers)",
"def sum(inputList):\n sum=0#the sum of the list starts from 0\n for num in inputList:\n sum=sum+num#add all number in th... | [
"0.83072984",
"0.7623929",
"0.7614517",
"0.7613487",
"0.7445052",
"0.74247944",
"0.7406183",
"0.7406183",
"0.7399114",
"0.7382333",
"0.73426735",
"0.73413736",
"0.7324949",
"0.7321548",
"0.728999",
"0.7227425",
"0.72244704",
"0.7189016",
"0.71679366",
"0.71667075",
"0.7156018... | 0.8694991 | 0 |
Testing the sum function with a list of fractions | def test_sum_list_fraction(self):
list_of_fractions = [Fraction(1, 4), Fraction(1, 4), Fraction(1, 2)]
result = sum(list_of_fractions)
self.assertEqual(result, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sum_list_floats(self):\n\n list_of_floats = [1.2, 2.34, 2.001]\n result = sum(list_of_floats)\n\n self.assertEqual(result, 5.541)",
"def test_add(self):\n newvalues = Fraction(1,2)+Fraction(1,2)\n fraction1 = Fraction(newvalues[0],newvalues[1])\n self.assertEqua... | [
"0.72050667",
"0.63461196",
"0.6275821",
"0.6267266",
"0.6242244",
"0.619898",
"0.61726063",
"0.61726063",
"0.6136146",
"0.60958403",
"0.6044922",
"0.60098386",
"0.60013944",
"0.59871864",
"0.59814495",
"0.59613097",
"0.59255284",
"0.59224653",
"0.5904114",
"0.58600134",
"0.5... | 0.84436464 | 0 |
Testing the sum function with a list of float values | def test_sum_list_floats(self):
list_of_floats = [1.2, 2.34, 2.001]
result = sum(list_of_floats)
self.assertEqual(result, 5.541) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_list(input_list: List[float]) -> float:\n return sum(input_list)",
"def sum_list(input_list: List[float]) -> float:\n return sum(input_list)",
"def sum_list(input_list: List[float]) -> float:\n sum: float = 0\n for i in input_list:\n sum = sum + i\n return sum",
"def fsum(items)... | [
"0.8083567",
"0.8083567",
"0.7788616",
"0.7374771",
"0.7311574",
"0.72328746",
"0.7066626",
"0.6972362",
"0.6807591",
"0.6759573",
"0.67543155",
"0.67068624",
"0.66648847",
"0.65459245",
"0.6536975",
"0.65316075",
"0.644555",
"0.6392924",
"0.6362586",
"0.6353249",
"0.63093615... | 0.861433 | 0 |
Returns a sorted list of selfplay data directories. | def list_selfplay_dirs(base_dir):
model_dirs = [os.path.join(base_dir, x)
for x in tf.io.gfile.listdir(base_dir)]
return sorted(model_dirs, reverse=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_data(self):\n data_list = []\n for root, dirs, files in os.walk(pathfinder.data_path()):\n for name in files:\n data_list.append(os.path.join(root, name))\n return data_list",
"def get_dirs():\n # join glob matchers\n dirnames = [\n str(dir_pat... | [
"0.7210885",
"0.7076178",
"0.6867692",
"0.685712",
"0.68322694",
"0.6808806",
"0.68082637",
"0.6803831",
"0.6774294",
"0.6724709",
"0.6708498",
"0.6695982",
"0.6552779",
"0.65096354",
"0.6490297",
"0.64788204",
"0.64532286",
"0.64205575",
"0.6420415",
"0.6389557",
"0.6384688"... | 0.7105153 | 1 |
Waits for all of the awaitable objects (e.g. coroutines) in aws to finish. All the awaitable objects are waited for, even if one of them raises an exception. When one or more awaitable raises an exception, the exception from the awaitable with the lowest index in the aws list will be reraised. | def wait(aws):
aws_list = aws if isinstance(aws, list) else [aws]
results = asyncio.get_event_loop().run_until_complete(asyncio.gather(
*aws_list, return_exceptions=True))
# If any of the cmds failed, re-raise the error.
for result in results:
if isinstance(result, Exception):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait(aws):\n\n aws_list = aws if isinstance(aws, list) else [aws]\n results = asyncio.get_event_loop().run_until_complete(asyncio.gather(\n *aws_list, return_exceptions=True))\n # If any of the cmds failed, re-raise the error.\n for result in results:\n if isinstance(result, Exception):\n rais... | [
"0.6854887",
"0.64489365",
"0.60607123",
"0.59655637",
"0.5942415",
"0.58964247",
"0.58717173",
"0.5787581",
"0.5619449",
"0.5607443",
"0.55679595",
"0.551879",
"0.54877734",
"0.5482153",
"0.5470917",
"0.540138",
"0.5392612",
"0.5390896",
"0.5383947",
"0.53785133",
"0.5370939... | 0.67563105 | 1 |
Check to see that only warn and info output appears in the stream. The first line may start with WARN] or WARNING] depending on whether 'WARN' has been registered as a global log level. See options_bootstrapper.py. | def assertWarnInfoOutput(self, lines):
self.assertEqual(2, len(lines))
self.assertRegexpMatches(lines[0], '^WARN\w*] warn')
self.assertEqual('INFO] info', lines[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_for_warnings(self):\n log = str()\n print(self.default_starter_args + self.arguments)\n if not self.log_file.exists():\n print(str(self.log_file) + \" not there. Skipping search\")\n return\n print(str(self.log_file))\n with self.log_file.open(err... | [
"0.72353804",
"0.6597861",
"0.651159",
"0.64776546",
"0.64776546",
"0.64776546",
"0.64776546",
"0.64776546",
"0.64776546",
"0.64776546",
"0.64776546",
"0.6448697",
"0.6411868",
"0.63813674",
"0.63161284",
"0.63127244",
"0.6260447",
"0.625881",
"0.6250657",
"0.6216382",
"0.615... | 0.7015353 | 1 |
Parses instruction's arguments using instructionargument module | def parse_args(self, instruction: ET.Element):
self.__args = []
cur_order = []
for child in instruction:
arg = Argument(child)
if arg.order in cur_order:
raise UnexpectedXMLStructure(
'Wrong order of argument element "{}"'.format(arg.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_arguments(args):",
"def decode_instruction(instruction):\n if not instruction.endswith(INST_TERM):\n raise InvalidInstruction('Instruction termination not found.')\n\n # Use proper encoding\n instruction = utf8(instruction)\n\n # Get arg size\n elems = inst... | [
"0.69461066",
"0.6887815",
"0.67382395",
"0.6320202",
"0.6312284",
"0.6152274",
"0.6121402",
"0.61088896",
"0.60927796",
"0.6092592",
"0.608646",
"0.6078641",
"0.6063982",
"0.60591644",
"0.5996822",
"0.59701645",
"0.59372264",
"0.59354186",
"0.5913147",
"0.58877",
"0.5884104"... | 0.7026168 | 0 |
Gets either a run or a compile task from the API | def getTask():
content = requests.get(MANAGER_URL+"task", params={"apiKey": API_KEY}).text
if content == "null":
return None
else:
return json.loads(content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n task_func = getattr(self, self.task_data.get('task_type'))\n task_obj = task_func()\n return task_obj",
"def get_task(self, key: str) -> Task:\n raise NotImplementedError",
"def fusion_api_get_task(self, param='', uri=None, api=None, headers=None):\n if u... | [
"0.616161",
"0.60326207",
"0.6017457",
"0.5974819",
"0.5968861",
"0.596335",
"0.5956364",
"0.58446765",
"0.5822358",
"0.5801867",
"0.57799363",
"0.57604116",
"0.5759838",
"0.57033783",
"0.5691822",
"0.5687267",
"0.56643313",
"0.5601746",
"0.5589945",
"0.5588639",
"0.55747354"... | 0.61274016 | 1 |
Posts the result of a compilation task | def compileResult(userID, didCompile, language):
r = requests.post(MANAGER_URL+"compile", data={"apiKey": API_KEY, "userID": userID, "didCompile": int(didCompile), "language": language}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result(self, result: osbuild.pipeline.BuildResult):",
"def return_result(self, compiled_result, response_channel):\n return self.worker.publish(\n channel=response_channel, message=compiled_result)",
"def build_step(self):\n run_cmd('./compile.sh', log_all=True, simple=True, log_ok... | [
"0.6297503",
"0.6123374",
"0.6079198",
"0.5799119",
"0.5607617",
"0.5598355",
"0.5551113",
"0.55006796",
"0.54995465",
"0.5477447",
"0.54718935",
"0.5466789",
"0.5461721",
"0.5413972",
"0.53827256",
"0.5374379",
"0.5362462",
"0.53495663",
"0.5337475",
"0.5330759",
"0.5323037"... | 0.6791586 | 0 |
Append base url to partial url | def get_full_url(self, part_url):
return BASE_URL + part_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_short_url_base(url):",
"def _get_base_url(self):\n return '/{}/'.format(self.name.replace('__', '/'))",
"def get_short_url_base():",
"def generate_full_url(base_url, lineage, segment):\n params = \"/\".join([lineage, segment])\n return urljoin(base_url, params)",
"def build_url(app, re... | [
"0.7237278",
"0.705202",
"0.70063066",
"0.698653",
"0.6804967",
"0.6804967",
"0.6779443",
"0.6767789",
"0.67246985",
"0.6697949",
"0.6675118",
"0.66569734",
"0.6630495",
"0.6603647",
"0.6587251",
"0.65712684",
"0.65546143",
"0.65124065",
"0.6508288",
"0.6486769",
"0.64825237"... | 0.72533536 | 0 |
Gets stats about additions and deletions Commit url to be used can be set via commit_url or generated using both full_name and commit_sha If all parameters are set, commit_url will be used, the others ignored | def get_commit_change_stats(self, commit_url='', full_name='', commit_sha=''):
if commit_url == '' and (commit_sha == '' and full_name == ''):
raise BaseException('commit url could not be generated. Commit url, commit sha and full name not set')
return None
url = commit_url
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_commit_stats(self):\n return self.commit_stats",
"def commit_detail(self, commit):\n\n files_changes = {\n diff.a_path for diff in commit.diff()\n }\n\n return {\n 'id': commit.hexsha,\n 'date': time.strftime(\n \"%a %b %d %H:%M:... | [
"0.6415148",
"0.6115201",
"0.6015644",
"0.5979885",
"0.5823878",
"0.5778963",
"0.5718678",
"0.56915957",
"0.56483024",
"0.5626998",
"0.559609",
"0.55215144",
"0.55175155",
"0.5492246",
"0.5487441",
"0.5458346",
"0.5453407",
"0.54493964",
"0.5440784",
"0.5440086",
"0.5401678",... | 0.7875595 | 0 |
Extract repo commits from details in the repo object | def extract_commits(self, repo_obj):
url = REPO_COMMIT_LIST.format(full_name=repo_obj['full_name'])
url = self.get_full_url(url)
json_data = loads(self.get_from_net(url))
commits = []
for i in json_data:
committer = i['committer']
#stats = self.get_commit_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commits_between(repo_path, start, end):\n \n git = subprocess.Popen([\"git\", \"log\", \"%s..%s\" % (start, end)], stdout=subprocess.PIPE, cwd=repo_path)\n log = git.stdout.read().decode(\"utf-8\")\n \n cur = None\n commits = []\n \n for line in log.splitlines():\n cm = re.match(... | [
"0.70833033",
"0.68818825",
"0.68100065",
"0.67859095",
"0.67429984",
"0.66558653",
"0.66049534",
"0.65828025",
"0.6567603",
"0.65087473",
"0.64007646",
"0.6381191",
"0.6355372",
"0.63061655",
"0.6305687",
"0.62776846",
"0.6246901",
"0.62380195",
"0.61890846",
"0.6171896",
"0... | 0.7930775 | 0 |
Gets all the public repos | def get_public_repos(self, max_repos=DEFAULT_MAX_PUBLIC_REPOS):
since = 0
repo_count = 0
repos = []
while repo_count < max_repos:
temp = self.process_repo(self.get_full_url(ALL_REPO_LIST.format(since=since)), True)
repos.extend(temp)
repo_count = len(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_public_repos():\n return Collaborator.objects.filter(user__username=settings.PUBLIC_ROLE)",
"def get_repos():\n\n return __do_get_repos()",
"def get_repos():\n response = requests.get('https://quay.io/api/v1/repository?public=true&namespace=ucsc_cgl')\n repo_data = json.loads(response.... | [
"0.806337",
"0.76858354",
"0.76047444",
"0.75227976",
"0.7520303",
"0.75177026",
"0.7487321",
"0.74738944",
"0.7405739",
"0.7387148",
"0.7383653",
"0.73297626",
"0.7236298",
"0.71387374",
"0.71294105",
"0.71154386",
"0.7107003",
"0.7050756",
"0.70224655",
"0.7014604",
"0.7005... | 0.7997378 | 1 |
Specifies that a property on a PlanningSolution class is a Collection of problem facts. A problem fact must not change during solving (except through a ProblemFactChange event). The constraints in a ConstraintProvider rely on problem facts for ConstraintFactory.from(Class). | def problem_fact_collection_property(fact_type):
def problem_fact_collection_property_function_mapper(getter_function):
ensure_init()
from org.optaplanner.optapy import PythonWrapperGenerator
from org.optaplanner.core.api.domain.solution import \
ProblemFactCollectionProperty as ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planning_entity_collection_property(entity_type):\n def planning_entity_collection_property_function_mapper(getter_function):\n ensure_init()\n from org.optaplanner.optapy import PythonWrapperGenerator\n from org.optaplanner.core.api.domain.solution import \\\n PlanningEntity... | [
"0.5206215",
"0.5189513",
"0.50499916",
"0.5004489",
"0.50003415",
"0.48822853",
"0.48719192",
"0.48710668",
"0.48444247",
"0.4822283",
"0.48182458",
"0.47978848",
"0.47941014",
"0.4786141",
"0.47829002",
"0.47829002",
"0.47618714",
"0.47462758",
"0.47167763",
"0.47167763",
"... | 0.6688512 | 0 |
Specifies that a property on a PlanningSolution class is a Collection of planning entities. Every element in the planning entity collection should have the PlanningEntity annotation. Every element in the planning entity collection will be added to the ScoreDirector. | def planning_entity_collection_property(entity_type):
def planning_entity_collection_property_function_mapper(getter_function):
ensure_init()
from org.optaplanner.optapy import PythonWrapperGenerator
from org.optaplanner.core.api.domain.solution import \
PlanningEntityCollectionP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def problem_fact_collection_property(fact_type):\n def problem_fact_collection_property_function_mapper(getter_function):\n ensure_init()\n from org.optaplanner.optapy import PythonWrapperGenerator\n from org.optaplanner.core.api.domain.solution import \\\n ProblemFactCollectionP... | [
"0.5543761",
"0.5468283",
"0.49544394",
"0.49080592",
"0.48011842",
"0.4657647",
"0.4588055",
"0.4588055",
"0.4588055",
"0.45510972",
"0.45053568",
"0.44909558",
"0.44828856",
"0.44828856",
"0.4442659",
"0.44088638",
"0.44076523",
"0.43961158",
"0.43705153",
"0.43380395",
"0.... | 0.63169026 | 0 |
Specifies that a class is a problem fact. A problem fact must not change during solving (except through a ProblemFactChange event). The constraints in a ConstraintProvider rely on problem facts for ConstraintFactory.from(Class). | def problem_fact(fact_class):
ensure_init()
out = JImplements('org.optaplanner.optapy.OpaquePythonReference')(fact_class)
out.__javaClass = _generate_problem_fact_class(fact_class)
_add_deep_copy_to_class(out)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_problem_class(Class, problem_object, seed, user, instance_directory):\n\n random = Random(seed)\n attributes = deepcopy(problem_object)\n\n # pass configuration options in as class fields\n attributes.update(dict(deploy_config))\n\n attributes.update({\n \"random\": random,\n ... | [
"0.5099245",
"0.48803625",
"0.48481956",
"0.48131022",
"0.47999078",
"0.47999078",
"0.477793",
"0.47729102",
"0.47412157",
"0.46989408",
"0.46854264",
"0.46791378",
"0.46720475",
"0.46611643",
"0.46604672",
"0.46555266",
"0.46472403",
"0.46181303",
"0.46012858",
"0.4595112",
... | 0.5774208 | 0 |
Specifies that the class is a planning solution (represents a problem and a possible solution of that problem). A possible solution does not need to be optimal or even feasible. A solution's planning variables might not be initialized (especially when delivered as a problem). A solution is mutable. For scalability reas... | def planning_solution(planning_solution_class):
ensure_init()
out = JImplements('org.optaplanner.optapy.OpaquePythonReference')(planning_solution_class)
out.__javaClass = _generate_planning_solution_class(planning_solution_class)
_add_deep_copy_to_class(out)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, solution, **kwargs):\n self.solution = solution # set solution\n self.parameters = kwargs # set solution parameters\n self.scaling_factor = None",
"def __init__(self, solution, **kwargs):\n self.solution = solution # set solution\n self.parameters = kwargs... | [
"0.6299187",
"0.6292075",
"0.62344855",
"0.6163733",
"0.5826677",
"0.581412",
"0.5805651",
"0.5738758",
"0.5664172",
"0.56512344",
"0.56407416",
"0.5592069",
"0.55457485",
"0.5484656",
"0.5465259",
"0.5464254",
"0.54427224",
"0.54386795",
"0.5395744",
"0.538688",
"0.5372749",... | 0.6527557 | 0 |
Marks a function as a ConstraintProvider. The function takes a single parameter, the ConstraintFactory, and must return a list of Constraints. To create a Constraint, start with ConstraintFactory.from(get_class(PythonClass)). | def constraint_provider(constraint_provider_function):
ensure_init()
constraint_provider_function.__javaClass = _generate_constraint_provider_class(constraint_provider_function)
return constraint_provider_function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createConstraint(*argv):",
"def value_range_provider(range_id):\n def value_range_provider_function_wrapper(getter_function):\n ensure_init()\n from org.optaplanner.core.api.domain.valuerange import ValueRangeProvider as JavaValueRangeProvider\n getter_function.__optaplannerValueRange... | [
"0.53345704",
"0.4972497",
"0.4919507",
"0.48735815",
"0.48686048",
"0.48448732",
"0.48336023",
"0.48179156",
"0.48084193",
"0.4801629",
"0.47201443",
"0.47076195",
"0.47014117",
"0.46949646",
"0.46941438",
"0.46845543",
"0.46794537",
"0.46794537",
"0.46768197",
"0.4663105",
... | 0.8258811 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.