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 |
|---|---|---|---|---|---|---|
Obtains forward model for attribution calculation. | def _model_forward(self, node_feats, input_graph):
bg = input_graph.to(self.device)
bg.requires_grad = True
node_feats.requires_grad = True
if self.model_name in ['MPNN', 'AttentiveFP', 'Weave']:
edge_feats = bg.edata.pop('e').to(self.device)
edg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def training_forward(self, x):\n if self.project_parameters.loss_function == 'BCELoss':\n return self.activation_function(self.backbone_model(x))\n elif self.project_parameters.loss_function == 'CrossEntropyLoss':\n return self.backbone_model(x)",
"def _model_forward(self, X):... | [
"0.677107",
"0.6757665",
"0.674837",
"0.67461365",
"0.6693381",
"0.6662878",
"0.6653157",
"0.664764",
"0.65741944",
"0.656011",
"0.65288794",
"0.6507014",
"0.6467847",
"0.64549124",
"0.6442284",
"0.6419036",
"0.6373381",
"0.636774",
"0.636348",
"0.63589954",
"0.63437355",
"... | 0.6484258 | 12 |
Obtains list of nodes from networkx graph. | def get_nodes(self):
self.map_graph_id()
self.nodes_list = [
self.NX_GRAPHS[self.graph_id].nodes[idx]['label']
for idx in range(len(self.NX_GRAPHS[self.graph_id].nodes))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_nodes(graph):\n return graph.get_nodes()",
"def get_node_list(self):\n return [[node] for node in self.graph.nodes]",
"def get_nodes(self):\n\n return list(self.graph.nodes)",
"def nodes(self):\n nodes = list()\n for node in self._nodes:\n if isinstance(n... | [
"0.81290925",
"0.79275805",
"0.78882056",
"0.78362733",
"0.7579781",
"0.75375116",
"0.7533195",
"0.74799204",
"0.7450993",
"0.7270034",
"0.7213504",
"0.7213504",
"0.71509254",
"0.7110197",
"0.70280707",
"0.7008313",
"0.6964104",
"0.69446146",
"0.69408005",
"0.6940304",
"0.691... | 0.76716036 | 4 |
Obtains colors for the graph, unique to each monomer type. | def get_colors(self):
colors = ["#244486", "#A6A6A6", "#B12122"]
cmap = LinearSegmentedColormap.from_list("mycmap", colors)
color_palette=[cmap(i) for i in np.linspace(0, 1, len(set(self.nodes_list)))]
return dict(zip(list(set(self.nodes_list)), color_palette)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_colors():\n colors = {}\n for h in wn.synset('chromatic_color.n.01').hyponyms():\n colors[h.lemmas()[0].name()] = [l.name() for l in h.lemmas()]\n colors[h.lemmas()[0].name()].extend(all_hyponyms(h)) \n for h in wn.synset('achromatic_color.n.01').hyponyms():\n colors[h.lemmas(... | [
"0.73690313",
"0.7140867",
"0.70722073",
"0.70722073",
"0.699025",
"0.69058144",
"0.68980634",
"0.6803439",
"0.6722728",
"0.65973896",
"0.65965253",
"0.6566893",
"0.6562677",
"0.6548809",
"0.65168214",
"0.6486621",
"0.64832085",
"0.6436591",
"0.6414918",
"0.63824373",
"0.6323... | 0.69503677 | 5 |
Set the threshold of [downvotes upvotes] for msg deletion. Must be a positive integer. Or, set to 0 to disable deletion. | async def _msgvote_threshold(self, ctx, threshold: int):
if threshold < 0:
await self.bot.say("Invalid threshold. Must be a positive "
"integer, or 0 to disable.")
elif threshold == 0:
self.settings["threshold"] = threshold
dataIO.save_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDeletesThreshold(self, v):\n return self._set(deletesThreshold=v)",
"async def threshold(self, ctx, threshold: int):\n if threshold > 0:\n self.bot.db.execute(\"UPDATE starboards SET threshold = ? WHERE channel_id = ?\", (threshold, ctx.channel.id))\n await ctx.say(\"st... | [
"0.5940317",
"0.5908805",
"0.56044817",
"0.5509326",
"0.5488833",
"0.5450139",
"0.544505",
"0.5435058",
"0.53938764",
"0.53872454",
"0.52894205",
"0.5268916",
"0.5266265",
"0.5213669",
"0.52001095",
"0.52001095",
"0.52001095",
"0.52001095",
"0.52001095",
"0.5167354",
"0.51660... | 0.74709475 | 0 |
mocked_requests_get defines all mocked responses when a requests is performed. | def mocked_requests_get(*args, **kwargs):
class MockResponse:
def __init__(self, json_data, status_code):
self.json_data = json_data
self.status_code = status_code
def json(self):
return self.json_data
query_author = "books?q=" + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mocked_responses():\n with responses.RequestsMock() as rsps:\n yield rsps",
"def requestsmock():\n with requests_mock.mock() as m:\n yield m",
"def mocked_requests_get(*args, **kwargs):\n response = {'message': '',\n 'data': {\n 'cti_token': 'secret-... | [
"0.7531881",
"0.7178869",
"0.6999562",
"0.69544023",
"0.6933968",
"0.68482053",
"0.67048717",
"0.66345376",
"0.65931076",
"0.657009",
"0.653123",
"0.6503166",
"0.64620703",
"0.6447016",
"0.64323777",
"0.63772553",
"0.6268926",
"0.6258488",
"0.6243775",
"0.62221223",
"0.619187... | 0.64616627 | 13 |
Tests if returns an error page when tries to get an unknown endpoint. | def test_load_unknow_page(self):
c = Client()
response = c.get('/unknown_page/')
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def test_unknown_routes():\n response = client.get(\"/unknown_endpoint\",\n headers={\"content-type\": \"application/json\"})\n assert response.status_code == status.HTTP_404_NOT_FOUND\n asser... | [
"0.7604285",
"0.75552994",
"0.7515756",
"0.7464528",
"0.7307294",
"0.72048783",
"0.7187761",
"0.7187761",
"0.7187761",
"0.7187761",
"0.7187761",
"0.7187761",
"0.7187761",
"0.7174547",
"0.71408063",
"0.71351635",
"0.71351635",
"0.71351635",
"0.71351635",
"0.71351635",
"0.71351... | 0.7239361 | 5 |
Tests if method returns None if there is no cover found in GoogleBooks with provided ISBN. | def test_cover_url_from_googlebooks_no_image(self, mock_get):
response = gbooks_covers.find_cover_url_by_isbn(self.ISBN_no_cover)
self.assertIsNone(response)
self.assertTrue(mock_get.called) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cover_url_from_googlebooks_no_book(self, mock_get):\n\n response = gbooks_covers.find_cover_url_by_isbn(self.ISBN_no_book_cover)\n self.assertIsNone(response)\n self.assertTrue(mock_get.called)",
"def test_cover_url_from_googlebooks(self, mock_get):\n\n response = gbooks_cove... | [
"0.7490847",
"0.7001113",
"0.6592009",
"0.65657103",
"0.6133459",
"0.59422314",
"0.5904803",
"0.5710968",
"0.5694943",
"0.56120557",
"0.5571088",
"0.55514616",
"0.5391233",
"0.5372699",
"0.5372214",
"0.5368649",
"0.5362959",
"0.53527826",
"0.5335295",
"0.52933455",
"0.5259094... | 0.7264783 | 1 |
Look for args that have been flagged as environment variables and add them to the env dict with appropriate naming | def _build_env(self, args):
env = os.environ.copy()
env['ANSIBLE_CONFIG'] = os.path.join(ANSIBLE_DIR, 'ansible.cfg')
if hasattr(args, 'stdout_callback'):
env['ANSIBLE_STDOUT_CALLBACK'] = args.stdout_callback
return env | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrapper_environment(args):\n\n return {\n ENVIRONMENT_KEY: json.dumps({\n 'verbose': args.verbose,\n 'cc': shlex.split(args.cc),\n 'cxx': shlex.split(args.cxx)\n })\n }",
"def register_envvars(self, *envvars):\n invalid_envvars = [\n envv... | [
"0.6868389",
"0.6800826",
"0.6732208",
"0.6580244",
"0.6566105",
"0.64468116",
"0.63941556",
"0.63608277",
"0.630738",
"0.6280451",
"0.6234468",
"0.62079895",
"0.6146195",
"0.6136591",
"0.6127284",
"0.6126336",
"0.6111989",
"0.6111989",
"0.6111989",
"0.6111989",
"0.6111989",
... | 0.6120975 | 16 |
Configureer level en formatering van een log message handler. handler log message handler (StreamHandler, FileHandler ...) level log level voor de handler fmt formatering voor LogRecord | def customize_handler(handler, level, fmt=None, datefmt=None):
# Configureer log level
handler.setLevel(lvl_name2num(level))
# Formatering aanpassen, indien gewenst.
if fmt or datefmt:
handler.setFormatter(logging.Formatter(fmt=fmt, datefmt=datefmt))
return handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_handler(logger, handler=None, loglevel=None):\n handler.setLevel(loglevel or DEFAULT_LOGLEVEL)\n if handler.level <= logging.DEBUG:\n _fmt = '%(asctime)s| %(levelname)-4.3s|%(threadName)10.9s/' \\\n '%(lineno)04d@%(module)-10.9s| %(message)s'\n handler.setFormatter(loggin... | [
"0.71410936",
"0.6846184",
"0.6759839",
"0.67118824",
"0.66556937",
"0.653523",
"0.6491778",
"0.6488392",
"0.6471862",
"0.6428811",
"0.6426427",
"0.63734484",
"0.63734484",
"0.6346872",
"0.63066393",
"0.62816715",
"0.6277693",
"0.62670577",
"0.6266271",
"0.62510836",
"0.62316... | 0.7690557 | 0 |
Get the string representation of the type | def typestr(self) -> str:
return self.type if not self.subtype else f"{self.type}:{self.subtype}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_as_string(self):\n return self.properties.get('TypeAsString', None)",
"def getTypeString(self):\n return '_'.join(self.types)",
"def type_name(self) -> str: # pragma: no cover\n return repr_type(self.type_obj)",
"def __str__(self):\n if self.default_kind:\n re... | [
"0.83725506",
"0.8139306",
"0.803697",
"0.79991615",
"0.79512566",
"0.7894215",
"0.7891021",
"0.7813892",
"0.7790613",
"0.7785516",
"0.7738249",
"0.7675809",
"0.76395655",
"0.7588796",
"0.7588796",
"0.75342405",
"0.75011265",
"0.74362093",
"0.7364607",
"0.7353307",
"0.7350364... | 0.8024219 | 3 |
Return the cached value if possible, otherwise calcuate one | def value(self) -> Any:
if self._value_cached is not None:
return self._value_cached
self._value_cached = self._value()
return self._value_cached | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cached_value(self, value):\n\n return value",
"def _get_cached_value(self, value):\n\n if self._refreshable is True and self.is_expired is False:\n self.refresh()\n\n return deepcopy(value)",
"def memoization_get(self, key):\n memoization_prepare(self)\n return ge... | [
"0.80349547",
"0.73637474",
"0.7059764",
"0.7045762",
"0.704065",
"0.7007236",
"0.67926514",
"0.6771527",
"0.67513025",
"0.6745836",
"0.66743433",
"0.664963",
"0.66382843",
"0.6605202",
"0.6562732",
"0.65601975",
"0.65589386",
"0.65589386",
"0.65361553",
"0.65165883",
"0.6516... | 0.68457395 | 6 |
This method returnsthe area of hte square | def area(self):
return (self.__size * self.__size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_area(side):\n return side**2",
"def area(self):\n return(self.__width * self.__height)",
"def calculatearea(self):\r\n return self.width * self.height",
"def findArea(self):\n\n a, b = self.sides\n area = a * b\n print(f\"Are of rectangle is: {area}\")",
"de... | [
"0.82266515",
"0.80633795",
"0.80577517",
"0.80132765",
"0.796371",
"0.79526836",
"0.7931318",
"0.79017246",
"0.7892182",
"0.7890928",
"0.7842324",
"0.7842324",
"0.78319013",
"0.78292793",
"0.7828729",
"0.78201866",
"0.7807436",
"0.7807436",
"0.7807436",
"0.7793398",
"0.77920... | 0.7604226 | 49 |
Add HTTP Basic Auth to a blueprint. Note this is only for casual use! | def add_basic_auth(blueprint: Blueprint, username, password, realm='api'):
@blueprint.before_request
def basic_http_auth(*args, **kwargs):
auth = request.authorization
if auth is None or auth.password != password or auth.username != username:
return Response('Please login', 401, {'W... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def add_basic_auth(self, credentials: t.Tuple[str, str]) -> 'Request':\n username, password = credentials\n encoded = b64encode(f'{username}:{password}'.encode('ascii'))\n return s... | [
"0.6745427",
"0.6653836",
"0.65600157",
"0.6539326",
"0.6496776",
"0.64171004",
"0.63237566",
"0.6270818",
"0.6264179",
"0.62448317",
"0.6244351",
"0.62169075",
"0.6209673",
"0.6133252",
"0.6108618",
"0.6100245",
"0.60786664",
"0.5996852",
"0.5956994",
"0.5933116",
"0.5929417... | 0.8427172 | 0 |
Sends a 401 response that enables basic auth | def authenticate():
return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm="api"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 proper credentials', 401,\n {'WWW-Authenticate': 'Basic realm=\"Login Required\"'})",
"def authenticate(self):\n... | [
"0.8092701",
"0.7958592",
"0.78515536",
"0.7842773",
"0.782448",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"0.7810809",
"... | 0.80936307 | 0 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
if len(output[0]) < topk[1]:
topk = (1, len(output[0]))
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:... | {
"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 |
Decay learning rates of the generator and discriminator. | def update_lr(self, g_lr, d_lr):
for param_group in self.g_optimizer.param_groups:
param_group['lr'] = g_lr
for param_group in self.d_optimizer.param_groups:
param_group['lr'] = d_lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decay(self):\n if self.l_rate > self.l_rate_bound[0] and self.l_rate - self.decay_rate > 0.0:\n self.l_rate -= self.decay_rate\n elif self.l_rate - self.decay_rate <= 0.0 or self.l_rate < self.l_rate_bound[0]:\n self.l_rate = self.l_rate_bound[0]\n\n for layer in self... | [
"0.69800407",
"0.69008964",
"0.65939236",
"0.65939236",
"0.651923",
"0.6506983",
"0.6446803",
"0.6434023",
"0.6434023",
"0.642687",
"0.6407774",
"0.6384823",
"0.6372518",
"0.6351471",
"0.63472474",
"0.6335245",
"0.6305104",
"0.6275327",
"0.6244698",
"0.62416416",
"0.62313867"... | 0.0 | -1 |
Reset the gradient buffers. | def reset_grad(self):
self.g_optimizer.zero_grad()
self.d_optimizer.zero_grad() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_grad(self):\n self.unet.zero_grad()",
"def reset_grad(self):\n self.g_optimizer.zero_grad()\n self.d_optimizer.zero_grad()\n self.dr_optimizer.zero_grad()",
"def reset_grad(self):\r\n self.unet.zero_grad()",
"def reset_grad(self):\n self.optimizer.zero_grad... | [
"0.7156704",
"0.71406925",
"0.71314186",
"0.70542574",
"0.7002798",
"0.6996964",
"0.69681984",
"0.6928698",
"0.678635",
"0.67519945",
"0.6728927",
"0.6691359",
"0.668999",
"0.66764534",
"0.66677326",
"0.6606647",
"0.65908575",
"0.65665776",
"0.6560536",
"0.65319395",
"0.65314... | 0.71080565 | 5 |
Get the width of the image. | def width(self):
return self.__size[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWidth(self):\n return self._image.width()",
"def width(self) -> int:\n return self._image_data.width",
"def getWidth(self):\n return _tkCall(self.image.width)",
"def get_width(self):\n width = np.size(self.img, 0)\n return width",
"def getWidth(self):\n return _... | [
"0.8995685",
"0.8949091",
"0.8556151",
"0.824331",
"0.790027",
"0.78577334",
"0.7837751",
"0.7804091",
"0.7801145",
"0.7801145",
"0.7801145",
"0.7801145",
"0.7768775",
"0.77654135",
"0.7744669",
"0.7744669",
"0.7744669",
"0.77310777",
"0.77310777",
"0.77192825",
"0.7679018",
... | 0.6985301 | 90 |
Get the height of the image. | def height(self):
return self.__size[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHeight(self):\n return self._image.height()",
"def height(self) -> int:\n return self._image_data.height",
"def getHeight(self):\n return _tkCall(self.image.height)",
"def get_height(self):\n height = np.size(self.img, 1)\n return height",
"def GetHeight(*args, **kwarg... | [
"0.89748824",
"0.8829107",
"0.8663871",
"0.84905857",
"0.79477125",
"0.7925694",
"0.7743584",
"0.772428",
"0.7720552",
"0.77103657",
"0.77103657",
"0.7681656",
"0.76748854",
"0.7626269",
"0.7618161",
"0.7618161",
"0.7618161",
"0.7618161",
"0.7614721",
"0.7602925",
"0.7585203"... | 0.754124 | 26 |
Returns a dictionary containing dataframes corresponding to cities. | def create_empty_city_dataframes(cities=cities, pflag=0):
assert isinstance(cities, dict)
assert all(isinstance(cities[state], list) for state in cities.keys())
assert os.path.exists(os.path.abspath('ProjectWorkspace.py'))
dataframe_dict = dict()
for state in cities.keys():
dataframe_dict[st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cities_weather(cities):\n result = pd.DataFrame()\n for city in cities:\n print(city)\n weather = ask_google_weather(city=city)\n weather = pd.DataFrame.from_dict(weather)\n result = pd.concat([result, weather], axis=0)\n result.reset_index(drop=True, inplace=True)\n ret... | [
"0.677241",
"0.65106684",
"0.6281531",
"0.6198236",
"0.6069549",
"0.59829396",
"0.59826714",
"0.5934217",
"0.5895753",
"0.5858749",
"0.58536977",
"0.5851927",
"0.5831677",
"0.5821156",
"0.58144486",
"0.5799305",
"0.5796243",
"0.57887226",
"0.5781928",
"0.578183",
"0.5734997",... | 0.74409205 | 0 |
Create seaborn correlation plot for input data frame. | def create_correlation_plot(df):
xdata = df.iloc[:, 0]
ydata = df.iloc[:, 1]
plt.clf
plt.figure(figsize=(20, 18))
sns.regplot(xdata, ydata, marker='o', data=df.index)
plt.title(f'{df.columns[0]} vs. {df.columns[1]}', color='k')
plt.xlabel(f'{df.columns[0]}', color='k')
plt.ylabel(f'{df.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_corr_plot():\r\n fig = plt.figure(figsize=(12, 12))\r\n ax = fig.add_subplot",
"def correlation_analysis(df, fig_size=(5,4), path=None):\n plt.clf()\n f, ax = plt.subplots(1, figsize=fig_size)\n corr = round(df.corr(), 4)\n sns.heatmap(corr, \n xtick... | [
"0.7246692",
"0.7127118",
"0.7126872",
"0.70759445",
"0.69986576",
"0.6995005",
"0.6845343",
"0.6835253",
"0.6832345",
"0.67997134",
"0.6635098",
"0.6589663",
"0.6564202",
"0.6563729",
"0.65554374",
"0.6549514",
"0.6549514",
"0.652232",
"0.64561737",
"0.64467824",
"0.64396423... | 0.76254743 | 0 |
Create dataclass from dictionary. All unused elements from dictionary are discarded | def instantiate(cls, dct):
# Dataclasses are instantiated from dictionaries
if is_dataclass(cls) :
par = {}
for f in fields(cls):
nm = f.name
ty = f.type
# Skip instantiation of missing fields with default value
if not (nm in dct) and f.default != ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, d):\n return loadd(d, cls)",
"def from_dict(cls, odic):\n return dacite.from_dict(data_class=cls, data=odic)",
"def from_dict(cls, dikt) -> 'Data':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, data):\n return cls(**data)",
"def from_dict(cl... | [
"0.7271921",
"0.7149666",
"0.7144027",
"0.71174437",
"0.70661217",
"0.702781",
"0.7019348",
"0.69003373",
"0.68942803",
"0.68271387",
"0.679622",
"0.67839783",
"0.6766451",
"0.6763817",
"0.674694",
"0.67236453",
"0.67236453",
"0.67236453",
"0.67236453",
"0.67236453",
"0.67236... | 0.6309223 | 97 |
Assert two template dicts are equal. | def assert_template_dicts(obj1: Any, obj2: Any) -> None:
assert to_template_dict(obj1) == to_template_dict(obj2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_01_is_equal_true(self):\n\n dict1 = {\"a\": \"1\", \"b\": \"2\"}\n dict2 = {\"a\": \"1\", \"b\": \"2\"}\n items_equal = utils.is_equal(dict1, dict2)\n self.assertTrue(items_equal)",
"def assertOrderedDictEqual(self, first, second):\n self.assertEqual(list(first.keys())... | [
"0.768882",
"0.7384812",
"0.7302259",
"0.723902",
"0.71761453",
"0.68514156",
"0.6841122",
"0.68154883",
"0.6761176",
"0.6638353",
"0.66266954",
"0.6622963",
"0.6608665",
"0.65642786",
"0.65540904",
"0.6534379",
"0.6531314",
"0.6524379",
"0.64973015",
"0.6403487",
"0.6361722"... | 0.84628654 | 0 |
Test _validate_supported_codec raise ValueError. | def test__validate_supported_codec_raise_value_error(self) -> None:
with pytest.raises(ValidationError) as excinfo:
ArgsDataModel(codec="foo")
assert excinfo.value.errors() == [
{
"loc": ("codec",),
"msg": f"Codec 'foo' must be one of: {', '.join(C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_codec(self):\n codecs = list(set([s[\"codec\"] for s in self.segments]))\n for c in codecs:\n if c != \"h264\":\n raise P1203StandaloneError(\"Unsupported codec: {}\".format(c))",
"def test_decoding_non_str_fails(self):\n self.assertRaises(DecodingError, b... | [
"0.7600213",
"0.66457534",
"0.65347075",
"0.6338999",
"0.61951196",
"0.6175674",
"0.611469",
"0.61115617",
"0.60953045",
"0.60518366",
"0.60212415",
"0.5969374",
"0.5964303",
"0.5941351",
"0.5941306",
"0.58573884",
"0.5852569",
"0.5851717",
"0.5809242",
"0.5807919",
"0.579893... | 0.81727165 | 0 |
Construct and use a GreedyVarianceReduction allocator. | def f() -> None:
x = torch.rand(7, 3).to(self.device)
kernel = ScaleKernel(MaternKernel())
allocator = GreedyVarianceReduction()
allocator.allocate_inducing_points(x, kernel, 4, x.shape[:-2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_ng(self, var_manager, budget):\r\n\r\n for var_name, var_dict in var_manager.variable_info.items():\r\n\r\n if var_dict['grad_free'] is False:\r\n continue\r\n\r\n if type(var_dict['grad_free']) == tuple:\r\n mu, sigma = var_dict['grad_free']\r\n... | [
"0.5591245",
"0.53230095",
"0.5284148",
"0.5158194",
"0.50883824",
"0.4925847",
"0.49215353",
"0.48731327",
"0.48665214",
"0.48507273",
"0.48452792",
"0.48426765",
"0.48336542",
"0.48079416",
"0.48010558",
"0.47966725",
"0.47935086",
"0.47852623",
"0.47837988",
"0.47743943",
... | 0.55896 | 1 |
Create a zero or zeros sequence Tensor like ``xs`` with a flag ``stop_graident=False`` . | def _zeros_like_with_grad(xs):
if not isinstance(xs, typing.Sequence):
ys = paddle.zeros_like(xs)
ys.stop_gradient = False
else:
ys = []
for x in xs:
y = paddle.zeros_like(x)
y.stop_gradient = False
ys.append(y)
return ys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)",
"def sp_zeros_like(x):\r\n\r\n # TODO: don't restrict to CSM formats\r\n _, _, indptr, shape = csm_properties(x)\r\n return CSM(format=x.format)(data=numpy.array([], dtype=x.type.dtype),\r\n i... | [
"0.675297",
"0.65332",
"0.6484068",
"0.63322335",
"0.62441754",
"0.62349343",
"0.6150928",
"0.61422604",
"0.6129888",
"0.6056266",
"0.601512",
"0.6009264",
"0.59898627",
"0.5971158",
"0.5968671",
"0.5943376",
"0.59402204",
"0.5940153",
"0.59227574",
"0.5908566",
"0.58920956",... | 0.6354818 | 3 |
The shape of flattened Jacobian matrix. | def shape(self):
return self._jacobian.shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self.to_array().shape",
"def shape(self):\n return self.symbolic.shape",
"def shape(self):\n return np.shape(self.MJD)",
"def shape(self):\n return self.X.shape",
"def shape(self):\n return self.array.shape",
"def matrix_shape(matrix):\n ret... | [
"0.6889995",
"0.6873796",
"0.6737198",
"0.66613376",
"0.66115713",
"0.65902203",
"0.65902203",
"0.65808403",
"0.65808403",
"0.6580456",
"0.6504967",
"0.64746857",
"0.6454255",
"0.6395666",
"0.6394811",
"0.63797563",
"0.6373186",
"0.6335526",
"0.6315055",
"0.629412",
"0.627907... | 0.79118663 | 0 |
The shape of flattened Hessian matrix. | def shape(self):
return self.symbolic.shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self.X.shape",
"def get_input_shape(self):\n return self.__x.shape",
"def __len__(self):\n return self.flatten_dim(self.shape[0])",
"def shape(self):\n return self.to_array().shape",
"def shape(self):\n return self._jacobian.shape",
"def kernel... | [
"0.66419446",
"0.65916127",
"0.65718883",
"0.6488848",
"0.6437589",
"0.6396285",
"0.6367403",
"0.63660544",
"0.63461757",
"0.6342537",
"0.6319948",
"0.6319948",
"0.6314499",
"0.62932974",
"0.62438405",
"0.62438405",
"0.62438405",
"0.62438405",
"0.62438405",
"0.6236529",
"0.62... | 0.6374386 | 6 |
Whether a member has been deleted | def is_deleted(self):
return 'deleted_at' in self._dict and bool(self._dict['deleted_at']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_deleted(self):\n if self.deleted:\n return True\n return False",
"def deleted(self) -> bool:\n return pulumi.get(self, \"deleted\")",
"def is_deleted(self):\n return self._is_record_status(self.DELETED)",
"def is_deleted(self):\n return self.state == Track... | [
"0.7737721",
"0.7628708",
"0.71311224",
"0.71236676",
"0.71236676",
"0.6986995",
"0.6886727",
"0.67946184",
"0.678187",
"0.6772974",
"0.6714008",
"0.66912466",
"0.66277844",
"0.64843905",
"0.64664745",
"0.6457902",
"0.64564925",
"0.64435387",
"0.6424539",
"0.6422907",
"0.6416... | 0.689616 | 6 |
Returns the Channels Group name to use for sending notifications. | def group_name(self):
return "device-%s" % self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_name(self):\n return self.groupname",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self):\n\n return self._group_name",
"def group_name(self):\n\t\treturn \"DocumentChat-%s\" % self.id",
"def group(self) -> str:\n return... | [
"0.7562947",
"0.7459391",
"0.7313024",
"0.7289817",
"0.71942765",
"0.7179899",
"0.7132132",
"0.70859176",
"0.7054288",
"0.7048387",
"0.70382917",
"0.70308083",
"0.70308083",
"0.69815993",
"0.6968596",
"0.6968596",
"0.6927066",
"0.69154215",
"0.68633115",
"0.68633115",
"0.6857... | 0.6940314 | 16 |
Prints a confusion matrix, as returned by sklearn.metrics.confusion_matrix, as a heatmap. Arguments | def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=18):
df_cm = pd.DataFrame(
confusion_matrix, index=class_names, columns=class_names,
)
fig = plt.figure(figsize=figsize)
try:
heatmap = sns.heatmap(df_cm, annot=True, fmt="d")
except ValueError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def showConfusionMatrix(self): \r\n sn.heatmap(self.conf_matrix, annot=True)\r\n plt.plot( label=\"Accuracy\")\r\n plt.plot( label=\"Error\")\r\n plt.figtext(0,0,'Accuracy: {}\\nError: {}\\nRecall: {}\\nPrecision: {}'.format(self.accuracy,\r\n ... | [
"0.80755705",
"0.8071822",
"0.798623",
"0.797623",
"0.7917525",
"0.79048616",
"0.7782778",
"0.7654174",
"0.76031286",
"0.7590769",
"0.75481963",
"0.74898654",
"0.7444642",
"0.7427823",
"0.74261343",
"0.7407815",
"0.74045",
"0.7402678",
"0.73859674",
"0.73857117",
"0.7379863",... | 0.7982271 | 3 |
r"""Returns the number of features per edge in the dataset. | def num_edge_features(self):
return self[0].num_edge_features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_edge_features(self) -> int:\n data, _, _ = self[0]\n if hasattr(data, 'num_edge_features'):\n return data.num_edge_features\n raise AttributeError(f\"'{data.__class__.__name__}' object has no \"\n f\"attribute 'num_edge_features'\")",
"def edgec... | [
"0.8566831",
"0.79432946",
"0.78410506",
"0.772038",
"0.76478434",
"0.7645892",
"0.7536793",
"0.7502153",
"0.74898654",
"0.74622643",
"0.74597126",
"0.7431437",
"0.7415829",
"0.7387756",
"0.73798543",
"0.7323974",
"0.72991294",
"0.7296228",
"0.72546446",
"0.72371554",
"0.7213... | 0.84992343 | 1 |
check if a string is a number or not | def isNumber(string):
for char in string:
charNum = ord(char)
if (charNum < 48 or charNum > 57):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)",
"def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False",
"def is_number(string):\n try:\n float(string)\n return True\n except ValueErro... | [
"0.865223",
"0.85058707",
"0.8495304",
"0.8490961",
"0.8481647",
"0.83910114",
"0.837488",
"0.8349926",
"0.8349926",
"0.8349926",
"0.83410865",
"0.82812905",
"0.82808816",
"0.8265786",
"0.8153745",
"0.81133115",
"0.809853",
"0.8086713",
"0.8068105",
"0.8008666",
"0.8002422",
... | 0.7563921 | 48 |
Return the URL to dismiss this message. | def dismiss_url(self) -> str:
# you can't dismiss a message that hasn't been saved yet
if not self.id:
return ""
if not self.is_dismissable:
return ""
return reverse("persistent_messages:dismiss_message", args=[self.id]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return reverse('detalle-del-mensaje', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('message-detail', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('message_detail', args=[str(self.id)])",
"def unsubscribe_url(se... | [
"0.66145533",
"0.6509419",
"0.6474384",
"0.6301061",
"0.62584996",
"0.6257894",
"0.6236549",
"0.60063994",
"0.5914091",
"0.5841969",
"0.5821715",
"0.58212805",
"0.57705396",
"0.5757952",
"0.5754154",
"0.5712313",
"0.5706629",
"0.5702621",
"0.56640136",
"0.56640136",
"0.553966... | 0.859227 | 0 |
Instantiate a resource object from saved params and local params | def from_json(self, params: JSONDict, local_params: JSONDict, workspace: Workspace) -> Resource:
return ApiResource(params["name"], params["role"], workspace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: Optional[InstanceArgs] = None,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOption... | [
"0.68180245",
"0.6652243",
"0.66084814",
"0.6598713",
"0.65427905",
"0.65343577",
"0.6513341",
"0.6513341",
"0.6513341",
"0.6513341",
"0.6513341",
"0.6513341",
"0.65025306",
"0.64923376",
"0.6447289",
"0.64384425",
"0.64384425",
"0.64384425",
"0.64384425",
"0.6437049",
"0.642... | 0.663771 | 2 |
Given the arguments passed in to create a resource, suggest a name for the case where the user did not provide one via name. This will be used by suggest_resource_name() to find a short, but unique name for the resource. | def suggest_name(self, workspace: Workspace, role: str, *args) -> str:
return role + "-api" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AutoName(base, resource, *args):\n auto_name = '%s-%s' % (base, '-'.join(list(args) + [default.AKA[resource]]))\n if not RFC1035_RE.match(auto_name):\n raise Error('\"%s\" name for type %s does not match RFC1035 regex (%s)' %\n (auto_name, resource, RFC1035_RE.pattern))\n return auto_name"... | [
"0.65720713",
"0.5812219",
"0.5801418",
"0.5801418",
"0.5801418",
"0.5801418",
"0.5801418",
"0.5456286",
"0.544371",
"0.5409685",
"0.5409685",
"0.53318447",
"0.5324971",
"0.5317554",
"0.53116643",
"0.5278829",
"0.52405816",
"0.5222712",
"0.52215725",
"0.518416",
"0.5143749",
... | 0.57693726 | 7 |
Test for if there is no input given to the request. In must give Wrong input. Please give an appropriate input!! error | def test_no_input(self):
resp = SearchTest.client.get('/api/search/')
self.assertEqual(json.loads(resp.content),"You give your input in wrong format. Please check the API documentation for the appropriate input format!!","No Input Test Error") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_for_incomplete_input(self):\n pass",
"def validate_input(self, *args):\n return",
"def isInputValid(self, input):\r\n pass",
"def _is_valid_input(self, parameter_name):\n raise NotImplementedError()",
"def validate_user_input(user_input):\n responses = ['t', 'r', '... | [
"0.6972856",
"0.67866445",
"0.6782777",
"0.65211105",
"0.6511052",
"0.6449751",
"0.64474857",
"0.6398483",
"0.63954777",
"0.63588244",
"0.6326576",
"0.6320246",
"0.6251278",
"0.6225876",
"0.62131786",
"0.6139479",
"0.61390823",
"0.6135849",
"0.6115806",
"0.6109763",
"0.609849... | 0.69513834 | 1 |
A LambdaRequest must have the following key value pairs to be valid. | def __init__(self, action, resource, instance_id, username, token):
self.action = action
self.resource = resource
self.instance_id = instance_id
self.username = username
self.token = token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_request_valid(request):\n valid_keys = ('action', 'time', 'data', 'token', 'address')\n is_keys_valid = all(key in request for key in valid_keys)\n\n return is_keys_valid",
"def _ValidRequest(request):\n if not request.json:\n abort(400)\n sessId = request.json['sessionId']\n sess... | [
"0.66474664",
"0.639454",
"0.6254029",
"0.61716",
"0.61260843",
"0.6124379",
"0.6115892",
"0.6089174",
"0.60586613",
"0.60456234",
"0.5963272",
"0.5902959",
"0.5863171",
"0.58425826",
"0.58331096",
"0.578548",
"0.57587516",
"0.57334167",
"0.57157695",
"0.5712963",
"0.5654324"... | 0.0 | -1 |
Add a new experience to memory. | def add(
self,
state: np.ndarray,
action: np.ndarray,
reward: np.float64,
next_state: np.ndarray,
done: float,
):
data = (state, action, reward, next_state, done)
if len(self.buffer) == self.buffer_size:
self.buffer[self.idx] = data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)",
"def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st... | [
"0.79568833",
"0.79042006",
"0.78795445",
"0.7577913",
"0.7570969",
"0.74478436",
"0.7361023",
"0.72697705",
"0.721816",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"... | 0.0 | -1 |
Add experiences to memory. | def extend(self, transitions: list):
for transition in transitions:
self.add(*transition) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)",
"def add(self, experience):\n self.buffer.append(experience)",
"def add(self, state, action, reward, next_state... | [
"0.7413625",
"0.7324363",
"0.7284591",
"0.7197588",
"0.7182374",
"0.71292293",
"0.70409894",
"0.7027297",
"0.6940904",
"0.6837658",
"0.68274903",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
"0.6813665",
... | 0.0 | -1 |
Return the current size of internal memory. | def __len__(self) -> int:
return len(self.buffer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8573752",
"0.82169205",
"0.8200361",
"0.8087402",
"0.8021614",
"0.7890747",
"0.78219426",
"0.78017354",
"0.77905464",
"0.7758844",
"0.77559924",
"0.77559924",
"0.775519",
"0.77544576",
"0.7733221",
"0.7732168",
"0.7720068",
"0.77145016",
"0.77092093",
"0.77077913",
"0.7697... | 0.0 | -1 |
Add a new transition to memory. | def add(self, transition: Tuple[np.ndarray, ...]) -> Tuple[Any, ...]:
self.n_step_buffer.append(transition)
# single step transition is not ready
if len(self.n_step_buffer) < self.n_step:
return ()
# add a multi step transition
reward, next_state, done = get_n_step_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_transition(self, state, action, reward, next_state, done):\n transition = Transition(state, action, reward, next_state, done)\n if self.size < self.capacity:\n self.memory.append(transition)\n else:\n self.memory[self.size % self.capacity] = transition\n\n ... | [
"0.80813277",
"0.8003553",
"0.79276067",
"0.7868197",
"0.77967376",
"0.72484",
"0.7240216",
"0.722328",
"0.70827883",
"0.70740074",
"0.70740074",
"0.7022395",
"0.69172335",
"0.6891959",
"0.6891959",
"0.6859183",
"0.68511873",
"0.679581",
"0.67272574",
"0.6721344",
"0.66817456... | 0.73557496 | 5 |
Return the current size of internal memory. | def __len__(self) -> int:
return len(self.episodes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8573752",
"0.82169205",
"0.8200361",
"0.8087402",
"0.8021614",
"0.7890747",
"0.78219426",
"0.78017354",
"0.77905464",
"0.7758844",
"0.77559924",
"0.77559924",
"0.775519",
"0.77544576",
"0.7733221",
"0.7732168",
"0.7720068",
"0.77145016",
"0.77092093",
"0.77077913",
"0.7697... | 0.0 | -1 |
Returns the size of the block. | def getSize(self):
return self.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_size(self):\n\n return self._block_size",
"def block_size(self, block_id): # -> int:\n ...",
"def get_length(self):\n\t\treturn len(self._blocks)",
"def physical_block_size(self) -> int:\n return self._physical_block_size",
"def logical_block_size(self) -> int:\n retur... | [
"0.8573685",
"0.8413342",
"0.826121",
"0.7950773",
"0.78979844",
"0.7576407",
"0.75350296",
"0.74588174",
"0.7418291",
"0.74119425",
"0.74021655",
"0.7388674",
"0.7386702",
"0.7386702",
"0.73838186",
"0.737626",
"0.73748934",
"0.7373209",
"0.7357",
"0.7347926",
"0.7347926",
... | 0.7167219 | 71 |
Returns the image name string used by the block. This is the file path to the image. | def getImageName(self):
return self.imageName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_name(self) -> str:\n return self._image_name",
"def image_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"image_name\")",
"def name(self, strippath=False):\n return _image.image_name(self, strippath)",
"def _get_image_name(self) -> str:\n dirname ... | [
"0.7994806",
"0.7841884",
"0.7586313",
"0.7467213",
"0.738079",
"0.738079",
"0.7356179",
"0.7145622",
"0.7136507",
"0.7126233",
"0.70896703",
"0.7000535",
"0.6944954",
"0.694073",
"0.69366074",
"0.68921316",
"0.6831386",
"0.6808438",
"0.6808438",
"0.6808438",
"0.6808438",
"... | 0.768592 | 2 |
return the middle value of three numbers | def _mid(a,b,c):
if a<=b<=c or c<=b<=a:
return b
elif b<=a<=c or c<=a<=b:
return a
elif a<=c<=b or b<=c<=a:
return c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_middle():\n num_list = session_attributes[NUMBER_LIST_KEY]\n return num_list[round(len(num_list) / 2) - 1] # Subtract 1 since arrays start at 0",
"def middle(self):\n return (self.lo+self.hi)/2",
"def _median_of_three(array, lower, upper):\n mid = (lower + upper) // 2\n a = array[l... | [
"0.7099691",
"0.69979155",
"0.6997722",
"0.6816176",
"0.65523803",
"0.65324694",
"0.6439322",
"0.6426108",
"0.6394656",
"0.6374244",
"0.6362339",
"0.6298763",
"0.6295643",
"0.62954456",
"0.6271927",
"0.6147953",
"0.61343753",
"0.6107061",
"0.6059675",
"0.6040536",
"0.6040506"... | 0.7084913 | 1 |
Configuration of findings limit given for specified infoTypes. Structure is documented below. | def max_findings_per_info_types(self) -> Optional[List['outputs.PreventionInspectTemplateInspectConfigLimitsMaxFindingsPerInfoType']]:
return pulumi.get(self, "max_findings_per_info_types") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info_type(self) -> 'outputs.PreventionInspectTemplateInspectConfigLimitsMaxFindingsPerInfoTypeInfoType':\n return pulumi.get(self, \"info_type\")",
"def limit(self, limit):\n raise NotImplementedError(\"This should have been implemented.\")",
"def _determine_limit(self, limit):\n\n # N... | [
"0.6146332",
"0.5686115",
"0.565774",
"0.5583004",
"0.553094",
"0.547629",
"0.5473567",
"0.54532516",
"0.54506534",
"0.54257137",
"0.54055405",
"0.54031897",
"0.5389581",
"0.5375157",
"0.53422886",
"0.5338949",
"0.5316945",
"0.5316534",
"0.5284045",
"0.52554274",
"0.52471274"... | 0.6930761 | 0 |
Max findings limit for the given infoType. | def max_findings(self) -> float:
return pulumi.get(self, "max_findings") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_findings_per_info_types(self) -> Optional[List['outputs.PreventionInspectTemplateInspectConfigLimitsMaxFindingsPerInfoType']]:\n return pulumi.get(self, \"max_findings_per_info_types\")",
"def _determine_limit(self, limit):\n\n # Note: +1 is allowed here because it allows\n # the use... | [
"0.70332",
"0.6528695",
"0.64451694",
"0.63915014",
"0.63686633",
"0.62867457",
"0.6284311",
"0.62510824",
"0.6103835",
"0.6103835",
"0.61014163",
"0.60127634",
"0.5974066",
"0.59692436",
"0.5945025",
"0.59292126",
"0.59292126",
"0.5884785",
"0.58601826",
"0.58496225",
"0.581... | 0.66320884 | 1 |
Words or phrases defining the dictionary. The dictionary must contain at least one phrase and every phrase must contain at least 2 characters that are letters or digits. | def words(self) -> List[str]:
return pulumi.get(self, "words") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_password_dictionary(value):\r\n password_max_edit_distance = getattr(settings, \"PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD\", None)\r\n password_dictionary = getattr(settings, \"PASSWORD_DICTIONARY\", None)\r\n\r\n if password_max_edit_distance and password_dictionary:\r\n for word i... | [
"0.6355287",
"0.62820494",
"0.62028193",
"0.61561894",
"0.61058146",
"0.61007786",
"0.6093594",
"0.6056923",
"0.599067",
"0.5973913",
"0.5971841",
"0.59448636",
"0.5917401",
"0.5911996",
"0.5900066",
"0.58779466",
"0.5862284",
"0.5849539",
"0.58412576",
"0.5839784",
"0.583048... | 0.0 | -1 |
Set the likelihood of a finding to a fixed value. Either this or relative_likelihood can be set. Possible values are `VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`. | def fixed_likelihood(self) -> Optional[str]:
return pulumi.get(self, "fixed_likelihood") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_likelihood(self) -> Optional[float]:\n return pulumi.get(self, \"relative_likelihood\")",
"def _approximate_constant(self, value, num, lobatto, use_mp, dps):\n self._approximate(lambda x: value, num, lobatto, use_mp, dps)",
"def constrain_fixed(self, value=None, warning=True, trigger... | [
"0.55545896",
"0.5175515",
"0.51713747",
"0.5123791",
"0.5119494",
"0.5104539",
"0.5073762",
"0.5059409",
"0.5037504",
"0.5027481",
"0.49439418",
"0.49439418",
"0.49439418",
"0.49439418",
"0.49439418",
"0.49222672",
"0.492003",
"0.49168822",
"0.49062216",
"0.4904987",
"0.4897... | 0.60319203 | 0 |
The name of the template to run when this job is triggered. | def inspect_template_name(self) -> str:
return pulumi.get(self, "inspect_template_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"template_name\")",
"def launch_template_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"launch_template_name\")",
"def template_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(... | [
"0.81138676",
"0.8055212",
"0.79743624",
"0.7819991",
"0.7815804",
"0.7790578",
"0.7753112",
"0.72410977",
"0.7171027",
"0.69916177",
"0.6975082",
"0.69562757",
"0.69187653",
"0.68314165",
"0.6802381",
"0.67973626",
"0.67636186",
"0.6716757",
"0.671088",
"0.671088",
"0.667031... | 0.75674635 | 7 |
Set of files to scan. Structure is documented below. | def table_reference(self) -> 'outputs.PreventionJobTriggerInspectJobStorageConfigBigQueryOptionsTableReference':
return pulumi.get(self, "table_reference") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_in_files():\r\n\tindatadir = '/nobackup/ejblom/reddit'\r\n\tcom_dir = '/comments'\r\n\tsubm_dir = '/submissions'\r\n\tglob_end = '/filtered*'\r\n\tcom_glob_str = indatadir + com_dir + glob_end\r\n\tsubm_glob_str = indatadir + subm_dir + glob_end\r\n\tinfilenames = sorted(glob.glob(com_glob_str)) + sorted(g... | [
"0.6767385",
"0.673401",
"0.66309094",
"0.6627138",
"0.658119",
"0.65786076",
"0.65786076",
"0.65512365",
"0.64952314",
"0.649171",
"0.6390174",
"0.6346995",
"0.6329438",
"0.6317168",
"0.63007855",
"0.62811357",
"0.62546664",
"0.6253678",
"0.6237987",
"0.6232",
"0.6231208",
... | 0.0 | -1 |
Set of files to scan. Structure is documented below. | def file_set(self) -> 'outputs.PreventionJobTriggerInspectJobStorageConfigCloudStorageOptionsFileSet':
return pulumi.get(self, "file_set") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_in_files():\r\n\tindatadir = '/nobackup/ejblom/reddit'\r\n\tcom_dir = '/comments'\r\n\tsubm_dir = '/submissions'\r\n\tglob_end = '/filtered*'\r\n\tcom_glob_str = indatadir + com_dir + glob_end\r\n\tsubm_glob_str = indatadir + subm_dir + glob_end\r\n\tinfilenames = sorted(glob.glob(com_glob_str)) + sorted(g... | [
"0.67633045",
"0.6734976",
"0.66269386",
"0.6626528",
"0.6581073",
"0.65746033",
"0.65746033",
"0.65495414",
"0.6492876",
"0.6490763",
"0.63891363",
"0.63462466",
"0.6325866",
"0.63149476",
"0.62970704",
"0.627791",
"0.62548035",
"0.6254756",
"0.62339306",
"0.6233228",
"0.623... | 0.0 | -1 |
Max number of bytes to scan from a file. If a scanned file's size is bigger than this value then the rest of the bytes are omitted. | def bytes_limit_per_file(self) -> Optional[float]:
return pulumi.get(self, "bytes_limit_per_file") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_files(self):\n\n return 10 ** self.int_len(self.cnt_files())",
"def size_limit_in_bytes(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"size_limit_in_bytes\")",
"def max_size_bytes(self) -> Optional[float]:\n return pulumi.get(self, \"max_size_bytes\")",
"def fs... | [
"0.7336007",
"0.6992155",
"0.6776653",
"0.67128235",
"0.66166985",
"0.6613381",
"0.6510247",
"0.6479228",
"0.6448904",
"0.6414842",
"0.64072883",
"0.6385317",
"0.6371549",
"0.63679975",
"0.635055",
"0.6323714",
"0.6294158",
"0.6289912",
"0.62657714",
"0.62341505",
"0.62286055... | 0.7657663 | 0 |
The name of a Cloud Storage bucket. | def bucket_name(self) -> str:
return pulumi.get(self, "bucket_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucket_name(self) -> str:\n ...",
"def bucket_name(self) -> str:\n return jsii.get(self, \"bucketName\")",
"def bucket_name(self) -> str:\n return jsii.get(self, \"bucketName\")",
"def bucket_name(self) -> str:\n return self._values.get('bucket_name')",
"def bucket_name(self... | [
"0.8537322",
"0.8530399",
"0.8530399",
"0.8456283",
"0.81805956",
"0.8159695",
"0.81413",
"0.81413",
"0.81413",
"0.81413",
"0.81413",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.8044478",
"0.7933762... | 0.86645687 | 0 |
A representation of a Datastore kind. Structure is documented below. | def kind(self) -> 'outputs.PreventionJobTriggerInspectJobStorageConfigDatastoreOptionsKind':
return pulumi.get(self, "kind") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind(self):\n return self.get_data(\"kind\")",
"def kind(self):\n return self._kind",
"def kind(self):\n return self._kind",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -... | [
"0.7517032",
"0.7039956",
"0.7039956",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
"0.68719137",
... | 0.5946753 | 56 |
The name of the Datastore kind. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kind_name(self) -> str:\n\n return self.kindName_",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n ... | [
"0.7589233",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"0.7560791",
"... | 0.0 | -1 |
When the job is started by a JobTrigger we will automatically figure out a valid startTime to avoid scanning files that have not been modified since the last time the JobTrigger executed. This will be based on the time of the execution of the last run of the JobTrigger. | def enable_auto_population_of_timespan_config(self) -> Optional[bool]:
return pulumi.get(self, "enable_auto_population_of_timespan_config") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime",
"def get_starttime(self):\n filetime = datetime.datetime.strptime(self.filenametime,\n \"%Y%m%d_%H%M%S\")\n ... | [
"0.7105928",
"0.67686945",
"0.6555243",
"0.65165955",
"0.64886606",
"0.6459843",
"0.6456194",
"0.6448518",
"0.6387918",
"0.63415974",
"0.630796",
"0.630796",
"0.630796",
"0.6303738",
"0.6293288",
"0.62766254",
"0.6238012",
"0.6158567",
"0.613741",
"0.613741",
"0.6119199",
"... | 0.0 | -1 |
The name of the Datastore kind. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kind_name(self) -> str:\n\n return self.kindName_",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n ... | [
"0.7590219",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",
"0.75611705",... | 0.0 | -1 |
Words or phrases defining the dictionary. The dictionary must contain at least one phrase and every phrase must contain at least 2 characters that are letters or digits. | def words(self) -> List[str]:
return pulumi.get(self, "words") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_password_dictionary(value):\r\n password_max_edit_distance = getattr(settings, \"PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD\", None)\r\n password_dictionary = getattr(settings, \"PASSWORD_DICTIONARY\", None)\r\n\r\n if password_max_edit_distance and password_dictionary:\r\n for word i... | [
"0.63549006",
"0.6281517",
"0.620499",
"0.6155821",
"0.6105766",
"0.61000955",
"0.6092803",
"0.6058518",
"0.5991605",
"0.59753144",
"0.59723234",
"0.5946283",
"0.5917193",
"0.5910998",
"0.5899718",
"0.5877584",
"0.5863777",
"0.58493346",
"0.58409154",
"0.5840471",
"0.583245",... | 0.0 | -1 |
The dataset ID of the table. | def dataset_id(self) -> str:
return pulumi.get(self, "dataset_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_id(self) -> str:\n return self._dataset_id",
"def get_dataset_id(self) -> int:\n return self.dataset_id",
"def get_datasetID(self):\n\t\treturn self.dsDoc['about']['datasetID']",
"def data_set_id(self) -> str:\n return self.__data_set_id",
"def get_datasetID(self):\n\t\tret... | [
"0.8626976",
"0.8529486",
"0.8209322",
"0.80671084",
"0.7985265",
"0.78483576",
"0.7520161",
"0.7475212",
"0.7238789",
"0.72329605",
"0.7143192",
"0.685807",
"0.68259525",
"0.68140155",
"0.6777033",
"0.67523265",
"0.66668147",
"0.66668147",
"0.6664852",
"0.6633856",
"0.659996... | 0.86626947 | 0 |
Get single existing Movie | def test_get_single_movie(client, add_movie):
# Create a Movie in the DB
movie = add_movie(title="The Big Lebowski", genre="comedy", year="1998")
# Request the Movie using the API
resp = client.get(f"/api/movies/{movie.id}/")
# Assert the response
assert resp.status_code == 200
assert resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_movie_by_id(movie_id):\n\n return Movie.query.get(movie_id)",
"def get_movie(self, id: int) -> Movie:\n raise NotImplementedError",
"def find_movie_by_title(title):\n return Movie.objects.filter(title=title).first()",
"def get_movie(movie_id=None):\n movie = [movie for movie in store.... | [
"0.8126471",
"0.7856548",
"0.77964467",
"0.77554107",
"0.73911935",
"0.7378006",
"0.73695946",
"0.7331305",
"0.7311966",
"0.72774065",
"0.7223854",
"0.7102708",
"0.7087934",
"0.7065429",
"0.70570326",
"0.6958612",
"0.6947302",
"0.69469506",
"0.6910748",
"0.68948346",
"0.67872... | 0.69888175 | 15 |
Draws line on image | def draw_line(self, point1, point2, line_color, line_width=2):
if point1 is not None and point2 is not None:
self.draw.line([point1, point2], fill=line_color, width=line_width) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _plot_line(self, image, x1, y1, x2, y2, width, color):\n\n draw = ImageDraw.Draw(image, \"RGBA\")\n draw.line([x1, y1, x2, y2], fill=color, width=width)\n del draw\n\n return image",
"def drawLine(img, start, end, color = (0,0,255), thickness = 3):\n\tcv2.line(img, start, end, col... | [
"0.84423685",
"0.8253794",
"0.7852899",
"0.78277296",
"0.75945413",
"0.7564541",
"0.75629723",
"0.7521763",
"0.74684286",
"0.7435795",
"0.7392736",
"0.73650795",
"0.73530984",
"0.7342623",
"0.7222016",
"0.72003496",
"0.7193474",
"0.716304",
"0.7159466",
"0.71547276",
"0.71083... | 0.6325626 | 81 |
Draws dot (filled circle) on image | def draw_dot(self, point, point_color, point_radius):
if point is not None:
xy = [
point[0] - point_radius,
point[1] - point_radius,
point[0] + point_radius,
point[1] + point_radius
]
self.draw.ellipse(xy,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_dot(self, center, color, thickness=5):\n center = self._format_point(center)\n opencv.circle(self.img, center.tuple(), radius=0, color=color.bgra(), thickness=thickness)",
"def plot(self, dot, x, y):\n penup()\n goto(x * self.scale + self.x_shift, -y * self.scale + self.y_shi... | [
"0.76724887",
"0.71337444",
"0.71321017",
"0.6934242",
"0.693163",
"0.6900731",
"0.6809976",
"0.66495866",
"0.66352755",
"0.66180366",
"0.6611945",
"0.6549174",
"0.65242517",
"0.6496858",
"0.6457064",
"0.64451605",
"0.64222044",
"0.6398223",
"0.6362811",
"0.6347054",
"0.63090... | 0.67170423 | 7 |
Sets the learning rate to the initial LR decayed by 10 every 1/3 and 2/3 epochs | def adjust_learning_rate(args, optimizer, epoch):
if (epoch*3==args.epochs) or (epoch*3==2*args.epochs):
lr = args.lr * (0.1 ** (epoch*3//args.epochs))
print("Changing Learning Rate to {}".format(lr))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.79568666",
"0.7936353",
"0.786411",
"0.7782513",
"0.7768681",
"0.7762653",
"0.77211714",
"0.77164",
"0.77064276",
"0.7697089",
"0.7683265",
"0.76829374",
"0.7661373",
"0.7660092",
"0.7648",
"0.7634222",
"0.7621536",
"0.7621536",
"0.7621536",
"0.76138234",
"0.76099634",
"... | 0.78411174 | 3 |
Return a TAG instance from python dictionary. | def from_dict(cls, tag_dict):
return cls(tag_dict.get('tag_type'), tag_dict.get('value')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'Tags':\n return util.deserialize_model(dikt, cls)",
"def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n name = dictionary.get('name')\r\... | [
"0.77696186",
"0.7041823",
"0.66769814",
"0.6645647",
"0.66357845",
"0.65567875",
"0.6377104",
"0.63482726",
"0.6280211",
"0.6266046",
"0.6261109",
"0.6261109",
"0.6261109",
"0.6261109",
"0.6261109",
"0.6261109",
"0.62513304",
"0.6245897",
"0.6234706",
"0.62273836",
"0.611942... | 0.7834658 | 0 |
Return a TAG instance from json. | def from_json(cls, tag_json):
return cls.from_dict(json.loads(tag_json)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(json):\n\n if \"targetType\" not in json or \"target\" not in json or \"action\" not in json or \"location\" not in json:\n raise InvalidJSONException(\"Tag must have a type, a value, an action and a location\")\n\n if type(json[\"targetType\"]) != int:\n raise Inv... | [
"0.7754125",
"0.68584627",
"0.67089695",
"0.6691237",
"0.65181",
"0.65103173",
"0.6436944",
"0.62627935",
"0.61784303",
"0.6139117",
"0.6139117",
"0.6139117",
"0.6122029",
"0.6116905",
"0.6116905",
"0.6113236",
"0.60766",
"0.5983055",
"0.5977469",
"0.59228516",
"0.5919517",
... | 0.8164613 | 0 |
Compare Interface class with another instance. | def __eq__(self, other):
if isinstance(other, str):
return self.address == other
if isinstance(other, Interface):
return self.port_number == other.port_number and \
self.switch.dpid == other.switch.dpid
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return (self.user_tag == other.user_tag and\n self.interface == other.interface)",
"def __eq__(self, other):\n if not isinstance(other, NodeInterfaceAlias):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, ot... | [
"0.6611852",
"0.652413",
"0.6390778",
"0.63853484",
"0.63255805",
"0.6277677",
"0.62735534",
"0.62709534",
"0.6220638",
"0.6220638",
"0.6220638",
"0.6220638",
"0.6216654",
"0.621408",
"0.6213908",
"0.62073296",
"0.6179445",
"0.6179445",
"0.6179445",
"0.617812",
"0.61589414",
... | 0.6194598 | 16 |
Return a Interface instance from python dictionary. | def from_dict(cls, interface_dict):
return cls(interface_dict.get('name'),
interface_dict.get('port_number'),
interface_dict.get('switch'),
interface_dict.get('address'),
interface_dict.get('state'),
interface_dict.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, uni):\n return cls(uni.get('interface'),\n uni.get('user_tag'))",
"def from_dict(cls, dikt) -> 'DownloadableDataSampleInterface':\n return deserialize_model(dikt, cls)",
"def __init__(self, raw_interface: Dict):\n pass",
"def from_dict(cls, obj):\r\n ... | [
"0.69279855",
"0.66442436",
"0.65520877",
"0.65024084",
"0.62905467",
"0.6249836",
"0.62423164",
"0.62117887",
"0.61339283",
"0.613051",
"0.6126485",
"0.61042374",
"0.6005264",
"0.59948045",
"0.59943223",
"0.5968988",
"0.5961342",
"0.5961342",
"0.5961342",
"0.5961342",
"0.596... | 0.7645877 | 0 |
Return a Uni instance from python dictionary. | def from_dict(cls, uni):
return cls(uni.get('interface'),
uni.get('user_tag')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt: dict) -> 'UserBase':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt: dict) -> 'User':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'VotingUser':\n return util.deserialize_model(dikt, cls)",
"def from_dictionary(... | [
"0.68682873",
"0.68670297",
"0.6623969",
"0.63668853",
"0.62668926",
"0.6185186",
"0.6166897",
"0.6166897",
"0.6166897",
"0.6166897",
"0.6166897",
"0.6166897",
"0.6158273",
"0.61492914",
"0.6144596",
"0.61397505",
"0.6139629",
"0.6139629",
"0.6139629",
"0.6139629",
"0.6139629... | 0.76731074 | 0 |
Filter out `(grad, var)` pairs that have a gradient equal to `None`. | def filter_empty_gradients(grads_and_vars):
grads_and_vars = tuple(grads_and_vars)
if not grads_and_vars:
return grads_and_vars
filtered = []
vars_with_empty_grads = []
for grad, var in grads_and_vars:
if grad is None:
vars_with_empty_grads.append(var)
else:
filtered.append((grad, var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_grads(grads_and_vars):\n grads_and_vars = tuple(grads_and_vars)\n if not grads_and_vars:\n return grads_and_vars\n filtered = []\n vars_with_empty_grads = []\n for grad, var in grads_and_vars:\n if grad is None:\n vars_with_empty_grads.append(var)\n else:\n filtered.append((grad... | [
"0.7082254",
"0.64509207",
"0.60876626",
"0.58870584",
"0.587493",
"0.58298326",
"0.5828215",
"0.5623903",
"0.5623481",
"0.5616531",
"0.54383004",
"0.54332477",
"0.53457373",
"0.53450847",
"0.5329456",
"0.5318941",
"0.53133917",
"0.53124195",
"0.5301863",
"0.5298531",
"0.5275... | 0.7452657 | 0 |
Loads iris dataset from official url. Script is used because pytest constantly showed error during the sklearn.datasets.load_iris import | def load_iris_dataset():
url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'
column_names = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'class']
filepath = Path('data/iris_data')
filepath.parent.mkdir(exist_ok=True)
urllib.request.urlretrieve(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_iris_dataset():\n \n # Location and file name for the dataset\n file_location = 'iris'\n data_file = file_location + os.sep + 'iris.data'\n \n # We have to map the categorical class names to numbers\n mapping = { 'Iris-setosa':'0', 'Iris-versicolor':'1', 'Iris-virginica':'2'}\n \n # Prepare a... | [
"0.6764371",
"0.6628921",
"0.661164",
"0.6566535",
"0.64652044",
"0.6413728",
"0.6313824",
"0.6309676",
"0.6283062",
"0.62500864",
"0.6219202",
"0.61175853",
"0.6103516",
"0.608755",
"0.6081649",
"0.60586584",
"0.6047626",
"0.6023151",
"0.6008722",
"0.59999",
"0.5940783",
"... | 0.7172017 | 0 |
Construct an OperatorString object that represents a string of operators that act on orbital degrees of freedom. | def __init__(self, orbital_operators, orbital_labels, op_type, prefactor=1.0):
self.orbital_operators = np.array(orbital_operators, dtype=str)
self.orbital_labels = np.array(orbital_labels, dtype=int)
self.op_type = op_type
if len(self.orbital_operators) != len(self.orbita... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opstring(op_string_name, op_type=None):\n \n name_list = op_string_name.strip().split()\n\n if name_list == [] or (len(name_list) == 1 and name_list[0] in ['1', '1.0', 'I']):\n if op_type is None:\n raise ValueError('When specifying an identity operator, you need to provide an op_typ... | [
"0.709293",
"0.6203983",
"0.61393744",
"0.61104697",
"0.5940708",
"0.5838156",
"0.57947886",
"0.5777184",
"0.5729976",
"0.5696303",
"0.56745714",
"0.5656875",
"0.5656452",
"0.5644685",
"0.56413126",
"0.5608194",
"0.55932075",
"0.5584201",
"0.55771726",
"0.5571425",
"0.5560534... | 0.6407155 | 1 |
Check equality between this OperatorString and another. | def __eq__(self, other):
equals = (len(self.orbital_operators) == len(other.orbital_operators)) and (self.orbital_operators == other.orbital_operators).all() and (self.orbital_labels == other.orbital_labels).all() and (self.op_type == other.op_type)
return equals | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, *args):\n return _libsbml.string___eq__(self, *args)",
"def __eq__(self, other) -> bool:\n return str(self) == str(other)",
"def __eq__(self, other):\n return str(self) == str(other)",
"def __eq__(self, other):\n return str(self) == str(other)",
"def __eq__(self... | [
"0.7715403",
"0.76144063",
"0.7601083",
"0.7601083",
"0.7601083",
"0.75443405",
"0.74995816",
"0.7255063",
"0.6886081",
"0.68624157",
"0.685009",
"0.68200254",
"0.6801517",
"0.67645526",
"0.6708114",
"0.66938007",
"0.6665319",
"0.66574436",
"0.6642314",
"0.6628456",
"0.660874... | 0.64987767 | 26 |
Creates an internal mapping of humanreadable class names to class indices. | def create_class_indices(self) -> None:
categories = list(np.loadtxt(self.path_manager.categories_file(), delimiter=",", dtype=str))
if self.include_noise_samples and not self.multi_label_classification:
categories.append("noise")
self.class_to_idx = {}
for idx, class_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_classdict(self):\n\t\ttarget_names = self.fetched[\"train\"].target_names\n\t\tself.classdict = {target_names[idx]: idx for idx in range(len(target_names))}",
"def get_class_names_from_indices(self, indices: List) -> List[str]:\n return [self.idx2classname[idx] for idx in indices]",
"def load_c... | [
"0.7209309",
"0.67527294",
"0.6665969",
"0.6594825",
"0.6452009",
"0.63875645",
"0.625862",
"0.62222224",
"0.6201916",
"0.6137641",
"0.60591006",
"0.60450524",
"0.60438067",
"0.60401726",
"0.6015896",
"0.5995015",
"0.5990505",
"0.59142995",
"0.5913849",
"0.58961546",
"0.58912... | 0.773929 | 0 |
Maps class indices to humanreadable class names. | def id_to_class_name(self, identifier: int):
return self.id_to_class_mapping()[identifier] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_class_names_from_indices(self, indices: List) -> List[str]:\n return [self.idx2classname[idx] for idx in indices]",
"def change_class_labels(classes):\n u,indices=np.unique(classes,return_inverse=True)\n return u,indices",
"def create_class_indices(self) -> None:\n\n categories = li... | [
"0.7421729",
"0.6805773",
"0.67025775",
"0.6641353",
"0.6481311",
"0.6459249",
"0.6246988",
"0.62053275",
"0.61896026",
"0.61762965",
"0.61678576",
"0.6164557",
"0.61047596",
"0.604508",
"0.60190743",
"0.60141814",
"0.60141814",
"0.59939784",
"0.5922053",
"0.59184104",
"0.590... | 0.0 | -1 |
Get a random element from the set. | def getRandom(self) -> int:
count = len(self.arr)
return self.arr[randint(0, count-1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.7704349",
"0.7388428",
"0.729529",
"0.72199696",
"0.68691766",
"0.6844957",
"0.6833531",
"0.67763513",
"0.6722701",
"0.67023355",
"0.6663022",
"0.66346914",
"0.66219616",
"0.66115355",
"0.659939",
"0.6566504",
"0.6476552",
"0.64612746",
"0.6441797",
"0.64155203",
"0.640025... | 0.5845104 | 96 |
remove duplicated items in an array. | def removeDuplicates(nums):
i = 0
j = 1
for r in range(len(nums)):
if j >= len(nums):
print(i + 1, nums)
return i + 1
if nums[i] != nums[j]:
i = i + 1
nums[i] = nums[j]
j = j + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicates_array(self, array: List) -> List:\n seen = set()\n seen_add = seen.add\n return [x for x in array if not (x in seen or seen_add(x))]",
"def removeDuplicates(array) -> list:\n try:\n removed = []\n for i in array:\n if i in removed:\n ... | [
"0.867852",
"0.7828795",
"0.7403744",
"0.7342197",
"0.7217988",
"0.71418846",
"0.71399814",
"0.71179676",
"0.7022906",
"0.70057094",
"0.6963614",
"0.6954983",
"0.69384706",
"0.6894172",
"0.6866194",
"0.6759203",
"0.6757008",
"0.6756796",
"0.6750025",
"0.66869307",
"0.66836137... | 0.6090845 | 90 |
Returns a onehot version of indices. | def one_hot(x, num_classes, dtype=jnp.float32):
return jax.nn.one_hot(x, num_classes).astype(dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_to_one_hot(cls_indeces, nb_classes):\n targets = np.array(cls_indeces).reshape(-1)\n return np.eye(nb_classes)[targets]",
"def indices_to_one_hot(data, nb_classes):\n\ttargets = np.array(data).reshape(-1)\n\treturn np.eye(nb_classes)[targets]",
"def indices_to_one_hot(data, nb_classes):\n ... | [
"0.8180944",
"0.80832934",
"0.8080572",
"0.8080572",
"0.8080572",
"0.8080572",
"0.8077973",
"0.806912",
"0.8053035",
"0.80431294",
"0.7914005",
"0.7759113",
"0.77359",
"0.77187693",
"0.7711457",
"0.76964605",
"0.76933616",
"0.76862174",
"0.76859206",
"0.7682822",
"0.76762766"... | 0.7391999 | 40 |
Overriding queryset method Fetches record according to owner and membership of a user | def get_queryset(self):
group_info = Group.objects.filter(id__in=Member.objects.filter(
user=self.request.user).values('group').distinct())
for data in group_info:
user_id = Member.objects.get(role_type='owner', group_id=data.id)
data.owner = user_id.user.phone
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_queryset(self, request, queryset, view):\n owner = request.query_params.get(\"owner\")\n\n if owner:\n kwargs = {self.owner_prefix + \"__username__iexact\": owner}\n\n return queryset.filter(**kwargs)\n\n return queryset",
"def get_queryset(self, **kwargs):\n... | [
"0.6662062",
"0.6603364",
"0.6602008",
"0.6601316",
"0.6590573",
"0.6572465",
"0.65674955",
"0.65007585",
"0.64533436",
"0.64254904",
"0.641675",
"0.63870084",
"0.63622534",
"0.6350179",
"0.63357174",
"0.62890667",
"0.6274181",
"0.6267711",
"0.62456167",
"0.6240702",
"0.61737... | 0.6248989 | 18 |
Overriding queryset method Fetches record according to owner and membership of a group | def get_queryset(self):
contact_data = Contact.objects.filter(contact_groups__in=Member.objects.filter(
user=self.request.user).values('group_id').distinct())
return contact_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n group_info = Group.objects.filter(id__in=Member.objects.filter(\n user=self.request.user).values('group').distinct())\n for data in group_info:\n user_id = Member.objects.get(role_type='owner', group_id=data.id)\n data.owner = user_id.user.ph... | [
"0.6904422",
"0.63106155",
"0.6277199",
"0.59034026",
"0.5761385",
"0.5740407",
"0.5678518",
"0.5658035",
"0.56267554",
"0.5626369",
"0.5618499",
"0.56182337",
"0.56052274",
"0.5574658",
"0.55440533",
"0.5524826",
"0.5510083",
"0.54816574",
"0.54543096",
"0.54173833",
"0.5396... | 0.567188 | 7 |
Return a humanreadable representation of a User. | def __repr__(self):
return (f'<User user_id={self.user_id}'
f' first_name={self.first_name} last_name={self.last_name}'
f' email_address={self.email_address}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n\n return '<User user_id={} email={} first_name={} last_name={}>'.format(self.user_id,\n self.email,\n self.first_name,\n ... | [
"0.72711605",
"0.72652227",
"0.72652227",
"0.72652227",
"0.72652227",
"0.72652227",
"0.7214205",
"0.7177958",
"0.7157754",
"0.7136232",
"0.71162754",
"0.71155113",
"0.70834893",
"0.7079185",
"0.70605624",
"0.7029648",
"0.696431",
"0.6926494",
"0.69244486",
"0.6921236",
"0.691... | 0.7074854 | 14 |
Turns CamelCase/camelCase name into camel_case. | def decamelize(name):
pat = re.compile(r'([A-Z]*[^A-Z]*)(.*)')
bits = []
while True:
head, tail = re.match(pat, name).groups()
bits.append(head)
if tail:
name = tail
else:
break
return '_'.join([bit.lower() for bit in bits]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_camel_case(name):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', name)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()",
"def to_upper_camelcase(name):\n return re.sub(r'(?:\\B_|\\b\\-|^)([a-zA-Z0-9])', lambda l: l.group(1).upper(),\n name)",
"def name_to_camel... | [
"0.87667096",
"0.85407287",
"0.8529774",
"0.82683194",
"0.814056",
"0.81385934",
"0.8099136",
"0.7952099",
"0.79440683",
"0.7796926",
"0.77441204",
"0.7699725",
"0.76822376",
"0.7677953",
"0.7656983",
"0.76497513",
"0.7645459",
"0.7642664",
"0.7642664",
"0.761502",
"0.7586151... | 0.6628356 | 87 |
create the API tornado app. | def createserver(ddir):
from jsb.tornado.server import TornadoServer
settings = {
"static_path": ddir + os.sep + "static",
"cookie_secret": "661oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
}
application = tornado.web.Application([(r"(/api/.*)", APIHandler)], **settings)
return Torna... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n return create_app()",
"def make_app():\n return tornado.web.Application([\n (r'/', MainHandler),\n (r'/async', AsyncHandler),\n (r'/gen', GenHandler),\n ])",
"def app():\n app = create_app()\n return app",
"def create_app():\n app = FastAPI()\n configure... | [
"0.7872509",
"0.76791275",
"0.7548198",
"0.75101906",
"0.74758214",
"0.74399006",
"0.742874",
"0.7294769",
"0.72813964",
"0.7272829",
"0.72658825",
"0.72645235",
"0.7259645",
"0.72557247",
"0.7241009",
"0.7179461",
"0.7179157",
"0.7178068",
"0.71695477",
"0.7116981",
"0.70776... | 0.0 | -1 |
Create a DataVector from the given list of floats. | def from_list(cls, vals: List[float]) -> DataVector:
array = np.array(vals)
return cls.create(array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_list(cls, vals: List[float]) -> TheoryVector:\n array = np.array(vals)\n return cls.create(array)",
"def from_list(cls, l):\n\n x, y, z = map(float, l)\n return cls(x, y, z)",
"def fromlist(self, floats):\n self.header = {}\n params = [p for p in self]\n ... | [
"0.71178794",
"0.694844",
"0.6767678",
"0.672143",
"0.62546146",
"0.62151164",
"0.6127795",
"0.6023091",
"0.5967216",
"0.59502846",
"0.59128314",
"0.5809435",
"0.5806907",
"0.57272387",
"0.57040036",
"0.56720364",
"0.5669023",
"0.5664781",
"0.56515115",
"0.56515115",
"0.56326... | 0.8016133 | 0 |
Create a TheoryVector from the given list of floats. | def from_list(cls, vals: List[float]) -> TheoryVector:
array = np.array(vals)
return cls.create(array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_list(cls, vals: List[float]) -> DataVector:\n array = np.array(vals)\n return cls.create(array)",
"def fromlist(self, floats):\n self.header = {}\n params = [p for p in self]\n min_len = min(len(params), len(floats))\n for param, value in zip(params[:min_len], f... | [
"0.7158615",
"0.66686875",
"0.66367096",
"0.6616725",
"0.6193955",
"0.617422",
"0.61525315",
"0.6111367",
"0.6033113",
"0.5938848",
"0.5924642",
"0.59160304",
"0.5880217",
"0.582118",
"0.5817939",
"0.5817939",
"0.5772544",
"0.5754276",
"0.5749705",
"0.5749705",
"0.57208043",
... | 0.7905007 | 0 |
Make sure the data and theory vectors are of the same shape. | def __post_init__(self):
assert self.data.shape == self.theory.shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_vector_shape(self):\n model = PoincareModel(self.data, size=20)\n self.assertEqual(model.kv.syn0.shape, (7, 20))",
"def _verify_integrity(self):\n if len(self.data.shape) != 1:\n raise ValueError(\n \"Data array must be one dimensional \"\n \... | [
"0.68823373",
"0.67249984",
"0.6260591",
"0.6093764",
"0.60826045",
"0.60603607",
"0.60273904",
"0.6024293",
"0.60062295",
"0.59979296",
"0.59750265",
"0.5970297",
"0.5969516",
"0.5968759",
"0.59475285",
"0.59100306",
"0.58953065",
"0.5888959",
"0.5868385",
"0.58459073",
"0.5... | 0.6402957 | 2 |
get the length of this dataset | def get_period_length(self) -> int:
return (dataset.max_date - dataset.min_date).days + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return self.dataset.shape[0]",
"def __len__(self):\n return self._dataset.size(dirs=self._dirs)",
"def length(self) -> int:\n return len(self.data)",
"def length(self):\n return len(self.data)",
"def length(self):\n return len(self.data)",
"def leng... | [
"0.8304645",
"0.8263683",
"0.8227546",
"0.81817335",
"0.81817335",
"0.81817335",
"0.8164903",
"0.8150208",
"0.8134237",
"0.8134237",
"0.8134237",
"0.8134237",
"0.8131471",
"0.81103545",
"0.8095975",
"0.8067523",
"0.80604196",
"0.8047066",
"0.8044654",
"0.80439675",
"0.8003424... | 0.0 | -1 |
Gets chash for this campaign. If it's not set, compute it and then return it. | def getHash(self):
if self.chash:
return self.chash
else:
self.setHash()
return self.chash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCash(self) -> int:\n return self.state[CASH]",
"def get_cash(self):\r\n return self.cash",
"def get_chern(self, attribute=True):\n chern = kcgfns.load_chern(self)\n if chern is None:\n chern = kcgfns.calc_chern(self)\n if attribute:\n self.chern =... | [
"0.5888465",
"0.57635087",
"0.556789",
"0.5529046",
"0.5266266",
"0.5202682",
"0.5116233",
"0.4974656",
"0.49716672",
"0.4924105",
"0.48224282",
"0.4734841",
"0.47021866",
"0.4686189",
"0.4682478",
"0.46793535",
"0.46468124",
"0.46132123",
"0.4539095",
"0.45345223",
"0.452760... | 0.5516241 | 4 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ShowSsoConfigResponse):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Initialize a new EuroSATDataModule instance. | def __init__(
self, batch_size: int = 64, num_workers: int = 0, **kwargs: Any
) -> None:
super().__init__(EuroSAT, batch_size, num_workers, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialise_energy_system(self):\n if not self.input_data:\n raise ValueError(\n \"There is no input data in the scenario. You cannot \"\n \"initialise an energy system without a year and the number of \"\n \"time steps.\"\n )\n ye... | [
"0.636455",
"0.6049229",
"0.59628606",
"0.5808824",
"0.5774204",
"0.5770782",
"0.5764389",
"0.57363695",
"0.57263136",
"0.57039535",
"0.5695362",
"0.5680085",
"0.5663867",
"0.56601447",
"0.5650159",
"0.5643002",
"0.56414634",
"0.5625103",
"0.5610904",
"0.5598252",
"0.55870414... | 0.56005615 | 19 |
Initialize a new EuroSAT100DataModule instance. | def __init__(
self, batch_size: int = 64, num_workers: int = 0, **kwargs: Any
) -> None:
super().__init__(EuroSAT100, batch_size, num_workers, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, RA, DEC, AST, I_data, Q_data, U_data, V_data):\n self.RA = RA\n self.DEC = DEC\n self.AST = AST\n self.I_data = I_data\n self.Q_data = Q_data\n self.U_data = U_data\n self.V_data = V_data\n self.fit_p = None\n self.e_fit_p = None\n ... | [
"0.60814416",
"0.5785055",
"0.5706952",
"0.5648751",
"0.5586587",
"0.5547952",
"0.55393314",
"0.5522181",
"0.5504972",
"0.54853195",
"0.5475161",
"0.54711485",
"0.5465857",
"0.5454763",
"0.5422433",
"0.5417103",
"0.5415436",
"0.5398041",
"0.53969765",
"0.5388971",
"0.5381834"... | 0.58199847 | 1 |
test case to check if the objects are saved in the credentials list | def test_save_login(self):
self.new_user.save_login()
self.assertEqual(len(User.users_list),1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_creds(self):\n self.new_credentials.save_creds()\n self.assertEqual(len(Credentials.credential_list),1)",
"def test_store_multiple_cred(self):\n self.new_cred.save_cred()\n test_cred = Credentials('stackoverflow','Lugaga', 'golfalpharomeo')\n test_cred.save_cred()... | [
"0.83383405",
"0.8011689",
"0.76053154",
"0.7589007",
"0.7577088",
"0.7560628",
"0.75559556",
"0.7507739",
"0.7387052",
"0.73291236",
"0.7285187",
"0.72751576",
"0.72340643",
"0.7007487",
"0.69533783",
"0.6951452",
"0.6922284",
"0.6920844",
"0.6920664",
"0.6889378",
"0.677895... | 0.6569781 | 29 |
split train and test eccv dataset | def eccv_train_and_test_set(split_csv_filepath):
df = pd.read_csv(split_csv_filepath, header=None)
filenames = [os.path.join(os.path.dirname(split_csv_filepath), 'hotornot_face', _.replace('.bmp', '.jpg')) for _ in
df.iloc[:, 0].tolist()]
scores = df.iloc[:, 1].tolist()
flags = df.iloc[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_test_and_train_data(self, test_size=0.3, view=0):\n X_train, X_test, y_train, y_test = train_test_split(self.data[view], self.class_data, test_size=test_size)\n return X_train, X_test, y_train, y_test",
"def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(s... | [
"0.7524769",
"0.7458796",
"0.73640025",
"0.7306263",
"0.7222674",
"0.72058046",
"0.71128553",
"0.7061862",
"0.70495003",
"0.70329326",
"0.7029111",
"0.6983538",
"0.6936621",
"0.6921005",
"0.69008386",
"0.6883558",
"0.68732303",
"0.6857968",
"0.6855126",
"0.68411344",
"0.68188... | 0.70484704 | 9 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(sparse_mx):
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(np.vstack((sparse_mx.row,
sparse_mx.col))).long()
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8299787",
"0.8148542",
"0.8045949",
"0.80325705",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80300856",
"0.80134654",
"0.7985302",
"0.7985302",
"... | 0.79973555 | 19 |
Determine value equality between this object and another object. | def __eq__(self, other):
return Team.compare(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self.value == other.value",
"def __eq__(self, other):\n return self.value == other or self.value == other.value",
"def __eq__(self, other):\n\n return self.type == other.type and self.value == other.value",
"def __eq__(self, other):\n if other is ... | [
"0.84007454",
"0.82553047",
"0.81534064",
"0.8024857",
"0.79856306",
"0.7977496",
"0.789133",
"0.7874858",
"0.7874858",
"0.7836901",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.77807915",
"0.... | 0.0 | -1 |
Returns the minimal distance between two upright bounding boxes. | def minDistBoundingBox(box1, box2):
x1, y1, bw1, bh1 = box1[0], box1[1], box1[2], box1[3]
x1b, y1b = x1 + bw1, y1 + bh1
x2, y2, bw2, bh2 = box2[0], box2[1], box2[2], box2[3]
x2b, y2b = x2 + bw2, y2 + bh2
left = x2b < x1
right = x1b < x2
bottom = y2b < y1
top = y1b < y2
if top and le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_hyperbox(b1,b2):\n return max(0,np.max(np.hstack((b1.l-b2.u,b2.l-b1.u))))",
"def bbox_dist(bbox1, bbox2):\n d = 0.0\n midpoint1 = midpoint(bbox1)\n midpoint2 = midpoint(bbox2)\n for i in range(2):\n d += (midpoint1[i] - midpoint2[i])**2\n d = np.sqrt(d)\n return d",
"de... | [
"0.669634",
"0.638709",
"0.63634086",
"0.604861",
"0.60173917",
"0.59743035",
"0.59131706",
"0.58721143",
"0.5817834",
"0.58122796",
"0.58122486",
"0.5776659",
"0.5759965",
"0.5717733",
"0.5691358",
"0.56833327",
"0.56815666",
"0.56365895",
"0.56303364",
"0.5623147",
"0.55844... | 0.70569134 | 0 |
For a ``dataclass`` instance get the fields that are different from the default values and return as ``dict``. | def dataclassNonDefaults(obj) -> dict:
if not is_dataclass(obj):
raise TypeError(f'Object {obj} is not a dataclass')
values = [getattr(obj, field.name) for field in fields(obj)]
return {
field.name: value for field, value in zip(fields(obj), values)
if value != field.default
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fields(class_or_instance):\n\n # Might it be worth caching this, per class?\n try:\n fields_dict = getattr(class_or_instance, _FIELDS)\n except AttributeError:\n raise TypeError(\"must be called with a dataclass type or instance\")\n\n return fields_dict",
"def get_dataclass_attribu... | [
"0.70047325",
"0.67623556",
"0.6705183",
"0.6700803",
"0.65386724",
"0.6482961",
"0.6403835",
"0.6403199",
"0.63314885",
"0.632886",
"0.62825507",
"0.62150896",
"0.61884236",
"0.61417824",
"0.6089505",
"0.60845125",
"0.60154104",
"0.601124",
"0.5992749",
"0.5978161",
"0.59200... | 0.8245919 | 0 |
Convert object to a tree of lists, dicts and simple values. The result can be serialized to JSON. | def tree(obj):
if isinstance(obj, (bool, int, float, str, bytes)):
return obj
elif isinstance(obj, (dt.date, dt.time)):
return obj.isoformat()
elif isinstance(obj, dict):
return {k: tree(v) for k, v in obj.items()}
elif isnamedtupleinstance(obj):
return {f: tree(getattr(o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_object(obj):\n if obj is None:\n return obj\n\n if isinstance(obj, etree._Element):\n return obj\n\n if isinstance(obj, list):\n return [serialize_object(sub) for sub in obj]\n\n result = OrderedDict()\n for key in obj:\n value = obj[key]\n if isinsta... | [
"0.69986624",
"0.6984587",
"0.6954623",
"0.6510834",
"0.6503316",
"0.64818424",
"0.639339",
"0.6312907",
"0.62150127",
"0.60614",
"0.60287744",
"0.6008188",
"0.6003403",
"0.5983773",
"0.59778595",
"0.59737194",
"0.59673166",
"0.5964827",
"0.5961532",
"0.5953827",
"0.59146965"... | 0.74067765 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.