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 minimum (lowest) value which can be displayed | def minimum(self) -> Union[int, float]:
return self.range[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMinValue(self):\n return self.MIN_VALUE",
"def _get_minimum(self):\n return self._minimum",
"def minimum(self):\n return self.properties.get('minimum')",
"def min(self):\n return self._min",
"def min(self):\n return self._min",
"def min(self):\n return sel... | [
"0.8073512",
"0.8065652",
"0.80652505",
"0.8047199",
"0.8047199",
"0.80276763",
"0.80135393",
"0.7995374",
"0.7974209",
"0.79295045",
"0.79295045",
"0.7824437",
"0.78182817",
"0.78049916",
"0.7744407",
"0.7726563",
"0.7726563",
"0.76342463",
"0.7590357",
"0.7570884",
"0.75645... | 0.73100615 | 41 |
The maximum (highest) value which can be displayed | def maximum(self) -> Union[int, float]:
return self.range[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_value(self):\n max_value = max(self.values)\n return max_value",
"def _get_maximum(self):\n return self._maximum",
"def get_max(self):\n return self.max[-1]",
"def max(self):\n return self.__max",
"def max(self):\n return self._max",
"def max(self):\n... | [
"0.82031345",
"0.8194746",
"0.8148341",
"0.8085211",
"0.8083942",
"0.8083942",
"0.8076797",
"0.8057222",
"0.8027967",
"0.8010207",
"0.7963719",
"0.79515153",
"0.78985894",
"0.78692895",
"0.7812291",
"0.77725774",
"0.77297646",
"0.7721884",
"0.77106327",
"0.76911503",
"0.76421... | 0.7344522 | 51 |
Draws the outline (border) of the progressbar, with a thickness value from self.border_thickness. | def _draw_outline(self) -> None:
stroke = self.border_thickness
# draw outline rectangle
for _w in range(self.widget_width):
for line in range(stroke):
self._bitmap[_w, line] = 1
self._bitmap[_w, self.widget_height - 1 - line] = 1
for _h in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawBorder(self):\n\t\t# horizontal lines\n\t\tself.wts(0, 0, '╭' + '─' * (self.width - 2) + '╮', self._borderColor)\t\t\t\t\t\t# Top\n\t\tself.wts(self.height - 2, 0, '└' + '─' * (self.width - 2) + '╯', self._borderColor)\t\t\t# Bottom\n\t\t# vertical lines\n\t\tfor yPos in range(1, self.height - 2):\n\t\t\ts... | [
"0.6980046",
"0.6372926",
"0.6327431",
"0.6217453",
"0.5957238",
"0.58896434",
"0.58797497",
"0.5851642",
"0.58446896",
"0.58434147",
"0.58277005",
"0.5813987",
"0.5771594",
"0.57411146",
"0.57224476",
"0.56495273",
"0.55723834",
"0.55633676",
"0.5514165",
"0.5503805",
"0.548... | 0.7037233 | 0 |
Determines any visual space reserved for the widget based on the defined border thickness, and whether a margin should be placed between the border and the bar. The value is calculated as (2 x border_thickness) minus (2 x margin_size). The value for margin_size is either 0 (zero) or 1 (one) depending on the value of ma... | def _get_fill_border_size(self) -> int:
return (2 * self.border_thickness) + (2 * self.margin_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def margin_size(self, value: int) -> None:\n\n if not isinstance(value, int):\n raise TypeError(\"The margin size must be an integer\")\n\n margin_spacing = (2 * value) + (2 * self._border_thickness)\n\n if margin_spacing >= self.widget_width:\n raise ValueError(\n ... | [
"0.69769204",
"0.6564969",
"0.6504523",
"0.6388232",
"0.6185595",
"0.61238915",
"0.6095111",
"0.6095111",
"0.6095111",
"0.6057181",
"0.60567766",
"0.5963709",
"0.5865675",
"0.58175457",
"0.57987976",
"0.575753",
"0.5754858",
"0.5664051",
"0.5650303",
"0.5649332",
"0.5642728",... | 0.6629648 | 1 |
Sample points on an ellipsoid. | def points_from_ellipsoid_surface(a, b, c=0, n=10):
points = []
points = np.zeros((n, 3))
points[:, 0] = np.random.normal(0, a, n)
points[:, 1] = np.random.normal(0, b, n)
if c > 0:
points[:, 2] = np.random.normal(0, c, n)
ds = np.linalg.norm(points / [a, b, c if c else 1], axis=-1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_ellipsoid(p0, covmat, size=1):\n return np.random.multivariate_normal(np.atleast_1d(p0),\n np.atleast_2d(covmat),\n size=size)",
"def __sample(self):\n # xvals are \"east\" vals and yvals are \"north\" vals on th... | [
"0.6874581",
"0.63683903",
"0.6125678",
"0.59566826",
"0.59409523",
"0.5909793",
"0.58333164",
"0.57778597",
"0.57595414",
"0.57524204",
"0.5748949",
"0.574591",
"0.5653992",
"0.5651043",
"0.5625236",
"0.55914676",
"0.558541",
"0.5564613",
"0.55560184",
"0.55366313",
"0.55275... | 0.5992955 | 3 |
Generate a quaternion from axis [x, y, z] and angle theta. | def quaternion_from_axis_angle(x, y, z, theta):
if x == y == z == 0:
return np.array([1, 0, 0, 0])
axis = np.array([x, y, z])
axis /= np.linalg.norm(axis)
return rowan.from_axis_angle(axis, theta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_axis_to_quaternion(axis, theta):\n if isinstance(axis, string_types):\n axis = axis.lower()\n if axis == 'x':\n axis = np.array([1., 0., 0.])\n elif axis == 'y':\n axis = np.array([0., 1., 0.])\n elif axis == 'z':\n axis = np.array([0., 0., ... | [
"0.76926434",
"0.7200943",
"0.7178451",
"0.71368057",
"0.69507265",
"0.6892011",
"0.6861867",
"0.68281937",
"0.6820917",
"0.68190604",
"0.6812797",
"0.68040746",
"0.6796988",
"0.67912024",
"0.67655146",
"0.675524",
"0.6728748",
"0.670903",
"0.6706233",
"0.6704836",
"0.6696777... | 0.849171 | 0 |
Check if two spheres are almost equal. Works for both circles and spheres. All args and kwargs are forwarded to np.isclose and np.allclose. | def sphere_isclose(c1, c2, *args, **kwargs):
return np.isclose(c1.radius, c2.radius, *args, **kwargs) and np.allclose(
c1.center, c2.center, *args, **kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _point_almost_equal(a,b, rtol=RTOL, atol=ATOL):\n return np.allclose(a._Point__loc, b._Point__loc,\n rtol=rtol, atol=atol)",
"def almost_equal(self, other, rtol=1e-05, atol=1e-08):\n\n # float attributes defining the instance\n fkeys = ['x0', 'y0', 'dx', 'dy']\n ... | [
"0.6594077",
"0.65919226",
"0.65481305",
"0.6344976",
"0.6266819",
"0.6196258",
"0.61764526",
"0.6156307",
"0.61361444",
"0.61240405",
"0.6084039",
"0.60762227",
"0.60162324",
"0.60157394",
"0.5998651",
"0.59830666",
"0.5966321",
"0.59443253",
"0.5931793",
"0.5924427",
"0.592... | 0.7489281 | 0 |
Fully connected block after MultiHead Attention layer | def point_wise_feed_forward_network(d_model, dff):
model = tf.keras.Sequential([
tf.keras.layers.Dense(dff, activation="relu"), # (batch_size, seq_len, dff)
tf.keras.layers.Dense(d_model) # (batch_size, seq_len, d_model)
])
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Attention_block(up_in,down_in,nf):\n# def MyTile(alpha, channels):\n# alpha = tf.tile(alpha, [1, 1, 1, 1, channels])\n# return alpha\n# def MyTile_output_shape(input_shape):\n# shape = list(input_shape)\n# assert len(shape) == 5 # only valid for 2D tensors\n# shape[-1]... | [
"0.6301469",
"0.6177806",
"0.59937316",
"0.5863203",
"0.5812946",
"0.5789855",
"0.5776795",
"0.57754254",
"0.57533485",
"0.5746879",
"0.57373106",
"0.5731077",
"0.5711967",
"0.5711967",
"0.5707474",
"0.57047576",
"0.57015866",
"0.5694274",
"0.5693507",
"0.56628716",
"0.562097... | 0.0 | -1 |
Turn a linear function into a linear layer. | def create_linear_layer(lin_fn, num_inputs):
inputs = torch.randn(num_inputs, dtype=torch.float64).requires_grad_(True)
bias = torch.ones((), dtype=torch.float64).requires_grad_(True)
out = lin_fn(inputs, bias)
layer = nn.Linear(num_inputs, len(out))
for i, x in enumerate(out):
inputs.grad =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_layer(self, W, b, x, use_relu=True):\n\n if use_relu is True:\n return np.maximum(W @ x + b, 0)\n return W @ x + b",
"def linear(*args, **kwargs):\n return nn.Linear(*args, **kwargs)",
"def linear(x, n_output, name=None, activation=None, reuse=None):\n\tprint('##Start lin... | [
"0.7015644",
"0.69151753",
"0.66974515",
"0.667202",
"0.66359043",
"0.66043425",
"0.65615773",
"0.6542365",
"0.6536673",
"0.6536673",
"0.6518618",
"0.64601105",
"0.6458006",
"0.6448246",
"0.6381619",
"0.63695693",
"0.63089275",
"0.62843263",
"0.62195283",
"0.61954653",
"0.617... | 0.75638497 | 0 |
Returns the raw dict representing metadata | def data(self):
if self.metadata is None:
self.refresh()
return self.metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_metadata(self):\n return {}",
"def _metadata(self) -> Dict[str, Any]:\n return self.__metadata",
"def get_metadata(self):\n # currently there is no metadata to send\n return {}",
"def get_metadata(self):\n metadata = {}\n for k in self.metadata_keys:\n ... | [
"0.7944604",
"0.78898597",
"0.7624449",
"0.76188534",
"0.76128864",
"0.75381374",
"0.75075316",
"0.75016296",
"0.7493172",
"0.7493172",
"0.74930686",
"0.7484301",
"0.7449703",
"0.74484664",
"0.7441979",
"0.73661745",
"0.73423994",
"0.727973",
"0.7275675",
"0.72202265",
"0.719... | 0.0 | -1 |
Sets the object's userfriendly nickname | def nickname(self, new_nickname):
self.set({"nickname": new_nickname}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_nickname(self, nickname):\n \n if len(nickname) > globals.MAX_NICKNAME_LENGTH:\n nick = nickname[0:globals.MAX_NICKNAME_LENGTH-3]+\"...\"\n else:\n nick = nickname\n \n self._nickname.set_message(nick)",
"async def nickname(self, ctx, *, nickna... | [
"0.7748096",
"0.74267966",
"0.72978115",
"0.72184396",
"0.7196049",
"0.71037096",
"0.70768476",
"0.70639694",
"0.70152736",
"0.68799037",
"0.679108",
"0.67883277",
"0.6730406",
"0.671135",
"0.6603327",
"0.65963477",
"0.6478311",
"0.64500314",
"0.6448181",
"0.6426235",
"0.6407... | 0.78098214 | 0 |
Load a json file. | def loadJSONFile(filename):
with open(filename, 'r') as f:
return json.loads(f.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(file_name):\n return json.load(open(file_name))",
"def loadJsonFromFile(filename):\n with open(filename) as f:\n return json.loads(f.read())",
"def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(... | [
"0.83696705",
"0.83017325",
"0.8254917",
"0.8245052",
"0.8221425",
"0.8220191",
"0.8184976",
"0.81796587",
"0.81759715",
"0.81759715",
"0.81718075",
"0.81650543",
"0.8141745",
"0.812603",
"0.8124406",
"0.8124353",
"0.81158227",
"0.81128657",
"0.8100738",
"0.8091333",
"0.80599... | 0.8113681 | 17 |
Retrieve currently authenticated user object. | def get_user_me(self):
url = 'users/me'
result = self.get(url)
return result.get('user', result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user(self):\n user_dict = self.auth.get_user_by_session()\n if user_dict is None:\n logging.debug(\"User dict is None.\")\n return None\n return self.auth.store.user_model.get_by_id(\n user_dict['user_id'], namespace=namespace_manager.get_namespace(... | [
"0.85820395",
"0.8489614",
"0.8362737",
"0.8358625",
"0.8350864",
"0.8350864",
"0.8269659",
"0.8265301",
"0.8107003",
"0.8092152",
"0.8051714",
"0.8040321",
"0.80391496",
"0.8032446",
"0.8028061",
"0.8028061",
"0.8028061",
"0.79858774",
"0.7980279",
"0.79760844",
"0.7950107",... | 0.0 | -1 |
Close the referenced contract. | def end_contract(self, contract_reference, reason, would_hire_again,
fb_scores=None, fb_comment=None):
url = 'contracts/{0}'.format(contract_reference)
data = {}
assert_parameter('reason', reason, self.CONTRACT_REASON_OPTIONS)
data['reason'] = reason
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.solenoid.set(self.CLOSE)",
"def close_channel(self):\n if not self._open:\n return\n for contract in self._state.htlc_contracts:\n contract.invalidate()\n self._state.htlc_contracts = []\n\n self._owner1_htlc_locked_setter(0)\n ... | [
"0.65670174",
"0.65140104",
"0.64808995",
"0.64808995",
"0.6393866",
"0.63196945",
"0.6247952",
"0.6247952",
"0.6229447",
"0.6223276",
"0.6191523",
"0.61667013",
"0.61610705",
"0.6149106",
"0.61285126",
"0.612419",
"0.612419",
"0.61238414",
"0.61238414",
"0.61238414",
"0.6123... | 0.0 | -1 |
Get specific job application as a client. | def get_client_application(self, application_id, buyer_team__reference):
data = {}
data['buyer_team__reference'] = buyer_team__reference
url = 'clients/applications/{0}'.format(application_id)
return self.get(url, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client(self, name):\n return self.get_clients(as_dict=True).get(name)",
"def job(job_name):\n ClientID = Job.get_client_id(job_name)\n return tasks_for_client_job(ClientID, job_name)",
"def client(self) -> str:\n return pulumi.get(self, \"client\")",
"def _get_client(self, request... | [
"0.63978887",
"0.62402445",
"0.6198",
"0.61576414",
"0.6136321",
"0.6130897",
"0.61121416",
"0.60793394",
"0.5979147",
"0.5958431",
"0.59523165",
"0.59523165",
"0.59153277",
"0.58909774",
"0.5878597",
"0.58340085",
"0.582294",
"0.5817454",
"0.5794533",
"0.57913315",
"0.579026... | 0.650442 | 0 |
Get active milestone for specific contract. | def get_active_milestone(self, contract_reference):
data = {}
url = 'fp/milestones/statuses/active/contracts/{0}'.format(contract_reference)
return self.get(url, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetLatestMilestone():\n # Use CQ Master target to get latest milestone.\n latest_url = LATEST_URL % {'target': constants.CQ_MASTER}\n gs_ctx = gs.GSContext()\n\n logging.info('Getting latest milestone from %s', latest_url)\n try:\n content = gs_ctx.Cat(latest_url).strip()\n\n # Expected syntax is li... | [
"0.5884148",
"0.5760047",
"0.56226885",
"0.5472332",
"0.539106",
"0.5107177",
"0.5066164",
"0.5040432",
"0.50038373",
"0.4964783",
"0.49621624",
"0.49297655",
"0.4894369",
"0.488449",
"0.4875231",
"0.48544598",
"0.48340154",
"0.48127288",
"0.4737784",
"0.4665102",
"0.46433663... | 0.8093473 | 0 |
Static method that takes a string, splits on a comma and returns a list, also making sure remove any empty strings from the list | def stringInputToList(x):
return list(filter(None, [y.strip() for y in x.split(',')])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_by_comma(s):\n return s.strip().split(\",\")",
"def convert_comma_separated_str_to_list(input_str: str, trim: bool = True) -> List[str]:\n comma_separated_str = input_str.strip() if trim else input_str\n if not comma_separated_str:\n return []\n\n result = []\n for part_str in com... | [
"0.83941555",
"0.8231512",
"0.7870149",
"0.77623475",
"0.76247424",
"0.75291634",
"0.7504882",
"0.74438494",
"0.7438485",
"0.7386243",
"0.7354062",
"0.7328664",
"0.7316443",
"0.724257",
"0.7173738",
"0.71224564",
"0.703261",
"0.70302844",
"0.7025223",
"0.7024757",
"0.7000193"... | 0.78267986 | 3 |
Get the basis for the n dimensional part of the Steenrod algebra. Build basis recursively. last = last term. last is >= bound, and we will append (last,) to the end of elements from basis (n last, bound=2 last). This means that 2 last <= n last, or 3 last <= n. | def basis_2(n, *, bound=1):
if n == 0:
return ((),)
result = [(n,)]
for last in range(bound, 1 + n // 3):
for vec in basis_2(n - last, bound=2 * last):
result.append(vec + (last,))
return tuple(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basis_generic(n, *, p, bound=1):\r\n if n == 0:\r\n return ((0,),) # \r\n if n == 1:\r\n return ((1,),)\r\n result = []\r\n \r\n # append P^{last} beta^{epsilon}\r\n for epsilon in [0,1]:\r\n # Without this lower bound edge case we lose the element (0, 1, 1) in degree... | [
"0.6352027",
"0.62040514",
"0.61184764",
"0.6047273",
"0.5897896",
"0.5890074",
"0.5885658",
"0.57801056",
"0.5759169",
"0.5620241",
"0.5595064",
"0.5581936",
"0.5580318",
"0.55353695",
"0.54639876",
"0.54491794",
"0.54146963",
"0.5369703",
"0.5367151",
"0.5311752",
"0.529558... | 0.63450444 | 1 |
return json User objects | def user_ret():
user_list = []
all_objs = storage.all("User")
for obj in all_objs.values():
user_list.append(obj.to_dict())
return jsonify(user_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userJSON():\n user = session.query(User).all()\n result = []\n\n for i in user:\n result += [i.serialize]\n\n return jsonify(Users=result)",
"def json(self):\n result = {}\n for user in self.users:\n result[user.user_id] = user.json\n return result",
"def ... | [
"0.82542247",
"0.8115099",
"0.7857184",
"0.78480744",
"0.7821726",
"0.77648944",
"0.7681941",
"0.7616825",
"0.7609725",
"0.76026094",
"0.760245",
"0.7591317",
"0.75394744",
"0.75233406",
"0.74818206",
"0.7444616",
"0.74334586",
"0.7428471",
"0.7423055",
"0.7418192",
"0.741690... | 0.81571275 | 1 |
Draws an ellipse using (360k + 1) discrete points; based on pseudo code | def get_ellipse_coords(a=0.0, b=0.0, x=0.0, y=0.0, angle=0.0, k=2):
pts = np.zeros((360*k+1, 2))
beta = -angle * np.pi/180.0
sin_beta = np.sin(beta)
cos_beta = np.cos(beta)
alpha = np.radians(np.r_[0.:360.:1j*(360*k+1)])
sin_alpha = np.sin(alpha)
cos_alpha = np.cos(alpha)
pts[:, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawEllipse(img, center, axes, angle, startAngle=0, endAngle=360, color = (0,0,255), fill = -1):\n\tcv2.ellipse(img, center, axes, angle, startAngle, endAngle, color, fill)",
"def tilted_ellipse(s, pos1, pos2, size_x, size_y, color, angle):\n surface = pygame.Surface((150, 150), pygame.SRCALPHA, 32).conve... | [
"0.73081726",
"0.7218406",
"0.7215335",
"0.6932191",
"0.68887305",
"0.67912483",
"0.67859185",
"0.67643356",
"0.67056125",
"0.6682268",
"0.6660289",
"0.6620706",
"0.6578318",
"0.65663314",
"0.65434426",
"0.6521887",
"0.6474014",
"0.6450579",
"0.6406207",
"0.6394606",
"0.63838... | 0.5787427 | 82 |
1hot encodes a tensor | def to_categorical(y, num_classes):
new_y = torch.eye(num_classes)[y.cpu().data.numpy(),]
if (y.is_cuda):
return new_y.cuda()
return new_y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\... | [
"0.82578593",
"0.8061468",
"0.80140257",
"0.7917851",
"0.7914897",
"0.7883416",
"0.78429884",
"0.78089696",
"0.7765784",
"0.77376443",
"0.77376443",
"0.7733915",
"0.7728651",
"0.77133274",
"0.7686273",
"0.76797515",
"0.75851345",
"0.7560708",
"0.75560004",
"0.75353223",
"0.75... | 0.0 | -1 |
Creates a grade dict from a row form. | def form_to_grade_row(form):
course = form["course"]
student = form["student"]
assignment, _, _ = form["assignment"].partition("[")
rowdata = json.loads(form["rowdata"])
grade = {"student": student, "assignment": assignment, "course": course}
grade["_id"] = "{student}-{assignment}-{course}".form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dict(row):\n return dict((key[0], value) for key, value in zip(colnames, row))",
"def get_row_dict(self, row):\n return self.get_dict(self.possibles[row], \"R\", row)",
"def form_to_grade_assignment(form):\n grade_id = \"{student}-{assignment}-{course}\".format(**form)\n grade = {\... | [
"0.66509485",
"0.65499103",
"0.6370172",
"0.62290734",
"0.62213093",
"0.6178408",
"0.6127212",
"0.6040272",
"0.6037651",
"0.5976455",
"0.59096533",
"0.58915955",
"0.57766086",
"0.5749406",
"0.57470036",
"0.57470036",
"0.57470036",
"0.57335395",
"0.57335395",
"0.5705864",
"0.5... | 0.75859386 | 0 |
Creates the DataLoader objects for the training, validation, and test sets. | def create_split_loaders(root_dir, batch_size, seed=0, transform=transforms.ToTensor(),
p_val=0.1, p_test=0.2, shuffle=True,
show_sample=False, extras={}):
# once all single json datasets are created you can concat them into a single one:
quickdraw_datase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creates_data_loader():\n dataset_faces = FaceDataset(\n IMG_DIR, transform=transform_train, face=True)\n\n dataset_no_faces = FaceDataset(\n IMG_DIR, transform=transform_train, face=False)\n\n datasets_faces_split = train_val_test(dataset_faces, 0.2, 0.0)\n datasets_no_faces_split = t... | [
"0.7935282",
"0.7927856",
"0.78891724",
"0.7726197",
"0.7722767",
"0.7704402",
"0.7666825",
"0.7627524",
"0.74950314",
"0.74918383",
"0.7462705",
"0.74104345",
"0.7353837",
"0.7344062",
"0.73362494",
"0.7333448",
"0.7196257",
"0.7161355",
"0.7160542",
"0.7152463",
"0.71032405... | 0.71026075 | 21 |
Test EventStreams with url from default site. | def test_url_with_streams(self):
streams = 'recentchange'
e = EventStreams(streams=streams)
self.assertEqual(
e._url, 'https://stream.wikimedia.org/v2/stream/' + streams)
self.assertEqual(e._url, e.url)
self.assertEqual(e._url, e.sse_kwargs.get('url'))
self.as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_url_missing_streams(self):\n with self.assertRaises(NotImplementedError):\n EventStreams()",
"def test_url_from_site(self, key):\n site = self.get_site(key)\n streams = 'recentchange'\n e = EventStreams(site=site, streams=streams)\n self.assertEqual(\n ... | [
"0.7300169",
"0.69946647",
"0.68183845",
"0.68033665",
"0.65966797",
"0.657555",
"0.65181506",
"0.6353719",
"0.6353719",
"0.6330753",
"0.62743527",
"0.62625444",
"0.6214412",
"0.61807495",
"0.61765236",
"0.6149776",
"0.59979254",
"0.5985642",
"0.5975823",
"0.5968839",
"0.5920... | 0.74042183 | 0 |
Test EventStreams with url from site with missing streams. | def test_url_missing_streams(self):
with self.assertRaises(NotImplementedError):
EventStreams() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_url_with_streams(self):\n streams = 'recentchange'\n e = EventStreams(streams=streams)\n self.assertEqual(\n e._url, 'https://stream.wikimedia.org/v2/stream/' + streams)\n self.assertEqual(e._url, e.url)\n self.assertEqual(e._url, e.sse_kwargs.get('url'))\n ... | [
"0.7969818",
"0.73117185",
"0.7227417",
"0.664857",
"0.6638547",
"0.64848655",
"0.6393822",
"0.6392778",
"0.63857347",
"0.6359634",
"0.6291006",
"0.62475723",
"0.62436795",
"0.6234471",
"0.6136316",
"0.6136007",
"0.6119837",
"0.61162955",
"0.6111094",
"0.608338",
"0.6051383",... | 0.81596744 | 0 |
Test EventStreams failing filter function settings. | def test_filter_function_settings_fail(self):
with self.assertRaises(TypeError):
self.es.register_filter('test') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_filter(self, none_type, all_type, any_type, result):\n self.es.filter = {'all': [], 'any': [], 'none': []}\n self.es.register_filter(lambda x: none_type, ftype='none')\n self.es.register_filter(lambda x: all_type, ftype='all')\n if any_type is not None:\n self.es.re... | [
"0.7351324",
"0.73253673",
"0.7210272",
"0.7153205",
"0.7141619",
"0.71208537",
"0.69448817",
"0.68963724",
"0.6631789",
"0.6509315",
"0.6478037",
"0.64454913",
"0.6402322",
"0.63853216",
"0.6379994",
"0.63519186",
"0.634373",
"0.6333119",
"0.6330011",
"0.63167495",
"0.630605... | 0.69867903 | 6 |
Checks if the current user has permission to edit the given dataset. | def has_edit_permissions(ps_or_token, selected_dataset_id):
try:
role = pennsieve_get_current_user_permissions(selected_dataset_id, ps_or_token)["role"]
except Exception as e:
abort(500, "Could not get permissions for this dataset.")
return role in ["owner", "manager"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkPermissionEditUsers(self):\n user = self.REQUEST.AUTHENTICATED_USER\n\n return bool(user.has_permission(eionet_edit_users, self))",
"def edit_allowed(self):\n account = Account.current_user_account\n if account is None:\n return False\n return self.user_can_edit(account.user)... | [
"0.73684084",
"0.7314556",
"0.7221785",
"0.718398",
"0.71801096",
"0.7136714",
"0.703597",
"0.7032112",
"0.69825906",
"0.69658035",
"0.6953812",
"0.69154143",
"0.68954784",
"0.68173236",
"0.6797478",
"0.67713076",
"0.6757528",
"0.6735634",
"0.66979504",
"0.66878027",
"0.66732... | 0.84489244 | 0 |
add a vertex to the graph vertex is of Vertex type | def add_vertex(self, vertex_name, vertex_type=None):
if vertex_name not in self._vertex_dict:
self._labels.InsertNextValue(vertex_name)
self._vertex_dict[vertex_name] = self.vertex_tuple(Vertex(vertex_name, vertex_type),
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')",
"def add_vertex(self, vertex_id):\n pass # TODO",... | [
"0.8757152",
"0.8541585",
"0.8475793",
"0.8435468",
"0.8278509",
"0.81456846",
"0.7949753",
"0.7949359",
"0.79003656",
"0.78772455",
"0.7873723",
"0.7873723",
"0.78717",
"0.78561455",
"0.78261155",
"0.7779243",
"0.7742088",
"0.7736784",
"0.77266556",
"0.7718829",
"0.77076334"... | 0.7739941 | 17 |
Adds directed edges of the same weight between two nodes | def add_undirected_edge(self, vertex_one, vertex_two, weight=None):
self._edge_dict[vertex_one, vertex_two] = Edge(vertex_one, vertex_two, weight)
self._edge_dict[vertex_two, vertex_one] = Edge(vertex_two, vertex_one, weight)
self._vertex_dict[vertex_two].abstract_vertex.add_edge(vertex_one, wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, n1, n2, weight):\n self.edges[n1.identifier][n2.identifier] = weight\n self.edges[n2.identifier][n1.identifier] = weight",
"def add_edge(self, n1, n2, weight):\n self.edges[n1.identifier][n2.identifier] = weight",
"def add_edge(self, n1, n2, weight=0):\n self.add_... | [
"0.786289",
"0.77945626",
"0.7779812",
"0.75748295",
"0.75469416",
"0.73219705",
"0.7321398",
"0.72620463",
"0.7236288",
"0.7235061",
"0.72068363",
"0.7153396",
"0.71336925",
"0.7124239",
"0.7114744",
"0.7089437",
"0.70535123",
"0.70403475",
"0.7034357",
"0.69539875",
"0.6928... | 0.6361667 | 58 |
adds a single directed edge from from_vertex to to_vertex. | def add_directed_edge(self, from_vertex, to_vertex, weight=None):
self._directed = True
self._vertex_dict[from_vertex].abstract_vertex.add_edge(to_vertex, weight)
from_vertex = self._vertex_dict[from_vertex].visual_vertex
to_vertex = self._vertex_dict[to_vertex].visual_vertex
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, from_vert, to_vert, cost=0):\n # if either vertex is not in the graph,\n # add it - or return an error (choice is up to you).\n if from_vert not in self.vert_dict or to_vert not in self.vert_dict:\n raise ValueError('vertexes not in graph')\n # if both vert... | [
"0.7993634",
"0.7709806",
"0.759325",
"0.752095",
"0.73874056",
"0.73771447",
"0.7373017",
"0.73340553",
"0.7200088",
"0.7198912",
"0.7167156",
"0.7165487",
"0.7093077",
"0.7088202",
"0.70818555",
"0.70790637",
"0.70748806",
"0.7064228",
"0.7056723",
"0.7054861",
"0.7037975",... | 0.76696396 | 2 |
SQL Server license type. | def sql_server_license_type(self) -> Optional[str]:
return pulumi.get(self, "sql_server_license_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lic_type():\n return VocabularyType.create(id='licenses', pid_type='lic')",
"def get_license_type():\n sql = \"\"\"\n SELECT license_type license, description\n FROM license_types_codes\n WHERE can_use = 'Y'\n \"\"\"\n\n # [('P', 'Permanent'), ... ]\n record_set = get_record(sql)\n ... | [
"0.7388876",
"0.6914536",
"0.65520567",
"0.6494581",
"0.64759284",
"0.6462194",
"0.64542824",
"0.61641365",
"0.61452985",
"0.6031865",
"0.5985203",
"0.59722406",
"0.59193486",
"0.5915004",
"0.5913919",
"0.5904301",
"0.5891602",
"0.5890338",
"0.5859811",
"0.5828259",
"0.573464... | 0.83057636 | 0 |
ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of. | def sql_virtual_machine_group_resource_id(self) -> Optional[str]:
return pulumi.get(self, "sql_virtual_machine_group_resource_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(se... | [
"0.776278",
"0.776278",
"0.776278",
"0.776278",
"0.776278",
"0.75804204",
"0.7398866",
"0.7398866",
"0.7398866",
"0.73647386",
"0.7292113",
"0.7292113",
"0.7292113",
"0.7292113",
"0.7292113",
"0.7292113",
"0.7292113",
"0.7292113",
"0.71181333",
"0.68674904",
"0.67758405",
"... | 0.8492074 | 0 |
Helper to instantiate boto.StorageUri with gsutil default flag values. Uses self.bucket_storage_uri_class to support mocking/testing. | def StorageUri(self, uri_str, debug=0, validate=True):
return boto.storage_uri(
uri_str, 'file', debug=debug, validate=validate,
bucket_storage_uri_class=self.bucket_storage_uri_class) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n raise BotoClientError('Attempt to instantiate abstract StorageUri '\r\n 'class')",
"def storage_factory(cls, prefix, storage_cls=None, storage_uri=None):\n\n key_prefix = '{}_{}_'.format(cls.__name__.upper(), prefix.upper())\n attr = '_{}_... | [
"0.7153329",
"0.6568823",
"0.6199052",
"0.6189113",
"0.6019432",
"0.59718597",
"0.5867964",
"0.5867233",
"0.5728584",
"0.57102615",
"0.5688545",
"0.55894995",
"0.55647904",
"0.5491404",
"0.5488742",
"0.5445343",
"0.54320383",
"0.54310596",
"0.54148364",
"0.54125553",
"0.54123... | 0.58884454 | 6 |
Sets the collections of this PersonDeleteOptions. | def collections(self, collections):
self._collections = collections | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_collections(self, collections):\n for collection in collections:\n self.drop_collection(collection)",
"def set_collection(self, service_name, collection_name, to_cache):\n self.services.setdefault(service_name, {})\n self.services[service_name].setdefault('collections', {... | [
"0.5033303",
"0.49573594",
"0.48853493",
"0.4865477",
"0.47951487",
"0.46853006",
"0.46215004",
"0.45475668",
"0.45191467",
"0.45182347",
"0.45089346",
"0.4502301",
"0.44906533",
"0.44569468",
"0.44522327",
"0.4444393",
"0.4437373",
"0.44267026",
"0.44267026",
"0.44095856",
"... | 0.62720793 | 1 |
Sets the comments of this PersonDeleteOptions. | def comments(self, comments):
self._comments = comments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments(self, comments):\n if comments is not None and len(comments) > 1000:\n raise ValueError(\"Invalid value for `comments`, length must be less than or equal to `1000`\") # noqa: E501\n\n self._comments = comments",
"def comments(self, comments):\n\n self.container['comm... | [
"0.6005803",
"0.5943034",
"0.533463",
"0.52282166",
"0.51729524",
"0.5094263",
"0.4986265",
"0.49235",
"0.49029818",
"0.48535043",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48... | 0.6326292 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PersonDeleteOptions):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 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 if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Just returns the index.html file, which should just load the bundle.js and let that do all of the UI work. | def index():
path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__))))
return flask.send_from_directory(path, 'index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n return render_template('index.html')",
"def main():\n return render_template('index.html')",
"def index(self):\n single = os.path.join(\n os.path.dirname(os.path.abspath(__file__)),\n 'index.html')\n return serve_file(single)",
"def entry_point():\n ... | [
"0.7738533",
"0.7738533",
"0.7414141",
"0.74037534",
"0.7329898",
"0.7315769",
"0.7315186",
"0.7315186",
"0.73046345",
"0.7270963",
"0.72009754",
"0.72007996",
"0.72007996",
"0.716833",
"0.713398",
"0.70457876",
"0.70437676",
"0.7042385",
"0.7026411",
"0.70246536",
"0.7022743... | 0.7127524 | 15 |
Find the Levenshtein distance between two strings. | def levenshtein_distance(first, second):
if len(first) > len(second):
first, second = second, first
if len(second) == 0:
return len(first)
first_length = len(first) + 1
second_length = len(second) + 1
distance_matrix = [range(second_length) for x in range(first_length)]
for i in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(str1, str2):\n return levenshtein.normalized_distance(str1, str2)",
"def levenshtein(str1, str2, normalise=False):\n\ttmp = Levenshtein.distance(str1, str2)\n\tif(normalise) and (len(str1) + len(str2)): tmp /= max(len(str1), len(str2))\n\treturn tmp",
"def levenshtein_distance(s1,s2):\n\n\t\tif... | [
"0.88262904",
"0.85578996",
"0.8429522",
"0.84293133",
"0.8122904",
"0.8121069",
"0.8070947",
"0.80158144",
"0.79765344",
"0.795814",
"0.7863481",
"0.7859027",
"0.7845665",
"0.7836424",
"0.78217846",
"0.76832783",
"0.7644912",
"0.7615896",
"0.74593014",
"0.74309814",
"0.73760... | 0.77217203 | 15 |
Returns true if val is numeric | def is_numeric(rows, col):
return rows.dtypes.values[col] in numerics | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_numeric(val):\n if \\\n isinstance(val, int) or \\\n isinstance(val, float):\n return True\n elif \\\n isinstance(val, str) and \\\n val.isdigit():\n return True\n else:\n return False",
"def is_number(self,val):\n try:\n float(val)\n return Tru... | [
"0.8437452",
"0.8303815",
"0.82677406",
"0.82184976",
"0.8187113",
"0.80023175",
"0.79353356",
"0.78887343",
"0.78261006",
"0.77817357",
"0.76678324",
"0.76633847",
"0.7627783",
"0.75996655",
"0.75971526",
"0.7559923",
"0.7481008",
"0.7464326",
"0.73992676",
"0.73918015",
"0.... | 0.7539499 | 16 |
Compute weights, means and covariances for density with given sigma and width | def make_conditional_density(bgm_fit, threshold, sigma, width):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ksdensity(data, width=0.3):\r\n def ksd(x_axis):\r\n def n_pdf(x, mu=5., sigma=3.): # normal pdf\r\n u = (x - mu) / abs(sigma)\r\n y = (1 / (np.sqrt(2 * np.pi) * abs(sigma)))\r\n y *= np.exp(-u * u / 2)\r\n return y\r\n prob = [n_pdf(x_i, data, width... | [
"0.6847839",
"0.67581236",
"0.6650327",
"0.6291274",
"0.6119458",
"0.5891344",
"0.5849947",
"0.58346367",
"0.582828",
"0.58138853",
"0.5813742",
"0.5779811",
"0.5779372",
"0.5774646",
"0.5751537",
"0.5704847",
"0.56982565",
"0.5682158",
"0.5678126",
"0.56680447",
"0.5661173",... | 0.60325634 | 5 |
Return the number of circular references to the object. For the purposes of this function, the circular reference must be only accessible (directly or indirectly) through the object. | def circular_reference_count(obj: typing.Any) -> int:
if np is not None:
result = _numpy_circular_ref_count(obj)
if result is not NotImplemented:
return result
return _get_circular_ref_count(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_refs(self):\n return self._n_refs",
"def referencecount(self) :\n\t\ttry :\n\t\t\treturn self._referencecount\n\t\texcept Exception as e:\n\t\t\traise e",
"def get_size(obj: Any) -> int:\n if isinstance(obj, BLACKLIST):\n return 0\n seen_ids: set[int] = set()\n size = 0\n object... | [
"0.7472081",
"0.712911",
"0.6964042",
"0.6863925",
"0.68219185",
"0.678775",
"0.6773094",
"0.67412645",
"0.6582645",
"0.65278816",
"0.64337957",
"0.6420373",
"0.6420373",
"0.64150935",
"0.6401749",
"0.63989073",
"0.6373764",
"0.63708293",
"0.6358727",
"0.63216347",
"0.6320435... | 0.85062957 | 0 |
Return all pyweakrefs to obj. If none, return an empty list. | def get_pyweakrefs(obj: typing.Any) -> list[ReferenceType]:
seq = _reference_id_registry.get(id(obj), [])
return [seq[0] for item in seq] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_refobjs(self, ):\n return cmds.ls(type=\"jb_reftrack\")",
"def list_refs(self):\n pass",
"def _refs(self, items):\n # type: (Iterable[Any]) -> Iterable[weakref.ReferenceType]\n return map(self.ref, items)",
"def list_all_refs(self):\n self.list_refs()\n s... | [
"0.69156635",
"0.68716735",
"0.6771153",
"0.6550949",
"0.6442704",
"0.64174813",
"0.6346928",
"0.6336576",
"0.6197461",
"0.61949223",
"0.6137897",
"0.6096993",
"0.60405004",
"0.60172296",
"0.5993775",
"0.5944581",
"0.5942475",
"0.59189206",
"0.5828131",
"0.57902074",
"0.57866... | 0.85791713 | 0 |
Convert a Node object into a more parsefriendly list of `string` type tokens. Assumes that all node children are leaf nodes. | def _node_to_expression(self, node):
expression = []
for child in node.to_list():
expression.append(str(child))
return expression | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens_from_treestring(s):\n return re.sub(r\"\\([0-9] |\\)\", \"\", s).split()",
"def stringify_children(node):\n parts = ([node.text] +\n list(chain(*([c.text, c.tail] for c in node.getchildren()))) +\n [node.tail])\n return ''.join(filter(None, parts))",
... | [
"0.626777",
"0.62520766",
"0.62091947",
"0.60921025",
"0.6065911",
"0.6017504",
"0.6001648",
"0.59398973",
"0.5920585",
"0.59128314",
"0.5901163",
"0.58749676",
"0.586857",
"0.58261245",
"0.5797739",
"0.57914984",
"0.5776789",
"0.5719219",
"0.57015646",
"0.5681303",
"0.567410... | 0.5989977 | 7 |
Verifies we can add a new tag to a VM and not modify an existing tag on that resource | def test_add_or_update_single_tag(self):
p = self.load_policy({
'name': 'test-azure-tag',
'resource': 'azure.vm',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'normalize',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_vm_tag_put(self):\n pass",
"def test_removal_does_not_raise_on_nonexistent_tag(self):\n p = self.load_policy({\n 'name': 'test-azure-tag',\n 'resource': 'azure.vm',\n 'filters': [\n {'type': 'value',\n 'key': '... | [
"0.77649385",
"0.7387739",
"0.7075966",
"0.6656576",
"0.65036297",
"0.6465619",
"0.6458824",
"0.6456048",
"0.6449689",
"0.6442221",
"0.6399257",
"0.63945055",
"0.6361586",
"0.63506293",
"0.6283683",
"0.62317973",
"0.6213603",
"0.6211985",
"0.61786103",
"0.6172332",
"0.6161824... | 0.7408799 | 1 |
Verifies attempting to delete a tag that is not on the resource does not throw an error | def test_removal_does_not_raise_on_nonexistent_tag(self):
p = self.load_policy({
'name': 'test-azure-tag',
'resource': 'azure.vm',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'norma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_tag(self):\r\n\r\n with app.test_client() as client:\r\n resp = client.post(f\"/tags/{self.tag.id}/delete\", follow_redirects=True)\r\n html = resp.get_data(as_text=True)\r\n\r\n self.assertEqual(resp.status_code, 200)\r\n self.assertNotIn(\"Marvel... | [
"0.7444001",
"0.7069921",
"0.6784255",
"0.6638141",
"0.6606541",
"0.6576158",
"0.65614355",
"0.64411354",
"0.6368591",
"0.63667697",
"0.63317627",
"0.632806",
"0.6313087",
"0.6304011",
"0.6302712",
"0.63016224",
"0.62931526",
"0.6242308",
"0.62377095",
"0.62280387",
"0.618957... | 0.7281134 | 1 |
Specifies whether the Studio authenticates users using IAM or Amazon Web Services SSO. Valid values are `SSO` or `IAM`. | def auth_mode(self) -> pulumi.Input[str]:
return pulumi.get(self, "auth_mode") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _aws_sign_in_with_sso(environment):\n aws_session_profile = '{}:session'.format(environment.terraform_config.aws_profile)\n # todo: add `... or if _date_modified(AWS_CONFIG_PATH) > _date_modified(AWS_CREDENTIALS_PATH)`\n if not _has_profile_for_sso(aws_session_profile):\n puts(color_notice(\"Co... | [
"0.6245215",
"0.5881491",
"0.55841917",
"0.554009",
"0.54665977",
"0.54594475",
"0.54534686",
"0.54287815",
"0.54287815",
"0.54287815",
"0.54287815",
"0.54287815",
"0.54287815",
"0.54287815",
"0.5407216",
"0.53266126",
"0.53002316",
"0.52990705",
"0.529096",
"0.5285283",
"0.5... | 0.51499397 | 31 |
The ID of the Amazon EMR Studio Engine security group. The Engine security group allows inbound network traffic from the Workspace security group, and it must be in the same VPC specified by `vpc_id`. | def engine_security_group_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "engine_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(s... | [
"0.68906003",
"0.68042195",
"0.68042195",
"0.6783754",
"0.6681128",
"0.6681128",
"0.6622851",
"0.6622851",
"0.65399075",
"0.6496629",
"0.6394589",
"0.63780427",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.62686855",
"0.62686855",
"0.... | 0.7011863 | 0 |
A list of subnet IDs to associate with the Amazon EMR Studio. A Studio can have a maximum of 5 subnets. The subnets must belong to the VPC specified by `vpc_id`. Studio users can create a Workspace in any of the specified subnets. | def subnet_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
return pulumi.get(self, "subnet_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceIdArgs']]]]:\n return pulumi.get(self, \"subnets\")",
"def vpc_subnet_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"vpc_subnet_ids\")",
"def subnets(self) -> pulumi.Input[Sequence[pulum... | [
"0.73894715",
"0.7189797",
"0.71686846",
"0.71197295",
"0.7049309",
"0.6976475",
"0.691663",
"0.6858147",
"0.6719743",
"0.66276485",
"0.66276485",
"0.66197515",
"0.66197515",
"0.66197515",
"0.6481879",
"0.6402061",
"0.6306242",
"0.62132555",
"0.62132555",
"0.62132555",
"0.610... | 0.6717716 | 9 |
The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate with the Studio. | def vpc_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.818983",
"0.818983",
"0.818983",
"0.818983",
"0.818983",
"0.818983",
"0.7784291",
"0.77626926",
"0.77626926",
"0.77626926",
"0.77626926",
"0.77626926",
"0.77626926",
"0.77626926",
"0.77626926",
"0.77626926",
"0.76044416",
"0.75755453",
"0.75755453",
"0.75755453",
"0.757554... | 0.76949507 | 20 |
The ID of the Amazon EMR Studio Workspace security group. The Workspace security group allows outbound network traffic to resources in the Engine security group, and it must be in the same VPC specified by `vpc_id`. | def workspace_security_group_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "workspace_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def workspace_security_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def security_group_id(self) -> pulumi.Inpu... | [
"0.72309697",
"0.7065785",
"0.67988247",
"0.67988247",
"0.6768797",
"0.6768797",
"0.6625691",
"0.6625691",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.638914",
"0.6377499",
"0.6354188",
"0.6262482",
"0.6262482",
"0.6262482",
"0.62624... | 0.7212722 | 1 |
list of tags to apply to the EMR Cluster. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Sequence[str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Optional[Sequence[str]]:\n return pulum... | [
"0.6295113",
"0.6204192",
"0.6204192",
"0.6181015",
"0.6166208",
"0.6166208",
"0.6166208",
"0.6166208",
"0.61349547",
"0.6119828",
"0.61182183",
"0.61088955",
"0.6096592",
"0.60926753",
"0.60607564",
"0.60321504",
"0.6023903",
"0.60192776",
"0.6017177",
"0.6010733",
"0.600462... | 0.0 | -1 |
Specifies whether the Studio authenticates users using IAM or Amazon Web Services SSO. Valid values are `SSO` or `IAM`. | def auth_mode(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "auth_mode") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _aws_sign_in_with_sso(environment):\n aws_session_profile = '{}:session'.format(environment.terraform_config.aws_profile)\n # todo: add `... or if _date_modified(AWS_CONFIG_PATH) > _date_modified(AWS_CREDENTIALS_PATH)`\n if not _has_profile_for_sso(aws_session_profile):\n puts(color_notice(\"Co... | [
"0.62466145",
"0.5880805",
"0.5586111",
"0.5540008",
"0.54662603",
"0.54598784",
"0.54522526",
"0.54288054",
"0.54288054",
"0.54288054",
"0.54288054",
"0.54288054",
"0.54288054",
"0.54288054",
"0.5406341",
"0.53264695",
"0.52999514",
"0.52974427",
"0.52915436",
"0.52838373",
... | 0.5184315 | 27 |
The ID of the Amazon EMR Studio Engine security group. The Engine security group allows inbound network traffic from the Workspace security group, and it must be in the same VPC specified by `vpc_id`. | def engine_security_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "engine_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"engine_security_group_id\")",
"def engine_security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n retur... | [
"0.7011863",
"0.68906003",
"0.68042195",
"0.68042195",
"0.6681128",
"0.6681128",
"0.6622851",
"0.6622851",
"0.65399075",
"0.6496629",
"0.6394589",
"0.63780427",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.62686855",
"0.62686855",
"0.... | 0.6783754 | 4 |
A list of subnet IDs to associate with the Amazon EMR Studio. A Studio can have a maximum of 5 subnets. The subnets must belong to the VPC specified by `vpc_id`. Studio users can create a Workspace in any of the specified subnets. | def subnet_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "subnet_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceIdArgs']]]]:\n return pulumi.get(self, \"subnets\")",
"def vpc_subnet_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"vpc_subnet_ids\")",
"def subnets(self) -> pulumi.Input[Sequence[pulum... | [
"0.73907185",
"0.71904325",
"0.7169779",
"0.7120933",
"0.7049621",
"0.6977677",
"0.6917519",
"0.68589866",
"0.6720354",
"0.67190456",
"0.67190456",
"0.67190456",
"0.6628669",
"0.6628669",
"0.6482749",
"0.6401452",
"0.6308063",
"0.6214535",
"0.6214535",
"0.6214535",
"0.6108716... | 0.66207427 | 14 |
list of tags to apply to the EMR Cluster. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Sequence[str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Optional[Sequence[str]]:\n return pulum... | [
"0.6297107",
"0.6205442",
"0.6205442",
"0.6182958",
"0.6167483",
"0.6167483",
"0.6167483",
"0.6167483",
"0.6137682",
"0.6121853",
"0.611996",
"0.61100036",
"0.6098546",
"0.6093912",
"0.6062168",
"0.60345334",
"0.60255885",
"0.6022085",
"0.602002",
"0.60125667",
"0.60065526",
... | 0.0 | -1 |
The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate with the Studio. | def vpc_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.81899697",
"0.81899697",
"0.81899697",
"0.81899697",
"0.81899697",
"0.81899697",
"0.7784446",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7762859",
"0.7694792",
"0.7694792",
"0.7694792",
"0.7694792",
"0.7694792... | 0.75754714 | 30 |
The ID of the Amazon EMR Studio Workspace security group. The Workspace security group allows outbound network traffic to resources in the Engine security group, and it must be in the same VPC specified by `vpc_id`. | def workspace_security_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "workspace_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def workspace_security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n ... | [
"0.7230404",
"0.72119355",
"0.6799017",
"0.6799017",
"0.67691904",
"0.67691904",
"0.6626241",
"0.6626241",
"0.6410782",
"0.6410782",
"0.6410782",
"0.6410782",
"0.6410782",
"0.6410782",
"0.63871807",
"0.63758147",
"0.6356685",
"0.6263406",
"0.6262679",
"0.6262679",
"0.6262679"... | 0.70653456 | 2 |
Get an existing Studio resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
arn: Optional[pulumi.Input[str]] = None,
auth_mode: Optional[pulumi.Input[str]] = None,
default_s3_location: Optional[pulumi.Input[str]] = None,
descr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_by_id(state_id):\n state = storage.get(State, state_id)\n if not state:\n abort(404)\n return jsonify(state.to_dict()), 200",
"def get_state_by_id(state_id):\n my_state = storage.get('State', state_id)\n if my_state is None:\n abort(404)\n return jsonify(my_state.to_... | [
"0.62434953",
"0.6238258",
"0.61616653",
"0.61550075",
"0.6134168",
"0.61179656",
"0.6100013",
"0.6011708",
"0.59448004",
"0.5883692",
"0.5881919",
"0.58268267",
"0.5796979",
"0.57796544",
"0.5776168",
"0.56969273",
"0.5687934",
"0.5654655",
"0.56533",
"0.5652628",
"0.5650857... | 0.71403503 | 0 |
Specifies whether the Studio authenticates users using IAM or Amazon Web Services SSO. Valid values are `SSO` or `IAM`. | def auth_mode(self) -> pulumi.Output[str]:
return pulumi.get(self, "auth_mode") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _aws_sign_in_with_sso(environment):\n aws_session_profile = '{}:session'.format(environment.terraform_config.aws_profile)\n # todo: add `... or if _date_modified(AWS_CONFIG_PATH) > _date_modified(AWS_CREDENTIALS_PATH)`\n if not _has_profile_for_sso(aws_session_profile):\n puts(color_notice(\"Co... | [
"0.624599",
"0.5880859",
"0.5585444",
"0.554019",
"0.5466168",
"0.5458107",
"0.54511636",
"0.54286975",
"0.54286975",
"0.54286975",
"0.54286975",
"0.54286975",
"0.54286975",
"0.54286975",
"0.5408002",
"0.5326396",
"0.52988803",
"0.5298873",
"0.5291467",
"0.52825856",
"0.52825... | 0.50133264 | 57 |
The ID of the Amazon EMR Studio Engine security group. The Engine security group allows inbound network traffic from the Workspace security group, and it must be in the same VPC specified by `vpc_id`. | def engine_security_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "engine_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"engine_security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(se... | [
"0.7013316",
"0.68066067",
"0.68066067",
"0.67850715",
"0.6683846",
"0.6683846",
"0.66251224",
"0.66251224",
"0.6543493",
"0.6500523",
"0.6398078",
"0.63792205",
"0.63436174",
"0.63436174",
"0.63436174",
"0.63436174",
"0.63436174",
"0.63436174",
"0.62710613",
"0.62710613",
"0... | 0.6892434 | 1 |
A list of subnet IDs to associate with the Amazon EMR Studio. A Studio can have a maximum of 5 subnets. The subnets must belong to the VPC specified by `vpc_id`. Studio users can create a Workspace in any of the specified subnets. | def subnet_ids(self) -> pulumi.Output[Sequence[str]]:
return pulumi.get(self, "subnet_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceIdArgs']]]]:\n return pulumi.get(self, \"subnets\")",
"def vpc_subnet_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"vpc_subnet_ids\")",
"def subnets(self) -> pulumi.Input[Sequence[pulum... | [
"0.73898906",
"0.7189846",
"0.71684754",
"0.7120305",
"0.7049348",
"0.69761866",
"0.69166553",
"0.6858007",
"0.6719755",
"0.671774",
"0.671774",
"0.671774",
"0.66273797",
"0.66273797",
"0.66198015",
"0.66198015",
"0.66198015",
"0.6481898",
"0.6401516",
"0.6306726",
"0.6108329... | 0.621323 | 20 |
list of tags to apply to the EMR Cluster. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Sequence[str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Optional[Sequence[str]]:\n return pulum... | [
"0.6297519",
"0.620676",
"0.620676",
"0.6183024",
"0.6168776",
"0.6168776",
"0.6168776",
"0.6168776",
"0.613707",
"0.61232334",
"0.61201113",
"0.61108613",
"0.60988414",
"0.60948294",
"0.6063684",
"0.6032174",
"0.6026579",
"0.60226846",
"0.6019676",
"0.6012371",
"0.600639",
... | 0.5863307 | 45 |
The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate with the Studio. | def vpc_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.818983",
"0.818983",
"0.818983",
"0.818983",
"0.818983",
"0.818983",
"0.7784291",
"0.76949507",
"0.76949507",
"0.76949507",
"0.76949507",
"0.76949507",
"0.76949507",
"0.76044416",
"0.75755453",
"0.75755453",
"0.75755453",
"0.75755453",
"0.75755453",
"0.75755453",
"0.757554... | 0.77626926 | 7 |
The ID of the Amazon EMR Studio Workspace security group. The Workspace security group allows outbound network traffic to resources in the Engine security group, and it must be in the same VPC specified by `vpc_id`. | def workspace_security_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "workspace_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def workspace_security_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def security_group_id(self) -> pulumi.Input... | [
"0.7212722",
"0.7065785",
"0.67988247",
"0.67988247",
"0.6768797",
"0.6768797",
"0.6625691",
"0.6625691",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.638914",
"0.6377499",
"0.6354188",
"0.6262482",
"0.6262482",
"0.6262482",
"0.626248... | 0.72309697 | 0 |
Get transition vertexes with edges indexes from degrees dictionary | def get_transition_vertexes(dd, start, end):
# from degrees dictionary choose vertexes with degree == 2
# except for start and end vertex, combine a list of
# such vertexes with indexes of their edges in edges list
v_indexes = {}
for v in dd:
if dd[v][0] == 2 and v != start and v != end:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\r\n return self.adjacent.keys()",
"def _degree_verts(g):\n n = len(g)\n # degs = map(len, g) is a tiny bit slower than the following line\n degs = [ len(g[v]) for v in range(n) ]\n dv = dict()\n for v in range(n):\n degnbr = [0] * n\n for w in g[v]:\n ... | [
"0.67272043",
"0.6594935",
"0.65947855",
"0.63876325",
"0.6276506",
"0.6225013",
"0.6201821",
"0.6201821",
"0.6201821",
"0.61925185",
"0.61531764",
"0.61029667",
"0.6101509",
"0.6093262",
"0.60884774",
"0.6087071",
"0.6083367",
"0.6081893",
"0.6076063",
"0.6063979",
"0.604960... | 0.7821683 | 0 |
Create a BatchNormalization layer. This layer implements batch normalization over the last (rightmost) dimension. Thus, it can be use with both fully connected and convolutional layers (but only with data in NHWC format). | def BatchNorm(name=None, decay=0.9, epsilon=1.0e-5):
return ConstructionWrapper.create(BatchNormLayerImpl,
name=name,
decay=decay,
epsilon=epsilon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BatchNormalization(inputs, data_format):\n return tf.layers.BatchNormalization(axis=1 if data_format == 'channels_first' else 3,\n momentum=_BATCH_NORM_DECAY,\n epsilon=_BATCH_NORM_EPSILON,\n scale=T... | [
"0.75805193",
"0.73706365",
"0.7120008",
"0.6879049",
"0.68375504",
"0.67765754",
"0.6714043",
"0.66775185",
"0.6622089",
"0.6591779",
"0.6552371",
"0.64931905",
"0.6475136",
"0.6472176",
"0.6456898",
"0.64525306",
"0.6388142",
"0.6384426",
"0.6303999",
"0.62576175",
"0.62461... | 0.6388783 | 16 |
Returns 'total' or 'Error message' | def __str__(self) -> str:
if self.error_msg != '':
self.temp = self.error_msg
self.error_msg = ''
return self.temp
return str(self.total) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_total(self):\n result = self.test_client.total\n\n assert result == 730",
"def total_errors(error_report):\n return(sum(error_report.values()))",
"def total(self):\n return self._total_name",
"def total(self):\n\t\treturn self._total",
"def GetTotal(self):\n return(s... | [
"0.65394455",
"0.6453566",
"0.6260625",
"0.62448514",
"0.62436324",
"0.6214098",
"0.61655754",
"0.6137783",
"0.6127321",
"0.6085776",
"0.6049657",
"0.60411245",
"0.59958357",
"0.5979235",
"0.5942186",
"0.59311056",
"0.59175617",
"0.5887511",
"0.5863224",
"0.5852764",
"0.58402... | 0.6347253 | 2 |
Returns 'total' or 'Error message' | def display(self):
return str(self.total) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_total(self):\n result = self.test_client.total\n\n assert result == 730",
"def total_errors(error_report):\n return(sum(error_report.values()))",
"def __str__(self) -> str:\n\n if self.error_msg != '':\n self.temp = self.error_msg\n self.error_msg = ''\n ... | [
"0.65402627",
"0.64530134",
"0.6346014",
"0.62602943",
"0.6244972",
"0.6243893",
"0.6213767",
"0.6165005",
"0.6137097",
"0.612788",
"0.6085676",
"0.6049451",
"0.6041037",
"0.5995169",
"0.5979148",
"0.5941639",
"0.5931698",
"0.5916831",
"0.58631784",
"0.5852342",
"0.5840609",
... | 0.58866787 | 18 |
Converts a sequence of elements to a string in a standard, filesystemsafe way | def seq2str(seq):
return ','.join(map(cleanstr, seq)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string",
"def get_itr_str(iterable) -> str:\n\treturn str([str(i) for i in iterable])",
"def list2string(a_list):\n\n the_string = ''\n for elem in a_list:\n the_string += str(elem)\n return the_strin... | [
"0.7136884",
"0.6967668",
"0.68453056",
"0.684023",
"0.68400466",
"0.68400466",
"0.6574962",
"0.64408785",
"0.64219457",
"0.6413968",
"0.63567305",
"0.63358706",
"0.6314232",
"0.63002855",
"0.62802845",
"0.6277351",
"0.6253571",
"0.6253571",
"0.6253571",
"0.62460905",
"0.6244... | 0.7047315 | 1 |
Return the full path on disk that corresponds to the path relative to the temporary directory that is passed in. | def getpath(self, path):
return self._join(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_temp_path():\n return os.getcwd() + \"/temp/\"",
"def _get_tmp_file_path(self):\n return os.path.join(self.tmp_dir, self.hash)",
"def temporary_file_path(self):\n return self.file.name",
"def get_file_path(filename: str):\n return TEMP_DIR.joinpath(filename)",
"def get_temp_file... | [
"0.79380274",
"0.7806176",
"0.75118315",
"0.7508504",
"0.73676074",
"0.7342549",
"0.72689205",
"0.72569627",
"0.724327",
"0.7217075",
"0.720923",
"0.7023557",
"0.6980985",
"0.6979958",
"0.69455653",
"0.6940433",
"0.69242626",
"0.6917203",
"0.6872001",
"0.68539155",
"0.6847839... | 0.0 | -1 |
Get a random element from the set. | def getRandom(self) -> int:
# Note randint range is inclusive at both end
random_idx = random.randint(0, len(self.slot) - 1)
return self.slot[random_idx] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.77060276",
"0.738916",
"0.7296881",
"0.72187954",
"0.6871744",
"0.68453854",
"0.68330806",
"0.67740154",
"0.67226046",
"0.6703282",
"0.6665089",
"0.66356236",
"0.66217655",
"0.6612035",
"0.66000897",
"0.6567767",
"0.6477719",
"0.6462421",
"0.64428514",
"0.64162946",
"0.640... | 0.0 | -1 |
Check the behaviour of the `kind` parameter. In short, "borderline2" generates sample closer to the boundary decision than "borderline1". We generate an example where a logistic regression will perform worse on "borderline2" than on "borderline1". | def test_borderline_smote_kind():
X, y = make_classification(
n_samples=500,
n_features=2,
n_informative=2,
n_redundant=0,
n_repeated=0,
n_clusters_per_class=1,
n_classes=3,
weights=[0.1, 0.2, 0.7],
class_sep=1.0,
random_state=1,
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_borderline_smote_no_in_danger_samples(kind):\n X, y = make_classification(\n n_samples=500,\n n_features=2,\n n_informative=2,\n n_redundant=0,\n n_repeated=0,\n n_clusters_per_class=1,\n n_classes=3,\n weights=[0.1, 0.2, 0.7],\n class_sep=... | [
"0.59879875",
"0.5278893",
"0.5067222",
"0.50639474",
"0.50141376",
"0.4952348",
"0.48771766",
"0.4809434",
"0.47661296",
"0.4752564",
"0.4752564",
"0.4720459",
"0.4624556",
"0.45733762",
"0.45580173",
"0.45507464",
"0.45396474",
"0.45207068",
"0.45138627",
"0.45116305",
"0.4... | 0.61739796 | 0 |
Takes users first then last name as input and capitalizes the first letter of each. | def prompt():
first_name = input("Enter student's first name: ")
first_name = first_name.title()
last_name = input("Enter student's last name: ")
last_name = last_name.title()
print('\n')
return last_name, first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name():\n return input(\"Enter Name: \").capitalize()",
"def question_6(first_name: str, last_name: str) -> str:\n return \"My full name is\" + \" \" + first_name.capitalize() + \" \" + last_name.capitalize()",
"def initials(full_name):\r\n\r\n if full_name is not None and len(full_name) > 0:\... | [
"0.72666925",
"0.7223408",
"0.7137103",
"0.7127314",
"0.69535625",
"0.69509304",
"0.69471914",
"0.6917256",
"0.6906421",
"0.6906306",
"0.68665546",
"0.68618315",
"0.68246955",
"0.6809483",
"0.67870843",
"0.6786523",
"0.67793804",
"0.67723227",
"0.6763861",
"0.6750215",
"0.674... | 0.0 | -1 |
Removes items that have a value of 0 from a dictionary of inventories | def filter_0_items(inventory):
new_list = [] # create an empty dictionary
for key in inventory: # iterate through the list
if inventory[key] == 0: # check for key = 0, if it is then
new_list.append(key) # add it to a new list
for keys in new_list:#iterting through new_list
del inventory[keys]
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_0_items(inventory):\n for k,v in inventory.copy().items():\n if inventory[k] == 0:\n inventory.pop(k)\n return inventory",
"def clean_up_map(self):\n self.items = [i for i in self.items if i.quantity != 0]",
"def remove_outlier(dict_object, keys):\n for key in keys:... | [
"0.8096963",
"0.7588919",
"0.6413768",
"0.63757044",
"0.6367684",
"0.63517725",
"0.62293726",
"0.6169815",
"0.61511654",
"0.6059877",
"0.58848983",
"0.57959706",
"0.5737003",
"0.5694725",
"0.5673215",
"0.55944765",
"0.5577092",
"0.55735654",
"0.5566581",
"0.55288976",
"0.5514... | 0.8019575 | 1 |
serialize struct_time to timezone | def serialize_datetime(date_time) -> timezone:
if isinstance(date_time, struct_time):
return timezone.datetime.fromtimestamp(mktime(date_time)).replace(tzinfo=pytz.UTC)
else:
raise TypeError("Can't convert this type to datetime") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_struct_to_datetime(struct_time_object):\n return datetime.datetime(*struct_time_object[:6])",
"def _serialize_time(val):\n return val.isoformat()",
"def serialized_time(time):\n formatted = time.isoformat()\n if formatted.endswith(\"+00:00\"):\n formatted = formatted[:-6] + \"Z\"\n\... | [
"0.6696328",
"0.66784537",
"0.6304099",
"0.6207683",
"0.605701",
"0.5979643",
"0.5960567",
"0.5920082",
"0.5860897",
"0.5860897",
"0.5845807",
"0.5836228",
"0.58273715",
"0.5815514",
"0.5766322",
"0.5720496",
"0.5704188",
"0.5628591",
"0.56161356",
"0.5607155",
"0.56001204",
... | 0.7104688 | 0 |
This functions calculates the value of the unnormalized log pdf for a given set of random variables. | def posterior(self, val, **kwargs) -> float:
data = self.data
# override val with parameters specified via kwargs
val = copy.deepcopy(val)
for key, value in kwargs.items():
setattr(val, key, value)
# extract parameters
gain = val.gain
states = val.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pdf(self, x, log = False):\n if log:\n return D.logsumexp(\n D.multiple_gauss_den(x, self.mu, self.va, log = True)\n + N.log(self.w))\n else:\n return N.sum(D.multiple_gauss_den(x, self.mu, self.va) * self.w, 1)",
"def log_pdf_norm... | [
"0.68979794",
"0.6882108",
"0.6845926",
"0.6833189",
"0.6705843",
"0.67021364",
"0.67021364",
"0.66996515",
"0.66792095",
"0.6675945",
"0.66572326",
"0.66349924",
"0.66148746",
"0.65684986",
"0.65437806",
"0.65375423",
"0.6525481",
"0.65251005",
"0.65140754",
"0.65016276",
"0... | 0.0 | -1 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
if not hasattr(g, 'sqlite_db'):
g.sqlite_db = connect_db()
return g.sqlite_db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.77386",
"0.7583937",
"0.73191303",
"0.71691906",
"0.70241207",
"0.69677013",
"0.69556284",
"0.6949856",
"0.6898213",
"0.684335",
"0.68303096",
"0.6820152",
"0.6806048",
"0.6796603",
"0.6770467",
"0.6762006",
"0.6751815",
"0.67481244",
"0.6732124",
"0.6701567",
"0.66891956"... | 0.64033985 | 73 |
Check if this module should be shown to current user | def module_is_avalaible(self):
return bool(self._get_nodes()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_visible_to(self, user):\n return True",
"def can_display(self, course, settings, is_user_authenticated, is_user_staff): # pylint: disable=unused-argument\r\n return True",
"def is_visible(cls, request):\n if cls.permission_required:\n return request.user.has_perm(cls.per... | [
"0.76317215",
"0.73722374",
"0.71845216",
"0.707793",
"0.6979916",
"0.6816758",
"0.6805052",
"0.6763103",
"0.6752099",
"0.67212373",
"0.67175233",
"0.67040926",
"0.6701367",
"0.6667071",
"0.6653928",
"0.6653928",
"0.6627656",
"0.66263145",
"0.661768",
"0.6601968",
"0.65655196... | 0.0 | -1 |
Registers a combination of one or more models, one or more keys and one or more signals. Whenever one of the signals is sent by one of the models, the associated cache keys will be deleted. By default, if you omit the `signals` parameter it will use the Django `post_save` signal. | def register(self, models, keys, signals=post_save, **kwargs):
if not isinstance(signals, (list, tuple)):
signals = [signals]
for signal in signals:
if settings.DEBUG:
err = "{} is not a valid Signal subclass.".format(signal)
assert isinstance(sign... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self):\n for signal, models in six.iteritems(self._registry):\n for model, keys in six.iteritems(models):\n # Local function the current signal is going to be\n # connected to.\n # Defining it dynamically allows us to pass in the current\n ... | [
"0.66491324",
"0.6442545",
"0.58168805",
"0.57932657",
"0.552136",
"0.548373",
"0.5481442",
"0.52676225",
"0.5223032",
"0.51982576",
"0.5167057",
"0.5161264",
"0.51268774",
"0.5116198",
"0.50248075",
"0.50216794",
"0.49629274",
"0.4926565",
"0.49122542",
"0.4890563",
"0.48737... | 0.78166646 | 0 |
gaussian(centre, k, x, intensity) == (intensity exp((k (x centre))^2)) | def gaussian(centre, k, intensity, xpos):
return intensity * np.exp(- np.power(k * (xpos - centre), 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_k(x0, y0, sigma, height, width):\n y = np.arange(0, width, 1, float)\n x = np.arange(0, height, 1, float)[:, np.newaxis]\n return np.exp(-((x - x0) ** 2 + (y - y0) ** 2) / (2 * sigma ** 2))",
"def gaussian(x, amplitude=1.0, center=0.0, sigma=1.0):\n \n return (amplitude/(np.sqrt(2.*np... | [
"0.75760573",
"0.71707886",
"0.7004626",
"0.69898623",
"0.69898623",
"0.69898623",
"0.69565445",
"0.6826124",
"0.6816904",
"0.6770682",
"0.6768502",
"0.67603844",
"0.6753947",
"0.6737203",
"0.67277646",
"0.672466",
"0.66839015",
"0.66783154",
"0.66724944",
"0.6649369",
"0.657... | 0.87825394 | 0 |
Checks if the goal state or start state is in the obstacle area | def obstacle_prone_area(self,image):
start_x=int(self.start[0])
start_y=int(self.start[1])
goal_x=int(self.goal[0])
goal_y=int(self.goal[1])
print(goal_x,goal_y)
if (image[int(self.maximum_size-goal_x),int(goal_y),0]==0) or ((image[int(self.maximum_size-start_x),i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goal_occupied(self, view):\n for line in view.obstacles:\n if linesegdist2(line.p1, line.p2, self.goal) < self.radius ** 2:\n return True\n\n for p in view.pedestrians:\n if p.velocity.length2() == 0.0:\n if p.position.distance_to2(self.goal) < ... | [
"0.73806673",
"0.7085184",
"0.705285",
"0.7039204",
"0.7030871",
"0.691709",
"0.6894923",
"0.67947966",
"0.67904234",
"0.6745311",
"0.6700286",
"0.6694245",
"0.6691153",
"0.6671266",
"0.6661765",
"0.66572803",
"0.6646301",
"0.6644943",
"0.66365445",
"0.662294",
"0.66006845",
... | 0.7400996 | 0 |
Returns snake_case representation of CamelCase string | def snake_case(string_to_convert):
return ''.join(['_' + i.lower() if i.isupper()
else i for i in string_to_convert]).lstrip('_') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])",
"def snake_to_camel(snake_str):\n title_str = snake_str.split('_')\n return ' '.join(title_str).title()",
"def snake_cas... | [
"0.8276623",
"0.8123017",
"0.8121616",
"0.80704784",
"0.801332",
"0.79801095",
"0.7953743",
"0.7894281",
"0.7890784",
"0.788816",
"0.7884458",
"0.788085",
"0.7879726",
"0.78380746",
"0.78271514",
"0.7821155",
"0.78191316",
"0.78118306",
"0.7800434",
"0.7755551",
"0.7742752",
... | 0.731683 | 51 |
Returns dashed snake_case representation of CamelCase string | def dash_snake_case(string_to_convert):
return ''.join(['-'+i.lower() if i.isupper()
else i for i in string_to_convert]).lstrip('-') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel(snake_str):\n title_str = snake_str.split('_')\n return ' '.join(title_str).title()",
"def snake_to_camel_case(string: str):\n return ''.join(string_component.title() for string_component in string.split('_'))",
"def to_camel_case(s):\n if s[:1].isupper() and '_' not in s:\n ... | [
"0.7527183",
"0.75240207",
"0.75016373",
"0.74720263",
"0.74485254",
"0.7333683",
"0.73252296",
"0.73077714",
"0.7285525",
"0.72804886",
"0.72637904",
"0.72493",
"0.71553737",
"0.71533054",
"0.71403205",
"0.71403205",
"0.71236026",
"0.7116473",
"0.7096663",
"0.70800185",
"0.7... | 0.73198795 | 7 |
Returns CamelCase version of dashsnakecase | def rev_dash_snake_case(string_to_convert):
return ''.join(i.capitalize() for i in string_to_convert.split('-')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel(snake_str):\n title_str = snake_str.split('_')\n return ' '.join(title_str).title()",
"def dash_snake_case(string_to_convert):\n return ''.join(['-'+i.lower() if i.isupper()\n else i for i in string_to_convert]).lstrip('-')",
"def _snake_to_camel(name, strict=Fals... | [
"0.76030785",
"0.7524594",
"0.75213164",
"0.74385285",
"0.7435249",
"0.73785967",
"0.73184705",
"0.73047245",
"0.7284594",
"0.72799665",
"0.7251861",
"0.72445214",
"0.7243555",
"0.7238941",
"0.7238941",
"0.7235791",
"0.7208121",
"0.719675",
"0.71825606",
"0.7165684",
"0.71581... | 0.74374133 | 4 |
Return True if frac1 is greater than frac2. | def compare_fracs(frac1, frac2):
return frac1[0]*frac2[1] > frac2[0]*frac1[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, frac):\n\n if isinstance(frac,Fraction):\n if (self.numerator ==0 and self.denominator==0) or (frac.numerator ==0 and frac.denominator==0):\n return self.inf_size > frac.inf_size\n if self.inf_size!=0 or frac.inf_size!= 0:\n return self.in... | [
"0.7365881",
"0.7272041",
"0.7179911",
"0.7146161",
"0.70425826",
"0.7039962",
"0.70348424",
"0.7027964",
"0.6976749",
"0.6785346",
"0.6748767",
"0.6638374",
"0.662061",
"0.6575495",
"0.6486706",
"0.6460307",
"0.64515734",
"0.64330274",
"0.6383279",
"0.63759863",
"0.63638836"... | 0.75417024 | 0 |
Returns the node furthest down the tree to the left. This one if it doesn't have a left child. | def get_leftmost_child(self):
if self.left_child == None:
return self
else:
return self.left_child.get_leftmost_child() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_left_node(self):\n\t\tif self.left_child == None:\n\t\t\t# if we are at the end of a branch\n\t\t\tlowest_right_parent = self.get_lowest_right_parent()\n\t\t\tif lowest_right_parent.parent == None:\n\t\t\t\t# if this was called from left edge of the tree\n\t\t\t\t# the lowest right parent is the 1/1 node\n... | [
"0.78348905",
"0.7655214",
"0.76067376",
"0.7596791",
"0.7550032",
"0.7471591",
"0.73937553",
"0.7313952",
"0.72924364",
"0.72379893",
"0.7209601",
"0.7154187",
"0.71160156",
"0.7078668",
"0.70374316",
"0.70040953",
"0.70040953",
"0.7002512",
"0.69932324",
"0.69902736",
"0.69... | 0.80510676 | 0 |
Returns the node furthest down the tree to the right. This one if it doesn't have a right child. | def get_rightmost_child(self):
if self.right_child == None:
return self
else:
return self.right_child.get_rightmost_child() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_right_node(self):\n\t\tif self.right_child == None:\n\t\t\t# if we are at the end of a branch\n\t\t\tlowest_left_parent = self.get_lowest_left_parent()\n\t\t\tif lowest_left_parent.parent == None:\n\t\t\t\t# if this was called from right edge of the tree\n\t\t\t\t# the lowest left parent is the 1/1 node\n\... | [
"0.796525",
"0.75402415",
"0.7468751",
"0.74566835",
"0.73042727",
"0.7213994",
"0.71809685",
"0.7162541",
"0.7078963",
"0.70587814",
"0.7023619",
"0.69773936",
"0.692357",
"0.6920898",
"0.6904356",
"0.6904356",
"0.68679136",
"0.6867284",
"0.6864408",
"0.6818495",
"0.68105125... | 0.81017864 | 0 |
returns the lowest parent up the tree from herethat is a right child. | def get_lowest_right_parent(self):
if self.parent == None:
# if we reached the top of the tree
# just return this node bc the 1/1 node is technically a child of both the 1/0 and 0/1 nodes
return self
elif not self.parent.is_left_child:
# the parent is a right child
return self.parent
else:
# the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lowest_left_parent(self):\n\t\tif self.parent == None:\n\t\t\t# if we reached the top of the tree\n\t\t\t# just return this node bc the 1/1 node is technically a child of both the 1/0 and 0/1 nodes\n\t\t\treturn self\n\t\telif not self.parent.is_left_child:\n\t\t\t# the parent is a right child\n\t\t\tretur... | [
"0.8165508",
"0.7484334",
"0.7232219",
"0.72201324",
"0.7219222",
"0.7097782",
"0.706845",
"0.70569",
"0.7031903",
"0.6971588",
"0.6931417",
"0.6929054",
"0.6923967",
"0.69074976",
"0.6900387",
"0.6890993",
"0.6888747",
"0.6853589",
"0.68239844",
"0.67936134",
"0.6713629",
... | 0.879376 | 0 |
returns the lowest parent up the tree from herethat is a right child. | def get_lowest_left_parent(self):
if self.parent == None:
# if we reached the top of the tree
# just return this node bc the 1/1 node is technically a child of both the 1/0 and 0/1 nodes
return self
elif not self.parent.is_left_child:
# the parent is a right child
return self.parent.get_lowest_left_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lowest_right_parent(self):\n\t\tif self.parent == None:\n\t\t\t# if we reached the top of the tree\n\t\t\t# just return this node bc the 1/1 node is technically a child of both the 1/0 and 0/1 nodes\n\t\t\treturn self\n\t\telif not self.parent.is_left_child:\n\t\t\t# the parent is a right child\n\t\t\tretu... | [
"0.879376",
"0.7484334",
"0.7232219",
"0.72201324",
"0.7219222",
"0.7097782",
"0.706845",
"0.70569",
"0.7031903",
"0.6971588",
"0.6931417",
"0.6929054",
"0.6923967",
"0.69074976",
"0.6900387",
"0.6890993",
"0.6888747",
"0.6853589",
"0.68239844",
"0.67936134",
"0.6713629",
"... | 0.8165508 | 1 |
Returns the node immediately adjacent to this one on the left. | def get_left_node(self):
if self.left_child == None:
# if we are at the end of a branch
lowest_right_parent = self.get_lowest_right_parent()
if lowest_right_parent.parent == None:
# if this was called from left edge of the tree
# the lowest right parent is the 1/1 node
# return the 0/1 node on th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_left(self):\n return BinaryNode.or_none(self.left)",
"def left(self, node):\r\n if self._col(node.count) > 0:\r\n return self.nodes[node.count - 1]\r\n else:\r\n return None",
"def get_node_left(self, n: MazeCell) -> MazeCell:\n if n.x == 0:\n ... | [
"0.81142855",
"0.7870073",
"0.7757782",
"0.76314723",
"0.7608703",
"0.7597988",
"0.7544402",
"0.7425856",
"0.74222994",
"0.74222994",
"0.7350586",
"0.72211397",
"0.7150839",
"0.71428347",
"0.71209687",
"0.7119852",
"0.7100721",
"0.70743316",
"0.70663226",
"0.7064136",
"0.7049... | 0.733992 | 11 |
Returns the node immediately adjacent to this one on the right. | def get_right_node(self):
if self.right_child == None:
# if we are at the end of a branch
lowest_left_parent = self.get_lowest_left_parent()
if lowest_left_parent.parent == None:
# if this was called from right edge of the tree
# the lowest left parent is the 1/1 node
# return the 1/0 (infinity) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_right(self):\n return BinaryNode.or_none(self.right)",
"def right(self, node):\r\n if self._col(node.count) < self.width - 1:\r\n return self.nodes[node.count + 1]\r\n else:\r\n return None",
"def get_node_right(self, n: MazeCell) -> MazeCell:\n if n.x ... | [
"0.7757745",
"0.7681669",
"0.7644593",
"0.7411781",
"0.71435314",
"0.7107883",
"0.7053521",
"0.7040047",
"0.7004506",
"0.69488287",
"0.69488287",
"0.6944938",
"0.6866788",
"0.6862768",
"0.68248725",
"0.6819765",
"0.681448",
"0.67990595",
"0.6777173",
"0.6739208",
"0.6692788",... | 0.7210988 | 4 |
Returns a list of the contents of this node and the tree below it. | def list_repr(self):
contents = [self.frac]
if self.left_child != None:
contents.append( self.left_child.list_repr())
if self.right_child != None:
contents.append(self.right_child.list_repr())
return contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self):\r\n return (node.content for node in self.traverse())",
"def display_content(self):\n list = []\n traverse = self.head\n\n if self.head == None:\n return\n\n while traverse.next != None:\n list.append(traverse.data)\n traverse =... | [
"0.7545305",
"0.7221679",
"0.7124678",
"0.7124678",
"0.6847774",
"0.67603606",
"0.6758241",
"0.6738163",
"0.67087984",
"0.66736764",
"0.66666347",
"0.66626066",
"0.6658105",
"0.66449296",
"0.6619297",
"0.66058624",
"0.66022676",
"0.6595541",
"0.65698355",
"0.65698355",
"0.656... | 0.6218129 | 56 |
Add point to scatter plot. | def addPoint(scat, new_point, c='k'):
old_off = scat.get_offsets()
new_off = np.concatenate([old_off, np.array(new_point, ndmin=2)])
old_c = scat.get_facecolors()
new_c = np.concatenate([old_c, np.array(to_rgba(c), ndmin=2)])
scat.set_offsets(new_off)
scat.set_facecolors(new_c)
scat.axes.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_scatter_points(self):\n self.plot(1)",
"def add_positions_to_plot(self, **kwargs):\n logger.debug('Adding data positions to plot')\n plt.scatter(self.x, self.y, **kwargs)",
"def append_point(self, point):\n self._points.append(point)",
"def addPoint(self, point):\n ... | [
"0.78793406",
"0.7692689",
"0.72777057",
"0.7265467",
"0.71528107",
"0.710891",
"0.70867044",
"0.7075996",
"0.7071812",
"0.7069824",
"0.70209235",
"0.7014326",
"0.69654846",
"0.6959172",
"0.68961143",
"0.6869594",
"0.67545736",
"0.6754094",
"0.67203087",
"0.6671629",
"0.66633... | 0.6714349 | 19 |
Create cluster and plot the corresponding scatter plot. | def createCluster(method, n_clust=3, min_samples=5):
if method == 'SpectralClustering':
clust = SpectralClustering(n_clusters=n_clust)
clust.fit(PC)
scat = plt.scatter(-100, -100, zorder=2)
elif method == 'OPTICS':
clust = OPTICS(min_samples=min_samples)
clust.fit(PC)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_plot(self):\r\n train = StandardScaler().fit_transform(self.X)\r\n pca = PCA(n_components=3)\r\n pca_component = pca.fit_transform(self.X)\r\n fig = plt.figure(figsize=(10,8))\r\n sns.set_palette(sns.color_palette(\"cubehelix\", 8))\r\n ax ... | [
"0.81966823",
"0.7874237",
"0.7726753",
"0.7325798",
"0.72916085",
"0.7283874",
"0.72141063",
"0.7174898",
"0.7167568",
"0.7039628",
"0.701429",
"0.696998",
"0.6915735",
"0.6895689",
"0.679039",
"0.67818",
"0.67807865",
"0.6762318",
"0.6709651",
"0.66942984",
"0.6642895",
"... | 0.67469656 | 18 |
Resolve path to hazard test data. | def hazard(cls, *args):
return cls.path_finder('hazard', *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_finder(cls, *args):\n safe_test_data = os.path.join(\n os.path.dirname(__file__),\n '../tasks/tests/data')\n safe_test_data = os.path.abspath(safe_test_data)\n return os.path.join(safe_test_data, *args)",
"def test_data_path(self):\n path = self._api.Get... | [
"0.58500385",
"0.58481675",
"0.56416404",
"0.5626117",
"0.55669755",
"0.55515575",
"0.55453956",
"0.55145955",
"0.54634666",
"0.54391176",
"0.54072106",
"0.54060847",
"0.5395263",
"0.5374539",
"0.53660613",
"0.5318112",
"0.53179896",
"0.53163916",
"0.52952117",
"0.52902603",
... | 0.50934446 | 34 |
Resolve path to exposure test data. | def exposure(cls, *args):
return cls.path_finder('exposure', *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_finder(cls, *args):\n safe_test_data = os.path.join(\n os.path.dirname(__file__),\n '../tasks/tests/data')\n safe_test_data = os.path.abspath(safe_test_data)\n return os.path.join(safe_test_data, *args)",
"def path_finder(cls, *args):\n # SAFE_PACKAGE we... | [
"0.6406937",
"0.6092738",
"0.6046272",
"0.60044646",
"0.590717",
"0.58784074",
"0.5844596",
"0.57231915",
"0.57198685",
"0.56847864",
"0.56348705",
"0.5606322",
"0.55872416",
"0.5548229",
"0.55310225",
"0.5518813",
"0.551596",
"0.54943013",
"0.549413",
"0.5473486",
"0.5465689... | 0.499489 | 98 |
Resolve path to exposure test data. | def aggregation(cls, *args):
return cls.path_finder('aggregation', *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_finder(cls, *args):\n safe_test_data = os.path.join(\n os.path.dirname(__file__),\n '../tasks/tests/data')\n safe_test_data = os.path.abspath(safe_test_data)\n return os.path.join(safe_test_data, *args)",
"def path_finder(cls, *args):\n # SAFE_PACKAGE we... | [
"0.6406937",
"0.6092738",
"0.6046272",
"0.60044646",
"0.590717",
"0.58784074",
"0.5844596",
"0.57231915",
"0.57198685",
"0.56847864",
"0.56348705",
"0.5606322",
"0.55872416",
"0.5548229",
"0.55310225",
"0.5518813",
"0.551596",
"0.54943013",
"0.549413",
"0.5473486",
"0.5465689... | 0.0 | -1 |
method to set queryset for retrieving objects for user's company only. | def get_queryset(self):
qs = super().get_queryset()
qs.filter(company=self.request.user.company)
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return self.request.user.setting_set.get().companies",
"def get_queryset(self):\n return self.request.user.setting_set.get().companies",
"def get_queryset(self):\n return self.request.user.setting_set.get().companies",
"def get_queryset(self):\n return se... | [
"0.74833214",
"0.74833214",
"0.74833214",
"0.74833214",
"0.7096127",
"0.6695653",
"0.6640594",
"0.6633222",
"0.6544434",
"0.6500737",
"0.6420627",
"0.6395806",
"0.6321692",
"0.62992424",
"0.62633705",
"0.61954886",
"0.6175595",
"0.6160776",
"0.6148539",
"0.6130602",
"0.611168... | 0.83381206 | 0 |
Configures the learning rate. | def _configure_learning_rate(num_samples_per_epoch, global_step):
num_batches_per_epoch = num_samples_per_epoch / FLAGS.batch_size
decay_steps = int(num_batches_per_epoch *
FLAGS.num_epochs_per_decay)
if FLAGS.learning_rate_decay_type == 'exponential':
return tf.train.exponential_decay(F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.78593874",
"0.75907296",
"0.742758",
"0.7406107",
"0.739691",
"0.7320627",
"0.7320627",
"0.72974896",
"0.7253351",
"0.7229305",
"0.721023",
"0.72072744",
"0.71990186",
"0.71936136",
"0.7180078",
"0.7170698",
"0.7169669",
"0.7165654",
"0.71405464",
"0.71101654",
"0.71101654... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.