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 |
|---|---|---|---|---|---|---|
Reduce this DataArray's data by applying ``prod`` along some dimension(s). | def prod(
self,
dim: Dims = None,
*,
skipna: bool | None = None,
min_count: int | None = None,
keep_attrs: bool | None = None,
**kwargs: Any,
) -> DataArray:
if (
flox_available
and OPTIONS["use_flox"]
and contains_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prod(self, axis=None, keepdims=False, dtype=None, out=None):\n return np.multiply.reduce(\n self, out=out, axis=axis, keepdims=keepdims, dtype=dtype\n )",
"def prod(\n self,\n dim: Dims = None,\n *,\n skipna: bool | None = None,\n min_count: int | N... | [
"0.75356025",
"0.72356445",
"0.69731647",
"0.68985814",
"0.6810773",
"0.6810773",
"0.6472493",
"0.63539034",
"0.6327443",
"0.6250724",
"0.6143561",
"0.60524917",
"0.6012047",
"0.5895768",
"0.58667177",
"0.58586097",
"0.58586097",
"0.58586097",
"0.58337677",
"0.58119243",
"0.5... | 0.69897264 | 2 |
Reduce this DataArray's data by applying ``sum`` along some dimension(s). | def sum(
self,
dim: Dims = None,
*,
skipna: bool | None = None,
min_count: int | None = None,
keep_attrs: bool | None = None,
**kwargs: Any,
) -> DataArray:
if (
flox_available
and OPTIONS["use_flox"]
and contains_on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(x, reduce_instance_dims=True, name=None): # pylint: disable=redefined-builtin\n return _numeric_combine(x, np.sum, reduce_instance_dims, name)",
"def sum(self, axis=None, keepdims=False, dtype=None, out=None):\n return np.add.reduce(self, out=out, axis=axis, keepdims=keepdims, dtype=dtype)",
"... | [
"0.708487",
"0.70516545",
"0.70296186",
"0.6916435",
"0.6822894",
"0.670114",
"0.6623486",
"0.6535948",
"0.6535948",
"0.65142673",
"0.6508816",
"0.65004647",
"0.6484067",
"0.6447339",
"0.64389634",
"0.6429189",
"0.6414335",
"0.63769716",
"0.63616836",
"0.6263026",
"0.61955464... | 0.6715113 | 6 |
Reduce this DataArray's data by applying ``cumsum`` along some dimension(s). | def cumsum(
self,
dim: Dims = None,
*,
skipna: bool | None = None,
keep_attrs: bool | None = None,
**kwargs: Any,
) -> DataArray:
return self.reduce(
duck_array_ops.cumsum,
dim=dim,
skipna=skipna,
keep_attrs=keep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumsum(\n self,\n dim: Dims = None,\n *,\n skipna: bool | None = None,\n keep_attrs: bool | None = None,\n **kwargs: Any,\n ) -> Dataset:\n return self.reduce(\n duck_array_ops.cumsum,\n dim=dim,\n skipna=skipna,\n ... | [
"0.7601719",
"0.7601719",
"0.7601719",
"0.71929914",
"0.70374393",
"0.6974349",
"0.6739214",
"0.6690532",
"0.6560123",
"0.64532024",
"0.6444809",
"0.6434722",
"0.6355989",
"0.6352609",
"0.6270605",
"0.6270605",
"0.6270605",
"0.62120354",
"0.6194247",
"0.6184793",
"0.6179344",... | 0.7733504 | 0 |
Reduce this DataArray's data by applying ``cumprod`` along some dimension(s). | def cumprod(
self,
dim: Dims = None,
*,
skipna: bool | None = None,
keep_attrs: bool | None = None,
**kwargs: Any,
) -> DataArray:
return self.reduce(
duck_array_ops.cumprod,
dim=dim,
skipna=skipna,
keep_attrs=ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumprod(\n self,\n dim: Dims = None,\n *,\n skipna: bool | None = None,\n keep_attrs: bool | None = None,\n **kwargs: Any,\n ) -> Dataset:\n return self.reduce(\n duck_array_ops.cumprod,\n dim=dim,\n skipna=skipna,\n ... | [
"0.78693175",
"0.78693175",
"0.78693175",
"0.74438745",
"0.73570323",
"0.72512066",
"0.71616554",
"0.6794507",
"0.66913575",
"0.6365985",
"0.6155289",
"0.60739994",
"0.6059755",
"0.60538614",
"0.602666",
"0.59202105",
"0.57904106",
"0.57707596",
"0.57707596",
"0.57707596",
"0... | 0.8048191 | 0 |
Handle mocked API request for repo existence check. | def callback_repo_check(self, request, uri, headers, status_code=404):
self.assertEqual(
request.headers['Authorization'],
'token {0}'.format(self.OAUTH2_TOKEN)
)
# Handle the new "rerun" repo differently
if self.TEST_RERUN_REPO in uri:
status_code = 4... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_github_repos_info_positive(self):\n self.assertIsNotNone(app.get_github_repos_info(\"dhh\")[\"repo_info\"])",
"def test_github_api_exists():\n p = github_api.GithubPath.from_repo('tensorflow/datasets', 'v3.1.0')\n with enable_api_call():\n assert p.exists()\n assert not (p / 'unnknown... | [
"0.6614973",
"0.6548657",
"0.6510613",
"0.6494966",
"0.6306936",
"0.6299396",
"0.6290716",
"0.6259003",
"0.625318",
"0.6162342",
"0.6154876",
"0.609253",
"0.6088747",
"0.607778",
"0.60644174",
"0.6063622",
"0.6023541",
"0.600028",
"0.60001606",
"0.59103364",
"0.58970094",
"... | 0.6812977 | 0 |
Manage both add and delete of team membership. ``action_list`` is a list of tuples with (``username``, ``added (bool)``) to track state of membership since this will get called multiple times in one library call. | def callback_team_membership(
request, uri, headers, success=True, action_list=None
):
# pylint: disable=too-many-arguments
username = uri.rsplit('/', 1)[1]
if not success:
status_code = 500
if request.method == 'DELETE':
if success:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self, request, action_list, group):\n return action_list",
"def add_list(action, user):\n \n userprofile = user.get_profile()\n \n board = userprofile.get_board(action['boardId'])\n \n # Create the list\n l = List()\n l.title = action['what']['title']\n l.color = act... | [
"0.5766691",
"0.5531757",
"0.5485128",
"0.54238945",
"0.53260785",
"0.5270922",
"0.5267349",
"0.52224904",
"0.51530606",
"0.51122624",
"0.4995376",
"0.4994134",
"0.49654278",
"0.49381015",
"0.49172172",
"0.4907861",
"0.4896086",
"0.48836443",
"0.48314428",
"0.48299542",
"0.48... | 0.63153493 | 0 |
caculate the attention weights. q, k, v must have matching leading dimensions. The mask has different shapes depending on its type(padding or look ahead) but it must be broadcastable for addition. | def scaled_dot_product_attention(q, k, v, mask):
matmul_qk = tf.matmul(q, k, transpose_b=True) # [..., q_len, kv_len]
# scale matmul_qk
dk = tf.cast(tf.shape(k)[-1], tf.float32)
scaled_attention_logits = matmul_qk / tf.sqrt(dk)
# print("scaled_attention_logits", tf.nn.top_k(scaled_attention_logits[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attention(self, q, k, v, mask):\n if (self.params.display_details == True) :\n print('Scaled dot q :', q.shape)\n print('Scaled dot k: ', k.shape)\n print('Scaled dot v: ', v.shape)\n print('Scaled dot mask: ', mask.shape)\n \n matmul_qk = tf... | [
"0.6798876",
"0.6614562",
"0.6541027",
"0.64965683",
"0.6480315",
"0.63856924",
"0.6354788",
"0.61816657",
"0.61601377",
"0.6148763",
"0.6042509",
"0.60187286",
"0.5998331",
"0.59813106",
"0.593155",
"0.59275615",
"0.5926666",
"0.5925003",
"0.5920547",
"0.5915503",
"0.5892713... | 0.5744126 | 30 |
Check that we reject a WRITE that names the iounit argument but still has a positional format argument (containing an '='). TODO 267. This test needs expanding and probably moving to a file dedicated to R913 and its (many) constraints. | def test_named_unit_before_fmt_error():
tcls = Write_Stmt
# Cannot have an un-named (positional) argument after a named argument
with pytest.raises(NoMatchError):
tcls('''WRITE (UNIT=6, '("write some=""'//'text'//'""")')''') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_write_stmt():\n tcls = Write_Stmt\n obj = tcls('write (123)\"hey\"')\n assert isinstance(obj, tcls), repr(obj)\n assert str(obj) == 'WRITE(123) \"hey\"'\n assert repr(obj).replace(\"u'\", \"'\") == (\n \"Write_Stmt(Io_Control_Spec_List(',', (Io_Control_Spec(None, \"\n \"Int_Li... | [
"0.6082462",
"0.5905375",
"0.56293344",
"0.5549656",
"0.5493521",
"0.54801637",
"0.5453339",
"0.54085284",
"0.53969",
"0.53846806",
"0.53668135",
"0.53544927",
"0.52869296",
"0.5286741",
"0.5283133",
"0.52826405",
"0.52780616",
"0.5258492",
"0.521193",
"0.5171243",
"0.5170175... | 0.60555166 | 1 |
Returns colour scheme for Peirce score. | def _get_peirce_colour_scheme():
this_colour_map_object = pyplot.cm.Blues
this_colour_norm_object = matplotlib.colors.BoundaryNorm(
LEVELS_FOR_PEIRCE_CONTOURS, this_colour_map_object.N)
rgba_matrix = this_colour_map_object(this_colour_norm_object(
LEVELS_FOR_PEIRCE_CONTOURS
))
col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conseguir_color(self):\n return self.pluma.conseguir_color()",
"def get_colour(self):\n return self.colour",
"def get_colour(self) -> str:\n return self.colour",
"def getColor(self):\n return self._l[2]",
"def get_palace_board_red(self):\n\n return self._palace_board_... | [
"0.678865",
"0.6306019",
"0.6232524",
"0.622833",
"0.6212288",
"0.6193526",
"0.61802113",
"0.6138026",
"0.6122331",
"0.61007756",
"0.60846984",
"0.60838187",
"0.60765666",
"0.60642964",
"0.60596305",
"0.6055237",
"0.604426",
"0.597812",
"0.5978035",
"0.59603816",
"0.595773",
... | 0.75720006 | 0 |
returns all projects for the given user | def all(cls):
projects_url = 'https://www.pivotaltracker.com/services/v5/projects'
root = _perform_pivotal_get(projects_url)
if root is not None:
return [Project.from_json(project_node) for project_node in root] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects_of_user(self, user_id):\n res = self.conn.cursor().execute(\"\"\"SELECT * FROM projects p JOIN users_projects up \n ON p.id = up.project_id \n WHERE owner=? OR up.user_id=?\n GROUP BY p.id\n ORDER BY last_update DESC\"\"\", (user_id, user_id,))\n return re... | [
"0.8428174",
"0.8384723",
"0.79425204",
"0.77670926",
"0.7678094",
"0.75687045",
"0.75545335",
"0.74962413",
"0.71681637",
"0.7070704",
"0.70580006",
"0.70128125",
"0.70014966",
"0.6903883",
"0.6897157",
"0.6875102",
"0.6849584",
"0.6834363",
"0.680805",
"0.67691106",
"0.6757... | 0.6513738 | 36 |
Get epoch time (seconds) from either passed in UTC datetime or current datetime | def get_epoch_time(utc_datetime=None):
if not utc_datetime:
utc_datetime = datetime.datetime.utcnow()
return math.ceil((utc_datetime - EPOCH_START).total_seconds()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _current_epoch_secs():\n now = datetime.datetime.utcnow()\n epoch = datetime.datetime(1970, 1, 1)\n return (now - epoch).total_seconds()",
"def epoch_time(when):\n if not when: return 0\n epoch = datetime.utcfromtimestamp(0)\n delta = when - epoch\n return int(delta.total_seconds())",
"def t... | [
"0.7687502",
"0.75600356",
"0.7200416",
"0.7182325",
"0.69882435",
"0.6922301",
"0.68947226",
"0.68947226",
"0.68390167",
"0.6823786",
"0.67153645",
"0.6711426",
"0.6711426",
"0.6687371",
"0.6630511",
"0.6630511",
"0.66261214",
"0.6570021",
"0.6527329",
"0.65121967",
"0.65042... | 0.77804226 | 0 |
Get epoch time (milliseconds) from either passed in UTC datetime or current datetime | def get_epoch_time_milliseconds(utc_datetime=None):
epoch_seconds = get_epoch_time(utc_datetime)
return epoch_seconds * MILLISECONDS_IN_SECOND | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_epoch_time(utc_datetime=None):\n if not utc_datetime:\n utc_datetime = datetime.datetime.utcnow()\n return math.ceil((utc_datetime - EPOCH_START).total_seconds())",
"def epoch_time_now():\n return int(time.time())",
"def epoch_time(when):\n if not when: return 0\n epoch = datetime... | [
"0.78353167",
"0.75055903",
"0.74338925",
"0.7330113",
"0.72694373",
"0.726492",
"0.7158576",
"0.7086221",
"0.69683",
"0.68982023",
"0.6857221",
"0.6855786",
"0.6811981",
"0.6789083",
"0.6776045",
"0.6776045",
"0.6746983",
"0.67409736",
"0.6735191",
"0.6717645",
"0.67158127",... | 0.75269914 | 1 |
Get local timezone offset from UTC | def get_timezone_offset():
timezone = get_localzone()
offset_minutes = timezone.utcoffset(datetime.datetime.now()).total_seconds() // SECONDS_IN_MINUTE
return parse_int(offset_minutes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_utc_offset():\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n # XXX: `return -time.timezone`?\n return timedelta.total_seconds()",
"def _local_time_offset():\n if time.localtime().tm_isdst and time.daylight:\n return -time.altzone\n else:\n return -time.t... | [
"0.8392",
"0.795721",
"0.7448938",
"0.7305791",
"0.7229861",
"0.72130525",
"0.70817757",
"0.7041948",
"0.7028021",
"0.697982",
"0.6969199",
"0.6959004",
"0.68061054",
"0.6785264",
"0.67403036",
"0.67114854",
"0.66978824",
"0.66267407",
"0.6565507",
"0.6550441",
"0.65430564",
... | 0.75287604 | 2 |
Removes Nonetype dict values | def remove_empty_values(_dict):
return {k: v for k, v in list(_dict.items()) if v is not None} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_nonetype(dictionary):\n\n return {k: v for k, v in dictionary.items() if v is not None}",
"def _remove_empty_values(data: T) -> T:\n if not isinstance(data, dict):\n return data\n return {k: _remove_empty_values(v) for k, v in data.items() if v is not None}",
"def nonull_dict(self):\... | [
"0.8104306",
"0.73003215",
"0.70699674",
"0.69735897",
"0.6717337",
"0.67100805",
"0.6706329",
"0.6688274",
"0.6626616",
"0.6622698",
"0.660085",
"0.6581392",
"0.6558225",
"0.65107256",
"0.6503204",
"0.64970636",
"0.6477513",
"0.6472595",
"0.6467408",
"0.6453751",
"0.64316624... | 0.66332585 | 8 |
Returns True if val is Falsy, otherwise returns False | def is_empty(val):
return not bool(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_truthy(val):\n return bool(val)",
"def non_empty(val):\n return val is not None and val != \"\"",
"def _val_is_null(self, val):\r\n return val is None",
"def not_none(value):\n return not value is None",
"def is_false(value):\n \n return (value is False)",
"def empty(self... | [
"0.7918933",
"0.790834",
"0.742545",
"0.7357178",
"0.73020804",
"0.70956635",
"0.70306563",
"0.7005919",
"0.7005919",
"0.7005919",
"0.7005919",
"0.7005919",
"0.69641405",
"0.6962459",
"0.69548154",
"0.69414115",
"0.6874724",
"0.6852935",
"0.6849699",
"0.6779061",
"0.6711758",... | 0.82153666 | 0 |
Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the earth's poles. It comes from the | def get_distance_metres(aLocation1, aLocation2):
dlat = aLocation2.lat - aLocation1.lat
dlong = aLocation2.lon - aLocation1.lon
return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat * dlat) + (dlong * dlong)) * 1.113195e5",
"def get_distance_metres(aLocation1, aLocation2):\n \n dlat = aLocation2.lat - aLocation1.lat\n ... | [
"0.6568299",
"0.6561358",
"0.6553495",
"0.637603",
"0.62047136",
"0.61963755",
"0.6160584",
"0.60860103",
"0.6035235",
"0.6024634",
"0.60170466",
"0.6015125",
"0.595105",
"0.58767265",
"0.5678368",
"0.56759465",
"0.56699306",
"0.5649891",
"0.56387025",
"0.56362545",
"0.557508... | 0.6597437 | 3 |
Get a random element from the set. | def getRandom(self):
random_index = randint(0, len(self.list_val)-1)
return self.list_val[random_index] | {
"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.6703282",
"0.6665089",
"0.66356236",
"0.66217655",
"0.6612035",
"0.66000897",
"0.6567767",
"0.6477719",
"0.6462421",
"0.64428514",
"0.64162946",
"0.6400411",
"0.6398... | 0.67226046 | 8 |
Flushes and closes the credential store | def _save_credential_store(self, store):
store.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.save()\n # self.fileKey = None\n if self.openAccount:\n self.openAccount.close()\n self.openAccount = None",
"def close(self):\n self.password = None\n self.session.close()",
"async def aclose(self) -> None:\n\t\tawait self._store... | [
"0.6961587",
"0.6681481",
"0.65697914",
"0.6494412",
"0.6471906",
"0.64025295",
"0.6352745",
"0.63433146",
"0.6317204",
"0.6268953",
"0.62491477",
"0.6214849",
"0.62142926",
"0.62142706",
"0.6199774",
"0.61757946",
"0.61647165",
"0.61625445",
"0.614162",
"0.6118002",
"0.61150... | 0.76500064 | 0 |
Is point inside rectangle? | def inside(point, rectangle):
ll = rectangle.getP1() # assume p1 is ll (lower left)
ur = rectangle.getP2() # assume p2 is ur (upper right)
return (ll.getX() < point.getX() < ur.getX() \
and ll.getY() < point.getY() < ur.getY()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inside(point, rectangle):\n\n ll = rectangle.getP1() # assume p1 is ll (lower left)\n ur = rectangle.getP2() # assume p2 is ur (upper right)\n\n return ll.getX() < point.getX() < ur.getX() and ll.getY() < point.getY() < ur.getY()",
"def in_rectangle(rect, point):\n if point[0] < rect[0]:\n ret... | [
"0.857744",
"0.8539096",
"0.8449531",
"0.81022304",
"0.808994",
"0.7911476",
"0.7871285",
"0.7795241",
"0.7795241",
"0.7786331",
"0.7713887",
"0.7588043",
"0.7583801",
"0.7561834",
"0.750968",
"0.7509136",
"0.7504957",
"0.74918765",
"0.74900085",
"0.7455613",
"0.74207807",
... | 0.85302395 | 2 |
initialize the parameters of a matrix where row may not equal to column | def init_params_weight(row,column):
W = np.random.rand(row, column)
W = W*2.0-1.0
return W.astype(config.floatX) # @UndefinedVariable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, rows, cols):\n if rows <= 0:\n raise ValueError('Number of matrix rows must be greater than zero.')\n if cols <= 0:\n raise ValueError('Number of matrix cols must be greater than zero.')\n\n self.__rows = rows\n self.__cols = cols\n\n # Cr... | [
"0.6686605",
"0.6631014",
"0.6458797",
"0.6404342",
"0.6389679",
"0.6373615",
"0.63321877",
"0.629574",
"0.62533295",
"0.6238518",
"0.6202394",
"0.6166935",
"0.6165265",
"0.6163629",
"0.6160024",
"0.615275",
"0.61468124",
"0.6145931",
"0.6144003",
"0.6133367",
"0.61225617",
... | 0.5729696 | 75 |
Return string representation of the user. | def __str__(self):
return self.username | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\n return str(self.user)",
"def __str__(self):\r\n return str... | [
"0.8076493",
"0.8076493",
"0.8076493",
"0.8076493",
"0.8076493",
"0.7992244",
"0.79252493",
"0.7744952",
"0.7744952",
"0.7744952",
"0.7744952",
"0.76876277",
"0.75422984",
"0.7532189",
"0.7523841",
"0.75130755",
"0.7482391",
"0.7477944",
"0.744449",
"0.7418454",
"0.7410065",
... | 0.67684555 | 73 |
Returns the index of the closing bracket | def index(self, sub, start=0):
br = "([{"[")]}".index(sub)]
count = 0
for i in range(start, len(self.string)):
char = self.string[i]
if char == br:
count += 1
elif char == sub:
if count > 0:
count -= 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_next_bracket(self) -> int:\n return 0",
"def _match_brackets(text: str, index_of_open_bracket: int) -> int:\n if text[index_of_open_bracket] != \"[\":\n raise SyntaxError(\n \"Index {} in 'text' is not an open bracket '['. It is {}\".format(\n index_of_open_bra... | [
"0.76493204",
"0.72793096",
"0.70370746",
"0.6890851",
"0.67595214",
"0.669932",
"0.65149295",
"0.6315805",
"0.6248002",
"0.62295926",
"0.6165225",
"0.6110622",
"0.60899574",
"0.5998586",
"0.5968843",
"0.59331805",
"0.58660525",
"0.58644426",
"0.5845861",
"0.5836592",
"0.5825... | 0.66420686 | 6 |
My new constructor, which makes sure that the ``FRAME_TOOL_WINDOW`` style is not passed through to the ``AuiFloatingFrame`` constructor | def __init__(self, *args, **kwargs):
if 'style' in kwargs:
style = kwargs['style']
# This is the default style, as defined
# in the AuiFloatingFrame constructor
else:
style = (wx.FRAME_TOOL_WINDOW |
wx.FRAME_FLOAT_ON_PARENT |
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _AuiDockingGuide_init(self, *args, **kwargs):\n\n if 'style' in kwargs:\n style = kwargs['style']\n\n # This is the default style, as defined\n # in the AuiDockingGuide constructor\n else:\n style = (wx.FRAME_TOOL_WINDOW |\n wx.FRAME_STAY_ON_TOP |\n wx.... | [
"0.70367366",
"0.6843715",
"0.6642154",
"0.6578007",
"0.654084",
"0.6410062",
"0.6291096",
"0.62042177",
"0.594362",
"0.59111077",
"0.5909552",
"0.5876681",
"0.57657516",
"0.56834096",
"0.56624097",
"0.564891",
"0.56267667",
"0.56264985",
"0.5610823",
"0.55926937",
"0.5591156... | 0.8233745 | 0 |
Set the end time | def __exit__(self, exc_type, exc_value, exc_traceback):
self.end = self()
print(str(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n... | [
"0.8896623",
"0.8896623",
"0.8753845",
"0.8753845",
"0.8753845",
"0.808294",
"0.80729717",
"0.78966063",
"0.7880066",
"0.782719",
"0.7651829",
"0.7645895",
"0.7642337",
"0.7366842",
"0.73140603",
"0.7286351",
"0.71829134",
"0.7159503",
"0.7158022",
"0.7158022",
"0.7158022",
... | 0.0 | -1 |
Turns unicode into bytes, if needed. Assumes UTF8. | def asbytes(s):
if isinstance(s, bytes):
return s
else:
return s.encode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_bytes(data):\n u_type = type(b''.decode('utf8'))\n if isinstance(data, u_type):\n return data.encode('utf8')\n return data",
"def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')",
"def to_bytes(data):\n if ... | [
"0.7645312",
"0.7617884",
"0.75509197",
"0.75476927",
"0.7262509",
"0.72417694",
"0.7219238",
"0.7205173",
"0.7201864",
"0.7165998",
"0.71641016",
"0.71378076",
"0.7127739",
"0.7048951",
"0.7035448",
"0.70284414",
"0.701449",
"0.70024306",
"0.6993095",
"0.69862777",
"0.697220... | 0.7495033 | 4 |
Turns bytes into unicode, if needed. Uses UTF8. | def asunicode(s):
if isinstance(s, bytes):
return s.decode('utf-8', 'replace')
else:
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_unicode(data):\n if isinstance(data, bytes):\n return data.decode('utf-8')\n else:\n return data",
"def utf8tounicode(arg):\n\n try:\n if isinstance(arg, unicode):\n return arg.decode('utf-8')\n except NameError:\n pass # Python 3\n re... | [
"0.7771352",
"0.7608568",
"0.760092",
"0.7586902",
"0.75841767",
"0.75071144",
"0.7426475",
"0.7411024",
"0.73730016",
"0.7314761",
"0.7290108",
"0.723653",
"0.7233475",
"0.72172374",
"0.7215756",
"0.7209994",
"0.719679",
"0.7185164",
"0.71597666",
"0.71575105",
"0.7137322",
... | 0.7844327 | 0 |
Turns bytes into unicode, if needed. | def asunicode_win(s):
if isinstance(s, bytes):
return s.decode(locale.getpreferredencoding())
else:
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asunicode(s):\n if isinstance(s, bytes):\n return s.decode('utf-8', 'replace')\n else:\n return s",
"def to_unicode(data):\n if isinstance(data, bytes):\n return data.decode('utf-8')\n else:\n return data",
"def _force_unicode(data):\n try:\n data... | [
"0.7776503",
"0.7750357",
"0.7712421",
"0.7590276",
"0.7534307",
"0.7445099",
"0.7434296",
"0.7369244",
"0.7362918",
"0.72458327",
"0.7245558",
"0.7220495",
"0.71380717",
"0.7137823",
"0.7132113",
"0.7120568",
"0.7104084",
"0.70992374",
"0.70992374",
"0.7098032",
"0.7059886",... | 0.6493746 | 85 |
First get the predict labels of valid data and compare them with true labels, then get the accuracy. | def validaccurary(C):
acc=np.zeros((nFolds))
for i in range(0,nFolds):
train_x, train_y, valid_x, valid_y=get_next_train_valid(i)
w,b=svmfit(i,C)
y_predict=predict(valid_x,w,b)
valid_y=valid_y.reshape(len(valid_y),1)
k=np.sum(np.absolute(y_predict-valid_y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(preds, labels):\n correct = preds == labels\n return correct.sum().float() / correct.shape[0]",
"def accuracy(predictions, labels):\n return (100.0 * np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1)) / predictions.shape[0])",
"def accuracy(labels, preds):\n\tassert labels.... | [
"0.789505",
"0.76515675",
"0.7560528",
"0.7535523",
"0.751631",
"0.7512759",
"0.74677944",
"0.7458111",
"0.7371566",
"0.7366773",
"0.7331763",
"0.73305213",
"0.7278432",
"0.72667116",
"0.7242942",
"0.72084904",
"0.7193115",
"0.7191824",
"0.71722233",
"0.7152112",
"0.7151536",... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at every specified step | def adjust_learning_rate(optimizer, gamma, step):
lr = args.lr * (0.8 ** step)
print(lr)
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(optimizer, lr, step, args):\n # decay = 0.1**(sum(epoch >= np.array(lr_steps)))\n lr = lr * (0.95**(step//args.lr_decay_every))\n print(\"current learning rate: {:.6f}\".format(lr))\n param_group = optimizer.param_groups\n for i in range(len(param_group)):\n param_gro... | [
"0.7677445",
"0.7677331",
"0.75425225",
"0.7532502",
"0.7501904",
"0.7474184",
"0.74659353",
"0.7463364",
"0.7447536",
"0.7445412",
"0.7445412",
"0.74243855",
"0.74243855",
"0.7419049",
"0.7414735",
"0.739953",
"0.73903084",
"0.73876435",
"0.7374959",
"0.7369073",
"0.7358724"... | 0.7550103 | 2 |
Name of the service. | def service_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "service_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self):\n return self._service_name",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self... | [
"0.90985924",
"0.90985924",
"0.89885104",
"0.87708855",
"0.87708855",
"0.87708855",
"0.832409",
"0.832409",
"0.832409",
"0.82325894",
"0.8127267",
"0.785057",
"0.7743876",
"0.76368743",
"0.7590222",
"0.75873625",
"0.7544445",
"0.73286045",
"0.7316036",
"0.7237534",
"0.7237534... | 0.8632549 | 7 |
ARN of an App Runner automatic scaling configuration resource that you want to associate with your service. If not provided, App Runner associates the latest revision of a default auto scaling configuration. | def auto_scaling_configuration_arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "auto_scaling_configuration_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_scaling_configuration_arn(self) -> Optional[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")",
"def auto_scaling_configuration_arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")",
"def autoscaling(self) -> Optional[pulumi.Inp... | [
"0.7602388",
"0.73555046",
"0.6526771",
"0.6416983",
"0.6149178",
"0.6127391",
"0.5787056",
"0.55833757",
"0.55405587",
"0.5494746",
"0.54689515",
"0.5468072",
"0.5468072",
"0.5468072",
"0.5468072",
"0.5468072",
"0.5468072",
"0.5468072",
"0.54050505",
"0.5402634",
"0.53579885... | 0.7562741 | 1 |
Keyvalue map of resource tags. 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) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.62630427",
"0.62630427",
"0.62630427",
"0.62630427",
"0.62515557",
"0.6199379",
"0.6197303",
"0.6197303",
"0.6171081",
"0.60235703",
"0.59087926",
"0.58788806",
"0.586093",
"0.586093",
"0.5852339",
"0.57716066",
"0.57523805",
"0.5746529",
"0.5728116",
"0.5700934",
"0.57009... | 0.56223136 | 100 |
ARN of the App Runner service. | def arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_service(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_service\")",
"def invoke_arn(self) -> str:\n return pulumi.get(self, \"invoke_arn\")",
"def service(self) -> str:\n return pulumi.get(self, \"service\")",
"def service_name(self) -> pulumi.Output[str]:... | [
"0.64479035",
"0.62479824",
"0.6121296",
"0.60471237",
"0.60471237",
"0.60471237",
"0.60307676",
"0.60307676",
"0.6026896",
"0.6026896",
"0.595133",
"0.58155525",
"0.58155525",
"0.58155525",
"0.5814132",
"0.5803242",
"0.5799869",
"0.56959033",
"0.5651628",
"0.5651628",
"0.565... | 0.0 | -1 |
ARN of an App Runner automatic scaling configuration resource that you want to associate with your service. If not provided, App Runner associates the latest revision of a default auto scaling configuration. | def auto_scaling_configuration_arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "auto_scaling_configuration_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_scaling_configuration_arn(self) -> Optional[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")",
"def auto_scaling_configuration_arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")",
"def autoscaling(self) -> Optional[pulumi.Inp... | [
"0.7602245",
"0.735489",
"0.6525766",
"0.64176255",
"0.6146565",
"0.61262655",
"0.57852095",
"0.5583138",
"0.55412686",
"0.5495257",
"0.5469104",
"0.54688543",
"0.54688543",
"0.54688543",
"0.54688543",
"0.54688543",
"0.54688543",
"0.54688543",
"0.54052836",
"0.54015535",
"0.5... | 0.75626993 | 2 |
Name of the service. | def service_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self):\n return self._service_name",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self... | [
"0.90985924",
"0.90985924",
"0.89885104",
"0.87708855",
"0.87708855",
"0.87708855",
"0.8632549",
"0.8632549",
"0.8632549",
"0.82325894",
"0.8127267",
"0.785057",
"0.7743876",
"0.76368743",
"0.7590222",
"0.75873625",
"0.7544445",
"0.73286045",
"0.7316036",
"0.7237534",
"0.7237... | 0.832409 | 11 |
Current state of the App Runner service. | def status(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self._env.get_state()",
"def running(self):\n info = self.info()\n return info['running']",
"def status(self):\n if self.app_id:\n return self.yarn_api.apps_info(self.app_id)\n else:\n raise KnitException(\"Cannot get status... | [
"0.68262595",
"0.6792812",
"0.67527646",
"0.67260224",
"0.66270804",
"0.6615319",
"0.6562786",
"0.6559686",
"0.6556301",
"0.6546062",
"0.6480879",
"0.64766324",
"0.64340585",
"0.6432745",
"0.6425858",
"0.6401064",
"0.6361489",
"0.63612664",
"0.6340973",
"0.6334077",
"0.632901... | 0.0 | -1 |
Keyvalue map of resource tags. 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) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.62645555",
"0.62645555",
"0.62645555",
"0.62645555",
"0.62532693",
"0.62005436",
"0.6198661",
"0.6198661",
"0.61729014",
"0.60247535",
"0.5909744",
"0.5876319",
"0.5861676",
"0.5861676",
"0.58533055",
"0.5772612",
"0.5753324",
"0.5748929",
"0.5728648",
"0.5701927",
"0.5701... | 0.56234 | 96 |
Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. | def tags_all(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags_all") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.7480712",
"0.7480712",
"0.744961",
"0.744961",
"0.744961",
"0.744961",
"0.7183903",
"0.70735323",
"0.7072765",
"0.7040842",
"0.70165676",
"0.6993755",
"0.6991922",
"0.69025457",
"0.6863047",
"0.6807731",
"0.6757412",
"0.6757412",
"0.6757412",
"0.6757412",
"0.6757412",
"0... | 0.0 | -1 |
ARN of the App Runner service. | def arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_service(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_service\")",
"def invoke_arn(self) -> str:\n return pulumi.get(self, \"invoke_arn\")",
"def service(self) -> str:\n return pulumi.get(self, \"service\")",
"def service_name(self) -> pulumi.Output[str]:... | [
"0.64479035",
"0.62479824",
"0.6121296",
"0.60471237",
"0.60471237",
"0.60471237",
"0.60307676",
"0.60307676",
"0.6026896",
"0.6026896",
"0.595133",
"0.58155525",
"0.58155525",
"0.58155525",
"0.5814132",
"0.5803242",
"0.5799869",
"0.56959033",
"0.5651628",
"0.5651628",
"0.565... | 0.56471735 | 39 |
ARN of an App Runner automatic scaling configuration resource that you want to associate with your service. If not provided, App Runner associates the latest revision of a default auto scaling configuration. | def auto_scaling_configuration_arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "auto_scaling_configuration_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_scaling_configuration_arn(self) -> Optional[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")",
"def auto_scaling_configuration_arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")",
"def auto_scaling_configuration_arn(... | [
"0.76024085",
"0.7562809",
"0.7562809",
"0.6525481",
"0.6417855",
"0.6147875",
"0.6126936",
"0.5785499",
"0.5585611",
"0.55428",
"0.54970145",
"0.5470329",
"0.5470329",
"0.5470329",
"0.5470329",
"0.5470329",
"0.5470329",
"0.5470329",
"0.54684174",
"0.5407366",
"0.5401369",
... | 0.7355564 | 3 |
Name of the service. | def service_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "service_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self):\n return self._service_name",
"def service_name(self) -> pulumi.Input[str]:\n return pulumi.get(self,... | [
"0.90985924",
"0.90985924",
"0.89885104",
"0.8632549",
"0.8632549",
"0.8632549",
"0.832409",
"0.832409",
"0.832409",
"0.82325894",
"0.8127267",
"0.785057",
"0.7743876",
"0.76368743",
"0.7590222",
"0.75873625",
"0.7544445",
"0.73286045",
"0.7316036",
"0.7237534",
"0.7237534",
... | 0.87708855 | 5 |
Current state of the App Runner service. | def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self._env.get_state()",
"def running(self):\n info = self.info()\n return info['running']",
"def status(self):\n if self.app_id:\n return self.yarn_api.apps_info(self.app_id)\n else:\n raise KnitException(\"Cannot get status... | [
"0.68262595",
"0.6792812",
"0.67527646",
"0.67260224",
"0.66270804",
"0.6615319",
"0.6562786",
"0.6559686",
"0.6556301",
"0.6546062",
"0.6480879",
"0.64766324",
"0.64340585",
"0.6432745",
"0.6425858",
"0.6401064",
"0.6361489",
"0.63612664",
"0.6340973",
"0.6334077",
"0.632901... | 0.0 | -1 |
Keyvalue map of resource tags. 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) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.62642497",
"0.62642497",
"0.62642497",
"0.62642497",
"0.6251339",
"0.6199256",
"0.61984146",
"0.61984146",
"0.6171527",
"0.6025279",
"0.5910227",
"0.58787954",
"0.58628654",
"0.58628654",
"0.58545613",
"0.57720864",
"0.5752244",
"0.574767",
"0.5728635",
"0.5702416",
"0.570... | 0.5696738 | 48 |
Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. | def tags_all(self) -> pulumi.Output[Mapping[str, str]]:
return pulumi.get(self, "tags_all") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.74800754",
"0.74800754",
"0.7448629",
"0.7448629",
"0.7448629",
"0.7448629",
"0.71848774",
"0.7073276",
"0.70731705",
"0.7040371",
"0.70166034",
"0.6994814",
"0.6991792",
"0.69025075",
"0.6864671",
"0.6808852",
"0.67572224",
"0.67572224",
"0.67572224",
"0.67572224",
"0.675... | 0.6592072 | 63 |
Given a model name, returns a pretrainedmodels.pytorch model in eval mode as well as an example input. | def load_pretrainedmodels(model_name):
# Lazy import as torchvision may not be required.
import pretrainedmodels
model = getattr(pretrainedmodels, model_name)().float().eval()
input_shape = [1, *model.input_size]
input_data = torch.rand(input_shape).float() * 256
for channel in range(3):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(model_name):\n if hasattr(torchvision.models, model_name):\n with torch.no_grad():\n if model_name.startswith(\"inception\"):\n height = width = 299\n mean = [0.5, 0.5, 0.5]\n std = [0.5, 0.5, 0.5]\n else:\n ... | [
"0.8106233",
"0.74055463",
"0.73103786",
"0.73092246",
"0.7196308",
"0.7172737",
"0.71333736",
"0.71026266",
"0.70072865",
"0.69900763",
"0.6964566",
"0.67862076",
"0.676909",
"0.668715",
"0.6633233",
"0.6631243",
"0.66252095",
"0.6600286",
"0.65757954",
"0.6562362",
"0.65465... | 0.73235846 | 2 |
Given a model name, returns a pytorch transformers model in eval mode. | def load_torchtransformers(model_name):
# There are two versions of huggingface, support both
try:
import pytorch_transformers
except ModuleNotFoundError:
import transformers as pytorch_transformers
if model_name == "bert":
tokenizer = pytorch_transformers.BertTokenizer.from_pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model(name, disable_logging=False):\n return PluginLoader._import(\"train.model\", name, disable_logging)",
"def load_simple_transformer(model_name):\n model = torch.nn.Transformer(nhead=2, num_encoder_layers=1, num_decoder_layers=1)\n model = model.eval()\n src = torch.rand((10, 32, 512)... | [
"0.697611",
"0.6974655",
"0.6780623",
"0.6676455",
"0.65731716",
"0.6506318",
"0.6412367",
"0.6401762",
"0.6367586",
"0.6244505",
"0.6217965",
"0.619761",
"0.6148934",
"0.61453503",
"0.61379516",
"0.6132714",
"0.6060599",
"0.6044852",
"0.59870446",
"0.59724617",
"0.5971283",
... | 0.73867327 | 0 |
changes datetime from utc to computer's local time | def datetime_from_utc_to_local(utc_datetime):
now_timestamp = time.time()
offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(now_timestamp)
return utc_datetime + offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localtime2utc(date):\n return date + (datetime.utcnow() - datetime.now())",
"def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)",
"def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time",
"def lo... | [
"0.7467327",
"0.7299433",
"0.7221331",
"0.71206695",
"0.70101184",
"0.7008891",
"0.70071393",
"0.70071393",
"0.70071393",
"0.70002633",
"0.6920775",
"0.691118",
"0.68929344",
"0.6862337",
"0.68511033",
"0.6793887",
"0.6756534",
"0.67129976",
"0.6707399",
"0.6707399",
"0.66897... | 0.7048078 | 4 |
A generic base class for electrical units. The class contains attributes to store the magnitude of the key and also contain the respective frequency associated with the electrical characteristic. Where series of frequency values are required it is expected that these will be achieved by using a list containing objects ... | def __init__(self, frequency: int = None, freq_unit: str = None, **kwargs):
self._freq: int = freq
self._freq_unit: str = freq_unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value, key_length=1):\r\n super().__init__(self.key, value)\r\n self.key_length = key_length\r\n self.items = OrderedDict()\r\n self.parse()\r\n\r\n self._PlatformTailNumber = None\r\n self._PlatformHeadingAngle = None\r\n self._ImageSourceSensor ... | [
"0.55618083",
"0.54142815",
"0.53817075",
"0.53536946",
"0.53438824",
"0.52844536",
"0.51879114",
"0.51562005",
"0.5135914",
"0.5134475",
"0.51331466",
"0.5132032",
"0.5116857",
"0.51153636",
"0.50826174",
"0.50541294",
"0.50439155",
"0.5021056",
"0.50179166",
"0.50034547",
"... | 0.5463841 | 1 |
The magnitude attribute getter. | def volts(self) -> NumType:
return self._volt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mag(self):\n raise NotImplementedError",
"def magnitude(x):\n return x.magnitude if hasattr(x, 'magnitude') else x",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(self):\n return math.sqrt(self.x**2 + self.y**2 + self.z**2)",
"def magnitude(self):\n ... | [
"0.78821415",
"0.7744481",
"0.75217575",
"0.75084037",
"0.74528784",
"0.74528784",
"0.73352927",
"0.7293906",
"0.7245636",
"0.7212631",
"0.71533173",
"0.71198696",
"0.7073964",
"0.6905093",
"0.6751131",
"0.6726429",
"0.6629411",
"0.6601528",
"0.6458073",
"0.6432477",
"0.64311... | 0.0 | -1 |
The magnitude attribute getter. | def amps(self) -> NumType:
return self._amp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mag(self):\n raise NotImplementedError",
"def magnitude(x):\n return x.magnitude if hasattr(x, 'magnitude') else x",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(self):\n return math.sqrt(self.x**2 + self.y**2 + self.z**2)",
"def magnitude(self):\n ... | [
"0.78821415",
"0.7744481",
"0.75217575",
"0.75084037",
"0.74528784",
"0.74528784",
"0.73352927",
"0.7293906",
"0.7245636",
"0.7212631",
"0.71533173",
"0.71198696",
"0.7073964",
"0.6905093",
"0.6751131",
"0.6726429",
"0.6629411",
"0.6601528",
"0.6458073",
"0.6432477",
"0.64311... | 0.0 | -1 |
Return ohm as a resistance. This will not change the insulation_code of self._ohms. | def r(self) -> float:
return self._ohms.real | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResistence(self):\n return self.resistence",
"def calculate_rh(self):\n # Check for existence of relative humidity and mixing ratio\n if self.data.get('Relative_Humidity') is None:\n if self.data.get('Mixing_Ratio') is None:\n raise KeyError('Calculate mixing... | [
"0.58289057",
"0.5756095",
"0.55540806",
"0.5437796",
"0.54163355",
"0.53827655",
"0.5373473",
"0.5333576",
"0.5330446",
"0.5281449",
"0.5253052",
"0.5227909",
"0.5227909",
"0.5215746",
"0.5182154",
"0.5170751",
"0.5131431",
"0.5111294",
"0.5100755",
"0.5100755",
"0.5049968",... | 0.59486413 | 0 |
Set ohm as a resistance. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. It is up to the user to ensure that it is the correct form. The existing insulation_code of self._ohms is overwritten. | def r(self, r: ComType):
if isinstance(r, complex):
self._ohms = r
else:
self._ohms = complex(r, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roof_insulation(self, roof_insulation):\n\n self._roof_insulation = roof_insulation",
"def occupation_code(self, occupation_code):\n\n self._occupation_code = occupation_code",
"def occupation_code(self, occupation_code):\n\n self._occupation_code = occupation_code",
"def study_code(... | [
"0.5550748",
"0.5465898",
"0.5465898",
"0.53447825",
"0.5243531",
"0.512811",
"0.512811",
"0.5075628",
"0.5047284",
"0.50365186",
"0.499787",
"0.49265862",
"0.48442093",
"0.4812334",
"0.48091078",
"0.47898212",
"0.47898212",
"0.4789178",
"0.47598323",
"0.47588435",
"0.4753784... | 0.42576623 | 72 |
Return ohm as a reactance. This will not change the insulation_code of self._ohms. | def x(self) -> float:
return self._ohms.imag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Om(self):\n return self._Om",
"def h_o(self):\n return self._h_o",
"def candle(self):\n return self._decorator_wrapper(EventName.candle)",
"def calc_impedance(self) -> (Ohm, None):\n power: ComType = complex(0)\n power_unit: str = ''\n amp: NumType = 0\n a... | [
"0.5490361",
"0.5456703",
"0.53395575",
"0.5336062",
"0.5302987",
"0.52687865",
"0.52315074",
"0.5160247",
"0.51602364",
"0.51602364",
"0.50709",
"0.50288886",
"0.5015687",
"0.50016296",
"0.49258858",
"0.49081108",
"0.49023128",
"0.48966557",
"0.4891811",
"0.4873488",
"0.4873... | 0.0 | -1 |
Set ohm as a reactance. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. The existing insulation_code of self._ohms is overwritten. | def x(self, x: ComType):
if isinstance(x, complex):
self._ohms = x
else:
self._ohms = complex(0, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code(self, code):\n\n self._code = code",
"def memo_code(self, memo_code):\n\n self._memo_code = memo_code",
"def set_code(self, code):\n self.set_payload(code)",
"def roof_insulation(self, roof_insulation):\n\n self._roof_insulation = roof_insulation",
"def code(self, code)... | [
"0.49665365",
"0.49065626",
"0.48271862",
"0.4815256",
"0.48065296",
"0.4793647",
"0.47817233",
"0.47817233",
"0.47809148",
"0.47809148",
"0.47222644",
"0.46523058",
"0.46509385",
"0.4619818",
"0.46148682",
"0.46065703",
"0.46027088",
"0.4600057",
"0.45986825",
"0.45986825",
... | 0.0 | -1 |
Return ohm as an impedance. This is returned as the absolute insulation_code for the This will not change the insulation_code of self._ohms | def z(self) -> NumType:
return abs(self._ohms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_impedance(self) -> (Ohm, None):\n power: ComType = complex(0)\n power_unit: str = ''\n amp: NumType = 0\n amp_unit: str = ''\n volt: NumType = 0\n volt_unit: str = ''\n\n if self._volt_exists and self._volt_exists:\n if hasattr(self._obj1, 'volts... | [
"0.6479323",
"0.54064494",
"0.5367667",
"0.5330968",
"0.53086656",
"0.52193964",
"0.51685053",
"0.5047589",
"0.49772018",
"0.49740693",
"0.496601",
"0.49538025",
"0.49090466",
"0.490588",
"0.4899409",
"0.4898324",
"0.4881354",
"0.48751566",
"0.48690826",
"0.485226",
"0.483707... | 0.4934608 | 12 |
Set ohm as an impedance. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. The existing insulation_code of self._ohms is overwritten. | def z(self, z: ComType):
self._ohms = z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_impedance(self, coord, c_axis, M, K, B, **kwargs):\r\n return self._arm.set_impedance(coord, c_axis, M, K, B, **kwargs)",
"def set_impedance_config(self, coord, c_axis):\r\n return self._arm.set_impedance_config(coord, c_axis)",
"def _initialize_dipole_model(self, model):\n for key... | [
"0.521271",
"0.50573397",
"0.48296985",
"0.48296985",
"0.47990018",
"0.4792651",
"0.47072685",
"0.45067558",
"0.4503179",
"0.44958884",
"0.4486635",
"0.44429332",
"0.43902498",
"0.42726007",
"0.42666242",
"0.4263231",
"0.4245052",
"0.4245052",
"0.42232153",
"0.4209167",
"0.41... | 0.40889707 | 31 |
There are two modes. 1. Subtract a complex to an Power() object. Return a new Power() object with '.power' that is the sum of the 'self.power' and the passed complex(). 2. Subtract two Power() objects, returning a new Power() object with '.ohm' that is the difference of 'self.power' and 'other.power'. a) The frequencie... | def __sub__(self, other):
if isinstance(other, complex):
return Power(self.power - other, self.power_unit, self.freq, self.freq_unit)
if self.power_unit != other.power_unit:
raise ArithmeticError(f"The objects' ohm units {self.power_unit} and {other.power_unit} are not the same."... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(self, other):\n if isinstance(other, complex):\n return Ohm(self.ohm - other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.\")\n... | [
"0.7868433",
"0.73533434",
"0.73213",
"0.7271727",
"0.7052522",
"0.6915829",
"0.66105074",
"0.65981007",
"0.65697485",
"0.64671576",
"0.64670223",
"0.6457807",
"0.6430139",
"0.6407553",
"0.64031404",
"0.63710004",
"0.6362891",
"0.6256372",
"0.62556434",
"0.62384874",
"0.62046... | 0.8721685 | 0 |
Return ohm as a resistance. This will not change the insulation_code of self._ohms. | def p(self) -> float:
return self._pwr.real | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r(self) -> float:\n return self._ohms.real",
"def getResistence(self):\n return self.resistence",
"def calculate_rh(self):\n # Check for existence of relative humidity and mixing ratio\n if self.data.get('Relative_Humidity') is None:\n if self.data.get('Mixing_Ratio')... | [
"0.59479755",
"0.58266187",
"0.57562566",
"0.5551067",
"0.5433529",
"0.54110503",
"0.53828955",
"0.53684855",
"0.53294766",
"0.53273535",
"0.5281292",
"0.5249423",
"0.522684",
"0.522684",
"0.5214339",
"0.5183197",
"0.51697826",
"0.5128865",
"0.51069456",
"0.5096244",
"0.50962... | 0.0 | -1 |
Return ohm as an impedance. This is returned as the absolute insulation_code for the This will not change the insulation_code of self._ohms | def s(self) -> NumType:
return abs(self._pwr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_impedance(self) -> (Ohm, None):\n power: ComType = complex(0)\n power_unit: str = ''\n amp: NumType = 0\n amp_unit: str = ''\n volt: NumType = 0\n volt_unit: str = ''\n\n if self._volt_exists and self._volt_exists:\n if hasattr(self._obj1, 'volts... | [
"0.64812356",
"0.54077005",
"0.5368085",
"0.5331127",
"0.53075564",
"0.52206373",
"0.5167214",
"0.5048432",
"0.49753687",
"0.4973499",
"0.4965105",
"0.49537203",
"0.49353448",
"0.49072888",
"0.49066025",
"0.48983705",
"0.48978457",
"0.48800385",
"0.48750883",
"0.4869345",
"0.... | 0.0 | -1 |
Compare the frequency attributes of the two objects and ensure that they are equal to allow the calculation to take place. Set the 'self._freq_equal' to True if the same. | def compare_freq(self):
if self._obj1.frequency != self._obj2.frequency:
raise ArithmeticError(f"The objects' frequency {self._obj1.frequency} and {self._obj2.frequency} are not the same.")
if self._obj1.freq_unit != self._obj1.freq_unit:
raise ArithmeticError(f"The objects' freq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return np.array_equal(\n self.np_floats(),\n other.np_floats()) and np.array_equal(\n self.np_ints(),\n other.np_ints()) and np.array_equal(\n self.freqs,\n other.freqs)",
"def __gt__(self, other):\n if not... | [
"0.6924577",
"0.6023659",
"0.60017574",
"0.5967577",
"0.5945457",
"0.5889283",
"0.58852327",
"0.5857143",
"0.5848025",
"0.5846018",
"0.58393663",
"0.5835524",
"0.58251196",
"0.58249813",
"0.58152753",
"0.5802302",
"0.57974994",
"0.57899815",
"0.5783015",
"0.57757765",
"0.5775... | 0.8551229 | 0 |
function to check if the current value is in a future time | def val_future_time(value):
today = timezone.now()
if value < today:
raise ValidationError('Datetime should be a future Date and time') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_in_future(date) -> bool:\n is_in_the_future = time_after(date)\n return is_in_the_future",
"def valid(t):\n return float(t) > time.time()",
"def isPast(self):\n return (self._t < time())",
"def is_in_the_future(dt):\n if dt > datetime.now(pytz.utc):\n return True\n retur... | [
"0.742416",
"0.7342394",
"0.72829944",
"0.7265453",
"0.7176794",
"0.7147083",
"0.7041912",
"0.70314723",
"0.6834246",
"0.67728204",
"0.6656451",
"0.66316754",
"0.6564517",
"0.65577716",
"0.65541255",
"0.65340716",
"0.65168554",
"0.64972854",
"0.64915395",
"0.6470125",
"0.6452... | 0.7358469 | 1 |
check for validations in end time by adding min interview duration ie, end time should be a time grater than now() + min duration | def val_future_end_time(value):
today = timezone.now() + timezone.timedelta(minutes=settings.MIN_INTERVIEW_DURATION)
if value < today:
raise ValidationError(f'Datetime should be atleast {settings.MIN_INTERVIEW_DURATION} min after current Date and time') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_time(self,data,data_orginal):\n if data['start_time'] > data['end_time']:\n raise ValidationError('event end time should be greater than start time.')",
"def validateTiming(obj):\n if obj.start_time:\n if obj.end_time:\n return obj.start_time <= timezone.now() and... | [
"0.7216719",
"0.71129835",
"0.68031824",
"0.6738553",
"0.658789",
"0.6553472",
"0.65149224",
"0.64622396",
"0.6392901",
"0.63849175",
"0.635124",
"0.6345768",
"0.6327704",
"0.63002944",
"0.62925655",
"0.6243793",
"0.62406015",
"0.6225465",
"0.6208335",
"0.61959475",
"0.613009... | 0.6642827 | 4 |
equ_type correpsonds to the WavelengthSolutionFunctions coeffs correponds to the function but for a polynomial coeffs = c y = c[0]+c[1]x+c[2]x2+c[3]c3+.... extra extra info from the extraction process | def __init__ (self, equ_type='none' , extra='none'):
self.equ_type = self.set_equation_type(equ_type)
self.coeffs = []
self.extra = str(extra) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth_order_const_coeff(*coeffs: List[Symbol], t: Symbol = t) -> Tuple[List[Symbol], Procedure]:\n\n # First, set up characteristic equation.\n char_eq_r, r = sympy.S.Zero, Dummy('r')\n\n for order, coeff in enumerate(coeffs[::-1]):\n char_eq_r += coeff * r ** order\n\n char_eq = Poly(char_eq_... | [
"0.5734576",
"0.56887656",
"0.5681322",
"0.5651976",
"0.56423664",
"0.5576589",
"0.5528677",
"0.5461771",
"0.5373789",
"0.5370976",
"0.5368531",
"0.5363878",
"0.5342567",
"0.5324895",
"0.5313149",
"0.52953506",
"0.5280881",
"0.5260313",
"0.5219243",
"0.52093476",
"0.5208789",... | 0.57912767 | 0 |
Returns the parent of self. If self is root ('/'), parent returns None. You much check the output of parent before using the value. Notcie that parent of root in the shell is '/', so this is a semantic difference between FarmFS and POSIX. | def parent(self):
if self._path == sep:
return None
elif self._parent is None:
self._parent = Path(first(split(self._path)))
return self._parent
else:
return self._parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(self):\n return self if self.is_root else self.__parent",
"def get_parent(self):\n if self.parent:\n return self.parent()\n else:\n return None",
"def find_parent(self):\n parent = self._parent\n if parent:\n return parent\n ... | [
"0.78836995",
"0.77781475",
"0.76843834",
"0.7628968",
"0.75214714",
"0.75041956",
"0.74604297",
"0.7354661",
"0.734197",
"0.72440976",
"0.7241017",
"0.7235812",
"0.72275674",
"0.72217995",
"0.72217995",
"0.72217995",
"0.7179848",
"0.7179848",
"0.71753633",
"0.71729606",
"0.7... | 0.81464714 | 0 |
Returns list of objects selected in the view. | def get_selected(self):
return [sel.internalPointer().obj for sel in self.view.selectedIndexes()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_selected_objects(remote):\n cmd1 = mmapi.StoredCommands()\n key1 = cmd1.AppendSceneCommand_ListSelectedObjects()\n remote.runCommand(cmd1)\n objects = mmapi.vectori()\n cmd1.GetSceneCommandResult_ListObjects(key1, objects)\n return vectori_to_list(objects)",
"def get_selected_objects (... | [
"0.7132821",
"0.7130354",
"0.69558793",
"0.6842191",
"0.6727035",
"0.6513116",
"0.6473067",
"0.6447992",
"0.6409065",
"0.63738596",
"0.63438207",
"0.6335116",
"0.63065183",
"0.63029337",
"0.6302812",
"0.62765443",
"0.6207948",
"0.620427",
"0.6197445",
"0.61648536",
"0.6141752... | 0.7057358 | 2 |
Shrinking a bytearray [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] | def test_bit_resize_shrink_removes_from_end(self):
ops = [bitwise_operations.bit_resize(self.zero_one_bin, 5)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
assert len(bins[self.zero_one_bin]) == 5
assert bins[self.zero_one_bi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shrink_arr(self):\n self._resize_arr(self._capacity // self._growth_factor)",
"def shrink(self):\r\n\r\n old = self._data\r\n self._capacity = self._capacity // 2\r\n self._data = [0] * self._capacity\r\n\r\n if len(old) >= 1:\r\n for i in range(self._size):\r\n... | [
"0.6551512",
"0.6509514",
"0.585405",
"0.5818946",
"0.56838995",
"0.567641",
"0.56488687",
"0.5614699",
"0.55934674",
"0.55568254",
"0.5555585",
"0.55294585",
"0.5512883",
"0.5506248",
"0.5469331",
"0.541783",
"0.54173297",
"0.5385371",
"0.5360227",
"0.5331471",
"0.5301435",
... | 0.59765244 | 2 |
Shrinking a bytearray [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] | def test_bit_resize_shrink_from_front(self):
ops = [bitwise_operations.bit_resize(self.zero_one_bin, 5, resize_flags=aerospike.BIT_RESIZE_FROM_FRONT)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
assert len(bins[self.zero_one_bin]) =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shrink_arr(self):\n self._resize_arr(self._capacity // self._growth_factor)",
"def shrink(self):\r\n\r\n old = self._data\r\n self._capacity = self._capacity // 2\r\n self._data = [0] * self._capacity\r\n\r\n if len(old) >= 1:\r\n for i in range(self._size):\r\n... | [
"0.6551586",
"0.65101767",
"0.597793",
"0.58557206",
"0.58172286",
"0.56845737",
"0.56777936",
"0.56472313",
"0.56167936",
"0.5591537",
"0.5559092",
"0.55571175",
"0.5512863",
"0.5503912",
"0.54688245",
"0.5421969",
"0.5418595",
"0.53878313",
"0.53612536",
"0.53343594",
"0.53... | 0.55316 | 12 |
Perform a bit_set op with an offset that places the value across bytes. | def test_bit_set_bit_inbetween_bytes(self):
value = bytearray()
value.append(255)
ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 4, 8, 1, value, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setbit(self, key, offset, value):\n key = self._encode(key)\n index, bits, mask = self._get_bits_and_offset(key, offset)\n\n if index >= len(bits):\n bits.extend(b\"\\x00\" * (index + 1 - len(bits)))\n\n prev_val = 1 if (bits[index] & mask) else 0\n\n if value:\n ... | [
"0.75205547",
"0.69871444",
"0.68143886",
"0.65187263",
"0.65010196",
"0.639893",
"0.63363326",
"0.6309361",
"0.62362903",
"0.62182957",
"0.62146336",
"0.6192626",
"0.6173701",
"0.60066473",
"0.5981619",
"0.59072906",
"0.58354443",
"0.5795803",
"0.57881266",
"0.5678882",
"0.5... | 0.66889226 | 3 |
' Perform a bit_set op with a bit offset that is larger than the bit_map being modified. | def test_bit_set_bit_index_out_of_range(self):
value = bytearray()
value.append(255)
ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 41, 8, 1, value, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bit(x, k):\n\n return x | (1 << k)",
"def setbit(self, key, offset, value):\n key = self._encode(key)\n index, bits, mask = self._get_bits_and_offset(key, offset)\n\n if index >= len(bits):\n bits.extend(b\"\\x00\" * (index + 1 - len(bits)))\n\n prev_val = 1 if (... | [
"0.6818344",
"0.6717861",
"0.6623272",
"0.6388839",
"0.6334515",
"0.6324545",
"0.6187075",
"0.6184176",
"0.61477",
"0.61284816",
"0.61269665",
"0.60442585",
"0.60281456",
"0.5958177",
"0.593757",
"0.5916329",
"0.59066445",
"0.58699304",
"0.58004355",
"0.5780619",
"0.5732328",... | 0.6449285 | 3 |
Perform a bit_set op with a value larger than the bit_map being modified. | def test_bit_set_bit_value_size_too_large(self):
value = bytearray()
for x in range(0, 5):
value.append(255)
ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 0, 48, 6, value, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bit(x, k):\n\n return x | (1 << k)",
"def setbit(self, key, offset, value):\n key = self._encode(key)\n index, bits, mask = self._get_bits_and_offset(key, offset)\n\n if index >= len(bits):\n bits.extend(b\"\\x00\" * (index + 1 - len(bits)))\n\n prev_val = 1 if (... | [
"0.6941478",
"0.6721615",
"0.6520868",
"0.65103495",
"0.6508883",
"0.64841413",
"0.6369438",
"0.62393576",
"0.6160469",
"0.61062336",
"0.60786474",
"0.6036452",
"0.6020244",
"0.59747124",
"0.5928422",
"0.5875835",
"0.5863233",
"0.5851287",
"0.5827314",
"0.57872456",
"0.578355... | 0.6376951 | 6 |
Perform a bit_set op with an bit size larger than the actual value. | def test_bit_set_bit_bit_size_too_large(self):
value = bytearray()
value.append(255)
ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 0, 16, 1, value, None)]
with pytest.raises(e.InvalidRequest):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_set_bit_value_size_too_large(self):\n value = bytearray()\n for x in range(0, 5):\n value.append(255)\n ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 0, 48, 6, value, None)]\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operat... | [
"0.77699894",
"0.6594298",
"0.6497174",
"0.6339704",
"0.6304334",
"0.6257113",
"0.6206651",
"0.620033",
"0.61832565",
"0.6174593",
"0.610813",
"0.61076254",
"0.6104633",
"0.60604364",
"0.6015046",
"0.5987889",
"0.5957026",
"0.59446806",
"0.59208137",
"0.5900072",
"0.58730924"... | 0.78068256 | 0 |
Perform a bit_set op with a non existent bin. | def test_bit_set_bit_bad_bin_name(self):
value = bytearray()
value.append(255)
ops = [bitwise_operations.bit_set("bad_name", 0, 8, 1, value, None)]
with pytest.raises(e.BinNotFound):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_set_bit_index_out_of_range(self):\n value = bytearray()\n value.append(255)\n ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 41, 8, 1, value, None)]\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)",
"def test_b... | [
"0.7023662",
"0.7013182",
"0.6553143",
"0.6487933",
"0.64827436",
"0.64403266",
"0.6393664",
"0.6350938",
"0.6335981",
"0.6330965",
"0.62376326",
"0.6232921",
"0.6223009",
"0.621056",
"0.61761284",
"0.61017376",
"0.60678023",
"0.59541297",
"0.5921793",
"0.59187233",
"0.58331"... | 0.70514387 | 0 |
Perform a bitwise add op. | def test_bit_add_simple(self):
ops = [bitwise_operations.bit_add(self.test_bin_ones, 0, 8, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([2] * 1 + [1] * 4)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ff_add(a, b):\n return a ^ b",
"def add(num1,num2):\n if(num2==0):\n return num1\n return add((num1^num2),(num1&num2)<<1)",
"def add(self, a, b):\n return a + b",
"def plus(self, other):\n return self | other",
"def __add__(self, other):\n\n return self._binary_elementwise_... | [
"0.72715294",
"0.7098102",
"0.70803595",
"0.70718306",
"0.69956553",
"0.6975312",
"0.69086856",
"0.68694097",
"0.68667156",
"0.6845859",
"0.67594755",
"0.67444706",
"0.67444706",
"0.67444706",
"0.67444706",
"0.67444706",
"0.67444706",
"0.6738565",
"0.66684777",
"0.6663798",
"... | 0.71233565 | 1 |
Perform a bitwise add op with an offset that lands inbetween bytes. | def test_bit_add_inbetween_bytes(self):
ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 4, 8, 255, False, aerospike.BIT_OVERFLOW_FAIL, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([15] * 1 +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _uint8_add(self, a, b):\n return ((a & 0xFF) + (b & 0xFF)) & 0xFF",
"def add_binary(a, b):\n return bin(a + b)[2:]",
"def _add(a, b):\n\n # Todo: What if numbers have bigger length than 8\n a = _I2B(a, fixed_length=8)\n b = _I2B(b, fixed_length=8)\n return _B2I([i ^ j for i, j in zip(... | [
"0.6895345",
"0.64765716",
"0.6331206",
"0.6284761",
"0.61512357",
"0.61413187",
"0.6051106",
"0.59600806",
"0.59311205",
"0.5892663",
"0.588553",
"0.5865346",
"0.5851213",
"0.58214045",
"0.581817",
"0.5771626",
"0.570471",
"0.57009697",
"0.56927943",
"0.5666603",
"0.5655928"... | 0.67608523 | 1 |
Perform a bitwise add op with multiple bytes. | def test_bit_add_multiple_bytes(self):
ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 8, 16, 65535, False, aerospike.BIT_OVERFLOW_FAIL, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([0] * 1 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add(a, b):\n\n # Todo: What if numbers have bigger length than 8\n a = _I2B(a, fixed_length=8)\n b = _I2B(b, fixed_length=8)\n return _B2I([i ^ j for i, j in zip(a, b)])",
"def _uint8_add(self, a, b):\n return ((a & 0xFF) + (b & 0xFF)) & 0xFF",
"def test_bit_add_inbetween_bytes(self):\n... | [
"0.72455776",
"0.698561",
"0.6880169",
"0.67817104",
"0.6642168",
"0.6629964",
"0.65817994",
"0.64933366",
"0.648726",
"0.6482742",
"0.64505666",
"0.64498633",
"0.6417345",
"0.63390696",
"0.62232685",
"0.62040883",
"0.61814713",
"0.61686695",
"0.61275816",
"0.6070808",
"0.606... | 0.749226 | 0 |
Perform a bitwise add op subtraction. | def test_bit_add_bit_size_signed(self):
ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 254, True, aerospike.BIT_OVERFLOW_WRAP, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([253] * 1 + [2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ff_add(a, b):\n return a ^ b",
"def __add__(self, tc): \n tc = TwosComplement(tc)\n bits = self.len if self.len > tc.len else tc.len \n result = self.int + tc.int\n return TwosComplement(result, bits)",
"def plus(self, other):\n return self | other",
"def subtract(self, other):\n... | [
"0.7376534",
"0.687527",
"0.6717175",
"0.66653",
"0.6615761",
"0.6604166",
"0.64860994",
"0.6468908",
"0.64633477",
"0.64633477",
"0.64028156",
"0.64028156",
"0.6377342",
"0.6358752",
"0.6314682",
"0.6313187",
"0.6297355",
"0.6297355",
"0.6281229",
"0.6281229",
"0.6281229",
... | 0.0 | -1 |
Perform a bitwise add op that overflows with the BIT_OVERFLOW_WRAP action. | def test_bit_add_overflow_wrap(self):
ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_WRAP, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([0] * 1 + [255] *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_add_overflow_fail(self):\n ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)",
"def test_bit_add_bit_size_out_of_range(self):\n ... | [
"0.69865286",
"0.63499284",
"0.6259732",
"0.6231338",
"0.6189133",
"0.6175745",
"0.61683786",
"0.609293",
"0.6042137",
"0.6023715",
"0.5987507",
"0.5873115",
"0.58514667",
"0.58116734",
"0.57713294",
"0.574729",
"0.5737004",
"0.5733803",
"0.56554",
"0.5628457",
"0.5598145",
... | 0.74974084 | 0 |
Perform a bitwise get op with a negative offset. | def test_bit_get_negative_offset(self):
ops = [bitwise_operations.bit_get(self.count_bin, -2, 2)]
_, _, result = self.as_connection.operate(self.test_key, ops)
expected_result = bytearray([192] * 1)
assert result[self.count_bin] == expected_result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_get_bit_offset_out_of_range(self):\n ops = [bitwise_operations.bit_get(self.test_bin_ones, 41, 1)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)",
"def test_bit_subtract_bit_offset_out_of_range(self):\n ops = [\n ... | [
"0.6487363",
"0.63536626",
"0.6093398",
"0.60396236",
"0.5953041",
"0.58536357",
"0.5741644",
"0.56206924",
"0.55487245",
"0.54852706",
"0.54610914",
"0.5309807",
"0.5308505",
"0.5308271",
"0.52730584",
"0.5258959",
"0.5250486",
"0.5231087",
"0.5225644",
"0.5214675",
"0.52085... | 0.7575732 | 0 |
Perform a bitwise get with a non existent bin. | def test_bit_get_bad_bin_name(self):
ops = [bitwise_operations.bit_get("bad_name", 0, 1)]
_, _, result = self.as_connection.operate(self.test_key, ops)
expected_result = None
assert result["bad_name"] == expected_result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_get_negative_offset(self):\n ops = [bitwise_operations.bit_get(self.count_bin, -2, 2)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = bytearray([192] * 1)\n assert result[self.count_bin] == expected_result",
"def test_bit_get_int_b... | [
"0.65858793",
"0.64688575",
"0.6412785",
"0.6410566",
"0.637989",
"0.6376321",
"0.63263226",
"0.6301394",
"0.6280836",
"0.62782186",
"0.6134096",
"0.61190915",
"0.6102165",
"0.6091341",
"0.6078036",
"0.60745895",
"0.59728205",
"0.5969861",
"0.5958944",
"0.58879626",
"0.584863... | 0.6674132 | 0 |
Perform a bitwise get int with a float for bit_size. | def test_bit_get_int_bad_argument_type(self):
ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 0, 1.5, False)]
with pytest.raises(e.ParamError):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_to_float(num_bits: int, value: int) -> float:\n if num_bits == 32:\n unpack_fmt = '>f'\n elif num_bits == 64:\n unpack_fmt = '>d'\n else:\n raise Exception(f\"Unhandled bit size: {num_bits}\")\n\n return struct.unpack(unpack_fmt, value.to_bytes(num_bits // 8, 'big'))[0]",
... | [
"0.6282031",
"0.62255764",
"0.61155313",
"0.6099737",
"0.60092103",
"0.59017307",
"0.58963114",
"0.5862443",
"0.5786344",
"0.5757085",
"0.57533264",
"0.57518935",
"0.5673248",
"0.56532824",
"0.56458986",
"0.5634913",
"0.56237686",
"0.5585483",
"0.5575712",
"0.55135816",
"0.54... | 0.4976141 | 95 |
Perform a bitwise get int op with sign true. | def test_bit_get_int_signed(self):
ops = [bitwise_operations.bit_get_int(self.five_255_bin, 0, 8, True)]
_, _, result = self.as_connection.operate(self.test_key, ops)
expected_result = -1
assert result["255"] == expected_result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_get_int(self):\n ops = [bitwise_operations.bit_get_int(self.five_255_bin, 0, 8, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 255\n assert result[\"255\"] == expected_result",
"def _get_bit(self, num, bit, mask=1):\n re... | [
"0.6509758",
"0.63602674",
"0.6266089",
"0.62134486",
"0.6150972",
"0.60837835",
"0.5986445",
"0.5969886",
"0.5921053",
"0.5897795",
"0.5893982",
"0.5842662",
"0.5799386",
"0.57741714",
"0.57586473",
"0.5749016",
"0.5726743",
"0.5701007",
"0.56617063",
"0.56174797",
"0.561278... | 0.7207223 | 0 |
Perform a bitwise lshift op. | def test_bit_lshift(self):
ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 8, 3, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([8] * 1 + [1] * 4)
assert bins[self.test_bin_ones] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_lshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_lshift_op, other)",
"def lshift(self, value):\n return self.clone().lshift_(value)",
"def __lshift__(self, other: Any) -> ColumnOperators:\n return self.operate(lshift, other)",
"def test_lshift():\n... | [
"0.8027732",
"0.7886314",
"0.77431446",
"0.74516565",
"0.74462485",
"0.7268534",
"0.71497965",
"0.70959824",
"0.70602524",
"0.70522314",
"0.7030007",
"0.7023261",
"0.6991336",
"0.6967866",
"0.6954833",
"0.6801171",
"0.6638819",
"0.6623668",
"0.6597141",
"0.65426666",
"0.65120... | 0.7045099 | 10 |
Perform a bitwise lshift op with bit_offset causing the op to cross bytes. | def test_bit_lshift_across_bytes(self):
ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 4, 12, 3, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([8] * 2 + [1] * 3)
assert bins[self.te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_lshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_lshift_op, other)",
"def lshift(self, value):\n return self.clone().lshift_(value)",
"def test_bit_lshift_offset_out_of_range(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 41, 8, 1,... | [
"0.72957206",
"0.72470534",
"0.71489215",
"0.70532566",
"0.6962672",
"0.69317377",
"0.6867541",
"0.67880154",
"0.6757078",
"0.6633713",
"0.66016227",
"0.65892166",
"0.65161103",
"0.64816165",
"0.64787185",
"0.64709115",
"0.6432299",
"0.6428693",
"0.6213718",
"0.6189667",
"0.6... | 0.6941355 | 5 |
Perform a bitwise lshift op with shift > 1 byte. | def test_bit_lshift_wrap(self):
ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 40, 8, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([1] * 4 + [0])
assert bins[self.test_bin_ones]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_lshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_lshift_op, other)",
"def lshift(self, value):\n return self.clone().lshift_(value)",
"def test_bit_lshift(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 8, 3, None)]\n\n se... | [
"0.7710645",
"0.75293803",
"0.72767824",
"0.72446424",
"0.72332287",
"0.7204835",
"0.71994394",
"0.7136731",
"0.71178627",
"0.70673007",
"0.6973365",
"0.6961192",
"0.6899262",
"0.6852815",
"0.68263626",
"0.680614",
"0.67216945",
"0.66920835",
"0.66585714",
"0.6643243",
"0.660... | 0.74472636 | 2 |
Perform a bitwise lshift op with offset > bitmap. | def test_bit_lshift_offset_out_of_range(self):
ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 41, 8, 1, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_lshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_lshift_op, other)",
"def lshift(self, value):\n return self.clone().lshift_(value)",
"def test_bit_lshift_wrap(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 40, 8, None)]\n\n ... | [
"0.69308263",
"0.66388756",
"0.65359557",
"0.6450406",
"0.6376182",
"0.63319093",
"0.6328476",
"0.62932926",
"0.6225093",
"0.61923605",
"0.6165442",
"0.6009935",
"0.59374416",
"0.59149414",
"0.590938",
"0.5865252",
"0.5850488",
"0.5823703",
"0.5793596",
"0.57894117",
"0.56782... | 0.667068 | 1 |
Perform a bitwise lshift op with bit_size > bitmap. | def test_bit_lshift_bit_size_too_large(self):
ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 41, 1, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_lshift_wrap(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 40, 8, None)]\n\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n expected_result = bytearray([1] * 4 + [0])\n assert bins[self.te... | [
"0.6950515",
"0.6931721",
"0.6767711",
"0.67303616",
"0.6553696",
"0.64958674",
"0.6486794",
"0.6405344",
"0.6370063",
"0.6367465",
"0.61931336",
"0.61865187",
"0.6111606",
"0.59819406",
"0.5948448",
"0.5942128",
"0.59374654",
"0.59374654",
"0.5933737",
"0.5898842",
"0.587550... | 0.7226745 | 0 |
Perform a bitwise lshift op with non existent bin. | def test_bit_lshift_bad_bin_name(self):
ops = [bitwise_operations.bit_lshift("bad_name", 0, 8, 1, None)]
with pytest.raises(e.BinNotFound):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_lshift_wrap(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_ones, 0, 40, 8, None)]\n\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n expected_result = bytearray([1] * 4 + [0])\n assert bins[self.te... | [
"0.76249284",
"0.7401031",
"0.73161966",
"0.72296137",
"0.7085757",
"0.7053143",
"0.69851166",
"0.6903455",
"0.69034207",
"0.68963444",
"0.6725142",
"0.6712761",
"0.66804767",
"0.66660064",
"0.6559047",
"0.6530069",
"0.6507873",
"0.6507873",
"0.64425284",
"0.6341766",
"0.6339... | 0.6630271 | 14 |
Perform a bitwise rshift op. | def test_bit_rshift(self):
ops = [bitwise_operations.bit_rshift(self.count_bin, 8, 8, 3, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([1] * 1 + [10] * 1 + [86] * 1 + [255] * 1 + [3] * 1)
ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_rshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_rshift_op, other)",
"def test_rshift():\n value = 42\n num_a = param.Integer(value=value)\n assert num_a.value == value\n\n new_value = operator.rshift(value, 1)\n num_a.value >>= 1\... | [
"0.810491",
"0.7768511",
"0.7738266",
"0.7697016",
"0.75073284",
"0.7475046",
"0.7341795",
"0.7313474",
"0.7258233",
"0.7258233",
"0.7221981",
"0.711292",
"0.7078737",
"0.70613086",
"0.6942691",
"0.68833375",
"0.687751",
"0.6842917",
"0.6815135",
"0.68089026",
"0.67682934",
... | 0.72645825 | 8 |
Perform a bitwise rshift op with bit_offset causing the op to cross bytes. | def test_bit_rshift_across_bytes(self):
ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 4, 16, 3, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([0] + [32] + [33] + [1] * 2)
assert bi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_rshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_rshift_op, other)",
"def test_bit_rshift_offset_out_of_range(self):\n ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 41, 8, 1, None)]\n\n with pytest.raises(e.OpNotApplicable):\n sel... | [
"0.7244314",
"0.7154679",
"0.7113184",
"0.70583224",
"0.70583224",
"0.6990083",
"0.698848",
"0.6960102",
"0.692946",
"0.6912611",
"0.69054914",
"0.67830527",
"0.6759512",
"0.675112",
"0.67480206",
"0.6669106",
"0.66167897",
"0.6611077",
"0.6480847",
"0.6463618",
"0.64371794",... | 0.70983434 | 3 |
Perform a bitwise rshift op with shift > 1 byte. | def test_bit_rshift_wrap(self):
ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 0, 40, 8, None)]
self.as_connection.operate(self.test_key, ops)
_, _, bins = self.as_connection.get(self.test_key)
expected_result = bytearray([0] + [1] * 4)
assert bins[self.test_bin_ones]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_rshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_rshift_op, other)",
"def test_rshift():\n value = 42\n num_a = param.Integer(value=value)\n assert num_a.value == value\n\n new_value = operator.rshift(value, 1)\n num_a.value >>= 1\... | [
"0.7760486",
"0.7638108",
"0.7405463",
"0.73835355",
"0.73835355",
"0.7353638",
"0.73003703",
"0.72271913",
"0.7211861",
"0.72058064",
"0.7191554",
"0.7107763",
"0.7016541",
"0.6985756",
"0.69458497",
"0.6906127",
"0.6903872",
"0.6837047",
"0.6822582",
"0.6795754",
"0.6775661... | 0.7462429 | 2 |
Perform a bitwise rshift op with offset > bitmap. | def test_bit_rshift_offset_out_of_range(self):
ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 41, 8, 1, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_rshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_rshift_op, other)",
"def test_bit_rshift_wrap(self):\n ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 0, 40, 8, None)]\n\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins =... | [
"0.68082476",
"0.6507718",
"0.6502205",
"0.6427334",
"0.6422783",
"0.6422783",
"0.6422021",
"0.64078856",
"0.6404838",
"0.63749677",
"0.62379384",
"0.6169324",
"0.6154082",
"0.61445355",
"0.61361104",
"0.60724884",
"0.6042694",
"0.60101116",
"0.5978205",
"0.59142226",
"0.5843... | 0.6681683 | 1 |
Perform a bitwise rshift op with bit_size > bitmap. | def test_bit_rshift_bit_size_too_large(self):
ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 0, 41, 1, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_rshift_wrap(self):\n ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 0, 40, 8, None)]\n\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n expected_result = bytearray([0] + [1] * 4)\n assert bins[self.te... | [
"0.6985838",
"0.6975781",
"0.6904481",
"0.6876606",
"0.6723617",
"0.6723617",
"0.64922476",
"0.6429139",
"0.6359374",
"0.63542265",
"0.6311663",
"0.62846226",
"0.6275696",
"0.6140997",
"0.6140134",
"0.60402584",
"0.60362566",
"0.60202444",
"0.5996184",
"0.5978953",
"0.5953361... | 0.73658377 | 0 |
Perform a bitwise rshift op with non existent bin. | def test_bit_rshift_bad_bin_name(self):
ops = [bitwise_operations.bit_rshift("bad_name", 0, 8, 1, None)]
with pytest.raises(e.BinNotFound):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_rshift_wrap(self):\n ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 0, 40, 8, None)]\n\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n expected_result = bytearray([0] + [1] * 4)\n assert bins[self.te... | [
"0.77459735",
"0.75241",
"0.74613017",
"0.74604154",
"0.71995145",
"0.71995145",
"0.71397847",
"0.70742303",
"0.70375466",
"0.6978173",
"0.6948442",
"0.6911191",
"0.67862636",
"0.67795265",
"0.6759934",
"0.6620327",
"0.6605335",
"0.65548635",
"0.65455306",
"0.653168",
"0.6469... | 0.6898766 | 12 |
Perform a bitwise rshift op with a float for bit_offset. | def test_bit_rshift_bad_arg(self):
ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 1.5, 8, 1, None)]
with pytest.raises(e.ParamError):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rshift():\n value = 42\n num_a = param.Integer(value=value)\n assert num_a.value == value\n\n new_value = operator.rshift(value, 1)\n num_a.value >>= 1\n assert num_a.value == new_value",
"def rshift(val, n):\n return (val % 0x100000000) >> n",
"def rshift(... | [
"0.64491475",
"0.6418916",
"0.6418916",
"0.6334104",
"0.6238364",
"0.613158",
"0.60414225",
"0.59965366",
"0.5973791",
"0.5960168",
"0.58904314",
"0.5882007",
"0.5775575",
"0.5775489",
"0.57745934",
"0.571472",
"0.5707195",
"0.5705338",
"0.5673862",
"0.5666417",
"0.5567847",
... | 0.54344374 | 24 |
Perform a bitwise subtract op on a nonexistent bin. | def test_bit_subtract_bad_bin_name(self):
ops = [bitwise_operations.bit_subtract("bad_name", 8, 16, 257, False, aerospike.BIT_OVERFLOW_FAIL, None)]
with pytest.raises(e.BinNotFound):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_subtract_overflow_fail(self):\n ops = [bitwise_operations.bit_subtract(self.test_bin_ones, 0, 8, 255, False, aerospike.BIT_OVERFLOW_FAIL, None)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)",
"def test_bit_subtract_simple(self):... | [
"0.6932047",
"0.68951654",
"0.68864524",
"0.68545467",
"0.68055755",
"0.668892",
"0.6510099",
"0.64084166",
"0.628363",
"0.62496334",
"0.6238307",
"0.6140046",
"0.6119843",
"0.6021742",
"0.5957144",
"0.5939512",
"0.5780383",
"0.5756103",
"0.56450284",
"0.56420887",
"0.5607923... | 0.78149927 | 0 |
Perform a bitwise subtract op that overflows with the BIT_OVERFLOW_FAIL action. | def test_bit_subtract_overflow_fail(self):
ops = [bitwise_operations.bit_subtract(self.test_bin_ones, 0, 8, 255, False, aerospike.BIT_OVERFLOW_FAIL, None)]
with pytest.raises(e.OpNotApplicable):
self.as_connection.operate(self.test_key, ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_subtract_bit_offset_out_of_range(self):\n ops = [\n bitwise_operations.bit_subtract(self.test_bin_zeroes, 41, 1, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)\n ]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)",
"... | [
"0.7370349",
"0.7360217",
"0.67168427",
"0.66955477",
"0.6690933",
"0.6342002",
"0.63284343",
"0.62131953",
"0.6136948",
"0.6106323",
"0.60354006",
"0.595727",
"0.590616",
"0.58953905",
"0.58631927",
"0.58592397",
"0.58166087",
"0.5726038",
"0.5701894",
"0.56896704",
"0.56878... | 0.819887 | 0 |
Attempts to find a candidate layer to use for CAM extraction | def locate_candidate_layer(mod: nn.Module, input_shape: Tuple[int, ...] = (3, 224, 224)) -> Optional[str]:
# Set module in eval mode
module_mode = mod.training
mod.eval()
output_shapes: List[Tuple[Optional[str], Tuple[int, ...]]] = []
def _record_output_shape(module: nn.Module, input: Tensor, outp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_CA_layer(arch, target_layer_name):\n\n hierarchy = target_layer_name.rsplit(\"_\",1)\n \n\n if target_layer_name == \"layer1\":\n return arch.layer1\n elif target_layer_name == \"layer2\":\n return arch.layer2\n elif target_layer_name == \"layer3\":\n return arch.layer3... | [
"0.62724084",
"0.6052908",
"0.5938766",
"0.5923088",
"0.58682144",
"0.5823416",
"0.5793721",
"0.5652858",
"0.56480765",
"0.5600004",
"0.55514055",
"0.55042034",
"0.5492678",
"0.54090405",
"0.53978735",
"0.53533643",
"0.53379434",
"0.5288922",
"0.52618504",
"0.5260588",
"0.524... | 0.6229697 | 1 |
Property for the event type based on the code | def event_type(self) -> str:
try:
return _EVENT_TYPE_MAPPINGS.get(self.transaction_event_code[0:3])
except:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type(self):\n return self.event_type",
"def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]",
"def getTypeCode(self):\n return _libsbml.Event_getTypeCode(self)",
"def eventType(self, code):\n for idx in self.pj[ETHOGRAM]:\n if self.pj[ETHOGR... | [
"0.7975509",
"0.79043937",
"0.78299266",
"0.7595855",
"0.7507185",
"0.7507185",
"0.73829275",
"0.7172342",
"0.7009818",
"0.6883189",
"0.6868885",
"0.6839677",
"0.6837829",
"0.66198236",
"0.6600466",
"0.6572228",
"0.6427415",
"0.6401485",
"0.6225099",
"0.6215366",
"0.6162485",... | 0.7815724 | 3 |
Property for the enumeration of this transaction () | def transaction_status_enum(self) -> TransactionStatus:
return _TRANSACTION_STATUS_MAPPING.get(self.transaction_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum(self):\r\n raise NotImplementedError",
"def enumeration(self):\n raise exceptions.NotImplementedError()",
"def __index__(cls): # pylint: disable=invalid-index-returned\n return TransType(60)",
"def attr(self):\n\n return EnumAttr(self)",
"def natural_key(self):\n\t\tse... | [
"0.71118397",
"0.6270592",
"0.62465674",
"0.6158069",
"0.59486014",
"0.58366627",
"0.58330446",
"0.58252573",
"0.5776557",
"0.5740692",
"0.57314277",
"0.5705731",
"0.5659605",
"0.565769",
"0.5623061",
"0.56176597",
"0.56176597",
"0.561505",
"0.561505",
"0.5612701",
"0.5606627... | 0.6593331 | 1 |
Property for the enumeration of this transaction () | def paypal_reference_id_type_enum(self) -> ReferenceIdType:
return _REFERENCE_ID_MAPPINGS.get(self.paypal_reference_id_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum(self):\r\n raise NotImplementedError",
"def transaction_status_enum(self) -> TransactionStatus:\n return _TRANSACTION_STATUS_MAPPING.get(self.transaction_status)",
"def enumeration(self):\n raise exceptions.NotImplementedError()",
"def __index__(cls): # pylint: disable=invalid-... | [
"0.71118397",
"0.6593331",
"0.6270592",
"0.62465674",
"0.6158069",
"0.59486014",
"0.58366627",
"0.58330446",
"0.58252573",
"0.5776557",
"0.5740692",
"0.57314277",
"0.5705731",
"0.5659605",
"0.565769",
"0.5623061",
"0.56176597",
"0.56176597",
"0.561505",
"0.561505",
"0.5612701... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.