query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
The id of the vpn. | def vpn_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "vpn_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpn_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpn_id\")",
"def vpn_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"vpn_id\")",
"def vnet_id(self) -> str:\n return pulumi.get(self, \"vnet_id\")",
"def vpn_gateway_id(self) -> pulumi.Output[str]:\n... | [
"0.86590296",
"0.8267716",
"0.74908084",
"0.7400676",
"0.72514105",
"0.7154449",
"0.70609546",
"0.70609546",
"0.7050627",
"0.6992322",
"0.69837177",
"0.6943146",
"0.6912867",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553... | 0.84793 | 1 |
The list of zone mapping. See `zone` below. | def zones(self) -> pulumi.Input[Sequence[pulumi.Input['TransitRouterVpnAttachmentZoneArgs']]]:
return pulumi.get(self, "zones") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zones(self) -> Sequence[str]:\n return pulumi.get(self, \"zones\")",
"def zones(self) -> Sequence[str]:\n return pulumi.get(self, \"zones\")",
"def zones(self):\n return self._zones",
"def our_zones(self) -> List[Zone]:\n pass",
"def zones(self) -> Optional[Sequence[str]]:\n... | [
"0.8014281",
"0.8014281",
"0.78589314",
"0.7829622",
"0.7721356",
"0.7721356",
"0.76673377",
"0.7600897",
"0.75689507",
"0.7549595",
"0.7536077",
"0.7531915",
"0.7249166",
"0.7249166",
"0.7209723",
"0.7186577",
"0.7154828",
"0.71297586",
"0.70469314",
"0.70145893",
"0.7000534... | 0.72397333 | 14 |
The ID of the forwarding router instance. | def transit_router_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "transit_router_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetID(self):\n return self.Route_ID",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def router(self) -> int... | [
"0.7289573",
"0.7114021",
"0.7114021",
"0.7114021",
"0.7114021",
"0.70918983",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.69826233",
"0.69826233",
"0.69826233",
"0.69826233",
"0.69147724",
"0.6904439",
"0.6863500... | 0.6692364 | 25 |
The id of the vpn. | def vpn_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "vpn_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpn_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpn_id\")",
"def vpn_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"vpn_id\")",
"def vnet_id(self) -> str:\n return pulumi.get(self, \"vnet_id\")",
"def vpn_gateway_id(self) -> pulumi.Output[str]:\n re... | [
"0.86590296",
"0.84793",
"0.74908084",
"0.7400676",
"0.72514105",
"0.7154449",
"0.70609546",
"0.70609546",
"0.7050627",
"0.6992322",
"0.69837177",
"0.6943146",
"0.6912867",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",... | 0.8267716 | 2 |
The list of zone mapping. See `zone` below. | def zones(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['TransitRouterVpnAttachmentZoneArgs']]]]:
return pulumi.get(self, "zones") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zones(self) -> Sequence[str]:\n return pulumi.get(self, \"zones\")",
"def zones(self) -> Sequence[str]:\n return pulumi.get(self, \"zones\")",
"def zones(self):\n return self._zones",
"def our_zones(self) -> List[Zone]:\n pass",
"def zones(self) -> Optional[Sequence[str]]:\n... | [
"0.80156714",
"0.80156714",
"0.7859613",
"0.783128",
"0.7722947",
"0.7722947",
"0.7668565",
"0.7602114",
"0.7569921",
"0.75506824",
"0.7537474",
"0.7533829",
"0.7251103",
"0.7251103",
"0.7240959",
"0.7210897",
"0.7187273",
"0.7155087",
"0.71303266",
"0.70483154",
"0.69997",
... | 0.7016008 | 20 |
The ID of the forwarding router instance. | def transit_router_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "transit_router_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetID(self):\n return self.Route_ID",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def _get_tunnel_id(self):\n return self.__tunnel_id",
"def router(self) -> int... | [
"0.7289573",
"0.7114021",
"0.7114021",
"0.7114021",
"0.7114021",
"0.70918983",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.6985108",
"0.69826233",
"0.69826233",
"0.69826233",
"0.69826233",
"0.6904439",
"0.68635005",
"0.6845346... | 0.69147724 | 18 |
The id of the vpn. | def vpn_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "vpn_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpn_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"vpn_id\")",
"def vpn_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"vpn_id\")",
"def vnet_id(self) -> str:\n return pulumi.get(self, \"vnet_id\")",
"def vpn_gateway_id(self) -> pulumi.Output[str]:\n ... | [
"0.84793",
"0.8267716",
"0.74908084",
"0.7400676",
"0.72514105",
"0.7154449",
"0.70609546",
"0.70609546",
"0.7050627",
"0.6992322",
"0.69837177",
"0.6943146",
"0.6912867",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
"0.6842553",
... | 0.86590296 | 0 |
The list of zone mapping. See `zone` below. | def zones(self) -> pulumi.Output[Sequence['outputs.TransitRouterVpnAttachmentZone']]:
return pulumi.get(self, "zones") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zones(self) -> Sequence[str]:\n return pulumi.get(self, \"zones\")",
"def zones(self) -> Sequence[str]:\n return pulumi.get(self, \"zones\")",
"def zones(self):\n return self._zones",
"def our_zones(self) -> List[Zone]:\n pass",
"def zones(self) -> Optional[Sequence[str]]:\n... | [
"0.8014281",
"0.8014281",
"0.78589314",
"0.7829622",
"0.7721356",
"0.7721356",
"0.76673377",
"0.7600897",
"0.75689507",
"0.7549595",
"0.7536077",
"0.7531915",
"0.7249166",
"0.7249166",
"0.72397333",
"0.7209723",
"0.7154828",
"0.71297586",
"0.70469314",
"0.70145893",
"0.700053... | 0.7186577 | 16 |
Returns a string containing the username of online users | def WhoIsOn():
onlineLock.acquire()
reply = str(len(OnLine)) + " user(s) currently online\n"
for i in range(0,len(OnLine)):
reply += " " + OnLine[i][0] +'\n'
onlineLock.release()
return reply | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def onlineusers(chan : str):\n\t await bot.say(users)",
"def online_users(self):\n raise NotImplementedError",
"def _getUsername(self):\n for (l, d) in getAccountNames(self.store):\n return l + u'@' + d",
"def get_euare_username(self):\n return self.get_all_users(acco... | [
"0.67469275",
"0.6658833",
"0.66328704",
"0.66121125",
"0.6542907",
"0.648639",
"0.6439699",
"0.64187366",
"0.64160293",
"0.64160293",
"0.64160293",
"0.64160293",
"0.64160293",
"0.64160293",
"0.64160293",
"0.64160293",
"0.6409486",
"0.63346213",
"0.6311257",
"0.6308306",
"0.6... | 0.76031923 | 0 |
(str) Return a formatted string of the results for this athlete. | def __str__(self) :
"""Implementation of this is optional but useful for observing your
programs behaviour.
"""
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\r\n results = f\"Pricing for {self.name} at {self.date.strftime('%Y-%m-%d')}:\\n----------------------------------------\\nRooms\\tMin\\tMax\\tAvg\"\r\n for i in range(0,len(self.rooms)-1):\r\n results += f\"\\n{self.rooms[i]}\\t{self.min_prices[i]}\\t{self.max_prices[i]... | [
"0.679877",
"0.66805476",
"0.6640746",
"0.6627501",
"0.65879256",
"0.656354",
"0.65548825",
"0.65398055",
"0.65241706",
"0.6517463",
"0.64961255",
"0.6488314",
"0.64452684",
"0.64410365",
"0.6425449",
"0.64177084",
"0.641579",
"0.6403437",
"0.63615376",
"0.635821",
"0.6348339... | 0.0 | -1 |
Sets the exon_number of this VariantInfoFusions. | def exon_number(self, exon_number):
self._exon_number = exon_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intron_number(self, intron_number):\n\n self._intron_number = intron_number",
"def set_number(self, number):\n self._number = number",
"def set_eoff(self, eoff: Iterable[Number]):\r\n self.eoff = eoff",
"def number(self, number):\n\n self._number = number",
"def number(self,... | [
"0.61303693",
"0.5755274",
"0.56387687",
"0.5597657",
"0.5597657",
"0.5597657",
"0.5597657",
"0.5501692",
"0.5420376",
"0.54126006",
"0.5371944",
"0.53238267",
"0.5305168",
"0.5208512",
"0.516739",
"0.5124283",
"0.51242757",
"0.50892633",
"0.5066721",
"0.50662285",
"0.5062082... | 0.84851414 | 0 |
Sets the intron_number of this VariantInfoFusions. | def intron_number(self, intron_number):
self._intron_number = intron_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inning_number(self, inning_number):\n\n self._inning_number = inning_number",
"def setWaveNumber(self, number):\n self._wave_number = number",
"def exon_number(self, exon_number):\n\n self._exon_number = exon_number",
"def set_number_served(self, number):\n self.number_served ... | [
"0.63131857",
"0.61199826",
"0.591219",
"0.58358586",
"0.58358586",
"0.5826741",
"0.5755891",
"0.57502836",
"0.56678283",
"0.5525524",
"0.55142534",
"0.55142534",
"0.55142534",
"0.55142534",
"0.5494471",
"0.5494471",
"0.5494471",
"0.5494471",
"0.5370045",
"0.53581184",
"0.530... | 0.85441804 | 0 |
Sets the lbpwlep of this VariantInfoFusions. | def lbpwlep(self, lbpwlep):
self._lbpwlep = lbpwlep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rbpwlep(self, rbpwlep):\n\n self._rbpwlep = rbpwlep",
"def lbpwrep(self, lbpwrep):\n\n self._lbpwrep = lbpwrep",
"def set_lam_l2w(self, lam_l2w=1e-3):\n zero_ary = np.zeros((1,))\n new_lam = zero_ary + lam_l2w\n self.lam_l2w.set_value(new_lam.astype(theano.config.floatX))... | [
"0.7014604",
"0.64740926",
"0.5457362",
"0.5457362",
"0.5401723",
"0.5327674",
"0.5327674",
"0.5275329",
"0.52460986",
"0.5204895",
"0.51970637",
"0.50027925",
"0.49371347",
"0.4908967",
"0.49019188",
"0.49019188",
"0.48752952",
"0.48072845",
"0.47657254",
"0.4750719",
"0.473... | 0.8483491 | 0 |
Sets the lbpwrep of this VariantInfoFusions. | def lbpwrep(self, lbpwrep):
self._lbpwrep = lbpwrep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lbpwlep(self, lbpwlep):\n\n self._lbpwlep = lbpwlep",
"def rbpwrep(self, rbpwrep):\n\n self._rbpwrep = rbpwrep",
"def rbpwlep(self, rbpwlep):\n\n self._rbpwlep = rbpwlep",
"def setWeightL(self, weight): # real signature unknown; restored from __doc__\n pass",
"def setLWS(sel... | [
"0.7344826",
"0.64272684",
"0.63688654",
"0.5397345",
"0.5345396",
"0.49711442",
"0.4864933",
"0.48271832",
"0.47815543",
"0.47655487",
"0.4757161",
"0.47145456",
"0.4707417",
"0.46904522",
"0.46904522",
"0.4651028",
"0.46389276",
"0.46333972",
"0.46333972",
"0.45844665",
"0.... | 0.81680006 | 0 |
Sets the rbpwlep of this VariantInfoFusions. | def rbpwlep(self, rbpwlep):
self._rbpwlep = rbpwlep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lbpwlep(self, lbpwlep):\n\n self._lbpwlep = lbpwlep",
"def rbpwrep(self, rbpwrep):\n\n self._rbpwrep = rbpwrep",
"def lbpwrep(self, lbpwrep):\n\n self._lbpwrep = lbpwrep",
"def prcp_bias(self):\n return self.mbmod.prcp_bias",
"def prcp_bias(self):\n return self.mbmod.... | [
"0.6979817",
"0.62270564",
"0.5546972",
"0.5385742",
"0.5385742",
"0.537006",
"0.5329336",
"0.5329336",
"0.5168767",
"0.5149926",
"0.50131124",
"0.49417228",
"0.48720422",
"0.4785047",
"0.4726242",
"0.47042844",
"0.46978933",
"0.4695224",
"0.46929857",
"0.46686032",
"0.465540... | 0.81746244 | 0 |
Sets the rbpwrep of this VariantInfoFusions. | def rbpwrep(self, rbpwrep):
self._rbpwrep = rbpwrep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rbpwlep(self, rbpwlep):\n\n self._rbpwlep = rbpwlep",
"def lbpwrep(self, lbpwrep):\n\n self._lbpwrep = lbpwrep",
"def set_rbw(self, cnum=1, BW=\"\"):\n scpi_command = scpi_preprocess(\":SENS{:}:BAND:RES {:}\", cnum, BW)\n self.write(scpi_command)",
"def setReplier(self, *args)... | [
"0.7236666",
"0.6606415",
"0.55646",
"0.51998174",
"0.517668",
"0.4961226",
"0.4952075",
"0.4922752",
"0.49070606",
"0.4895776",
"0.4893218",
"0.4893218",
"0.4888051",
"0.4847368",
"0.47712702",
"0.4760089",
"0.47511226",
"0.47505832",
"0.47168347",
"0.47109035",
"0.46966815"... | 0.8075693 | 0 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602374",
"0.85093755",
"0.8237104",
"0.8050309",
"0.80128866",
"0.79348034",
"0.78766525",
"0.77898884",
"0.7786461",
"0.7745792",
"0.7627315",
"0.76055235",
"0.757999",
"0.7514394",
"0.75038797",
"0.75035286",
"0.74850684",
"0.7440529",
"0.74325883",
"0.74239755",
"0.740... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Sell shares of stock | def sell():
return apology("TODO") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sell(self, stock, sig, day):\n\n # Get the index of the stock\n idx = self.ncs.index(stock)\n\n # Only need to sell the unit recommended by the trading agent, not necessarily all stock unit.\n num_share = min(abs(int(sig)), self.state[idx + 1])\n commission = dp.Trading.comm... | [
"0.7493962",
"0.7363704",
"0.72457373",
"0.7232984",
"0.7170457",
"0.7157004",
"0.7102979",
"0.70986",
"0.7088864",
"0.7058037",
"0.7032456",
"0.7011614",
"0.6995602",
"0.6966525",
"0.69662094",
"0.6964375",
"0.69479614",
"0.6914818",
"0.68679184",
"0.68611443",
"0.6845491",
... | 0.0 | -1 |
Return true iff this is an accepting state. | def isAccepting(self) -> bool:
return self.accepting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accepted(self) -> bool:\n return pulumi.get(self, \"accepted\")",
"def is_accepted(self):\n return self._accepted",
"def accepted(self):\n return self.__accepted",
"def CanTransitionTo(self, state):\n return self.IsBlocked(state) == 0",
"def is_state(self, state):\n retur... | [
"0.7066704",
"0.7053635",
"0.65485287",
"0.6478708",
"0.6467776",
"0.6459428",
"0.6458197",
"0.6390523",
"0.6300346",
"0.6282164",
"0.62357694",
"0.62292206",
"0.6169708",
"0.6127562",
"0.6126116",
"0.60769093",
"0.6070802",
"0.60664535",
"0.604899",
"0.6041192",
"0.60185444"... | 0.76677406 | 0 |
A function to calculate the transformation matrix Q for the element. | def Q_matrix(node1, node2):
# calculate the unit axial vector of the bar element in global coords
axial_vect = (node2 - node1)/la.norm(node2 - node1)
# get cos theta and sin theta
costheta = axial_vect[0]
sintheta = axial_vect[1]
# fill in the transformation matrix
Q = np.array([[costheta, -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _matrix(self):\n\t\treturn q_matrix(self.rot_quat)",
"def Q_mat(self, angle):\n\n # U_i values for the block multiplication\n U_1 = (1 / 8) * (3 * self.Qxx + 3 * self.Qyy + 2 * self.Qxy + 4 * self.Qss)\n U_2 = (1 / 2) * (self.Qxx - self.Qyy)\n U_3 = (1 / 8) * (self.Qxx + self.Qyy ... | [
"0.6876695",
"0.66858464",
"0.6626991",
"0.64433914",
"0.63761026",
"0.63422513",
"0.63340306",
"0.6259898",
"0.62205017",
"0.62020683",
"0.6187671",
"0.6185622",
"0.6168217",
"0.6158059",
"0.61579627",
"0.61543167",
"0.613269",
"0.6117354",
"0.61125416",
"0.6110592",
"0.6108... | 0.6573287 | 3 |
Excludes any questions that aren't published yet. | def get_queryset(self):
return Question.objects.filter(pk=self.kwargs.get('pk', None)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden(self):\n\n today = timezone.now().date()\n return self.filter(\n ~Q(status='published')\n | (\n Q(submission_deadline__lt=today)\n & ~Q(recurrence='ongoing')))",
"def test_is_published_with_future_question(self):\n time = timezon... | [
"0.65908915",
"0.6223479",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6209108",
"0.6202153",
"0.61874676",
"0.61874676",
"0.61834395",
"0.61680806",
"0.61680806",
"0.61577",... | 0.0 | -1 |
Excludes any questions that aren't published yet. | def get_queryset(self):
return Question.objects.filter(pub_date__lte=timezone.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden(self):\n\n today = timezone.now().date()\n return self.filter(\n ~Q(status='published')\n | (\n Q(submission_deadline__lt=today)\n & ~Q(recurrence='ongoing')))",
"def test_is_published_with_future_question(self):\n time = timezon... | [
"0.65892863",
"0.62230533",
"0.62014467",
"0.61893433",
"0.61893433",
"0.61852986",
"0.6170101",
"0.6170101",
"0.6159485",
"0.61317044",
"0.6125395",
"0.6119233",
"0.6100283",
"0.6100283",
"0.60915196",
"0.6077764",
"0.60734934",
"0.60692275",
"0.60182565",
"0.60182565",
"0.6... | 0.62109476 | 9 |
Excludes any questions that aren't published yet. | def get_queryset(self):
return Question.objects.filter(pub_date__lte=timezone.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden(self):\n\n today = timezone.now().date()\n return self.filter(\n ~Q(status='published')\n | (\n Q(submission_deadline__lt=today)\n & ~Q(recurrence='ongoing')))",
"def test_is_published_with_future_question(self):\n time = timezon... | [
"0.65908915",
"0.6223479",
"0.6202153",
"0.61874676",
"0.61874676",
"0.61834395",
"0.61680806",
"0.61680806",
"0.61577",
"0.6130839",
"0.61250585",
"0.6117061",
"0.6098479",
"0.6098479",
"0.608942",
"0.6077105",
"0.60743284",
"0.6067166",
"0.6016055",
"0.6016055",
"0.6002819"... | 0.6209108 | 8 |
Listing nodes calls the right endpoint and succeeds on 200. | def test_list_nodes(self):
clb = self.get_clb('get', 'clburl/loadbalancers/12345/nodes',
((), self.expected_kwargs),
Response(200), '{"nodes": []}')
d = clb.list_nodes(self.rcs)
self.assertEqual({'nodes': []}, self.successResultOf(d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes_index():\n output = docker('node','ls')\n resp = json.dumps(docker_node_ls_to_array(output))\n return Response(response=resp, mimetype=\"application/json\")",
"def nodes_index():\n output = docker(\"node\", \"ls\")\n \n resp = json.dumps(docker_nodes_to_array(output))\n return Resp... | [
"0.74164224",
"0.7317649",
"0.7053895",
"0.69525564",
"0.6923203",
"0.67744154",
"0.6684738",
"0.66120934",
"0.6567958",
"0.65608865",
"0.6507527",
"0.6453338",
"0.645243",
"0.6390178",
"0.6330365",
"0.6312207",
"0.6245316",
"0.6237175",
"0.6237175",
"0.62262374",
"0.6165247"... | 0.7381827 | 1 |
takes an absolute path of a module and returns the fully qualified name of the module | def _get_module_name(path):
relative_path = path.replace(root_path(), '/')
# remove __init__.py .. (invalid module name)
# relative_path = relative_path.replace("__init__.py", '')
return relative_path[1:-3].replace("/", ".") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_module_name(module_path):\n return ntpath.split(module_path)[1].split(\".\")[0]",
"def get_module_name(module_path):\n return ntpath.split(module_path)[1].split(\".\")[0]",
"def get_module_name_for_path(path):\n module_name = path.replace(\"/\", \".\")\n if module_name.endswith(\".__init__.... | [
"0.8291738",
"0.8291738",
"0.804558",
"0.7629801",
"0.7565559",
"0.7441266",
"0.7440143",
"0.7288706",
"0.72150356",
"0.7159193",
"0.7100449",
"0.7065689",
"0.7041233",
"0.69673175",
"0.69256186",
"0.6919164",
"0.69113445",
"0.68972653",
"0.6895619",
"0.68600404",
"0.6850461"... | 0.81057614 | 2 |
Return the path to the `plugins` directory of the environment. | def get_plugins_dir(env):
plugins_dir = os.path.realpath(".")
path = root_path()
return os.path.normcase(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugins_directory(self):\n return self._normalize_absolute_or_relative_path(\n self.project_config_with_variables_substituted.plugins_directory\n )",
"def plugin_dir(self):\n return self.tmpdir(\"plugins\")",
"def get_plugin_dir(self, f): # f should be __file__\n d = f.sp... | [
"0.8171355",
"0.7980748",
"0.7292902",
"0.7157388",
"0.7084367",
"0.7058253",
"0.667754",
"0.6674674",
"0.66532207",
"0.6636907",
"0.6611465",
"0.6499908",
"0.64489675",
"0.64165765",
"0.63587976",
"0.6334988",
"0.63151896",
"0.630538",
"0.629906",
"0.62410635",
"0.62171406",... | 0.873277 | 0 |
Sets global logging level level specified by string ``level_name``, such as 'debug', or 'warn'. | def set_loglevel(level_name):
assert type(level_name) == str, level_name
level_name = level_name.upper()
levels_avail = [level
for level in dir(logging)
if isinstance(getattr(logging, level), int)]
assert level_name in levels_avail, (
"{} not a valid loglevel, chose o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_logging_level(level_name=None):\r\n try:\r\n log.setLevel(getattr(logging, level_name.upper()))\r\n except AttributeError:\r\n log.setLevel(logging.DEBUG)\r\n log.debug(\"Logging set to {}\".format(level_name))\r\n\r\n logging.basicConfig()",
"def log_level(level, name = None):\... | [
"0.84206533",
"0.8070057",
"0.7664912",
"0.7476284",
"0.7401499",
"0.7131154",
"0.709905",
"0.69998723",
"0.6979707",
"0.6923159",
"0.69054586",
"0.6879634",
"0.6858793",
"0.6796197",
"0.67901045",
"0.6740156",
"0.6726305",
"0.6705466",
"0.66997343",
"0.6671719",
"0.6669522",... | 0.82749426 | 1 |
Extract template name from string containing document text | def _get_template(txt):
template = pymmd.value(txt, 'latexfooter', pymmd.COMPLETE)
template_re = re.compile(r'(?P<template>[a-zA-Z0-9._]*)\/footer.tex')
match = template_re.search(template)
return match.group('template') if match else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_template_name(template_name):\n page = find_page('Template:' + template_name)\n if not page:\n return None\n match = regex.match(r'\\{\\{([^|{}]*)', page.source)\n if not match:\n return None\n return match.group(1).rstrip()",
"def getTemplate(name):\n with open('templat... | [
"0.66835827",
"0.655606",
"0.6361534",
"0.63067836",
"0.62189823",
"0.6131386",
"0.61023915",
"0.6016508",
"0.5936658",
"0.5912563",
"0.5899109",
"0.58125967",
"0.5796928",
"0.5792008",
"0.5777721",
"0.5766276",
"0.5761998",
"0.57547116",
"0.57297045",
"0.5715127",
"0.5669621... | 0.6980722 | 0 |
Return the total number of images in the dataset. | def __len__(self):
return len(self.records) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_n_data(dataloader):\n\n if isinstance(dataloader.dataset, datasets.ImageFolder):\n return len(dataloader.dataset.imgs)\n else:\n return dataloader.dataset.data.shape[0]",
"def numberOfImages(self):\n return self._nimages",
"def __len__(self):\n print(\"number of images... | [
"0.79589343",
"0.7868952",
"0.7677412",
"0.7673693",
"0.75164026",
"0.75164026",
"0.7370348",
"0.73570573",
"0.7334503",
"0.7260679",
"0.7238845",
"0.7214807",
"0.70920694",
"0.7078799",
"0.70641774",
"0.70536566",
"0.703138",
"0.7024604",
"0.70061064",
"0.70061064",
"0.69835... | 0.0 | -1 |
Returns `(images,labels)` pair where image is a list [imgsPlane1,imgsPlane2,imgsPlane3] and labels is a list [gt,gt,gt] | def __getitem__(self, index):
img_raw = {}
for plane in self.planes:
# Load raw image data for each plane
img_raw[plane] = np.load(self.paths[plane][index])
# Resize the image loaded in the previous step
img_raw[plane] = self._resize_image(img_raw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_labels(filename, num_images):\n gt_imgs = []\n tmp_imgs = []\n for i in range(1, num_images+1):\n imageid = \"satImage_%.3d\" % i\n image_filename = filename + imageid + \".png\"\n if os.path.isfile(image_filename):\n img = Image.open(image_filename)\n ... | [
"0.7063231",
"0.6920151",
"0.665958",
"0.66201985",
"0.6533774",
"0.64641726",
"0.63926655",
"0.62060326",
"0.61429405",
"0.61282456",
"0.60878867",
"0.60835373",
"0.60797673",
"0.6072757",
"0.6041757",
"0.5984007",
"0.59555405",
"0.5934585",
"0.5930591",
"0.591656",
"0.58936... | 0.5625701 | 51 |
Resize the image to `(3,224,224)` and apply transforms if possible. | def _resize_image(self, image):
# Resize the image
# Calculate extra padding present in the image
# which needs to be removed
pad = int((image.shape[2] - INPUT_DIM)/2)
# This is equivalent to center cropping the image
image = image[:,pad:-pad,pad:-pad]
# Normalize... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, image):\n image = cv2.resize(image, self.size)\n trans = transforms.Compose([\n transforms.ToTensor(),\n transforms.Normalize((0.3337, 0.3064, 0.3171),\n (0.2672, 0.2564, 0.2629))\n ])\n\n if self.setname == 'trai... | [
"0.6534122",
"0.6493911",
"0.64159685",
"0.63325983",
"0.63290834",
"0.62551665",
"0.62194526",
"0.6182433",
"0.61554706",
"0.6132222",
"0.61081487",
"0.6106424",
"0.6103954",
"0.6010801",
"0.5954911",
"0.59168506",
"0.58713996",
"0.5827365",
"0.5800185",
"0.57902926",
"0.576... | 0.62961864 | 5 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lon1, lat1, lon2, lat2): # 经度1,纬度1,经度2,纬度2 (十进制度数)
# 将十进制度数转化为弧度
lon1, lat1, lon2, lat2 = map(float, [lon1, lat1, lon2, lat2])
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine公式
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat / 2) ** 2 + cos(lat1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle_distance(latitudes1: float, longitudes1: float, latitudes2: float, longitudes2: float) -> float:\n dlat = math.radians(latitudes1 - latitudes2)\n dlon = math.radians(longitudes1 - longitudes2)\n alat = math.radians((latitudes1 + latitudes2) / 2)\n R = 3958.8\n x = dlon * math.cos(al... | [
"0.8263672",
"0.79028153",
"0.76523226",
"0.7635832",
"0.7599059",
"0.75452703",
"0.75348586",
"0.7534801",
"0.7523721",
"0.7497239",
"0.74971086",
"0.7460991",
"0.7404893",
"0.73632264",
"0.7353057",
"0.7325208",
"0.73241794",
"0.72988456",
"0.72679293",
"0.7267184",
"0.7219... | 0.0 | -1 |
Checks the missing values in the all dataframes. The target column in the predict variable will not be checked here because it is assumed to have all missing values. | def check_missing(
self, subset=None, printResult=True, returnResult=False):
#Check if subset is actually a subset of the parameters or not:
if subset:
self.subset_check(subset)
else:
subset = self.datablock.columns
check_dict = {}
for key,data i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fillMissingValues(self):\n invalidFiles = False\n message = \"\"\n\n try :\n connectedDataFrames = pd.concat([ self.train_set, self.test_set ])\n\n # Get All Features With Nulls\n trainSet_featuresWithNulls = self.train_set.apply(lambda x: sum(x.isnull()), ... | [
"0.6729903",
"0.6637593",
"0.64175284",
"0.6314501",
"0.6292577",
"0.62203383",
"0.61885077",
"0.6170335",
"0.6168148",
"0.61320883",
"0.6101378",
"0.60987574",
"0.60698205",
"0.60666114",
"0.6065096",
"0.6043632",
"0.59755665",
"0.59686744",
"0.59451056",
"0.5896496",
"0.589... | 0.67352384 | 0 |
Read the last frame sent to the transport. This method assumes that at most one frame was sent. It raises an AssertionError otherwise. | def last_sent_frame(self):
stream = asyncio.StreamReader(loop=self.loop)
for (data,), kw in self.transport.write.call_args_list:
stream.feed_data(data)
self.transport.write.call_args_list = []
stream.feed_eof()
if stream.at_eof():
frame = None
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lastRead(self):\n return _yarp.BufferedPortBottle_lastRead(self)",
"def raw_read(self):\n buf = self.wf.readframes(self.frames_per_read)\n if not buf:\n self.eof = True\n return None\n\n self.framesread += self.frames_per_read\n\n return buf",
"def _... | [
"0.6693249",
"0.6576862",
"0.65570784",
"0.6375857",
"0.6308638",
"0.6286092",
"0.6228879",
"0.61766577",
"0.61697537",
"0.6139372",
"0.61056876",
"0.608746",
"0.6087177",
"0.6087177",
"0.60398793",
"0.60384643",
"0.59827054",
"0.5956132",
"0.5950611",
"0.5949872",
"0.5945340... | 0.82410413 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i+n]",
"def _chunks(self, l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]",
"def chunk(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(l, n):\n ... | [
"0.80763406",
"0.79780173",
"0.7848591",
"0.7818154",
"0.7764843",
"0.7764843",
"0.7740603",
"0.76803994",
"0.7677509",
"0.7673566",
"0.765864",
"0.7655856",
"0.7655856",
"0.7655856",
"0.76458347",
"0.7615106",
"0.75838816",
"0.7557435",
"0.7549177",
"0.7549177",
"0.7549177",... | 0.7448925 | 73 |
Returns a list of tuples as a path from the given start to the given end in the given maze | def astar(maze, start, end):
# Create start and end node
start_node = Node(None, start)
start_node.g = start_node.h = start_node.f = 0
end_node = Node(None, end)
end_node.g = end_node.h = end_node.f = 0
# Initialize both open and closed list
open_list = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(maze, start, end):\n pq = queue.PriorityQueue()\n visited = {}\n result_row, result_col = end\n start_row, start_col = start\n cost = manhattan_distance(start_row, start_col, result_row, result_col)\n pq.put((cost, [(start_row, start_col)]))\n while not pq.empty():\n cur_pa... | [
"0.7186189",
"0.685255",
"0.6810174",
"0.6658109",
"0.65126026",
"0.6453765",
"0.6447593",
"0.6447593",
"0.64222276",
"0.63607824",
"0.63607824",
"0.63607824",
"0.6307588",
"0.6262609",
"0.6258561",
"0.625568",
"0.6223364",
"0.61855656",
"0.61711717",
"0.61630076",
"0.6160937... | 0.6486278 | 5 |
Inversedecay learning rate until warmup_steps, then decay. | def lr_decay_with_warmup(global_step, warmup_steps, hidden_units=512):
return hidden_units ** -0.5 * min(
(global_step + 1.0) * warmup_steps ** -1.5, (global_step + 1.0) ** -0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate_decay(config, global_step):\n warmup_steps = tf.to_float(config.train.warmup_steps)\n global_step = tf.to_float(global_step)\n return config.hidden_units ** -0.5 * tf.minimum(\n (global_step + 1.0) * warmup_steps ** -1.5, (global_step + 1.0) ** -0.5)",
"def learning_rate_decay(hparams, gl... | [
"0.75810266",
"0.7275951",
"0.7227143",
"0.7184868",
"0.71514416",
"0.71426105",
"0.697105",
"0.68892366",
"0.6863351",
"0.6844407",
"0.6840964",
"0.67982936",
"0.6746357",
"0.67127556",
"0.6664801",
"0.6649206",
"0.66429824",
"0.66301966",
"0.6566296",
"0.65446305",
"0.65418... | 0.71941584 | 3 |
Normalizes a relative sub path with respect to the enclosed root directory. Returns a tuple of the renormalized relative sub path and the absolute sub path. | def co_norm(cls, *, rel_sub_path: pl.Path) -> typ.Tuple[pl.Path, pl.Path]:
if rel_sub_path.is_absolute():
msg = f'Sub path "{rel_sub_path}" is not a relative path'
logger.error(msg)
raise tex.AbsoluteSubpath(msg)
root_dir = cls.get_root_dir()
path = root_dir ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_rel_path(path, basepath):\n # gracefully ignore invalid input absolute path + no basepath\n if path is None:\n return basepath\n if os.path.isabs(path) and basepath is not None:\n return os.path.normpath(os.path.relpath(os.path.realpath(path), os.path.realpath(basepath)))\n ... | [
"0.6802757",
"0.6386042",
"0.6362782",
"0.6333542",
"0.6329502",
"0.63043755",
"0.6227099",
"0.6151259",
"0.6143848",
"0.61081845",
"0.60960364",
"0.60195833",
"0.6015488",
"0.60038203",
"0.5983719",
"0.59282523",
"0.59236336",
"0.5905265",
"0.5902391",
"0.58402854",
"0.58304... | 0.79027987 | 0 |
Return iterator over I/O items. | def items(self):
return self._data.items() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate(self):\n return self._reader.iterate()",
"def iterReader(self,it):\n\n for line in it:\n yield line",
"def __iter__(self):\n\t\tcursor = self._items\n\t\twhile not cursor is None:\n\t\t\tyield cursor.data\n\t\t\tcursor=cursor.next",
"def __iter__(self):\n cursor = 0\n whi... | [
"0.72537017",
"0.7155723",
"0.7136155",
"0.68558836",
"0.6830546",
"0.68055856",
"0.67850345",
"0.6782942",
"0.67756015",
"0.6730783",
"0.6678585",
"0.664032",
"0.66183233",
"0.65892714",
"0.65770686",
"0.65754503",
"0.65532917",
"0.65531474",
"0.65403414",
"0.6524115",
"0.64... | 0.0 | -1 |
Get output field. Check that the output exists. | def __getattr__(self, name):
if name not in self._fields:
raise AttributeError("Outputs have no field {}".format(name))
return super().__getattr__(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getoutput(self):\r\n return self._output",
"def getFieldOutput(self, node, fieldName):\n nodeFormat = node.nodeFormat()\n try:\n field = nodeFormat.fieldDict[fieldName]\n return field.outputText(node, False, nodeFormat.formatHtml)\n except KeyError:\n ... | [
"0.6831557",
"0.6700493",
"0.6664252",
"0.65516686",
"0.63621616",
"0.62126654",
"0.6192201",
"0.6164954",
"0.6148032",
"0.606178",
"0.6022867",
"0.60045964",
"0.59856766",
"0.5964628",
"0.5956516",
"0.5860158",
"0.5830537",
"0.5798976",
"0.5788066",
"0.57775426",
"0.57775426... | 0.62426627 | 5 |
Find data object ID for given slug. This method queries the Resolwe API and requires network access. | def get_data_id_by_slug(self, slug):
resolwe_host = os.environ.get("RESOLWE_HOST_URL")
url = urllib.parse.urljoin(
resolwe_host, "/api/data?slug={}&fields=id".format(slug)
)
with urllib.request.urlopen(url, timeout=60) as f:
data = json.loads(f.read().decode("utf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_object(model, *args, **kwargs):\n pk, slug = kwargs['object_slug'].split('-', 1)\n obj = get_object_or_404(model, pk=pk)\n return obj",
"def get_data_id(data):\n return data.id if type(data).__name__ == \"Data\" else data",
"def get_data_id(data):\n return data.id if type(da... | [
"0.5938799",
"0.59084505",
"0.5901982",
"0.5752632",
"0.57101226",
"0.5704482",
"0.5697307",
"0.5650851",
"0.5604886",
"0.5602073",
"0.5602073",
"0.5602073",
"0.5602073",
"0.5602073",
"0.5602073",
"0.5602073",
"0.5602073",
"0.5602073",
"0.55998176",
"0.5584506",
"0.55790365",... | 0.8404844 | 0 |
Calculates Ngram for every 1, 2, ... N. N included. Returns a list of strings | def getNgrams(text, N):
res = []
# filter stopwords
tokenized = tokenizer.tokenize(text)
filtered_words = [word for word in tokenized if word not in stops and len(word) > 4]
for n in range(1, N+1):
grams = ngrams(filtered_words, n)
for gram in grams:
gram_as_str = "_".join(gram).lower()
res.append(gram_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ngrams(text, n):\n tokens = text.split()\n return [\" \".join(tokens[i:i + n]) for i in range(len(tokens) - (n - 1))] # list of str",
"def ngrams(n, text):\n for i in range(num_ngrams(n, text)):\n yield text[i:i+n]",
"def word2ngrams(text, n=4, exact=True):\n return [\"\".join(g) fo... | [
"0.80950034",
"0.8063549",
"0.7956386",
"0.7951137",
"0.78903896",
"0.7886876",
"0.78564566",
"0.7842132",
"0.7810121",
"0.7789758",
"0.7776022",
"0.77658296",
"0.7763884",
"0.76866394",
"0.76721877",
"0.7647975",
"0.76339495",
"0.7626226",
"0.75927985",
"0.7560851",
"0.75569... | 0.800667 | 2 |
Create a DocMarkdownConverter object from the input html. | def markdownify(html: str) -> DocMarkdownConverter:
return DocMarkdownConverter(bullets='•').convert(html) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_to_markdown(\n html: str,\n) -> str:\n html_parser = html2text.HTML2Text()\n html_parser.body_width = 0\n html_parser.mark_code = True\n return html_parser.handle(html)",
"def mdconverter(text):\n if isinstance(text, DictProperty.DotDict):\n return text\n elif isinstance(text, ... | [
"0.6778643",
"0.6538918",
"0.65220594",
"0.6517119",
"0.6431166",
"0.6208491",
"0.6034612",
"0.5931463",
"0.59301704",
"0.5919844",
"0.5891964",
"0.58895326",
"0.58587575",
"0.58205545",
"0.57945454",
"0.57945454",
"0.57916534",
"0.5773989",
"0.5737556",
"0.57248884",
"0.5688... | 0.70316803 | 0 |
Given a Python symbol, return its signature and description. The first tuple element is the signature of the given symbol as a markupfree string, and the second tuple element is the description of the given symbol with HTML markup included. If the given symbol is a module, returns a tuple `(None, str)` else if the symb... | async def get_symbol_html(self, symbol: str) -> Optional[Tuple[list, str]]:
url = self.inventories.get(symbol)
if url is None:
return None
async with self.bot.http_session.get(url) as response:
html = await response.text(encoding='utf-8')
# Find the signature he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_symbol_embed(self, symbol: str) -> Optional[discord.Embed]:\n scraped_html = await self.get_symbol_html(symbol)\n if scraped_html is None:\n return None\n\n signatures = scraped_html[0]\n permalink = self.inventories[symbol]\n description = markdownify(sc... | [
"0.6077472",
"0.5656848",
"0.55509645",
"0.5187072",
"0.5109529",
"0.5061209",
"0.49313608",
"0.48488104",
"0.48406875",
"0.48362222",
"0.48141798",
"0.47906625",
"0.4785521",
"0.4783541",
"0.47576955",
"0.47504845",
"0.47248948",
"0.4721277",
"0.47200933",
"0.4719078",
"0.47... | 0.71463335 | 0 |
Generate a string representation of the tree Use an preorder traversal of the tree | def __str__(self):
ans = "["
ans += str(self._value)
for child in self._children:
ans += ", "
ans += str(child)
return ans + "]" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_tree(self, option='pre_order'):\n if option == 'preorder':\n nodes = self.pre_order(self.root)\n else:\n nodes = [] # not desired!\n\n print_str = ''\n for node in nodes:\n print_str += str(node)\n\n return print_str",
"def print_tree... | [
"0.7984946",
"0.79837584",
"0.75195307",
"0.74486893",
"0.74185497",
"0.7370272",
"0.7367992",
"0.7350066",
"0.73286843",
"0.7324034",
"0.7314318",
"0.7212077",
"0.7108223",
"0.7088545",
"0.70839685",
"0.7080506",
"0.7074047",
"0.7060962",
"0.7013598",
"0.696531",
"0.6961157"... | 0.0 | -1 |
Returns a Certificate ARN from the Amazon Certificate Service given the DNS name | def get_certificate_arn(self, dns_name):
if not self.acm:
return None
try:
certs = self.acm.list_certificates()["CertificateSummaryList"]
cert = [cert['CertificateArn'] for cert in certs if cert['DomainName'] == dns_name]
return cert[0] if cert else None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_arn_for_cert(self, cert_name):\n cert_arn = None\n\n try:\n cert = self.conn_iam.get_server_certificate(cert_name)\n cert_arn = cert.arn\n logging.info(\"IAM::get_arn_for_cert: \"\n \"Found arn '%s' for certificate '%s'\"\n ... | [
"0.6424177",
"0.55924237",
"0.5541017",
"0.5502666",
"0.533157",
"0.52430904",
"0.5122477",
"0.5106245",
"0.49686316",
"0.49466324",
"0.49451146",
"0.48911697",
"0.4885593",
"0.48788193",
"0.48744446",
"0.4831639",
"0.4823015",
"0.48177126",
"0.47801805",
"0.4773643",
"0.4773... | 0.8041044 | 0 |
This is the network definition of Gluon Hybrid Alexnet | def __init__(self, classes=1000, **kwargs):
super(GluonHybridAlexNet, self).__init__(**kwargs)
with self.name_scope():
self.features = nn.HybridSequential(prefix='')
with self.features.name_scope():
self.features.add(nn.Conv2D(64, kernel_size=11, strides=4,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_network(self):\r\n raise NotImplementedError()",
"def build_net():\n net = graph.Network(\"net\")\n net_input = net.create_input(\"i\", DIM)\n bucket = net.create_bucket(\"b\", DIM)\n net_output = net.create_output(\"o\", DIM)\n net.create_connection(\"i_to_b\", net_input, bucket,... | [
"0.64314294",
"0.628278",
"0.62512994",
"0.6165474",
"0.6074242",
"0.6042941",
"0.60029423",
"0.5945616",
"0.5922792",
"0.59118867",
"0.59116894",
"0.586475",
"0.5863986",
"0.58622175",
"0.5846893",
"0.5834157",
"0.5817077",
"0.58158416",
"0.5809947",
"0.5804825",
"0.58040446... | 0.6728999 | 0 |
Build a model from selected parameters or load trained model for evaluation. | def get_model(args, train_loader, mean, stddev, atomref, logging=None):
if args.mode == "train":
if logging:
logging.info("building model...")
representation = get_representation(args, train_loader)
output_module = get_output_module(
args,
representation=r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_model(args, load_path='', partial=False):\n #global_data and conv_data not used yet\n if args.selector == \"none\":\n # if args.model_name == \"ref_transformer\" or args.model_name == \"plain_transformer\":\n model = ClarifyQuestionRanker(args, args.device)\n elif args.selecto... | [
"0.70930016",
"0.7075998",
"0.69423544",
"0.68525714",
"0.67765343",
"0.6689862",
"0.6688971",
"0.66303694",
"0.6625791",
"0.6586656",
"0.65777653",
"0.65636474",
"0.65636474",
"0.6550426",
"0.65250266",
"0.6520726",
"0.6517824",
"0.65169233",
"0.64992183",
"0.6471219",
"0.64... | 0.67193705 | 5 |
This method takes as input a square array 'arr' and returns a new array which is a similarity transformation U^dag(arr)U of 'arr' that changes the basis of arr from inbasis to sbasis (or the reverse, U(arr)U^dag, from sbasis to inbasis if the input bool parameter 'reverse' is set to True.) U = umat , U^dag = Hermitian ... | def switch_arr_basis(arr, umat, reverse=False):
umat_H = umat.conj().T
assert arr.shape == umat.shape
if not reverse:
new_arr = np.dot(np.dot(umat_H, arr), umat)
else:
new_arr = np.dot(np.dot(umat, arr), umat_H)
return new_arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abs_square(arr):\n return np.conjugate(arr)*arr",
"def qubo_to_ising(mat: np.ndarray):\n mat /= 4\n for i in range(mat.shape[0]):\n mat[i, i] += np.sum(mat[i, :])",
"def symmetrized_matrix(U):\n M = U.copy()\n inds = onp.triu_indices_from(M,k=1)\n M[(inds[1], inds[0])] = M[inds]\n ... | [
"0.55426025",
"0.5460452",
"0.5456243",
"0.5399272",
"0.5328071",
"0.5328071",
"0.5328071",
"0.5328071",
"0.5314182",
"0.52898985",
"0.5280582",
"0.5256252",
"0.52093536",
"0.5206545",
"0.516697",
"0.51488465",
"0.51396936",
"0.51243365",
"0.51191235",
"0.51007015",
"0.508932... | 0.75732744 | 0 |
This method takes as input a int|float or a 1D array of floats. It returns the array, with negative items replaced by zero | def positive_part_of_vec(vec):
vec1 = vec
if isinstance(vec, (int, float)):
vec1 = [vec]
li = list(vec1)
li_new = [max(0, x) for x in li]
return np.array(li_new) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_replace(array):\n type_arrayinput = type(array) # Uncomment while debugging\n for r in range(array.shape[0]):\n for c in range(array.shape[1]):\n if array[r][c] == 0:\n array[r][c] = 1\n type_arrayoutput = type(array) # Uncomment while debugging\n return arra... | [
"0.64827687",
"0.6411167",
"0.6365551",
"0.63612825",
"0.6255593",
"0.61540604",
"0.6126116",
"0.60592973",
"0.603526",
"0.60314584",
"0.5920997",
"0.5917338",
"0.589945",
"0.5822833",
"0.58137566",
"0.58104163",
"0.58087647",
"0.58074546",
"0.579224",
"0.57901317",
"0.577126... | 0.6147614 | 6 |
This method returns a random complex 1D numpy array, normalized, of size dim. | def random_st_vec(dim):
st_vec = np.random.randn(dim) + 1j*np.random.randn(dim)
st_vec /= np.linalg.norm(st_vec)
return st_vec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_complex_array(N):\n re = np.random.rand(N)\n im = np.random.rand(N)\n return re + 1j*im",
"def random_complex_array(size,seed=None): \n if seed is not None:\n np.random.seed(seed)\n return np.random.rand(size).astype(np.double) + np.random.rand(size).astype(np.double)*1j",
"... | [
"0.7407877",
"0.71933687",
"0.68507355",
"0.6663216",
"0.6529604",
"0.6374072",
"0.6326213",
"0.6210175",
"0.617049",
"0.6059159",
"0.59330416",
"0.5904241",
"0.5846649",
"0.58459836",
"0.58361375",
"0.58351547",
"0.58263564",
"0.5767629",
"0.576391",
"0.5741291",
"0.5729653"... | 0.56161034 | 31 |
Create boolean mask by actually number of a padded tensor. | def get_paddings_indicator(actual_num, max_num, axis=0):
actual_num = torch.unsqueeze(actual_num, axis + 1)
# tiled_actual_num: [N, M, 1]
max_num_shape = [1] * len(actual_num.shape)
max_num_shape[axis + 1] = -1
max_num = torch.arange(max_num, dtype=torch.int, device=actual_num.device).view(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_mask(t: Union[torch.Tensor, np.array], padding_idx=0):\n if type(t) is np.ndarray:\n mask = np.not_equal(t, padding_idx)*1.0\n else:\n mask = torch.ne(t, padding_idx).float()\n return mask",
"def attention_mask(nd, ns, *, dtype):\n i = tf.range(nd)[:,None]\n j = tf.range(... | [
"0.7440539",
"0.6902586",
"0.678297",
"0.6742602",
"0.67122",
"0.66695637",
"0.6661279",
"0.6647773",
"0.6630107",
"0.66225624",
"0.6473563",
"0.64296454",
"0.64257705",
"0.63703644",
"0.63690156",
"0.63335764",
"0.63138485",
"0.62863815",
"0.62837577",
"0.62654746",
"0.61772... | 0.5801729 | 50 |
Calculate the number of days until the reserved instance expires. | def calc_expiry_time(expiry):
if isinstance(expiry, float):
expiry_datetime = datetime.datetime.fromtimestamp(expiry).replace(
tzinfo=None)
else:
expiry_datetime = dateutil.parser.parse(expiry).replace(tzinfo=None)
return (expiry_datetime - datetime.datetime.utcnow()).days | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_days_until_expiration(self):\n return self.policy.get_days_until_expiration(self)",
"def duration( self ):\n return 1 + self.startDate.date().daysTo(self.endDate.date())",
"def days_remaining(self):\n return self.date_difference(self, GregorianDate(self.year, MonthOfYear.DECEMBER, ... | [
"0.70705223",
"0.65106523",
"0.6492883",
"0.6464395",
"0.632284",
"0.6319774",
"0.6319774",
"0.63196725",
"0.63196725",
"0.63196725",
"0.6319491",
"0.6319491",
"0.6319491",
"0.6319491",
"0.6319491",
"0.6319491",
"0.6319491",
"0.6319491",
"0.63191956",
"0.63191956",
"0.6318596... | 0.0 | -1 |
Crea un usuario que no es staff ni superuser | def create_user(self, email, first_name, last_name, password=None):
if not email:
raise ValueError('Users must have an email address')
print(self.model)
user = self.model(
email=self.normalize_email(email),
first_name=first_name,
last_name=last_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def super_usuario_dummy(**params):\n\n defaults = {\n 'email': 'admin@foodstack.mx',\n 'password': 'password123'\n }\n\n defaults.update(params)\n\n return get_user_model().objects.create_superuser(**defaults)",
"def create_super_user(self):\n\n if User.objects.filter(username=se... | [
"0.7530912",
"0.7513345",
"0.7511373",
"0.7484837",
"0.74797136",
"0.7475091",
"0.74636674",
"0.74494004",
"0.74289656",
"0.7423305",
"0.7414824",
"0.7401677",
"0.7398249",
"0.73775274",
"0.7373418",
"0.73658407",
"0.73531383",
"0.7351571",
"0.7345375",
"0.7330534",
"0.732753... | 0.0 | -1 |
A convenient wrapper for stacked bar graph plot for pressure/weight | def plot_stacked_bar(frac,x='time',**kwargs):
# setup colors and labels using seaborn
import seaborn as sns
cp_br=sns.diverging_palette(250,20,n=8)
cp_mag=sns.diverging_palette(200,60,n=4)
c_2p = cp_br[:2]
c_2p += cp_mag[:2]
c_hot = cp_br[6:][::-1]
c_hot += cp_mag[2:][::-1]
varname ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_all_cities_stacked_bar(all_cities):\r\n left = 1.5\r\n bottom = 0\r\n counts = []\r\n for topic in all_cities:\r\n last = 0\r\n for poverty_level in all_cities[topic]:\r\n count = all_cities[topic][poverty_level]\r\n #only create labels for legend once\r\n ... | [
"0.64881146",
"0.6207617",
"0.6183121",
"0.6061625",
"0.6042254",
"0.58525145",
"0.5837695",
"0.57910115",
"0.57509804",
"0.57071835",
"0.5706736",
"0.5704518",
"0.56427675",
"0.5641844",
"0.55935496",
"0.5573174",
"0.5545732",
"0.55285704",
"0.5515514",
"0.5513714",
"0.55133... | 0.64480406 | 1 |
Compute a perspective transform matrix using the pinhole camera model. Assumes the same horizontal and vertical fov angle. | def perspective_matrix(image_w, image_h, theta, phi, fov=np.pi/4):
# Convert the image to the 3D coordinate space by setting the Z coordinate of image pixel to 0
to_3d = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 0], [0, 0, 1]])
# Set the origin to the image center
T = np.eye(4)
T[0, 3] = -image_w/2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perspective_transform(self):\n mtx_perp = cv2.getPerspectiveTransform(self.src_points, self.dst_points)\n mtx_perp_inv = cv2.getPerspectiveTransform(self.dst_points, self.src_points)\n return mtx_perp, mtx_perp_inv",
"def perspective(fovy, aspect, znear, zfar):\n h = math.tan(fovy / 3... | [
"0.7143419",
"0.7069605",
"0.67195326",
"0.655534",
"0.6475241",
"0.6442365",
"0.6404028",
"0.63931966",
"0.6391128",
"0.6382139",
"0.63442194",
"0.6278526",
"0.627764",
"0.62506515",
"0.6191378",
"0.61238307",
"0.609609",
"0.60936344",
"0.6092595",
"0.6076591",
"0.5999081",
... | 0.7744444 | 0 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
{
'title':'Home Page',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\treturn render_template('home.html')",
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n )",
"def home():\r\n return render_template('home.html')",
"def home():\r\n return render_template(\"home.html\")",
"def home():\n\n return render_t... | [
"0.8605755",
"0.8495015",
"0.8452865",
"0.84418297",
"0.83532524",
"0.83532524",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
... | 0.0 | -1 |
Renders the contact page. | def contact(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/contact.html',
{
'title':'Contact',
'message':'Your contact page.',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n return render_template(\"contact.html\")",
"def contact():\n return render_template(\"home/contact.html\")",
"def contact():\r\n return render_template(\r\n 'contact.html',\r\n title='Contact',\r\n year=datetime.now().year,\r\n message='Your contact page.'\... | [
"0.8325958",
"0.82439756",
"0.8212342",
"0.8212342",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8172992",
"0.8172992",
"0.8051458",
"0.8005288",
... | 0.7544549 | 39 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
{
'title':'About',
'message':'Your application description page.',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.853708",
"0.84225804",
"0.84096235",
"0.83830416",
"0.8295423",
"0.8293176",
"0.8293176",
"0.8283257",
"0.8283257",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.... | 0.0 | -1 |
Renders the about page. | def cigarette(request):
if request.method == 'POST':
readstring = request.body
readstring = readstring.decode("ascii")
if not os.path.isfile(datapath):
f = open(datapath,'w')
else:
f = open(datapath,'a')
f.write(readstring+"\n")
f.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.85373485",
"0.842411",
"0.841022",
"0.83836156",
"0.8296103",
"0.82935613",
"0.82935613",
"0.82837594",
"0.82837594",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"... | 0.0 | -1 |
Renders the about page. | def detail(request):
tmpfilename = "app/static/temp/test.png"
try:
data = GetData (datapath,request.GET["date"])
test = PreparePlotDataWithTime(data)
PlotData(test,request.GET["date"],convertdatehourtoAMPM,tmpfilename)
except:
data = GetData(datapath)
test =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.85373485",
"0.842411",
"0.841022",
"0.83836156",
"0.8296103",
"0.82935613",
"0.82935613",
"0.82837594",
"0.82837594",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"... | 0.0 | -1 |
Returns a `pathnet_lib.ComponentsLayer` with linear task specific layers. This is a small helper function to create a layer of fully connected components for multiple classification tasks (with possibly different numbers of classses). The constructed layer assumes that the next layer contains task heads to compute the ... | def create_layer_with_task_specific_linear_heads(num_classes_for_tasks):
num_tasks = len(num_classes_for_tasks)
components = []
for num_classes in num_classes_for_tasks:
components.append(pn.RoutedComponent(
pn_components.FCLComponent(numbers_of_units=[num_classes]),
pn.IndependentTaskBasedRo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_task_layer(self, n_output_units: int, previous_task_layer=None):\n if previous_task_layer is None:\n current_task_layer: Linear = getattr(self.model,\n self.classifier_field)\n in_features = current_task_layer.in_features\n ... | [
"0.6811561",
"0.5968386",
"0.58591014",
"0.5759645",
"0.5497409",
"0.54511034",
"0.5349426",
"0.52697945",
"0.5234784",
"0.52326876",
"0.5187159",
"0.5173403",
"0.51207626",
"0.5089136",
"0.5069529",
"0.50487065",
"0.5025129",
"0.5015522",
"0.5004581",
"0.4999841",
"0.4997426... | 0.8125083 | 0 |
Calculates an average vector. Expected x as a 2D array with columns as elements and a row per vector | def average_vector(x):
mean_vector = x.mean(axis = 0)
return(mean_vector) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v_avg(vecs):\n xs = []\n ys = []\n\n for v in vecs:\n xs.append(v[0])\n ys.append(v[1])\n\n xresult = 0\n for x in xs:\n xresult += x\n\n yresult = 0\n for y in ys:\n yresult += y\n\n return xresult / len(xs), yresult / len(ys)",
"def mean_2d_array(x):\n ... | [
"0.72298485",
"0.7198375",
"0.7171856",
"0.7032877",
"0.6971097",
"0.6905673",
"0.6846431",
"0.67762893",
"0.67591995",
"0.67490864",
"0.6676853",
"0.6676062",
"0.65625656",
"0.6427988",
"0.63963705",
"0.6384003",
"0.6381861",
"0.6377255",
"0.63767624",
"0.6374262",
"0.636228... | 0.8693165 | 0 |
Initialise a UnreliableCar instance, based on parent class Car. | def __init__(self, name='Unreliable Car', fuel=0, reliability=50):
super().__init__(name, fuel)
self.reliability = reliability | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, vehicle: Vehicle):\n self._vehicle = vehicle",
"def __init__(self, make, model, year):\n\t\tsuper(ElectricCar,self).__init__(make,model,year)\n\t\tself.battery = Battery()",
"def __init__(self, data, connection):\n\t\tsuper(Vehicle, self).__init__(data)\n\t\tself.connection = connecti... | [
"0.58510494",
"0.5491709",
"0.54525983",
"0.53689843",
"0.5344301",
"0.5321206",
"0.52986693",
"0.5215616",
"0.5195653",
"0.51451373",
"0.51451373",
"0.51442164",
"0.5089082",
"0.50879747",
"0.50861937",
"0.507779",
"0.50673056",
"0.5064278",
"0.5050112",
"0.5032293",
"0.5019... | 0.6127947 | 0 |
Convert the long color into hex colour | def getHexColour(self, longColour):
longColour = long(longColour)
if longColour < 0:
longColour = long(longColour) & 0xFFFFFFFF
hexColour = hex(longColour)[2:-3]
hexColour = '#' + hexColour.rjust(6, '0').upper()
return hexColour | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_hex(self) -> str:\n return f\"#{self.color_int // 65536:02x}{(self.color_int // 256) % 256:02x}{self.color_int % 256:02x}\"",
"def toHexString(color: java.awt.Color) -> unicode:\n ...",
"def color_to_hex(color):\n if color.startswith(\"#\"):\n return x256.from_hex(color.strip(... | [
"0.73811203",
"0.7173617",
"0.70986426",
"0.6962304",
"0.6946804",
"0.680639",
"0.6739694",
"0.66806155",
"0.6663437",
"0.66496885",
"0.6641205",
"0.65821654",
"0.65798044",
"0.65694565",
"0.65669024",
"0.65468395",
"0.6533022",
"0.652104",
"0.6514488",
"0.6511181",
"0.651068... | 0.8006828 | 0 |
Deletes a message from the specified SQS queue. | def dequeue_message(sqs_url, receipt_handle):
client = boto3.client('sqs')
client.delete_message(
QueueUrl=sqs_url,
ReceiptHandle=receipt_handle
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_sqs_message(self, queue, message):\n\t\tconn = boto.connect_sqs(self.aws_id, self.aws_key)\n\t\tq = conn.create_queue(queue)\n\t\tq.delete_message(message)",
"def delete_sqs_message(sqs_queue_url, msg_receipt_handle):\n\n # Delete the message from the SQS queue\n sqs_client = boto3.client('sqs')... | [
"0.88342434",
"0.8326503",
"0.80846184",
"0.7921072",
"0.74378705",
"0.7356117",
"0.72943926",
"0.70069695",
"0.6984689",
"0.69147563",
"0.69106233",
"0.6904558",
"0.68850994",
"0.68795687",
"0.67788935",
"0.6664052",
"0.6653269",
"0.66383475",
"0.65899813",
"0.65842396",
"0.... | 0.7554086 | 4 |
Capitalises the first letter only in a string. | def upperfirst(input_string):
return input_string[0].upper() + input_string[1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize_first(string):\n return string[0].upper() + string[1:]",
"def capitalize(s: str) -> str:\n return s[0].upper() + s[1:]",
"def make_capital(string):\n\n if isinstance(string, str) and string:\n return string[:1].upper() + string[1:]\n else:\n return string",
"def caps(... | [
"0.8520205",
"0.84249747",
"0.82814854",
"0.8244778",
"0.822208",
"0.8205782",
"0.817942",
"0.8080188",
"0.8043015",
"0.8043015",
"0.80111974",
"0.7978258",
"0.78765136",
"0.7691614",
"0.76758724",
"0.7674407",
"0.7647705",
"0.7624323",
"0.7602932",
"0.75917196",
"0.7581209",... | 0.75935066 | 19 |
A generator that yields all Speakers that are needed for the Speaker Clustering Suite to function | def create_all_speakers():
yield Speaker(False, 40, 'speakers_40_clustering_vs_reynolds')
yield Speaker(False, 100, 'speakers_100_50w_50m_not_reynolds')
yield Speaker(True, 40, 'speakers_40_clustering_vs_reynolds')
yield Speaker(True, 60, 'speakers_60_clustering')
yield Speaker(True, 80, 'speakers_8... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_speakers():\r\n\r\n speakers = get_db().get_all_speakers()\r\n\r\n return render_template('speakers.html', speakers=speakers)",
"def speakers(self): \n\n speakers = []\n for device in soco.discover():\n info = device.get_current_transport_info()\n if info['cu... | [
"0.6246076",
"0.5971908",
"0.5931271",
"0.5770881",
"0.56970733",
"0.563052",
"0.5547339",
"0.5523813",
"0.5514747",
"0.54822886",
"0.5475816",
"0.5470221",
"0.5468684",
"0.5462468",
"0.5442154",
"0.54361945",
"0.5424982",
"0.53979504",
"0.53869027",
"0.53719664",
"0.5336336"... | 0.77493113 | 0 |
Get full file path for test config | def _get_test_file_path(self, file_path):
for path in (os.path.join(self._resource_config.test_files_location, file_path),
os.path.join(self._resource_config.test_files_location, self._reservation_id, file_path),
file_path):
if os.path.exists(path):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_config_path():\n return os.path.join(os.path.dirname(__file__), 'test_schedules.config')",
"def config_file_path(self) -> str:\n return pulumi.get(self, \"config_file_path\")",
"def config_file_path(self) -> str:\n return pulumi.get(self, \"config_file_path\")",
"def config_file... | [
"0.8439344",
"0.78167015",
"0.78167015",
"0.781647",
"0.7816451",
"0.7748169",
"0.7712638",
"0.7637847",
"0.7591164",
"0.75771683",
"0.75380003",
"0.74537134",
"0.735526",
"0.73528725",
"0.73528725",
"0.73528725",
"0.73528725",
"0.73528725",
"0.7352309",
"0.7352168",
"0.73518... | 0.0 | -1 |
Close the logger and flush entries. | def close(self):
self.log_to_api()
self.entries = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self._log_reader.close()",
"def flush(logger=root):\r\n logger.flush()",
"def closeLoggingStreams(self):\n\t\tif self.__logger is not None:\n\t\t\tself.__logger.info('Closing logger streams.')\n\t\t\tfor handler in self.__logger.handlers:\n\t\t\t\thandler.close()",
"def end_log()... | [
"0.7649411",
"0.750828",
"0.7473801",
"0.73380816",
"0.73380816",
"0.7133414",
"0.69811165",
"0.68336034",
"0.68231225",
"0.6782784",
"0.6766006",
"0.6764938",
"0.67426753",
"0.6721877",
"0.6631414",
"0.66294175",
"0.6624083",
"0.6612535",
"0.65956897",
"0.6559574",
"0.655573... | 0.71872246 | 5 |
Reform the input dict, removing NaN values. | def reform_dict(raw_dict,
k1_min=None,
k2_min=None,
form="dict-arr",
len_m=None):
res = {}
if form == "dict-dict":
for k1 in raw_dict:
if k1_min is not None and k1 < k1_min:
continue
for k2 in raw_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_nan_dict(x):\n return {k: v for k, v in x.items() if pd.notnull(v)}",
"def remove_nan(obj):\n for key, value in obj.items():\n if isNaN(value):\n obj.pop(key, None)\n return obj",
"def clean_dict(d: dict) -> dict:\n new_d = {}\n for i in d:\n if d[i] i... | [
"0.76364475",
"0.7217793",
"0.6795493",
"0.67541426",
"0.66047066",
"0.6531896",
"0.64562523",
"0.6394069",
"0.63520736",
"0.63448334",
"0.6342157",
"0.6288243",
"0.6244005",
"0.6230811",
"0.62051797",
"0.62005895",
"0.62005895",
"0.6192292",
"0.61763656",
"0.61644584",
"0.61... | 0.59126306 | 33 |
Load model from checkpoint. | def load_checkpoint(model, checkpoint: str):
print("Loading model checkpoint", checkpoint)
od = torch.load(checkpoint)
# remove proceeding 'N.' from checkpoint that comes from DDP wrapper
saved_model = od["model"]
model.load_state_dict(saved_model) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_checkpoint_model(self, checkpoint):\n with open(checkpoint, 'r') as file:\n info = json.load(file)\n path = Path(info['params_path'])\n self.gen.load_parameters(str(path / 'model.h5'), raise_if_missing=True)\n self.dis.load_parameters(str(path / 'cls.h5'), raise_... | [
"0.8559217",
"0.83081347",
"0.81678295",
"0.81678295",
"0.8096299",
"0.7990111",
"0.7988889",
"0.7973495",
"0.7940887",
"0.7849882",
"0.782374",
"0.78143144",
"0.77886295",
"0.77886295",
"0.7772035",
"0.77632946",
"0.773514",
"0.7732876",
"0.7703572",
"0.77016366",
"0.7683215... | 0.83715624 | 1 |
Liefert die Nummer des aktuell eingestellten Sounds zurueck. | def getSoundIndex(self, ext=C_EXT_MASTER):
return self._sound_index[ext] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_rounds(self):\n return self._data_holder.numRounds",
"def speech_rate(self):\r\n objects = self.__get_objects()\r\n z1 = str(objects[1]).strip().split()\r\n return int(z1[2])",
"def win_amount(self):\n pass",
"def get_rounds(number):\n pass",
"def get_text(... | [
"0.5941433",
"0.5926425",
"0.5756069",
"0.5626051",
"0.55555886",
"0.54996234",
"0.54785657",
"0.543962",
"0.5413603",
"0.53805804",
"0.53766894",
"0.5336741",
"0.5306324",
"0.5236862",
"0.52313644",
"0.52172923",
"0.5214272",
"0.51798975",
"0.51615614",
"0.5148288",
"0.51468... | 0.0 | -1 |
Reset slices for a video. | def reset_slices(self, video):
self.stdout.write("\nForcing slices re-creation")
video.recording_slices = []
video.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_scale_slice_transform(self):\n self.indices = None\n self.reflect = None",
"def clean_up_slices(self):\n self.delete_data_im_slices()\n self.delete_label_im_slices()",
"def test_unslice_will_restore_original_render_resolution(self):\n dres = pm.PyNode('defaultResolu... | [
"0.63560367",
"0.6335895",
"0.60467046",
"0.59977984",
"0.5983754",
"0.5845156",
"0.5812444",
"0.57794183",
"0.5632296",
"0.5587741",
"0.5561238",
"0.55366015",
"0.55325675",
"0.55292505",
"0.5524011",
"0.5520229",
"0.5499561",
"0.54956865",
"0.5485912",
"0.54831326",
"0.5460... | 0.8372902 | 0 |
Constructor for the CreateIdentificationRequest class | def __init__(self,
return_urls=None,
identity_provider=None,
i_frame=None,
language=None,
get_social_security_number=None,
pre_filled_social_security_number=None,
page_title=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, request_id, donation_id):\n super().__init__()\n\n if not isinstance(request_id, int):\n raise TypeError\n if not isinstance(donation_id, int):\n raise TypeError\n\n self.request_id = request_id\n self.donation_id = donation_id",
"def cr... | [
"0.6350705",
"0.6094159",
"0.60766435",
"0.60574967",
"0.60496205",
"0.5996444",
"0.59560186",
"0.58868265",
"0.5869295",
"0.5869295",
"0.5854709",
"0.5818802",
"0.5788078",
"0.5785008",
"0.5778882",
"0.57445407",
"0.57005566",
"0.5694097",
"0.5672637",
"0.56667405",
"0.56629... | 0.0 | -1 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
return_urls = idfy_rest_client.models.return_urls.ReturnUrls.from_dictionary(dictionary.get('ReturnUrls')) if dictionary.get('ReturnUrls') e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionar... | [
"0.81689686",
"0.81689686",
"0.813836",
"0.80257535",
"0.80040085",
"0.798756",
"0.79445213",
"0.78791505",
"0.784138",
"0.78387725",
"0.78144383",
"0.7809402",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.... | 0.0 | -1 |
Truncates a sequence pair in place to the maximum length. | def _truncate_seq_pair(tokens_a, tokens_b, max_length):
# This is a simple heuristic which will always truncate the longer sequence
# one token at a time. This makes more sense than truncating an equal percent
# of tokens from each, since if one sequence is very short then each token
# that's truncated ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _truncate_seq_pair(tokens_a, tokens_b, max_length):\n\n\t# This is a simple heuristic which will always truncate the longer sequence\n\t# one token at a time. This makes more sense than truncating an equal percent\n\t# of tokens from each, since if one sequence is very short then each token\n\t# that's truncat... | [
"0.7616466",
"0.76045316",
"0.7567926",
"0.7560364",
"0.7560364",
"0.75303763",
"0.75285566",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7523197",
"0.7520785",
"0.7520785",
... | 0.76052254 | 2 |
Creates a logger with requested name. | def set_logger(logger_name):
logger = logging.getLogger(logger_name)
logger.setLevel(logging_level)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging_level)
formatter = logging.Formatter('%(asctime)s; %(name)s; %(levelname)s; %(message)s')
ch.setFormatter(formatter)
logger.addHandle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_logger(name: str) -> logging.Logger:\r\n logger = logging.getLogger(name)\r\n logger.setLevel(os.getenv(\"LOG_LEVEL\", \"INFO\"))\r\n ch = logging.StreamHandler(sys.stdout)\r\n\r\n # create formatter\r\n formatter = ExtraLogFormatter(\"%(asctime)s %(levelname)s [%(pathname)s:%(lineno)d] %... | [
"0.7763192",
"0.772721",
"0.7713865",
"0.7666359",
"0.7644536",
"0.7633609",
"0.75663495",
"0.7524541",
"0.7508333",
"0.74990183",
"0.74520147",
"0.74520147",
"0.74090385",
"0.7392116",
"0.7389927",
"0.7375262",
"0.7371061",
"0.7315702",
"0.7313337",
"0.73059565",
"0.7304175"... | 0.0 | -1 |
Returns a logger instance by the name. | def get_logger(logger_name):
return set_logger(logger_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger(name):\n return Logging.get_logger(name)",
"def logger(name):\n return Logging.get_logger(name)",
"def logger_for(name):\n return logging.getLogger(name)",
"def get_logger(cls, name):\r\n return cls._factory.get_logger(name)",
"def get_logger_by_name(name: str):\n if name ... | [
"0.8716226",
"0.8716226",
"0.86374766",
"0.8534853",
"0.8372945",
"0.83025247",
"0.8297665",
"0.8297665",
"0.8273081",
"0.82649946",
"0.82010627",
"0.8179743",
"0.81157154",
"0.81157154",
"0.7997414",
"0.79665935",
"0.7869938",
"0.7824508",
"0.780857",
"0.7805047",
"0.7793213... | 0.7767598 | 21 |
Returns True if TensorTracer is enabled. | def is_enabled():
return tensor_tracer_flags.TTParameters().is_enabled() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_tracing(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"active_tracing\")",
"def has_tracer(self, uuid):\n return uuid in self._sessions and self._sessions[uuid].tracer()",
"def is_enabled() -> bool:\n try:\n _get_refjit()\n return True\n except ImportError:\... | [
"0.68865323",
"0.6578214",
"0.64046687",
"0.6267029",
"0.6264119",
"0.6205519",
"0.60750365",
"0.6072307",
"0.6061941",
"0.60335255",
"0.60176766",
"0.5950585",
"0.59407014",
"0.59158397",
"0.5899856",
"0.58912677",
"0.5890669",
"0.5887421",
"0.5819449",
"0.58063114",
"0.5799... | 0.805785 | 0 |
Checks if the given device type is valid. | def check_device_type(device_type):
if device_type not in [_DEVICE_TYPE_TPU, _DEVICE_TYPE_CPU]:
raise ValueError('Invalid device_type "%s"'%device_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_device_type(device_type, **kw):\n\n device_type = device_type.lower()\n return is_string(device_type) and (device_type in VALID_DEVICES)",
"def _validate_type(type_, spec_version):\n if spec_version == \"2.0\":\n if not re.match(TYPE_REGEX, type_):\n raise ValueError(\n ... | [
"0.82071054",
"0.6233257",
"0.61542875",
"0.61265886",
"0.6097936",
"0.6059722",
"0.60298806",
"0.59652525",
"0.59405375",
"0.5900581",
"0.5872228",
"0.5819238",
"0.5814844",
"0.57920253",
"0.5785852",
"0.57728434",
"0.57529825",
"0.574646",
"0.5687455",
"0.5685597",
"0.56593... | 0.7859832 | 1 |
Return true if scalar output tensor from Op is not safe to be traced. | def unsafe_scalar_trace(op):
# Tracing the following causes cycle in the graph on TPU.
if op.type in ['LoopCond', 'Enter', 'Merge', 'Const',
'Switch', 'Less', 'ReadVariableOp']:
return True
# Tracing the following will cause casting-issue
# with the norm tracing mode or other c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _skip_tensor(self, op_id, out_tensor, report_handler):\n\n # Skips a tensor if the tensor has a non-numeric type.\n # Note: we cannot use check_ops.is_numeric_tensor(out_tensor)\n # because it also excludes tensors with dtypes, bool, and\n # float32_ref, which we actually want to ... | [
"0.7193757",
"0.66722035",
"0.65440226",
"0.6282455",
"0.62396",
"0.6237086",
"0.6168195",
"0.6122997",
"0.6122997",
"0.6094312",
"0.6042788",
"0.59070224",
"0.5874953",
"0.58676547",
"0.5836537",
"0.58250606",
"0.5771035",
"0.57560396",
"0.57289076",
"0.57120717",
"0.5697635... | 0.68761396 | 1 |
Returns True if the given op is not an interesting one to be traced. | def _less_interesting_op(self, op):
# If flag is set to include less interesting ops, then include everything.
if self._parameters.include_less_interesting_ops:
return False
# Following ops are highly unlikey to cause bugs.
return op.type in ['Const', 'Identity', 'Cast', 'Shape'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _skip_op(self, op_id, op, ops_in_exec_path, report_handler):\n if TensorTracer.while_loop_op(op):\n report_handler.instrument_op(\n op, TensorTracer.reason(op_id, _REASON_WHILELOOP_OP))\n return True\n if TensorTracer.unsafe_op(op):\n report_handler.instrument_op(\n op, T... | [
"0.756445",
"0.66482514",
"0.6639093",
"0.643253",
"0.62884593",
"0.6072893",
"0.600627",
"0.5872288",
"0.58187026",
"0.579598",
"0.57757413",
"0.574304",
"0.57216287",
"0.5702159",
"0.56859845",
"0.56523544",
"0.5580048",
"0.5578211",
"0.5577552",
"0.55687165",
"0.55687165",... | 0.6844649 | 1 |
Initializes a TensorTracer. Sets the various member fields from the flags (if given) or the defaults. | def __init__(self):
self._replica_id = None
self._tt_config = tensor_tracer_report.TensorTracerConfig()
self._parameters = tensor_tracer_flags.TTParameters()
self._included_op_full_names = set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_tracing(trace_flags):\n global TRACE_METHOD\n global TRACE_API\n global TRACE_ENABLED\n\n try:\n trace_flags = [flag.strip() for flag in trace_flags]\n except TypeError: # Handle when trace_flags is None or a test mock\n trace_flags = []\n for invalid_flag in set(trace_fl... | [
"0.61767393",
"0.6137865",
"0.6046253",
"0.5894591",
"0.58710396",
"0.58581907",
"0.58108985",
"0.57825613",
"0.57798374",
"0.5763845",
"0.57569903",
"0.5742827",
"0.5734447",
"0.5711293",
"0.5688883",
"0.568322",
"0.5681277",
"0.5667697",
"0.5660532",
"0.5639001",
"0.5635999... | 0.7064144 | 0 |
Checks whether the op is included in the tensor tracer flags. | def _is_user_included_op(self, op):
def _is_op_or_any_neighbor_included(op, check_before=0, check_after=0):
"""Helper function to check if op is included or not."""
if op.name in self._included_op_full_names:
return True
for opname_re in self._parameters.included_opname_re_list:
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_op(self):\n return 1 in self",
"def isOp(self):\n return self.getCaller().isOp()",
"def _is_report_op(self, op):\n return op.endswith(\"_f_r\") or op == self._terascan_update_op",
"def _if_tune_ops(self, op_json):\n if self.tune_ops_name is None:\n return True\n ... | [
"0.6441574",
"0.64273125",
"0.6401736",
"0.6372137",
"0.62543523",
"0.6248614",
"0.6129927",
"0.6072477",
"0.6047392",
"0.5943639",
"0.59338975",
"0.590395",
"0.5813247",
"0.57867604",
"0.57735246",
"0.57502025",
"0.56908727",
"0.5628578",
"0.56276387",
"0.5621952",
"0.558213... | 0.6167767 | 6 |
Returns True if immediate tensors should be first saved to a cache. | def _use_tensor_values_cache(self):
if self._parameters.trace_mode not in set([
tensor_tracer_flags.TRACE_MODE_NAN_INF,
tensor_tracer_flags.TRACE_MODE_NORM,
tensor_tracer_flags.TRACE_MODE_MAX_ABS]):
return False
if (self._parameters.trace_dir and
_trace_files_need_precreat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _evaluate_is_cached(self, node):\n pref = node.pref\n previous_nodes = self._evaluated.get(pref)\n if previous_nodes:\n previous_nodes.append(node)\n previous_node = previous_nodes[0]\n node.binary = previous_node.binary\n node.binary_remote = pr... | [
"0.5954593",
"0.5897505",
"0.58902234",
"0.5860267",
"0.5756017",
"0.5735776",
"0.57282186",
"0.5713768",
"0.56860584",
"0.5647061",
"0.5639554",
"0.5580197",
"0.5572843",
"0.5542272",
"0.5530476",
"0.5468509",
"0.54658437",
"0.5426118",
"0.54174924",
"0.5405872",
"0.53832275... | 0.6692868 | 0 |
Trace function for detecting any NaN/Inf in the tensor. | def _detect_nan_inf(tensor):
if tensor.dtype.is_floating:
mask = math_ops.reduce_any(
gen_math_ops.logical_or(
gen_math_ops.is_nan(tensor), gen_math_ops.is_inf(tensor)))
output_tensor = control_flow_ops.cond(mask,
lambda: c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preprocess_traced_tensor(self, tensor):\n\n def _detect_nan_inf(tensor):\n \"\"\"Trace function for detecting any NaN/Inf in the tensor.\"\"\"\n\n if tensor.dtype.is_floating:\n mask = math_ops.reduce_any(\n gen_math_ops.logical_or(\n gen_math_ops.is_nan(tensor), ... | [
"0.7032501",
"0.6938709",
"0.65309334",
"0.6495059",
"0.6491535",
"0.64128643",
"0.6402218",
"0.6400318",
"0.639452",
"0.63761115",
"0.6362727",
"0.63335466",
"0.63076675",
"0.6292618",
"0.62514734",
"0.6185677",
"0.616416",
"0.6159935",
"0.6155211",
"0.61424583",
"0.60968304... | 0.72455895 | 0 |
Checks if the tensor is the first NaN/Inf tensor in the computation path. | def _detect_inf_nan_producer(tensor):
if tensor.op.inputs:
inp_check = [
_detect_nan_inf(inp_tensor) for inp_tensor in tensor.op.inputs
]
is_any_input_inf_nan = math_ops.add_n(inp_check)
else:
is_any_input_inf_nan = constant_op.constant(0, dtypes.bool)
is_cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _detect_nan_inf(tensor):\n\n if tensor.dtype.is_floating:\n mask = math_ops.reduce_any(\n gen_math_ops.logical_or(\n gen_math_ops.is_nan(tensor), gen_math_ops.is_inf(tensor)))\n output_tensor = control_flow_ops.cond(mask,\n ... | [
"0.7399853",
"0.7348695",
"0.6951781",
"0.6914466",
"0.6799718",
"0.67268866",
"0.6703992",
"0.67032534",
"0.6677608",
"0.66199243",
"0.6608297",
"0.65658",
"0.6550183",
"0.6533223",
"0.6531517",
"0.65222776",
"0.651265",
"0.6484661",
"0.6481788",
"0.6474942",
"0.64649504",
... | 0.67113304 | 6 |
Returns True if we should not trace out_tensor. | def _skip_tensor(self, op_id, out_tensor, report_handler):
# Skips a tensor if the tensor has a non-numeric type.
# Note: we cannot use check_ops.is_numeric_tensor(out_tensor)
# because it also excludes tensors with dtypes, bool, and
# float32_ref, which we actually want to trace.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_outref_form(self) -> bool:\n return any(isinstance(a, TensorOutRef) for a in self.all_arg_values)",
"def _is_tensor(self):\n return True",
"def _use_tensor_values_cache(self):\n\n if self._parameters.trace_mode not in set([\n tensor_tracer_flags.TRACE_MODE_NAN_INF,\n tensor_tr... | [
"0.67455816",
"0.65047514",
"0.64706224",
"0.60401726",
"0.60271144",
"0.6024034",
"0.6008378",
"0.59532917",
"0.58920103",
"0.58489454",
"0.5758589",
"0.5738121",
"0.57311004",
"0.57008165",
"0.5695708",
"0.5659782",
"0.56433165",
"0.56433165",
"0.56433165",
"0.56433165",
"0... | 0.7295837 | 0 |
children get the children pci_node objects | def children(self):
if not self._children:
self._children = self._find_children()
return self._children | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children(self):\n\n return self.children",
"def getChildren(self):\n\t\treturn self.children",
"def getChildren(self):\n\t\treturn self._children",
"def get_children(self):\n children = []\n children.append(self.get_child1())\n children.append(self.get_child2())\n retur... | [
"0.7066974",
"0.693062",
"0.6821417",
"0.681691",
"0.68020284",
"0.68020284",
"0.67666227",
"0.67399",
"0.6712788",
"0.67065287",
"0.6674306",
"0.66452295",
"0.66030586",
"0.6588467",
"0.65615636",
"0.65350276",
"0.65277267",
"0.65205395",
"0.65190303",
"0.650392",
"0.6498241... | 0.6382534 | 30 |
Override cleaned_data to ignore forms with empty data. | def cleaned_data(self):
return [x for x in super(BaseZenodoPublishFormset, self).cleaned_data if x] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cleaned_data(self):\n try:\n return self.cleaned_data\n except AttributeError:\n return self.clean_data",
"def clean(self):\n for f, val in self.cleaned_data.iteritems():\n if val is None and f not in self.data:\n self.cleaned_data[f] = self.f... | [
"0.79281217",
"0.78744453",
"0.78236324",
"0.7594642",
"0.73991686",
"0.70125574",
"0.70075065",
"0.69865483",
"0.6958156",
"0.692775",
"0.6872821",
"0.67173505",
"0.6710957",
"0.65349144",
"0.6513759",
"0.6507781",
"0.6460186",
"0.64448303",
"0.6442189",
"0.64320123",
"0.641... | 0.71557075 | 5 |
Get the lists of tf.feature_columns for features only. | def only_feature_columns(self) -> list:
return self._tf_feature_cols | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_feature_columns(self) -> list:\n return (\n self._tf_feature_cols\n + self._label_tf_feature_cols\n + self._id_tf_feature_cols\n )",
"def export_feature_columns(self) -> list:\n return self._tf_export_cols",
"def id_feature_columns(self) -> list:\n ... | [
"0.8015203",
"0.7689695",
"0.7643111",
"0.76283354",
"0.759349",
"0.759349",
"0.75780284",
"0.7314899",
"0.73115355",
"0.7279875",
"0.7273538",
"0.7235111",
"0.7195761",
"0.71703",
"0.70323074",
"0.6985808",
"0.696293",
"0.666387",
"0.66425145",
"0.66420346",
"0.64617133",
... | 0.8868115 | 0 |
Return a certain type of feature column according to the configuration of column _name. | def create_tf_feature_column(self, _name: str) -> tf.feature_column:
_tf_feature_column = None
_fc_type = self._td_conf_parser.fc_type(_name)
_fc_params = self._td_conf_parser.fc_params(_name)
_shape = self._td_conf_parser.shape(_name)
_dtype = self._td_conf_parser.dtype(_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_type(self, column_name):\n extra_cols = list_columns_for_table(self.name)\n\n if column_name in extra_cols:\n col = _COLUMNS[(self.name, column_name)]\n\n if isinstance(col, _SeriesWrapper):\n return 'series'\n elif isinstance(col, _ColumnFun... | [
"0.7141371",
"0.7141371",
"0.7120828",
"0.70157444",
"0.69604367",
"0.6938921",
"0.67963755",
"0.66527826",
"0.65996885",
"0.6577594",
"0.64651537",
"0.63634074",
"0.6357984",
"0.63008326",
"0.62147236",
"0.61955684",
"0.61497325",
"0.6111958",
"0.6104461",
"0.60849065",
"0.6... | 0.6288291 | 14 |
This method returns the tile index for the given tile image if it is part of this tileset, and returns 0 if the tile could not be found. Constant complexity due to dictionary lookup. | def findTile(self, tileImage):
tileString = tileImage.tostring()
if self.TileDict.has_key(tileString):
return self.TileDict[tileString] + 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_map_pixel_index(self, ipixel):\n index = np.where(self.map_pixel_list == ipixel)\n return (int(index[0])) if len(index[0]) else 0",
"def tile_id(self, layer: int, tile: Tile) -> int:\r\n return self.tiles_ids[layer].get(tile, self.tiles_ids[0][Tile.VOID])",
"def find_pixel_index(s... | [
"0.6666151",
"0.6485918",
"0.6428182",
"0.63990575",
"0.63751554",
"0.6039489",
"0.6009446",
"0.5950454",
"0.5946756",
"0.5918978",
"0.5851163",
"0.5836042",
"0.58346003",
"0.5769309",
"0.5739838",
"0.57290167",
"0.5727889",
"0.57271904",
"0.5720271",
"0.5718668",
"0.5707357"... | 0.8321821 | 0 |
This function takes the tiledMap image, and obtains a list self.List, where an entry equals i if self.TileSet.List[i1] is the corresponding picture on the tiledMap image. If a matching tile is not found, i is set to 0. | def readMap(self):
MapImage = Image.open(self.mapImageFile).convert("RGB")
MapImageWidth, MapImageHeight = MapImage.size
self.Width, self.mapHeightInTiles = MapImageWidth / self.TileWidth, MapImageHeight / self.TileHeight
progress = -1
for y in range(self.mapHeightInTiles):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readTiles(self):\n TileImage = Image.open(self.Filename).convert(\"RGB\")\n TileIW, TileIH = TileImage.size\n TilesetW, TilesetH = TileIW / self.TileWidth, TileIH / self.TileHeight\n\n for y in range(TilesetH):\n for x in range(TilesetW):\n box = self.TileW... | [
"0.6741197",
"0.64064735",
"0.6324281",
"0.62639445",
"0.60791427",
"0.59177077",
"0.58078605",
"0.57997555",
"0.5779502",
"0.57706255",
"0.576551",
"0.57554454",
"0.5722621",
"0.57193863",
"0.57072103",
"0.56990105",
"0.5684074",
"0.567843",
"0.56783587",
"0.5648808",
"0.564... | 0.6755611 | 0 |
Every Consumer will ask for a cart from the Marketplace. Each cart will come with a set of add / remove operations. | def run(self):
for cart in self.carts:
cart_id = self.marketplace.new_cart()
for operation in cart:
quantity = operation["quantity"]
while quantity:
if operation["type"] == "add" and self.marketplace.add_to_cart(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(input_data):\n \n cart = ShoppingCart()\n for ent in input_data:\n quantity, imported, price, category, name = prepare_cart_data(ent)\n\n # Add Data in user Shopping Cart\n cart.add(quantity, imported, price, category, name)\n cart.print_receipt()\n sys.exit(0)",
"def pl... | [
"0.64240426",
"0.6278302",
"0.62403095",
"0.62087536",
"0.61931145",
"0.61247534",
"0.60981816",
"0.6015225",
"0.5937291",
"0.5913827",
"0.59042245",
"0.5897495",
"0.5896572",
"0.58704257",
"0.57721853",
"0.5769665",
"0.57358587",
"0.5726855",
"0.5720208",
"0.5714698",
"0.571... | 0.7172532 | 0 |
Instantiate a CreatePriceSubscription request. | def __init__(self, data):
super(CreatePriceSubscription, self).__init__()
self.data = data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_subscription(self,\n request: pubsub.Subscription = None,\n *,\n name: str = None,\n topic: str = None,\n push_config: pubsub.PushConfig = None,\n ack_deadline_seconds: int = None,\n retry: retries.Retry = gapic_v1.method.DEFAU... | [
"0.601929",
"0.5991759",
"0.5930527",
"0.59244996",
"0.59005904",
"0.5886638",
"0.5841739",
"0.5834914",
"0.567267",
"0.5622237",
"0.5619847",
"0.54865766",
"0.5469489",
"0.5437112",
"0.5409496",
"0.54073435",
"0.53948563",
"0.5376699",
"0.5371634",
"0.53673255",
"0.53673255"... | 0.65414935 | 0 |
Instantiate a MarginImpactRequest request. | def __init__(self, ContextId, ReferenceId):
super(MarginImpactRequest, self).__init__(ContextId=ContextId,
ReferenceId=ReferenceId) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(GetCriticScoreRequest, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.pose is None:\n self.pose = nav_2d_msgs.msg.Pose2DStamped()\n if self.velocity is Non... | [
"0.53186387",
"0.51994425",
"0.5197015",
"0.51426494",
"0.5085859",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
"0.50093526",
... | 0.72732395 | 0 |
Offsets this mesh by a given vector. In practice, adds v to all vertex in all polygons | def offset(self, v):
new_polys = []
for poly in self.polygons:
new_poly = []
for p in poly:
new_poly.append(p + v)
new_polys.append(new_poly)
self.polygons = new_polys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self, vector: 'Vertex') -> None:\n delta = Vec2(vector)\n self.vertices = [v + delta for v in self.vertices]",
"def translate(self, vec): # vec is just an array of floats\n for i in range(len(self.vertices)):\n for j in range(len(vec)):\n self.vertice... | [
"0.71136564",
"0.6467797",
"0.6390907",
"0.6386605",
"0.6327875",
"0.62846315",
"0.61890095",
"0.6126797",
"0.607864",
"0.60172033",
"0.5994771",
"0.5975677",
"0.5952517",
"0.5942114",
"0.59356374",
"0.59314567",
"0.5890147",
"0.58826554",
"0.5866935",
"0.5749558",
"0.5727062... | 0.76367366 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.