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 |
|---|---|---|---|---|---|---|
Convert class labels from scalars to onehot vectors. | def dense_to_one_hot(labels_dense, num_classes=10):
num_labels = labels_dense.shape[0]
index_offset = numpy.arange(num_labels) * num_classes
labels_one_hot = numpy.zeros((num_labels, num_classes))
labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
return labels_one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.8250402",
"0.807683",
"0.80523187",
"0.7977843",
"0.7908335",
"0.7900327",
"0.7892233",
"0.7869711",
"0.7849721",
"0.7849721",
"0.7826951",
"0.7826122",
"0.77677035",
"0.7765413",
"0.77540547",
"0.77540547",
"0.77540547",
"0.77489346",
"0.7742955",
"0.7737176",
"0.77226317... | 0.76462805 | 33 |
Returns the highest magnification for the slide | def highest_mag(slide):
return int(slide.properties['aperio.AppMag']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mag(self):\n return self.photosamplers.get_estimate(mag=True)[0]",
"def get_mag_for_size(slide, size):\n max_size = slide.dimensions\n max_mag = highest_mag(slide)\n downsample = np.average([max_dim/size_dim for max_dim, size_dim in zip(max_size, size)])\n return max_mag/downsample",
"de... | [
"0.7143382",
"0.6984062",
"0.6947595",
"0.6700194",
"0.6502702",
"0.6465279",
"0.6439392",
"0.6389368",
"0.62770873",
"0.62758964",
"0.6203424",
"0.6182897",
"0.6060569",
"0.6010728",
"0.6000861",
"0.59334785",
"0.5931892",
"0.59017086",
"0.5889821",
"0.58670044",
"0.584315",... | 0.8554771 | 0 |
fetcher.get_models() should return a list of models. | def test_get_models_returns_models(fc: fetcher.Fetcher):
ml = fc.get_models()
assert isinstance(ml, list)
assert isinstance(ml[0], models.LookmlModel) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit', None)\n search_opts.pop('offset', None)\n sort_key = ... | [
"0.7452906",
"0.72231185",
"0.7150281",
"0.71438277",
"0.70214987",
"0.69560665",
"0.69169444",
"0.6905092",
"0.68741965",
"0.6871369",
"0.6853938",
"0.6839921",
"0.67970765",
"0.67815137",
"0.6671083",
"0.66492426",
"0.6614827",
"0.65691483",
"0.6551473",
"0.64561534",
"0.64... | 0.769774 | 0 |
fetcher.get_models() should throw if a model is not found. | def test_get_models_throws_if_model_does_not_exist(fc: fetcher.Fetcher, project, model):
with pytest.raises(exceptions.NotFoundError) as exc:
fc.get_models(project=project, model=model)
assert "An error occured while getting models." in str(exc.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_models_returns_models(fc: fetcher.Fetcher):\n ml = fc.get_models()\n assert isinstance(ml, list)\n assert isinstance(ml[0], models.LookmlModel)",
"def get_models(self, app_name):\n try:\n models = list(apps.get_app_config(app_name).get_models())\n return models\... | [
"0.7327567",
"0.69435924",
"0.67743224",
"0.67731684",
"0.666128",
"0.66390353",
"0.6595562",
"0.6590047",
"0.64084816",
"0.6316313",
"0.6267025",
"0.62651926",
"0.626041",
"0.6233475",
"0.6200443",
"0.61957514",
"0.61935633",
"0.61921066",
"0.61672646",
"0.61589247",
"0.6154... | 0.75194955 | 0 |
fetcher.get_models() should throw if a model is not found. | def test_get_models_throws_if_project_does_not_exist(
fc: fetcher.Fetcher, project, model
):
with pytest.raises(exceptions.NotFoundError) as exc:
fc.get_models(project=project, model=model)
assert "An error occured while getting projects." in str(exc.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_models_throws_if_model_does_not_exist(fc: fetcher.Fetcher, project, model):\n with pytest.raises(exceptions.NotFoundError) as exc:\n fc.get_models(project=project, model=model)\n assert \"An error occured while getting models.\" in str(exc.value)",
"def test_get_models_returns_models(fc... | [
"0.75194955",
"0.7327567",
"0.69435924",
"0.67743224",
"0.67731684",
"0.66390353",
"0.6595562",
"0.6590047",
"0.64084816",
"0.6316313",
"0.6267025",
"0.62651926",
"0.626041",
"0.6233475",
"0.6200443",
"0.61957514",
"0.61935633",
"0.61921066",
"0.61672646",
"0.61589247",
"0.61... | 0.666128 | 5 |
fetcher.get_used_models() should return models that have queries against them. | def test_get_used_models(fc: fetcher.Fetcher, test_model):
used_models = fc.get_used_models()
assert isinstance(used_models, dict)
assert len(used_models) > 0
assert all(type(model_name) == str for model_name in used_models.keys())
assert all(type(query_count) == int for query_count in used_models.v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def availablemodels(self):\n return self.__models.keys()",
"def _get_models(self, req, is_detail):\n context = req.environ['meteos.context']\n\n search_opts = {}\n search_opts.update(req.GET)\n\n # Remove keys that are not related to model attrs\n search_opts.pop('limit'... | [
"0.70178705",
"0.66382486",
"0.6534866",
"0.631813",
"0.63044095",
"0.6285215",
"0.61792207",
"0.6041896",
"0.60361505",
"0.6007675",
"0.592958",
"0.5920479",
"0.58479476",
"0.5833444",
"0.58288264",
"0.5817674",
"0.58034897",
"0.58034897",
"0.58034897",
"0.58034897",
"0.5747... | 0.7987806 | 0 |
Compute Haversine distance between points. LatLongDistance(p1, p2) returns distance in meters between points p1 and p2. A point p is a list/array p=[longitude, latitude] | def latlong_distance(p1, p2):
radius = 6371 # km
lat1 = p1[1] * math.pi / 180.0
lat2 = p2[1] * math.pi / 180.0
lon1 = p1[0] * math.pi / 180.0
lon2 = p2[0] * math.pi / 180.0
deltaLat = lat2 - lat1
deltaLon = lon2 - lon1
a = (math.sin(deltaLat / 2)**2
+ math.cos(lat1) * math.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def haversine(point_1, \n point_2):\n # Specify the radius of the Earth in kilometers\n earth_radius = 6372.8\n # Extract latitudes and longitudes from the provided points\n latitude_1 = point_1[0]\n latitude_2 = point_2[0]\n longitude_1 = point_1[1]\n longitude_2 = point_2[1]\n ... | [
"0.7411768",
"0.7283244",
"0.7281911",
"0.7275467",
"0.7160516",
"0.7140681",
"0.71359766",
"0.706824",
"0.7068029",
"0.7050806",
"0.70261496",
"0.70184296",
"0.69995123",
"0.6997063",
"0.69919103",
"0.6987301",
"0.69823533",
"0.69742984",
"0.6964179",
"0.6947977",
"0.6935867... | 0.71147573 | 7 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(render_template('index.html', auth=False), 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.76140213 | 41 |
Check if user is admin | def require_admin(func):
@wraps(func)
def decorator(*args, **kwargs):
if not g.user:
# flash('此操作需要登录账户')
return redirect(url_for('admin.login'))
if g.user.name != 'admin':
abort(403)
return func(*args, **kwargs)
return decorator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_admin(user):\n return user in admins",
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def is_admin(self, user):\n return user.name in self.admins",
"def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_ad... | [
"0.8688236",
"0.8687356",
"0.8556875",
"0.8554287",
"0.85044616",
"0.84716874",
"0.8450938",
"0.841185",
"0.84050906",
"0.8394017",
"0.8363089",
"0.83423585",
"0.83161926",
"0.8280715",
"0.82797027",
"0.82743096",
"0.82743096",
"0.8248748",
"0.82192075",
"0.8196186",
"0.81672... | 0.0 | -1 |
r""" Return the number of variables used in this matrix. | def num_vars(self):
return self._nvars | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_variables(self):\n return len(self.variables)",
"def num_vars(self):\n return self.nvars",
"def nvar(self):\n return len(self.__vars)",
"def GetNumberOfVariables(self):\n\n # nvar = 0\n # for i in self.variables_order:\n # # DO NOT COUNT VARIABLES THAT GE... | [
"0.826646",
"0.80817354",
"0.79613394",
"0.7953327",
"0.79433763",
"0.7778536",
"0.7749949",
"0.75871086",
"0.74991745",
"0.74765337",
"0.74339026",
"0.72988725",
"0.71537995",
"0.71156085",
"0.7080469",
"0.69808406",
"0.691234",
"0.67460585",
"0.6729376",
"0.6723816",
"0.671... | 0.8000086 | 2 |
r""" Return the list of entries of this matrix. | def list(self):
return [self[i,j] for i in range(self._d) for j in range(self._d)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_list(self):\n data = []\n for row in self._matrix_data:\n for column in row:\n data.append(column)\n return data",
"def rows(self):\n return list(self)",
"def as_list_of_lists(self):\n return self._matrix_data",
"def readentries(self):\n ... | [
"0.74211484",
"0.7351907",
"0.7139602",
"0.7107239",
"0.7102002",
"0.7040875",
"0.700234",
"0.700234",
"0.69514894",
"0.6915959",
"0.6805772",
"0.68021935",
"0.67886513",
"0.6775163",
"0.6770315",
"0.6736421",
"0.67067957",
"0.66475236",
"0.6628927",
"0.66164464",
"0.65946597... | 0.69504046 | 9 |
r""" Return the list of equal coefficients between self and other. | def equal_coefficients(self, other):
d = self._d
return [(i,j) for i in range(d) for j in range(d) \
if self[i][j] == other[i][j]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __xor__(self, other):\n\n sym_diff = [value for value in self if value not in other]\n sym_diff.extend([value for value in other if value not in self])\n\n return sym_diff",
"def GetEqualConstrains(self):\n return _gmat_py.Spacecraft_GetEqualConstrains(self)",
"def coefficients(... | [
"0.66310555",
"0.6198817",
"0.61889756",
"0.5865301",
"0.5818835",
"0.5683608",
"0.5683608",
"0.56740135",
"0.5648324",
"0.56273437",
"0.56273437",
"0.5593266",
"0.55242145",
"0.5514569",
"0.546532",
"0.5455155",
"0.5414487",
"0.5409538",
"0.5363544",
"0.53480685",
"0.5334692... | 0.78071773 | 0 |
Used to get a users full name | def get_full_name(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name(self):\n full_name = '%s %s' % (self.user.first_name.strip(), self.user.last_name.strip())\n if len(full_name.strip()) == 0:\n full_name = self.user.username\n return full_name.strip()",
"def get_full_name(self):\n full_name = f'{self.first_name} {self.las... | [
"0.8447406",
"0.84173375",
"0.840863",
"0.840863",
"0.8322008",
"0.83157456",
"0.8233342",
"0.8191648",
"0.81704843",
"0.80976194",
"0.8085201",
"0.8049897",
"0.80166596",
"0.8014928",
"0.8014928",
"0.80035484",
"0.7998611",
"0.79971266",
"0.79911834",
"0.79884243",
"0.798031... | 0.0 | -1 |
Used to get the users short name | def get_short_name(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n # The user is identified by their email address\n return self.first_name",
"def get_shor... | [
"0.8692162",
"0.8692162",
"0.8692162",
"0.8419169",
"0.835935",
"0.8267483",
"0.8214984",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0.8179056",
"0... | 0.73236275 | 60 |
Reset the obstacles' positions within the map (should be called when map is refreshed to clean the array) | def reset_obstacles(self):
self.obstacles = np.array([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.obstacles = []\n self._tick = 0",
"def recreate_obstacles(self):\n self.board_matrix = np.full(Dimension.board_size(), 1)\n self.obstacles = self.create_obstacles()",
"def reset(self) -> None:\n self.map = []\n for col in range(self.width):\n ... | [
"0.80095875",
"0.7382117",
"0.72062683",
"0.7101044",
"0.7061013",
"0.70536333",
"0.7010583",
"0.6989404",
"0.69813454",
"0.69743735",
"0.6880206",
"0.68602246",
"0.6838129",
"0.6808036",
"0.67923963",
"0.6767282",
"0.67519385",
"0.67181975",
"0.67109746",
"0.6702349",
"0.669... | 0.84130687 | 0 |
Construct a filename from varying experimental parameters. | def construct_filename(output_dir,
file_descriptor,
extension,
*args,
**kwargs):
if len(args) == 0 and len(kwargs) == 0:
return Path(output_dir,
'{}{}'.format(file_descriptor, extension))
elif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_filename(self):\n expansion_string = '_'.join(sorted(args.exp)) if args.exp else 'noexp'\n return 'quad--{}--{}{}{}_{}{}_{}{}_{}{}{}{}{}_{}{}--{:02}_{:02}--{:02}_{:02}_{:02}_{:02}_{:02}_{:02}_{:02}_{:02}_{:02}--{}.log'.format(self.pts_total, hex(self.cnt_T)[-1:], self.cnt_S, self.cnt_U, self.... | [
"0.7097925",
"0.66764444",
"0.6525119",
"0.64324546",
"0.62918216",
"0.6271143",
"0.62647027",
"0.6250804",
"0.6229975",
"0.6168056",
"0.6167285",
"0.61520386",
"0.6138422",
"0.6122441",
"0.61129963",
"0.6110849",
"0.6091121",
"0.60664004",
"0.6061048",
"0.60583425",
"0.59809... | 0.59908104 | 20 |
Return current credit limit | def get_limit(self):
return self._limit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plan_limit(self, source):\n commitment = getattr(self.get_subscription(), 'commitment', {})\n return self.get_plan().get_price_data(source, commitment)[1]",
"def get_limit(self):\n return self.limit",
"def charge_limit(self, limit=None):\n if limit is None:\n done... | [
"0.70615613",
"0.6857322",
"0.68410796",
"0.6831366",
"0.6759597",
"0.661983",
"0.6546747",
"0.63908046",
"0.63815755",
"0.6301675",
"0.6296434",
"0.6276246",
"0.626394",
"0.6231881",
"0.62091506",
"0.62080514",
"0.6149896",
"0.6149896",
"0.6126138",
"0.61131227",
"0.6094338"... | 0.6619479 | 7 |
Charge given price to the card, assuming sufficient card limit Return True if charge was processed;False if charge was denied | def charge(self,price):
if price + self._balance> self._limit:
return False
else:
self._balance+=price
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charge(self, price):\n if not isinstance(price, (int, float)):\n raise TypeError('Price must be numeric')\n if price + self._balance > self._limit: # if charge would exceed limit\n return False # cannot accept charge\n self._balance += price\n... | [
"0.8322736",
"0.8296711",
"0.7829243",
"0.6570418",
"0.6408199",
"0.612218",
"0.61032504",
"0.60590565",
"0.6037275",
"0.60188115",
"0.5950383",
"0.59281176",
"0.59213865",
"0.5874455",
"0.58660394",
"0.5860026",
"0.5825693",
"0.5783239",
"0.57501924",
"0.5738126",
"0.5724947... | 0.8432956 | 0 |
get the list of agents managed by this starter | def get_agents(self):
ret = []
for i in self.all_instances:
if i.instance_type == InstanceType.AGENT:
ret.append(i)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manager_agents(self):\n return self.get(\"manager_agents\")",
"def get_agents(self):\n if self.retrieved:\n raise errors.IllegalState('List has already been retrieved.')\n self.retrieved = True\n return objects.AgentList(self._results, runtime=self._runtime)",
"def li... | [
"0.77033234",
"0.7416487",
"0.7300729",
"0.7252941",
"0.72281355",
"0.7117161",
"0.70339304",
"0.6690089",
"0.666582",
"0.66602963",
"0.6639476",
"0.6470405",
"0.6329325",
"0.62738615",
"0.6230014",
"0.61977404",
"0.61977404",
"0.61977404",
"0.61977404",
"0.6167947",
"0.61341... | 0.76709455 | 1 |
return jwt header from current installation | def get_jwt_header(self):
if self.jwt_header:
return self.jwt_header
self.jwt_header = self.get_jwt_token_from_secret_file(str(self.jwtfile))
return self.jwt_header | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authentication_header():\n with open(KEY_FILE, \"r\") as file:\n header = json.load(file)\n return header",
"def get_authorization_header(self):\n return {\"Authorization\": \"Bearer {}\".format(self.get_jwt())}",
"def get_jwt(self, request):\n auth_header_prefix = self.auth_head... | [
"0.7406444",
"0.7215993",
"0.7196089",
"0.7186894",
"0.7012713",
"0.6979103",
"0.6942568",
"0.69397306",
"0.69034165",
"0.6893624",
"0.6858153",
"0.68385124",
"0.6749719",
"0.6743572",
"0.6729134",
"0.6724721",
"0.6700563",
"0.6690566",
"0.6663717",
"0.66617864",
"0.663666",
... | 0.8041909 | 0 |
Returns the total number of available frames. | def __len__(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_frames(self) -> int:\n return self.num_frames",
"def size(self):\n if self.frames is None:\n return 0\n return self.frames.size",
"def frames(self):\n frame_count = 0\n if self.is_video() or self.is_audio():\n if self.__dict__['nb_frames']:... | [
"0.8600426",
"0.77835464",
"0.7621566",
"0.75558245",
"0.7531837",
"0.7526261",
"0.7391324",
"0.7189588",
"0.71559983",
"0.70775414",
"0.70692587",
"0.7036695",
"0.7004031",
"0.69709444",
"0.6951622",
"0.688492",
"0.68131065",
"0.6812733",
"0.6789151",
"0.66947013",
"0.664887... | 0.0 | -1 |
Returns the total number of available frames. | def __len__(self):
return len(self.keys) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_frames(self) -> int:\n return self.num_frames",
"def size(self):\n if self.frames is None:\n return 0\n return self.frames.size",
"def frames(self):\n frame_count = 0\n if self.is_video() or self.is_audio():\n if self.__dict__['nb_frames']:... | [
"0.8600426",
"0.77835464",
"0.7621566",
"0.75558245",
"0.7531837",
"0.7526261",
"0.7391324",
"0.7189588",
"0.71559983",
"0.70775414",
"0.70692587",
"0.7036695",
"0.7004031",
"0.69709444",
"0.6951622",
"0.688492",
"0.68131065",
"0.6812733",
"0.6789151",
"0.66947013",
"0.664887... | 0.0 | -1 |
Playing with spatial convs after transpose convolutions. Recent testing suggests this is the best setup so far. Revisit idea of interleaving spatial convolutions between transpose layers to achieve more cleanly defined shapes. | def decoder_setup_1():
decoder = RetinaDecoder(
# pre-pooling
{'op': 'avg', 'kernel': (1, 2, 2), 'causal': True},
# grouped temporal conv stacks:
[
{
'in': 15, 'out': [45, 45, 15], 'kernel': (2, 1, 1),
'stride': 1, 'groups': 15, 'acivation'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_transposed_conv2d_model(self):\n tf.compat.v1.reset_default_graph()\n\n _ = transposed_conv2d_model()\n\n conn_graph = ConnectedGraph(tf.compat.v1.get_default_graph(), ['input_1'], ['conv2d_transpose/BiasAdd'])\n self.assertEqual(conn_graph.get_all_ops()['conv2d_transpose/conv2... | [
"0.6420241",
"0.63742214",
"0.630493",
"0.62457377",
"0.6166526",
"0.61490655",
"0.60816073",
"0.6013133",
"0.59594655",
"0.59204423",
"0.5848845",
"0.5842317",
"0.58345294",
"0.5829648",
"0.58118945",
"0.5805117",
"0.57954824",
"0.5793485",
"0.5791456",
"0.57831615",
"0.5781... | 0.0 | -1 |
Create a onehot encoding of x of size k. | def one_hot(x, k, dtype=np.float32):
return np.array(x[:, None] == np.arange(k), dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_hot(z, K):\n z_one_hot = np.zeros((z.size, K))\n z_one_hot[np.arange(z.size), z] = 1\n return z_one_hot",
"def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)",
"def _one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype... | [
"0.804429",
"0.801011",
"0.78977334",
"0.7889785",
"0.7800311",
"0.7714966",
"0.75706875",
"0.75658363",
"0.7427502",
"0.7418045",
"0.73576915",
"0.735553",
"0.7347711",
"0.7343637",
"0.7291789",
"0.7286171",
"0.7206042",
"0.72045",
"0.7190287",
"0.7164403",
"0.71621656",
"... | 0.7974455 | 2 |
Returns a Bokeh glyph object. | def _init_glyph(self, plot, mapping, properties):
level = properties.pop('level', 'underlay')
renderer = plot.add_tile(mapping['tile_source'], level=level)
renderer.alpha = properties.get('alpha', 1)
return renderer, renderer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createReferenceGlyph(self):\n return _libsbml.GeneralGlyph_createReferenceGlyph(self)",
"def createTextGlyph(self):\n return _libsbml.Layout_createTextGlyph(self)",
"def _init_glyph(self, plot, mapping, properties):\n properties.pop('source')\n properties.pop('legend')\n ... | [
"0.64251554",
"0.6417896",
"0.6385368",
"0.61207485",
"0.6027903",
"0.5853716",
"0.5838887",
"0.580616",
"0.5715113",
"0.5697527",
"0.5558109",
"0.55418766",
"0.5470425",
"0.54696107",
"0.5457854",
"0.5454618",
"0.5413018",
"0.5380582",
"0.5379364",
"0.5375702",
"0.5330651",
... | 0.5845592 | 6 |
Percolates up the item if the first element in the item is smaller than the first element in the parent. | def __sift_up(self, i: int):
while i > 0:
parent = (i - 1) // 2
if self.__heap[i][0] < self.__heap[parent][0]:
tmp = self.__heap[parent]
self.__heap[parent] = self.__heap[i]
self.__heap[i] = tmp
i = parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percolate_up(self, index):\n if self.min is True:\n parent = self._parent(index)\n if index > 0 and self._data[index] < self._data[parent]:\n self._swap(index, parent)\n self.percolate_up(parent)\n if self.min is False:\n parent = sel... | [
"0.73008174",
"0.6977387",
"0.69455796",
"0.6931688",
"0.6897218",
"0.68804336",
"0.6834447",
"0.6793737",
"0.67846876",
"0.67604595",
"0.672829",
"0.6725234",
"0.6719083",
"0.66191155",
"0.65959144",
"0.6558018",
"0.65543073",
"0.6469654",
"0.64037776",
"0.63678527",
"0.6363... | 0.69485795 | 2 |
Returns false if the user is not logged in | def is_anonymous(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in(self):\n return self.auth.get_user_by_session() is not None",
"def isLoggedIn(self):\n session = self.getSession()\n if session is not None:\n return True\n return False",
"def is_logged_in(self) -> bool:\n return self.id is not None and self.username is ... | [
"0.85514784",
"0.8487751",
"0.8463887",
"0.84311163",
"0.83854413",
"0.83422846",
"0.8227351",
"0.81986076",
"0.8189232",
"0.81029665",
"0.80995315",
"0.8037724",
"0.79774845",
"0.7907793",
"0.78765494",
"0.7856657",
"0.7833945",
"0.7820103",
"0.7789442",
"0.77781737",
"0.771... | 0.0 | -1 |
Returns true if the user is logged in | def is_authenticated(self):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in():\n\n if current_user.is_authenticated:\n return True\n\n return False",
"def is_logged_in():\n return 'user' in session",
"def logged_in(self):\n return self.auth.get_user_by_session() is not None",
"def isLoggedIn(self):\n session = self.getSession()\n if ses... | [
"0.88950294",
"0.8790608",
"0.8753903",
"0.8581064",
"0.8567044",
"0.84687513",
"0.84203804",
"0.8413966",
"0.8383255",
"0.8209496",
"0.82089865",
"0.8092678",
"0.80382335",
"0.8021618",
"0.79841244",
"0.7928396",
"0.7890733",
"0.78188694",
"0.77794355",
"0.7776155",
"0.77729... | 0.7648227 | 30 |
Returns true if the logged in user is an admin | def is_admin(self):
if self.type == 1:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_admin == 'YES':\n return True\n return False",
"def isAdmin():\n\tif 'username' in session and session['usernam... | [
"0.88923126",
"0.8880638",
"0.8843605",
"0.87530965",
"0.87412965",
"0.86163646",
"0.8612412",
"0.85848016",
"0.84613305",
"0.8420776",
"0.84073126",
"0.840208",
"0.8374834",
"0.83690375",
"0.835545",
"0.8350487",
"0.8346385",
"0.8346304",
"0.83000356",
"0.8297389",
"0.828466... | 0.7866901 | 36 |
Returns true if the current user is following the desired user | def is_following(self, user):
return self.followed.filter(followers.c.followed_id == user.id).count() > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_user_following(self, user_id):\n return user_id in self.following",
"def is_following(self, you, them):\n if self.filter(from_user=you, to_user=them).count() > 0:\n return True\n return False",
"def is_following(self, user):\n return self.followed.filter_by(\n ... | [
"0.7629527",
"0.7531042",
"0.7460013",
"0.73141354",
"0.72661006",
"0.70735085",
"0.70591176",
"0.7049096",
"0.6914572",
"0.69122463",
"0.68232995",
"0.6788982",
"0.67763567",
"0.6769098",
"0.6714947",
"0.65794",
"0.6538119",
"0.652213",
"0.6521558",
"0.64769983",
"0.64418167... | 0.7424364 | 4 |
Returns true if the current user is following the desired user | def is_following_by_username(self, id):
return self.followed.filter(followers.c.followed_id == id).count() > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_user_following(self, user_id):\n return user_id in self.following",
"def is_following(self, you, them):\n if self.filter(from_user=you, to_user=them).count() > 0:\n return True\n return False",
"def is_following(self, user):\n return self.followed.filter_by(\n ... | [
"0.7629707",
"0.75313014",
"0.74600714",
"0.7424218",
"0.7424218",
"0.73141986",
"0.7265916",
"0.7074228",
"0.7049804",
"0.6913712",
"0.6912288",
"0.682332",
"0.6789204",
"0.6776134",
"0.67695856",
"0.67149085",
"0.65792125",
"0.6536938",
"0.6522163",
"0.6520679",
"0.6476891"... | 0.70594585 | 8 |
Gets the list of banks. | def get_banks() -> List[BankDetails]:
from paynlsdk.api.transaction.getbanks import Request
client = APIClient()
request = Request()
client.perform_request(request)
return request.response.banks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def banks(self):\n return self.__banks",
"def banks(self):\n return self.__banks",
"def banks(self):\n return self.__banks",
"def banks(self):\n return self.__banks",
"def banks(self):\n return self.__banks",
"def banks(self):\n return self.__banks",
"def banks... | [
"0.83688354",
"0.83688354",
"0.83688354",
"0.83688354",
"0.83688354",
"0.83688354",
"0.83688354",
"0.76620173",
"0.664025",
"0.664025",
"0.664025",
"0.664025",
"0.664025",
"0.664025",
"0.664025",
"0.6498705",
"0.6401011",
"0.63876766",
"0.6261225",
"0.6159119",
"0.6064427",
... | 0.7611785 | 8 |
admin should be passed through for nonadmin users | async def test_auth_admin_non_admin(app):
name = 'kiwi'
user = add_user(app.db, app, name=name, admin=False)
assert user.admin is False
cookies = await app.login_user(name)
assert user.admin is False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_admin():\n\tif not current_user.is_admin:\n\t\tabort(403)",
"def check_admin():\r\n if not current_user.is_admin:\r\n abort(403)",
"def check_admin():\n if not current_user.is_admin:\n abort(403)",
"def check_admin():\n if not current_user.is_admin:\n abort(403)",
"d... | [
"0.76604193",
"0.76227117",
"0.7580729",
"0.7580729",
"0.74723893",
"0.7399326",
"0.73662555",
"0.72489077",
"0.7212591",
"0.71992993",
"0.7144615",
"0.7074819",
"0.7029829",
"0.7020532",
"0.70080376",
"0.7003052",
"0.7002116",
"0.6998605",
"0.69832844",
"0.6980152",
"0.69801... | 0.0 | -1 |
Tests whether ``SoundboardSound.__eq__`` works as intended. | def test__SoundboardSound__eq():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240038
volume = 0.69
sound_id = 202305240039
guild_id = 202305240040
keyword_parameters = {
'available': available,
'emoji': emoji,
'name':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, NhlOddsScoringPlay):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n if not isinstance(other, DiarizeAudio):\n return False\n\n return self.__dict__ == other.__dict__",
... | [
"0.7053136",
"0.69082266",
"0.68528724",
"0.6663054",
"0.6607504",
"0.65843195",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
... | 0.7741757 | 0 |
Getter method for usr_traceroute_count, mapped from YANG variable /mpls_state/statistics_oam/usr_traceroute_count (uint32) | def _get_usr_traceroute_count(self):
return self.__usr_traceroute_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_usr_traceroute_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"usr-traceroute-count\", rest_name=\"usr-trac... | [
"0.8096988",
"0.58348656",
"0.5540107",
"0.5337788",
"0.5088764",
"0.50769204",
"0.5072222",
"0.50714403",
"0.5059296",
"0.50581366",
"0.50281113",
"0.49717057",
"0.4894099",
"0.48607355",
"0.48384598",
"0.48260984",
"0.48260832",
"0.48071045",
"0.47291836",
"0.47040775",
"0.... | 0.7333012 | 1 |
Getter method for echo_req_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_sent_count (uint32) | def _get_echo_req_sent_count(self):
return self.__echo_req_sent_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-sent-count\", rest_name=\"echo-req-s... | [
"0.7922508",
"0.6860566",
"0.67645717",
"0.65473276",
"0.64664423",
"0.5968414",
"0.5861087",
"0.5787943",
"0.5689521",
"0.56807286",
"0.5430021",
"0.54220355",
"0.5201689",
"0.5130782",
"0.49798772",
"0.4948916",
"0.48980132",
"0.48834348",
"0.4872083",
"0.48253825",
"0.4824... | 0.7223332 | 1 |
Setter method for echo_req_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_sent_count (uint32) | def _set_echo_req_sent_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-sent-count", rest_name="echo-req-sent-count", pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-sent-count\", rest_name=\"echo-res... | [
"0.7546443",
"0.74266785",
"0.69616437",
"0.66970843",
"0.6288053",
"0.6279342",
"0.6064423",
"0.57884806",
"0.5556439",
"0.5305215",
"0.52710307",
"0.5181049",
"0.50654066",
"0.50303006",
"0.50086975",
"0.49919927",
"0.48444322",
"0.4777001",
"0.4770685",
"0.4731099",
"0.468... | 0.86451477 | 0 |
Getter method for echo_req_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_received_count (uint32) | def _get_echo_req_received_count(self):
return self.__echo_req_received_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | [
"0.77231425",
"0.7023055",
"0.6542562",
"0.62707675",
"0.5976226",
"0.5851045",
"0.58174163",
"0.54856044",
"0.54173255",
"0.5317395",
"0.50623125",
"0.5022893",
"0.5022014",
"0.4883163",
"0.4860375",
"0.48226205",
"0.48192063",
"0.4816786",
"0.4814243",
"0.4797339",
"0.46779... | 0.70718306 | 1 |
Setter method for echo_req_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_received_count (uint32) | def _set_echo_req_received_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-received-count", rest_name="echo-req-receive... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | [
"0.7757586",
"0.7065394",
"0.68073034",
"0.67364514",
"0.66612166",
"0.62458676",
"0.56309354",
"0.5338627",
"0.52505404",
"0.50096846",
"0.48576525",
"0.48448968",
"0.48185655",
"0.47561345",
"0.4739262",
"0.46860245",
"0.46509308",
"0.46177593",
"0.45707104",
"0.45225346",
... | 0.84776396 | 0 |
Getter method for echo_req_timeout_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_timeout_count (uint32) | def _get_echo_req_timeout_count(self):
return self.__echo_req_timeout_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_timeout_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-timeout-count\", rest_name=\"echo... | [
"0.80206865",
"0.6734563",
"0.6540391",
"0.6376731",
"0.61047983",
"0.60804176",
"0.60245043",
"0.5819295",
"0.55777395",
"0.49859354",
"0.49369183",
"0.4863983",
"0.48448384",
"0.48247913",
"0.4788822",
"0.4729328",
"0.47008264",
"0.4682831",
"0.46340755",
"0.46337748",
"0.4... | 0.7347358 | 1 |
Setter method for echo_req_timeout_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_timeout_count (uint32) | def _set_echo_req_timeout_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-timeout-count", rest_name="echo-req-timeout-c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | [
"0.7362202",
"0.7095978",
"0.6999127",
"0.6642217",
"0.64998084",
"0.60558325",
"0.57168615",
"0.5617509",
"0.52749455",
"0.50046265",
"0.4905859",
"0.49030608",
"0.48003668",
"0.4683387",
"0.4644038",
"0.45746693",
"0.45659736",
"0.4561842",
"0.45596886",
"0.4557894",
"0.448... | 0.87411803 | 0 |
Getter method for echo_resp_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_sent_count (uint32) | def _get_echo_resp_sent_count(self):
return self.__echo_resp_sent_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-sent-count\", rest_name=\"echo-res... | [
"0.7885906",
"0.71892625",
"0.7101065",
"0.69950885",
"0.66274446",
"0.6617462",
"0.635762",
"0.5800941",
"0.577533",
"0.55431056",
"0.5397536",
"0.5257677",
"0.5200311",
"0.5128361",
"0.5111158",
"0.51002544",
"0.50733143",
"0.50320685",
"0.50222456",
"0.4920297",
"0.4917206... | 0.7451523 | 1 |
Setter method for echo_resp_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_sent_count (uint32) | def _set_echo_resp_sent_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-resp-sent-count", rest_name="echo-resp-sent-count",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | [
"0.7872074",
"0.7738624",
"0.7278106",
"0.7268996",
"0.6715367",
"0.65274954",
"0.6379835",
"0.60264504",
"0.5693287",
"0.55500114",
"0.5237852",
"0.515169",
"0.50731426",
"0.5025889",
"0.49551892",
"0.4954932",
"0.4935209",
"0.49100864",
"0.4884356",
"0.48487535",
"0.4827424... | 0.8611856 | 0 |
Setter method for echo_resp_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_received_count (uint32) | def _set_echo_resp_received_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-resp-received-count", rest_name="echo-resp-rece... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | [
"0.76704717",
"0.73230594",
"0.70944583",
"0.6276271",
"0.618727",
"0.6063231",
"0.60443354",
"0.51781255",
"0.5142111",
"0.50479865",
"0.49492952",
"0.48183542",
"0.47569573",
"0.47515997",
"0.47491166",
"0.4727505",
"0.46277964",
"0.45390615",
"0.45219365",
"0.44867164",
"0... | 0.8556093 | 0 |
Getter method for return_codes, mapped from YANG variable /mpls_state/statistics_oam/return_codes (list) | def _get_return_codes(self):
return self.__return_codes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_return_codes(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGListType(\"number\",return_codes.return_codes, yang_name=\"return-codes\", rest_name=\"return-codes\", parent=self, is_container='list', user_ordered=False, path_helper=se... | [
"0.74746984",
"0.6001439",
"0.5503843",
"0.52020866",
"0.51311105",
"0.5087448",
"0.5053257",
"0.50515985",
"0.49911606",
"0.48414174",
"0.48189038",
"0.46903574",
"0.4685551",
"0.4676945",
"0.46544784",
"0.46471697",
"0.45722067",
"0.45684677",
"0.45653287",
"0.44813254",
"0... | 0.6220025 | 1 |
Returns the indices without performing any operation on them. To be used for fitting on the whole dataset. This strategy is not compatible with HPO search. | def no_resampling(random_state: np.random.RandomState,
indices: np.ndarray) -> np.ndarray:
return indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices(self) -> np.ndarray:\n return self.impl.indices",
"def get_indices(self):\r\n return self._indices",
"def vir_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==0:\n indices.append(index)\n return indices",
"d... | [
"0.7181901",
"0.69676125",
"0.69128466",
"0.6892532",
"0.68412507",
"0.67869836",
"0.6754658",
"0.67145926",
"0.6703281",
"0.66633874",
"0.65803033",
"0.6534292",
"0.6509533",
"0.64898914",
"0.6441676",
"0.6402624",
"0.63538474",
"0.6317454",
"0.6311111",
"0.6274377",
"0.6259... | 0.65598696 | 11 |
Returns the sum of all priorities stored in this sum tree. | def _total_priority(self):
return self.nodes[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self) -> int:\n return self.root.sum",
"def sum(self):\n return sum(self.items())",
"def get_sum(self):\n return self.__tree[0]",
"def sum(self):\n return sum(self._values.values())",
"def total_priority(self) -> int:\n return self.tree[0].item()",
"def sum(self... | [
"0.6984377",
"0.67695606",
"0.67609626",
"0.6698405",
"0.6667603",
"0.6662966",
"0.66467816",
"0.66216046",
"0.66216046",
"0.65775466",
"0.6440943",
"0.6387141",
"0.635604",
"0.6329519",
"0.63249815",
"0.6249568",
"0.61827457",
"0.6161957",
"0.61138844",
"0.6100439",
"0.60939... | 0.65628356 | 10 |
This function will optionally print a header guard for `cl_khr_fp64` if a 64bit type is used as the source or destination and return a bool that indicates whether this guard will need closed after the calling function has finished printing functions that use the 64bit source/destination type. | def conditional_guard(src, dst):
int64_count = 0
float64_count = 0
float16_count = 0
if src in int64_types or dst in int64_types:
int64_count = 1
if src in float64_types or dst in float64_types:
float64_count = 1
if src in float16_types or dst in float16_types:
float16_count = 1
if float16_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_64_windows():\n return struct.calcsize('P') * 8 == 64",
"def have_binary128():\n try:\n ti = type_info(np.longdouble)\n except FloatingError:\n return False\n return (ti['nmant'], ti['maxexp']) == (112, 16384)",
"def is_H(self):\n return True",
"def is_H(self):\n ... | [
"0.4971328",
"0.46334147",
"0.46194386",
"0.46194386",
"0.4604871",
"0.4570718",
"0.45214003",
"0.45135522",
"0.44693208",
"0.44124466",
"0.44066575",
"0.44048572",
"0.43934348",
"0.43365443",
"0.42555895",
"0.4250501",
"0.42504188",
"0.42486706",
"0.42251563",
"0.4212047",
"... | 0.59550357 | 0 |
Apply weight normalization module from all of the layers. | def apply_weight_norm(self):
def _apply_weight_norm(m):
if isinstance(m, torch.nn.Conv1d) or isinstance(
m, torch.nn.ConvTranspose1d
):
torch.nn.utils.weight_norm(m)
logging.debug(f"Weight norm is applied to {m}.")
self.apply(_app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n for layer in self.modules():\n if isinstance(layer, (nn.Conv1d, nn.Linear)):\n nn.init.xavier_uniform_(layer.weight)\n if layer.bias is not None:\n nn.init.constant_(layer.bias, 0)\n elif isinstance(layer, nn.B... | [
"0.7143955",
"0.7143955",
"0.7143955",
"0.71335757",
"0.7069364",
"0.7069364",
"0.70534694",
"0.7049442",
"0.70303166",
"0.6807604",
"0.6779128",
"0.6764302",
"0.67596924",
"0.6736109",
"0.6710482",
"0.66960436",
"0.6584008",
"0.6554928",
"0.6526808",
"0.65179425",
"0.6516647... | 0.73184675 | 1 |
Apply weight normalization module from all of the layers. | def apply_weight_norm(self):
def _apply_weight_norm(m):
if isinstance(m, torch.nn.Conv1d) or isinstance(
m, torch.nn.ConvTranspose1d
):
torch.nn.utils.weight_norm(m)
logging.debug(f"Weight norm is applied to {m}.")
self.apply(_app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n for layer in self.modules():\n if isinstance(layer, (nn.Conv1d, nn.Linear)):\n nn.init.xavier_uniform_(layer.weight)\n if layer.bias is not None:\n nn.init.constant_(layer.bias, 0)\n elif isinstance(layer, nn.B... | [
"0.71435213",
"0.71435213",
"0.71435213",
"0.7134102",
"0.70675933",
"0.70675933",
"0.70535696",
"0.7048801",
"0.70298284",
"0.6807073",
"0.67789346",
"0.6764012",
"0.6759336",
"0.67359823",
"0.671116",
"0.6696031",
"0.6583814",
"0.6554803",
"0.65268165",
"0.65178454",
"0.651... | 0.7316938 | 2 |
Apply weight normalization module from all of the layers. | def apply_weight_norm(self):
def _apply_weight_norm(m):
if isinstance(m, torch.nn.Conv1d) or isinstance(
m, torch.nn.ConvTranspose1d
):
torch.nn.utils.weight_norm(m)
logging.debug(f"Weight norm is applied to {m}.")
self.apply(_app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n for layer in self.modules():\n if isinstance(layer, (nn.Conv1d, nn.Linear)):\n nn.init.xavier_uniform_(layer.weight)\n if layer.bias is not None:\n nn.init.constant_(layer.bias, 0)\n elif isinstance(layer, nn.B... | [
"0.71430475",
"0.71430475",
"0.71430475",
"0.713435",
"0.70688635",
"0.70688635",
"0.7052796",
"0.7049518",
"0.70298177",
"0.68070155",
"0.6778134",
"0.676388",
"0.6760103",
"0.67364126",
"0.6710347",
"0.6696243",
"0.65825963",
"0.65547544",
"0.6525561",
"0.6517765",
"0.65163... | 0.73182416 | 0 |
Returns a humanized rstring representing time difference between now() and the input timestamp. The output rounds up to days, hours, minutes, or seconds. 4 days 5 hours returns '4 days' 0 days 4 hours 3 minutes returns '4 hours', etc... | def time_since(timestamp=None):
rstr = ""
if not timestamp or not isinstance(timestamp, datetime.datetime):
return rstr
now = timezone.now()
timediff = now - timestamp
days = timediff.days
weeks = days//7
months = days//30
minutes = timediff.seconds % 3600 // 60
seconds = ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.7199235",
"0.6999816",
"0.6862485",
"0.6823745",
"0.6743255",
"0.6654757",
"0.66247755",
"0.65492713",
"0.64874226",
"0.64806837",
"0.6469421",
"0.64674145",
"0.64304537",
"0.6402844",
"0.6387063",
"0.6360706",
"0.6358006",
"0.6357516",
"0.63572836",
"0.63446885",
"0.63081... | 0.7168039 | 1 |
Check if two things have the same type. | def same_type(one, two):
return isinstance(one, type(two)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_equal_same_type(self, other):\n return True",
"def is_same(type1, type2):\n nake_type1 = remove_declarated(type1)\n nake_type2 = remove_declarated(type2)\n return nake_type1 == nake_type2",
"def sametype(variable1, variable2):\n\n # Return the result\n return isinstance(variable1,... | [
"0.826196",
"0.7960103",
"0.7685877",
"0.75767535",
"0.73899287",
"0.7386229",
"0.73627245",
"0.72946095",
"0.7151994",
"0.7137583",
"0.7062871",
"0.7059909",
"0.70217156",
"0.69869566",
"0.6975931",
"0.69511235",
"0.6951103",
"0.682518",
"0.6799043",
"0.6766386",
"0.67605907... | 0.8348503 | 0 |
Add token to vocabulary. | def add_token(self, token):
token = self.process_token(token)
self._token_count.update([token]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_token(self,token):\n\t\tif not token:\n\t\t\tlogging.error(\"Token cannot be empty!\")\n\t\t\texit()\n\n\t\tself.tokens.append(token.lower())\n\t\t#self.user_defined_token = token.lower()",
"def add_embedding(self, token, embedding):\n self.word2idx[token] = self.vocab_size\n self.vocab_siz... | [
"0.7474371",
"0.7235822",
"0.6903988",
"0.6526929",
"0.65188766",
"0.6505907",
"0.6505907",
"0.64998305",
"0.6496983",
"0.6493279",
"0.64262176",
"0.6420701",
"0.6391367",
"0.6325264",
"0.63200015",
"0.62549394",
"0.62311953",
"0.622333",
"0.6177798",
"0.61690384",
"0.6133628... | 0.68879795 | 4 |
Convert `document` into the bagofwords (BoW) format = list of `(token_id, token_count)` tuples. | def doc2bow(self, document, allow_update=False, return_missing=False):
doc=[t.text for t in document.tokens]
if isinstance(doc, string_types):
raise TypeError("doc2bow expects an array of unicode tokens on input, not a single string")
# Construct (word, frequency) mapping.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_bag_words(document_tokenized):\n bag_words = dict()\n for token in document_tokenized:\n if token in bag_words.keys():\n bag_words[token] += 1\n else:\n bag_words[token] = 1\n return bag_words",
"def sentencesToBow(documents):\n bowSentences = []\n dict... | [
"0.75598925",
"0.67602545",
"0.64582515",
"0.63520515",
"0.5917524",
"0.5897528",
"0.58469146",
"0.5783915",
"0.5782803",
"0.5771413",
"0.57590044",
"0.5732742",
"0.5720406",
"0.57064784",
"0.5675183",
"0.5654374",
"0.5644353",
"0.5635149",
"0.55853426",
"0.5584801",
"0.55662... | 0.6443913 | 3 |
Get the token_id of given token. | def token_to_id(self, token):
token = self.process_token(token)
return self.token2id.get(token, len(self.token2id) - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_to_id(self, token):\n token = self.process_token(token)\n return self._token2id.get(token, len(self._token2id) - 1)",
"def token_to_id(self, token):\r\n return self.encoder.get(token, self.encoder.get(self.unk_token))",
"def token_id(self) -> Optional[pulumi.Input[int]]:\n ... | [
"0.8310672",
"0.7980398",
"0.79235566",
"0.7840283",
"0.7578476",
"0.730748",
"0.71591955",
"0.7151534",
"0.7099397",
"0.6803577",
"0.66393685",
"0.65554255",
"0.6520694",
"0.64726806",
"0.64626735",
"0.6437027",
"0.6431865",
"0.6408412",
"0.63829017",
"0.6313626",
"0.6299330... | 0.8298625 | 1 |
dataloader for training dataset via voxsampler. | def load_train(trainlst, traindir, maptrain5994, L=L,
batch_size=batch_size, num_worker=num_worker,
max_utt_per_spk=max_utt_per_spk, load_wav=None):
if load_wav is None:
def load_train_wav(path): return loadWAV(path, L=L, evalmode=False)
else:
load_train_wav = load_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_train, **self.dl_kwargs)",
"def dataloader(self):\n\n # load / split data\n train_data = self.data.get_train_data()\n if self.args.use_dev:\n train_data, de... | [
"0.7731121",
"0.7497621",
"0.72368264",
"0.71800596",
"0.7143441",
"0.7102657",
"0.7093028",
"0.7014497",
"0.6950995",
"0.6860976",
"0.6830999",
"0.67986304",
"0.6784964",
"0.6782085",
"0.67802626",
"0.6743672",
"0.6729586",
"0.6659931",
"0.66424596",
"0.6627726",
"0.6623991"... | 0.0 | -1 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Construct a new Player | def __init__(self):
self.loop = asyncio.get_event_loop()
self.aiohttp = web.Application(
loop=self.loop,
middlewares=[unhandled_route],
)
self.client = ClientSession()
self.ws = WebSocketHandler(self)
self.cert = self._load_ssl_certificate()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createPlayer(self):\n sw, ne = self.playerCreationRectangle\n x = self.random.randrange(sw.x, ne.x)\n y = 1.0\n z = self.random.randrange(sw.y, ne.y)\n player = Player(Vector(x, y, z), 2, self.seconds)\n for observer in self.observers:\n observer.playerCreat... | [
"0.8133294",
"0.73655224",
"0.7338226",
"0.7169045",
"0.7107056",
"0.71011436",
"0.7019268",
"0.70154893",
"0.7000745",
"0.6951531",
"0.6851873",
"0.68201184",
"0.6619382",
"0.6601898",
"0.6583949",
"0.65359473",
"0.65358025",
"0.6531014",
"0.6509729",
"0.6432442",
"0.639431"... | 0.0 | -1 |
Constructor with data and next element | def __init__(self, data):
self.data = data
self.next = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data, next=None):\n self.data = data\n self.next = next",
"def __init__(self, data, next = None):\n\t\tself.data = data\n\t\tself.next = next",
"def __init__(self, data=None, next=None):\n self.data = data\n self.next = next",
"def __init__(self, data, next_node... | [
"0.8599574",
"0.85121983",
"0.84967536",
"0.8359982",
"0.8315263",
"0.8315263",
"0.81818867",
"0.8087428",
"0.80368114",
"0.8025065",
"0.8019018",
"0.7919946",
"0.76897675",
"0.7610863",
"0.7575822",
"0.75584215",
"0.7526036",
"0.7419128",
"0.72142625",
"0.7198809",
"0.708651... | 0.8276122 | 7 |
Returns first n values from the given sequence. | def take(n, seq):
seq = iter(seq)
result = []
try:
for i in range(n):
result.append(next(seq))
except StopIteration:
pass
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(n, seq):\n return itertools.islice(seq, n)",
"def nth(n, seq):\n try:\n return seq[n]\n except TypeError:\n return next(itertools.islice(seq, n, None))",
"def take(iterable, n):\n return list(itertools.islice(iterable, n))",
"def lookahead(n, iterable):\n for value in is... | [
"0.7429517",
"0.6876003",
"0.6727532",
"0.67118037",
"0.66985476",
"0.66985476",
"0.66961426",
"0.6665714",
"0.6665714",
"0.66652995",
"0.6647308",
"0.64990807",
"0.6490624",
"0.6476307",
"0.6448948",
"0.6416278",
"0.6414325",
"0.64115244",
"0.6388718",
"0.63765794",
"0.63302... | 0.7366886 | 1 |
Old string code that takes any 2D list and maps it to a 1D list by adding each subsequent row to the end of the first row | def transformation_flatten(twoDlistinput):
oneDlistoutput = []
for i in range(len(twoDlistinput)):
for j in range(len(twoDlistinput[i])):
oneDlistoutput.append(twoDlistinput[i][j])
return(oneDlistoutput) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_row(lst, is_collocation):\n split_list = lst[0].split(\"\\t\")\n if is_collocation:\n return [split_list[0] + \" \" + split_list[1], \"1\"]\n return [split_list[0] + \" \" + split_list[1], \"0\"]",
"def transpose(str_list):\n # takes list of strings of dimensions n x m\n if (n :... | [
"0.66831225",
"0.6467971",
"0.6433592",
"0.62176746",
"0.61118764",
"0.59531605",
"0.59194076",
"0.5904703",
"0.5842135",
"0.58245844",
"0.5760106",
"0.57579666",
"0.573827",
"0.5714012",
"0.5692371",
"0.569116",
"0.56879634",
"0.56724775",
"0.56658834",
"0.5663291",
"0.56433... | 0.576872 | 10 |
Sets the peer of this Dial. | def peer(self, peer):
if peer is None:
raise ValueError("Invalid value for `peer`, must not be `None`") # noqa: E501
self._peer = peer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPeer (self, peer):\n\t\tself.peer = peer",
"def setPeerToPeerNetwork(self, peerToPeerNetwork):\r\n raise NotImplementedError()",
"def peer(self, value: Optional[MicrobitPeer]) -> None:\n if self.__peer is not None:\n self.__peer.remove_listener(self.__execute)\n\n if valu... | [
"0.83918417",
"0.67424357",
"0.6415004",
"0.60654163",
"0.5945206",
"0.5834176",
"0.5686866",
"0.5547047",
"0.54729116",
"0.54373324",
"0.54167396",
"0.53934383",
"0.5380653",
"0.5360441",
"0.5354226",
"0.53020024",
"0.5296971",
"0.5267418",
"0.52219296",
"0.52138495",
"0.517... | 0.7684957 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Dial):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.808826",
"0.808826",
"0.8054592",
"0.79827315",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Hamming Heuristic (admissible) provides very little speedup, but it's one line and admissible | def spotlessroomba_first_heuristic(state : SpotlessRoombaState) -> float:
# TODO a nontrivial admissible heuristic
return len(state.dirty_locations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chk_hamming(data):\n pass",
"def hamming_algorithm(data: bytearray):\n print(f\"data: {data}\")\n # 12345678 12345678 12345678 12345678\n if len(data) % 4 != 0:\n diff = 4 - len(data) % 4\n data += bytes(diff)\n m = len(data)\n r = 0\n chunck = 0\n i = 0\n ret_... | [
"0.75875574",
"0.6815475",
"0.68022764",
"0.626976",
"0.62238514",
"0.6208715",
"0.6082887",
"0.60824615",
"0.6025382",
"0.60161185",
"0.5995922",
"0.5990126",
"0.5911016",
"0.5893186",
"0.5888975",
"0.5871593",
"0.58487594",
"0.58374834",
"0.5815022",
"0.5806226",
"0.5787427... | 0.0 | -1 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038751",
"0.7924752",
"0.7923082",
"0.78850657",
"0.78771824",
"0.7815519",
"0.77652335",
"0.775546",
"0.77440816",
"0.77313656",
"0.77284646",
"0.77244157",
"0.770246",
"0.76888484",
"0.76888484",
"0.766384",
"0.7656689",
"0.7655605",
"0.7655605",
"0.76455575",
"0.764555... | 0.7537613 | 27 |
Checks top to target to see if it hit top of screen | def check_top(self):
if self.rect.top <=0:
self.target_direction = 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_autos_top(self):\n\t\tscreen_rect = self.screen.get_rect()\n\t\tfor auto in self.autos.sprites():\n\t\t\tif auto.rect.top <= screen_rect.top:\n\t\t\t\t# Treat this the same as if the pigeon got hit.\n\t\t\t\tself._pigeon_hit()\n\t\t\t\tbreak",
"def hits_top_or_bottom(self):\n if self.y >= self.... | [
"0.733528",
"0.73351",
"0.6623284",
"0.6466618",
"0.6390728",
"0.62321746",
"0.6225023",
"0.62215257",
"0.6199803",
"0.61606985",
"0.6129186",
"0.610839",
"0.6086093",
"0.6061291",
"0.6013783",
"0.598041",
"0.5974214",
"0.5962553",
"0.58782667",
"0.58218175",
"0.58168215",
... | 0.8144298 | 0 |
Start random direction movement | def go(self):
# if we want to go to the right, we need to decrease x and increase y
# if we want to go to the left, we need to increase x and decrease y
h = random.randrange(2, 4)
v = random.randrange(1, 3)
if not bool(random.getrandbits(1)):
h = - h
self.velo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRandDirection(self):\n phi = 2*math.pi*random.random()\n u = 2*random.random() - 1\n v = math.sqrt(1-u*u)*math.cos(phi)\n w = math.sqrt(1-u*u)*math.sin(phi)\n self.direction = (u,v,w)",
"def random_move(turtle, distance):\n angle = uniform(-90,90)\n d = uniform(0,dista... | [
"0.76126647",
"0.7555828",
"0.7380981",
"0.7263461",
"0.71452343",
"0.7137276",
"0.69984514",
"0.6989068",
"0.6987881",
"0.69832087",
"0.6966477",
"0.6943634",
"0.6943634",
"0.6928557",
"0.6794044",
"0.67522436",
"0.6749555",
"0.6610872",
"0.6600256",
"0.6551586",
"0.6535305"... | 0.6732395 | 17 |
Make an ArgumentParser instance for comparative benchmark options. | def make_argument_parser():
parser = Benchmark.make_argument_parser()
parser.add_argument('--skip-reference',
action='store_true',
help='Skip the reference simulation run.')
return parser | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_argument_parser():\n parser = argparse.ArgumentParser()\n parser.add_argument('--device',\n type=str,\n choices=['CPU', 'GPU'],\n help='Execution device.',\n required=True)\n pa... | [
"0.72827846",
"0.7190032",
"0.7093924",
"0.7032623",
"0.70229095",
"0.69860554",
"0.6946884",
"0.694275",
"0.693303",
"0.6930106",
"0.69170386",
"0.68352914",
"0.6832233",
"0.68094486",
"0.68094486",
"0.6783497",
"0.6778075",
"0.6772473",
"0.675373",
"0.6753382",
"0.6745362",... | 0.788973 | 0 |
Unstack batch dimension and split into channels and alpha mask. | def unstack_and_split(self, x, batch_size, num_channels=3):
unstacked = torch.reshape(x, [batch_size, -1] + list(x.shape)[1:])
channels, masks = torch.split(unstacked, [num_channels, 1], dim=2)
return channels, masks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batch_size, h, w, nc)\n return x_t",
"def batch_collate_fn(batch):\n images = []\n masks = []\n \n for ... | [
"0.59909207",
"0.58123934",
"0.5716505",
"0.5716326",
"0.5704696",
"0.5700815",
"0.55700964",
"0.5564052",
"0.55450964",
"0.55180305",
"0.551707",
"0.54962254",
"0.5416754",
"0.5411667",
"0.5395286",
"0.5373396",
"0.53642625",
"0.5344805",
"0.5337699",
"0.5336697",
"0.5332148... | 0.7611791 | 0 |
Close the session and the Thrift transport. | def close(self):
# PEP 249
rpc.close_service(self.service) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.clos... | [
"0.78195184",
"0.78195184",
"0.78195184",
"0.78195184",
"0.78195184",
"0.78195184",
"0.7808701",
"0.7711172",
"0.76763135",
"0.7660848",
"0.7508555",
"0.7420375",
"0.7418072",
"0.7413811",
"0.7404994",
"0.732449",
"0.7322094",
"0.722286",
"0.7220323",
"0.71922815",
"0.712453"... | 0.0 | -1 |
The name of the application that is associated with this environment. | def application_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "application_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def application_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"application_name\")",
"def application_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"a... | [
"0.8759173",
"0.8733051",
"0.8620485",
"0.8620485",
"0.8601236",
"0.8559315",
"0.8510323",
"0.8470934",
"0.83924884",
"0.8365387",
"0.81169367",
"0.80879086",
"0.8058957",
"0.80493975",
"0.80454445",
"0.80223936",
"0.8003628",
"0.79939234",
"0.7801216",
"0.7618629",
"0.748491... | 0.83143616 | 13 |
If specified, the environment attempts to use this value as the prefix for the CNAME in your Elastic Beanstalk environment URL. If not specified, the CNAME is generated automatically by appending a random alphanumeric string to the environment name. | def cname_prefix(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "cname_prefix") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_env_prefix(instrument):\n return \"crds://\"",
"def create_r53_name ( base_name, name ) :\n env = get_env_type( base_name )\n if env :\n env = env.lower( )\n if ( env == 'prod' ) :\n return name\n\n return name + '.' + env",
"def env_name(self):\n return f\"{self.project_nam... | [
"0.64996815",
"0.5894681",
"0.5874034",
"0.5585658",
"0.5544347",
"0.54832244",
"0.5323281",
"0.5320591",
"0.52773994",
"0.52695954",
"0.5262594",
"0.5224099",
"0.5203325",
"0.5185465",
"0.51792514",
"0.51767623",
"0.51628804",
"0.5161422",
"0.51356816",
"0.5127793",
"0.51247... | 0.52725095 | 9 |
A unique name for the environment. | def environment_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "environment_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._env_name",
"def name(self):\n return get_env_name(self.tool_name,\n self._python,\n self._requirements,\n self._tagged_env_vars)",
"def env_name(self):\n return f\"{self.project_... | [
"0.79486114",
"0.75685275",
"0.7347741",
"0.71612895",
"0.7083821",
"0.6932168",
"0.6866546",
"0.6833046",
"0.6826362",
"0.6653989",
"0.66474885",
"0.658179",
"0.6504934",
"0.6459993",
"0.64504695",
"0.64480555",
"0.6429557",
"0.6411307",
"0.6345184",
"0.63397086",
"0.6339165... | 0.69573826 | 5 |
The Amazon Resource Name (ARN) of an existing IAM role to be used as the environment's operations role. | def operations_role(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "operations_role") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_arn(self) -> str:\n return pulumi.get(self, \"role_arn\")",
"def iam_role_arn(self) -> str:\n return pulumi.get(self, \"iam_role_arn\")",
"def role_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Input[str]:\n ... | [
"0.7612605",
"0.75487196",
"0.7544673",
"0.7489435",
"0.74707127",
"0.74707127",
"0.7373255",
"0.7373255",
"0.734374",
"0.734374",
"0.734374",
"0.734374",
"0.72820526",
"0.72820526",
"0.7252721",
"0.71177185",
"0.70236653",
"0.69610494",
"0.6929272",
"0.6908325",
"0.69070154"... | 0.6835086 | 21 |
The Amazon Resource Name (ARN) of the custom platform to use with the environment. | def platform_arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "platform_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"platform_arn\")",
"def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")",
"def platform():\n return \"micaz\"",
"def PlatformName():\n if override_platform_name:\n return over... | [
"0.7836344",
"0.6630474",
"0.66273826",
"0.6609992",
"0.6324445",
"0.6285871",
"0.623594",
"0.61513615",
"0.60816205",
"0.60486674",
"0.60041595",
"0.598996",
"0.59880674",
"0.596188",
"0.59613025",
"0.5961109",
"0.5934884",
"0.5923574",
"0.5923574",
"0.59224755",
"0.59224755... | 0.77357316 | 1 |
The name of the application version to deploy. | def version_label(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "version_label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_name(self) -> str:\n return pulumi.get(self, \"version_name\")",
"def app_version(self) -> str:\n return pulumi.get(self, \"app_version\")",
"def version_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"version_name\")",
"def get_package_name(self):\n ... | [
"0.79632217",
"0.7523307",
"0.7298782",
"0.7256948",
"0.7225796",
"0.7173701",
"0.7093467",
"0.70632595",
"0.70144266",
"0.691959",
"0.6919559",
"0.6915445",
"0.6907794",
"0.6907794",
"0.68302757",
"0.68228155",
"0.67623806",
"0.6752896",
"0.6749308",
"0.6721663",
"0.67069286... | 0.0 | -1 |
Get an existing Environment resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Environment':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = EnvironmentArgs.__new__(EnvironmentArgs)
__props__.__dict__["applicat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Environment':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = EnvironmentArgs.__new__(EnvironmentArgs)\n\n __props__.__dict... | [
"0.6518575",
"0.61676663",
"0.615199",
"0.6109608",
"0.6109441",
"0.60900664",
"0.6072669",
"0.5931966",
"0.58831435",
"0.5837981",
"0.5818557",
"0.58057237",
"0.5786659",
"0.5786354",
"0.5778798",
"0.5712893",
"0.56756985",
"0.5640747",
"0.5597875",
"0.5522777",
"0.54472834"... | 0.6545722 | 0 |
The name of the application that is associated with this environment. | def application_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "application_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")",
"def app_name(self): # pylint:disable=function-redefined\n return self._app_name",
... | [
"0.8760097",
"0.8733922",
"0.8601743",
"0.8560242",
"0.8511749",
"0.8471325",
"0.8393377",
"0.8365738",
"0.8314625",
"0.8314625",
"0.8314625",
"0.8314625",
"0.811715",
"0.8087263",
"0.8060348",
"0.8050741",
"0.80447793",
"0.80227804",
"0.80048144",
"0.79946846",
"0.7801479",
... | 0.8621024 | 3 |
If specified, the environment attempts to use this value as the prefix for the CNAME in your Elastic Beanstalk environment URL. If not specified, the CNAME is generated automatically by appending a random alphanumeric string to the environment name. | def cname_prefix(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "cname_prefix") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_env_prefix(instrument):\n return \"crds://\"",
"def create_r53_name ( base_name, name ) :\n env = get_env_type( base_name )\n if env :\n env = env.lower( )\n if ( env == 'prod' ) :\n return name\n\n return name + '.' + env",
"def env_name(self):\n return f\"{self.project_nam... | [
"0.6500855",
"0.5895467",
"0.5876529",
"0.5587471",
"0.55460733",
"0.5484087",
"0.5324461",
"0.5320309",
"0.5279635",
"0.5274285",
"0.52700907",
"0.52646524",
"0.5225509",
"0.5187014",
"0.5178442",
"0.5177224",
"0.5163091",
"0.5162621",
"0.5136999",
"0.51282483",
"0.5125458",... | 0.52051395 | 13 |
A unique name for the environment. | def environment_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "environment_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._env_name",
"def name(self):\n return get_env_name(self.tool_name,\n self._python,\n self._requirements,\n self._tagged_env_vars)",
"def env_name(self):\n return f\"{self.project_... | [
"0.79474497",
"0.75676024",
"0.7346393",
"0.71637094",
"0.69561476",
"0.69324404",
"0.6864522",
"0.6832018",
"0.6827754",
"0.66545093",
"0.66468686",
"0.65825635",
"0.6506662",
"0.6461384",
"0.6451408",
"0.64490986",
"0.6430531",
"0.6412154",
"0.6346107",
"0.6341232",
"0.6337... | 0.7082336 | 4 |
The Amazon Resource Name (ARN) of an existing IAM role to be used as the environment's operations role. | def operations_role(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "operations_role") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_arn(self) -> str:\n return pulumi.get(self, \"role_arn\")",
"def iam_role_arn(self) -> str:\n return pulumi.get(self, \"iam_role_arn\")",
"def role_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Input[str]:\n ... | [
"0.7611145",
"0.7547483",
"0.7543366",
"0.7487498",
"0.7469303",
"0.7469303",
"0.7371766",
"0.7371766",
"0.73421746",
"0.73421746",
"0.73421746",
"0.73421746",
"0.7280896",
"0.7280896",
"0.72515625",
"0.70219666",
"0.69590557",
"0.6927607",
"0.69078577",
"0.6905639",
"0.68344... | 0.7117283 | 15 |
The Amazon Resource Name (ARN) of the custom platform to use with the environment. | def platform_arn(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "platform_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"platform_arn\")",
"def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")",
"def platform():\n return \"micaz\"",
"def PlatformName():\n if override_platform_name:\n return overr... | [
"0.7735306",
"0.66278744",
"0.6624211",
"0.6606932",
"0.6323558",
"0.6283941",
"0.6234539",
"0.61513674",
"0.6081606",
"0.60462385",
"0.60026896",
"0.5988347",
"0.598575",
"0.59628206",
"0.5962734",
"0.59611076",
"0.59324396",
"0.59225625",
"0.59225625",
"0.5922316",
"0.59223... | 0.7835914 | 0 |
The name of the application version to deploy. | def version_label(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "version_label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_name(self) -> str:\n return pulumi.get(self, \"version_name\")",
"def app_version(self) -> str:\n return pulumi.get(self, \"app_version\")",
"def version_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"version_name\")",
"def get_package_name(self):\n ... | [
"0.79674184",
"0.752541",
"0.7301922",
"0.7259704",
"0.72298706",
"0.71760947",
"0.7097202",
"0.7067314",
"0.7017301",
"0.69222665",
"0.69211406",
"0.6917922",
"0.6909662",
"0.6909662",
"0.6832326",
"0.6825434",
"0.67636746",
"0.6756408",
"0.67505723",
"0.67250407",
"0.670931... | 0.6369655 | 59 |
The column labels of the DataFrame. Returns orca.Index The column labels of each column. | def columns(self):
return self._columns
# return Index(self._data_columns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def labels(self):\n \n return self.column_labels",
"def column_labels(self):\n return tuple(self._columns.keys())",
"def get_labels(self) -> {int: str}:\n return {x: col.label for x, col in self._cols.items()}",
"def get_label_indices(df: DataFrame, labels: list):\n return [idx... | [
"0.7897917",
"0.76980937",
"0.7478725",
"0.69867",
"0.6826641",
"0.68240386",
"0.6750179",
"0.6732042",
"0.6705691",
"0.66914195",
"0.6630234",
"0.65252477",
"0.6519194",
"0.64722145",
"0.6469839",
"0.64630276",
"0.6462272",
"0.6409666",
"0.6367081",
"0.63438576",
"0.62805796... | 0.6088458 | 41 |
Align the input columns, filling the missing columns with None Examples >>> merge_columns( ... ["a", "b", "ba", "d", "f"], ... ["e", "c", "d", "g", "ga", "a"] ... ) (('a','a'),('b',None),('ba',None),(None,c),('d','d'),(None,'e'),('f',None),(None,'g'),(None,'ga')) | def merge_columns(self_columns, other_columns):
sorted_self_columns, sorted_other_columns = sorted(self_columns), sorted(other_columns)
self_idx = other_idx = 0
self_len, other_len = len(self_columns), len(other_columns)
while self_idx < self_len and other_idx < other_len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_columns(allowed_columns):\n\n v_columns = [v for v in allowed_columns if v in df.columns]\n v_columns.sort()\n for i in range(1, len(v_columns)):\n df[v_columns[0]] = df[v_columns[0]].fillna(df[v_columns[i]])\n df.drop(v_columns[i], 1, inplace=True)\n return v_columns[0]",
"def merge_column... | [
"0.6452826",
"0.59999216",
"0.5639353",
"0.53557676",
"0.5288406",
"0.51761496",
"0.50632006",
"0.5041874",
"0.5031121",
"0.49720797",
"0.49664128",
"0.49384537",
"0.49003986",
"0.4899783",
"0.48729792",
"0.4778065",
"0.47356743",
"0.47148484",
"0.46847248",
"0.4650927",
"0.4... | 0.5532568 | 3 |
Return a sorted selections by the correlation rsquared scores | def __sort_predictors_by_corr(self, station, selections, var, From, To, by, how, constant=True,
selectionsnames=None, sort_cor=True, cor_lim=None):
scores_corel = pd.DataFrame(index=np.arange(0, len(selections)), columns=['corel', 'selections', 'params',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corr_list(self):\n c = self.df.corr().abs()\n s = c.unstack()\n so = s.sort_values(ascending=False)\n i = int(len(so) ** (1/2))\n charts = so[i:]\n charts = charts[::2]\n if len(charts) > 3:\n charts = charts[:3]\n return charts.index, charts.v... | [
"0.5838652",
"0.55438906",
"0.5539825",
"0.5511799",
"0.5483375",
"0.54549277",
"0.54273504",
"0.5422278",
"0.5394091",
"0.536099",
"0.53258604",
"0.53121966",
"0.5309838",
"0.5289699",
"0.52868915",
"0.5261606",
"0.5250422",
"0.52314734",
"0.5225502",
"0.5213998",
"0.5203932... | 0.62526226 | 0 |
To be used in conjunction with loss.binary_xentropy_with_sigmoid | def sigmoid_with_binary_xentropy(z):
return sigmoid(z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\r\n #pred_x = (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\r\n pred_x = 1.0 / (1.0 + np.exp(-x))\r\n return pred_x\r\n pass",
"def test_sigmoid_cross_entropy(self):\n loss_op = pointwise_losses.SigmoidCrossEntropy()\n\n y_pred = loss_op.final_activation_op({\n ... | [
"0.7591269",
"0.75822216",
"0.7455182",
"0.74292374",
"0.74232256",
"0.74232256",
"0.74083984",
"0.74083984",
"0.74083984",
"0.74083984",
"0.74083984",
"0.74083984",
"0.7393072",
"0.73908216",
"0.73857445",
"0.73740834",
"0.73655087",
"0.73640925",
"0.73640925",
"0.73588455",
... | 0.8279197 | 0 |
Return a diagonal mask computed from an array. Useful when the data is the same if you transpose the array, eg in a heatmap. | def get_diagonal_mask(data):
mask = np.zeros_like(data, dtype=np.bool)
mask[np.triu_indices_from(mask)] = True
return mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_diagonal(self, array):\n diags = [array[::-1, :].diagonal(i) for i in range(-array.shape[0] + 1, array.shape[1])]\n\n # Now back to the original array to get the upper-left-to-lower-right diagonals,\n # starting from the right, so the range needed for shape (x,y) was y-1 to -x+1 descen... | [
"0.72953194",
"0.61421484",
"0.6136961",
"0.58667374",
"0.5818971",
"0.558432",
"0.5531007",
"0.55216306",
"0.5488027",
"0.5458054",
"0.5457682",
"0.5436873",
"0.54321617",
"0.5413237",
"0.54027534",
"0.5357985",
"0.5352605",
"0.53214806",
"0.53060347",
"0.5296002",
"0.528144... | 0.706273 | 1 |
Retrieve the ItopapiOSVersion corresponding to this server | def find_os_version(self):
if self.osversion_id is not None:
ItopapiPrototype.get_itop_class('OSVersion').find(self.osfamily_id)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_os_version(self):\n\t\treturn call_sdk_function('PrlSrvInfo_GetOsVersion', self.handle)",
"def get_osversion(self):\n\t\treturn call_sdk_function('PrlFoundVmInfo_GetOSVersion', self.handle)",
"def get_os_version(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetOsVersion', self.handle)",
"def os_vers... | [
"0.8168305",
"0.7857166",
"0.7728561",
"0.76559675",
"0.7597805",
"0.7398409",
"0.7351898",
"0.7313755",
"0.7304044",
"0.7298166",
"0.7229817",
"0.7214568",
"0.7212459",
"0.719492",
"0.7193201",
"0.71634763",
"0.7163448",
"0.7133119",
"0.7087612",
"0.7079623",
"0.70749295",
... | 0.7123767 | 18 |
Retrieve the ItopapiOrganization corresponding to this server | def find_organization(self):
if self.org_id is not None:
ItopapiPrototype.get_itop_class('Organization').find(self.org_id)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization(self):\n return self._tower.get_organization_by_id(self._data.get('organization'))",
"def get_organization(self):\n return self.reference[REF_ORGANIZATION][REF_VALUE]",
"def getOrganization(self):\n return _libsbml.ModelCreator_getOrganization(self)",
"def get_organizati... | [
"0.7651209",
"0.71187073",
"0.7091516",
"0.68542224",
"0.6810734",
"0.680332",
"0.67780435",
"0.6712279",
"0.6706957",
"0.66816705",
"0.6667797",
"0.6625002",
"0.65964967",
"0.6589382",
"0.6561183",
"0.6561183",
"0.6561183",
"0.65521574",
"0.6543021",
"0.64575344",
"0.6378819... | 0.75703514 | 1 |
Builds the correct URL. Replaces "query" with "queryauth" if client has authentication information. | def _build_url(self, service, resource_type, parameters={}):
# authenticated dataselect queries have different target URL
if self.user is not None:
if service == "dataselect" and resource_type == "query":
resource_type = "queryauth"
return build_url(self.base_url, ser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_url(self, request, action, **query):\n base = urlparse.urljoin(request['base_url'], self.auth_prefix + '/' + action)\n return appendArgs(base, query)",
"def construct_url(self):\n path = [self.path]\n path.extend([str(x) for x in self.params])\n\n url = self.client.ba... | [
"0.7369034",
"0.7334827",
"0.72362584",
"0.7071104",
"0.7013484",
"0.6760965",
"0.65050304",
"0.6447025",
"0.6425153",
"0.63879895",
"0.6378408",
"0.6330067",
"0.63281715",
"0.62623614",
"0.62623614",
"0.62423044",
"0.62401664",
"0.62292403",
"0.6221821",
"0.61912405",
"0.615... | 0.660301 | 6 |
URL builder for the FDSN webservices. Built as a separate function to enhance testability. | def build_url(base_url, service, major_version, resource_type,
parameters=None, service_mappings=None, subpath='fdsnws'):
# Avoid mutable kwargs.
if parameters is None:
parameters = {}
if service_mappings is None:
service_mappings = {}
# Only allow certain resource types.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _uri(helper):\n return '/'.join((\n helper.context_meta['server_uri'],\n 'servicesNS',\n 'nobody',\n 'Splunk_TA_paloalto',\n 'storage',\n 'collections',\n 'data',\n 'minemeldfeeds'))",
"def new_url(module):\n # To create the URL, we need to take t... | [
"0.66425973",
"0.65290934",
"0.64784485",
"0.6391138",
"0.6334783",
"0.6291143",
"0.6275944",
"0.62580895",
"0.6257961",
"0.6254215",
"0.6222721",
"0.6197548",
"0.61817586",
"0.61761576",
"0.61630815",
"0.6116728",
"0.6090364",
"0.6049933",
"0.6026856",
"0.60260284",
"0.60106... | 0.6375497 | 4 |
Set appointment's begin date; Pass to appointment's begin time | def appointment_date(begin_date):
session.attributes['begin_date'] = str(begin_date)
qs = render_template('time')
return question(qs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_begin_date(self, begin_date):\n self.set_value_into_input_field(self.begin_date_inputbox_locator, begin_date)",
"def begin_date(self, value):\n\n if not isinstance(value, datetime):\n raise TypeError(_pretty_message(\n '''\n begin_date must be an ins... | [
"0.7065128",
"0.7005564",
"0.697397",
"0.6942992",
"0.65339845",
"0.64918524",
"0.6489678",
"0.647476",
"0.6436995",
"0.6375545",
"0.62956077",
"0.61982006",
"0.61860764",
"0.61311483",
"0.6118447",
"0.6097708",
"0.6097708",
"0.6097708",
"0.6097708",
"0.6097708",
"0.6097708",... | 0.7202706 | 0 |
Set appointment's end date; Pass to appointment's end time | def appointment_end_date(end_date):
session.attributes['end_date'] = str(end_date)
msg = render_template('end_time')
return question(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_end_date(self, date):\n pass",
"def end_date_time(self, end_date_time):\n\n self._end_date_time = end_date_time",
"def end_date(self, end_date):\n self._end_date = end_date",
"def change_end_date(self, new_end_date):\n self.end_date = new_end_date",
"def appointment_end_... | [
"0.76225775",
"0.7512484",
"0.7296414",
"0.72335875",
"0.72125554",
"0.71424943",
"0.71424943",
"0.71424943",
"0.71424943",
"0.71424943",
"0.71424943",
"0.71424943",
"0.71424943",
"0.7120749",
"0.7087847",
"0.6900266",
"0.6880423",
"0.6880423",
"0.6826085",
"0.6826085",
"0.68... | 0.78313226 | 0 |
Usage When you call the DescribeDBInstanceEncryptionKey operation, the instance must have transparent data encryption (TDE) enabled in BYOK mode. You can call the [ModifyDBInstanceTDE](~~131267~~) operation to enable TDE. | def describe_dbinstance_encryption_key_with_options(
self,
request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,
runtime: util_models.RuntimeOptions,
) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:
UtilClient.validate_model(request)
query = {}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_dbinstance_encryption_key(\n self,\n request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,\n ) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:\n runtime = util_models.RuntimeOptions()\n return self.describe_dbinstance_encryption_key_with_op... | [
"0.673887",
"0.6716472",
"0.65085775",
"0.6401395",
"0.6124461",
"0.6019866",
"0.5743563",
"0.5593969",
"0.5453083",
"0.53697926",
"0.50822043",
"0.5020621",
"0.50204563",
"0.50042874",
"0.4984543",
"0.49620974",
"0.49530983",
"0.48969638",
"0.4866419",
"0.4756271",
"0.472960... | 0.6771073 | 0 |
Usage When you call the DescribeDBInstanceEncryptionKey operation, the instance must have transparent data encryption (TDE) enabled in BYOK mode. You can call the [ModifyDBInstanceTDE](~~131267~~) operation to enable TDE. | async def describe_dbinstance_encryption_key_with_options_async(
self,
request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,
runtime: util_models.RuntimeOptions,
) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:
UtilClient.validate_model(request)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_dbinstance_encryption_key_with_options(\n self,\n request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,\n runtime: util_models.RuntimeOptions,\n ) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:\n UtilClient.validate_model(request)\n ... | [
"0.67736393",
"0.6740733",
"0.6716724",
"0.64031655",
"0.61244464",
"0.60200423",
"0.5743947",
"0.55937266",
"0.54525197",
"0.5369969",
"0.5083985",
"0.5020417",
"0.50197154",
"0.5004098",
"0.49828136",
"0.4963517",
"0.4952876",
"0.4897045",
"0.4868045",
"0.4755675",
"0.47292... | 0.6510804 | 3 |
Usage When you call the DescribeDBInstanceEncryptionKey operation, the instance must have transparent data encryption (TDE) enabled in BYOK mode. You can call the [ModifyDBInstanceTDE](~~131267~~) operation to enable TDE. | def describe_dbinstance_encryption_key(
self,
request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,
) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:
runtime = util_models.RuntimeOptions()
return self.describe_dbinstance_encryption_key_with_options(requ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_dbinstance_encryption_key_with_options(\n self,\n request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,\n runtime: util_models.RuntimeOptions,\n ) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:\n UtilClient.validate_model(request)\n ... | [
"0.6771073",
"0.6716472",
"0.65085775",
"0.6401395",
"0.6124461",
"0.6019866",
"0.5743563",
"0.5593969",
"0.5453083",
"0.53697926",
"0.50822043",
"0.5020621",
"0.50204563",
"0.50042874",
"0.4984543",
"0.49620974",
"0.49530983",
"0.48969638",
"0.4866419",
"0.4756271",
"0.47296... | 0.673887 | 1 |
Usage When you call the DescribeDBInstanceEncryptionKey operation, the instance must have transparent data encryption (TDE) enabled in BYOK mode. You can call the [ModifyDBInstanceTDE](~~131267~~) operation to enable TDE. | async def describe_dbinstance_encryption_key_async(
self,
request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,
) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:
runtime = util_models.RuntimeOptions()
return await self.describe_dbinstance_encryption_key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_dbinstance_encryption_key_with_options(\n self,\n request: dds_20151201_models.DescribeDBInstanceEncryptionKeyRequest,\n runtime: util_models.RuntimeOptions,\n ) -> dds_20151201_models.DescribeDBInstanceEncryptionKeyResponse:\n UtilClient.validate_model(request)\n ... | [
"0.6772166",
"0.6739101",
"0.671771",
"0.6509689",
"0.6125098",
"0.60211706",
"0.5744258",
"0.5594484",
"0.5452331",
"0.5370367",
"0.50826246",
"0.5019888",
"0.5019626",
"0.500507",
"0.49832922",
"0.49626267",
"0.49528944",
"0.48964608",
"0.48669487",
"0.47548133",
"0.4728359... | 0.6401872 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.