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 |
|---|---|---|---|---|---|---|
Returns an int64_list from a bool / enum / int / uint. | def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result",
"def convertT... | [
"0.6880756",
"0.65959364",
"0.64623183",
"0.6449189",
"0.6366776",
"0.62898964",
"0.6271142",
"0.6215376",
"0.61042506",
"0.59511524",
"0.59452623",
"0.5903748",
"0.5866437",
"0.5866437",
"0.5856854",
"0.58461636",
"0.58444816",
"0.583239",
"0.5803493",
"0.57961476",
"0.57961... | 0.5508473 | 59 |
Given a selling price this function returns the margin | def get_margin(self, selling_price):
selling_price = ( selling_price - self.product_price ) / 2
return selling_price | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def margin(self):\n sp = self.sale_price or zero\n if u.isempty(sp):\n return zero\n cp = self.cost_price or zero\n return u.decimal((um-(cp/sp))*cem, True)",
"def calculate_margin_required(stock_token,price,quantity,transaction_type,stoploss):\n\t# Equity:-\n\n\tstock_data... | [
"0.79091424",
"0.71048373",
"0.6478069",
"0.6412291",
"0.64070207",
"0.62512976",
"0.61613333",
"0.61414295",
"0.6083334",
"0.59958106",
"0.593597",
"0.59158564",
"0.58685285",
"0.58391863",
"0.5832643",
"0.5832417",
"0.58267504",
"0.58140326",
"0.5789264",
"0.57839507",
"0.5... | 0.8863053 | 0 |
Performs a Shapiro and Wilk test on a serie of value to look for its normality. | def check_normality(serie: List[float], alpha: int = 0.05) -> bool:
stat, p = stats.shapiro(serie)
print('Statistics=%.3f, p=%.3f' % (stat, p))
if p > alpha:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_normality(df, features_to_analyse, p_value_threshold=0.05):\n \n is_normal_threshold = 1 - p_value_threshold\n\n normality_results = pd.DataFrame(data=None, index=['stat','pval'], columns=features_to_analyse)\n for f, feature in enumerate(features_to_analyse):\n try:\n stat,... | [
"0.61086965",
"0.6041759",
"0.6032998",
"0.59104115",
"0.59104115",
"0.59104115",
"0.5851156",
"0.5851156",
"0.5851156",
"0.57688844",
"0.5749838",
"0.56769127",
"0.5670779",
"0.5646989",
"0.563634",
"0.5591718",
"0.5574862",
"0.55650854",
"0.5542877",
"0.5539889",
"0.5524835... | 0.66801393 | 0 |
Specifies a limit expression. | def limit(self, amount):
self._limit = amount
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit(self, limit):\n self._evaluated = False\n self._limit = limit\n return self",
"def set_Limit(self, value):\n super(DescribeEvaluationsInputSet, self)._set_input('Limit', value)",
"def limit(self, limit):\n raise NotImplementedError(\"This should have been implemented.\")",
"d... | [
"0.72966176",
"0.7016928",
"0.6824612",
"0.6777435",
"0.6747338",
"0.67210436",
"0.66901046",
"0.66871417",
"0.6672887",
"0.66625845",
"0.66374624",
"0.6628438",
"0.65572345",
"0.6534167",
"0.6530071",
"0.6530071",
"0.6530071",
"0.65214014",
"0.6492277",
"0.64443266",
"0.6356... | 0.6403654 | 20 |
Aggregates a columns values. | def sum(self, column):
self.aggregate("SUM", "{column}".format(column=column))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colsums (self):\n return self.values.sum (axis=1)",
"def reduce(self, dframe, columns):\n self.columns = columns\n self.column = columns[0]\n new_dframe = self.agg()\n\n for column in new_dframe.columns:\n dframe[column] += new_dframe[column]\n\n dframe[se... | [
"0.64441526",
"0.6266128",
"0.62496394",
"0.6179645",
"0.6154095",
"0.5998069",
"0.5958051",
"0.5834011",
"0.57610923",
"0.5734647",
"0.569916",
"0.565602",
"0.55501515",
"0.5525935",
"0.5521713",
"0.54617244",
"0.54457945",
"0.54406846",
"0.54097456",
"0.5394647",
"0.5385493... | 0.48416287 | 76 |
Aggregates a columns values. | def count(self, column="*"):
self.aggregate("COUNT", "{column}".format(column=column))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colsums (self):\n return self.values.sum (axis=1)",
"def reduce(self, dframe, columns):\n self.columns = columns\n self.column = columns[0]\n new_dframe = self.agg()\n\n for column in new_dframe.columns:\n dframe[column] += new_dframe[column]\n\n dframe[se... | [
"0.64441526",
"0.6266128",
"0.62496394",
"0.6179645",
"0.6154095",
"0.5998069",
"0.5958051",
"0.5834011",
"0.57610923",
"0.5734647",
"0.569916",
"0.565602",
"0.55501515",
"0.5525935",
"0.5521713",
"0.54617244",
"0.54457945",
"0.54406846",
"0.54097456",
"0.5394647",
"0.5385493... | 0.0 | -1 |
Aggregates a columns values. | def max(self, column):
self.aggregate("MAX", "{column}".format(column=column))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colsums (self):\n return self.values.sum (axis=1)",
"def reduce(self, dframe, columns):\n self.columns = columns\n self.column = columns[0]\n new_dframe = self.agg()\n\n for column in new_dframe.columns:\n dframe[column] += new_dframe[column]\n\n dframe[se... | [
"0.64441526",
"0.6266128",
"0.62496394",
"0.6179645",
"0.6154095",
"0.5998069",
"0.5958051",
"0.5834011",
"0.57610923",
"0.5734647",
"0.569916",
"0.565602",
"0.55501515",
"0.5525935",
"0.5521713",
"0.54617244",
"0.54457945",
"0.54406846",
"0.54097456",
"0.5394647",
"0.5385493... | 0.0 | -1 |
Aggregates a columns values. | def avg(self, column):
self.aggregate("AVG", "{column}".format(column=column))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colsums (self):\n return self.values.sum (axis=1)",
"def reduce(self, dframe, columns):\n self.columns = columns\n self.column = columns[0]\n new_dframe = self.agg()\n\n for column in new_dframe.columns:\n dframe[column] += new_dframe[column]\n\n dframe[se... | [
"0.64441526",
"0.6266128",
"0.62496394",
"0.6179645",
"0.6154095",
"0.5998069",
"0.5958051",
"0.5834011",
"0.57610923",
"0.5734647",
"0.569916",
"0.565602",
"0.55501515",
"0.5525935",
"0.5521713",
"0.54617244",
"0.54457945",
"0.54406846",
"0.54097456",
"0.5394647",
"0.5385493... | 0.0 | -1 |
Aggregates a columns values. | def min(self, column):
self.aggregate("MIN", "{column}".format(column=column))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colsums (self):\n return self.values.sum (axis=1)",
"def reduce(self, dframe, columns):\n self.columns = columns\n self.column = columns[0]\n new_dframe = self.agg()\n\n for column in new_dframe.columns:\n dframe[column] += new_dframe[column]\n\n dframe[se... | [
"0.64441526",
"0.6266128",
"0.62496394",
"0.6179645",
"0.6154095",
"0.5998069",
"0.5958051",
"0.5834011",
"0.57610923",
"0.5734647",
"0.569916",
"0.565602",
"0.55501515",
"0.5525935",
"0.5521713",
"0.54617244",
"0.54457945",
"0.54406846",
"0.54097456",
"0.5394647",
"0.5385493... | 0.0 | -1 |
reduce a tensor on a certain axis based on sum. | def reduce_sum_d(x, y, axis=None, keepdims=None, kernel_name="reduce_sum_d"):
dtype = x["dtype"]
dtype_lower = dtype.lower()
check_list = ("float16", "float32")
check_dtype(dtype_lower, check_list, param_name="x")
with te.op.compute():
shape = x["shape"]
shape_range = x["range"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(tensor, axis=None):\n raise NotImplementedError",
"def reduce_sum(\n input_tensor: remote_blob_util.BlobDef,\n axis: Optional[Union[int, Sequence[int]]] = None,\n keepdims: bool = False,\n name: Optional[str] = None,\n) -> remote_blob_util.BlobDef:\n name = _gen_unique_name_if_need(... | [
"0.76949906",
"0.7263131",
"0.7092084",
"0.6876064",
"0.68422484",
"0.6706367",
"0.6702404",
"0.66649634",
"0.6622693",
"0.65654516",
"0.65495473",
"0.65121984",
"0.65027636",
"0.64792264",
"0.6451438",
"0.6438257",
"0.63843244",
"0.637158",
"0.63430643",
"0.63307846",
"0.632... | 0.6701793 | 7 |
The provisioning state, which only appears in the response. | def provisioning_state(self) -> str:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"... | [
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.843888",
"0.82020336",
"0.82020336",
"0.82020336",
"0.82020336",
"0.82020336",
"0.81364286",
"0.78288543",
"0.78288543",
"0.777... | 0.8441288 | 7 |
The date when the host was first provisioned. | def provisioning_time(self) -> str:
return pulumi.get(self, "provisioning_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_created(self) -> str:\n return pulumi.get(self, \"date_created\")",
"def creation_date(self) -> str:\n return pulumi.get(self, \"creation_date\")",
"def creation_date(self) -> str:\n return pulumi.get(self, \"creation_date\")",
"def creation_date(self) -> str:\n return pu... | [
"0.693746",
"0.68698615",
"0.68698615",
"0.68698615",
"0.6808437",
"0.6808437",
"0.6732785",
"0.66754246",
"0.66580284",
"0.66555226",
"0.66555226",
"0.66555226",
"0.665055",
"0.6577627",
"0.6577402",
"0.65764683",
"0.6568393",
"0.65609",
"0.65609",
"0.65609",
"0.65482455",
... | 0.67841715 | 6 |
Determine operating system tag from sys.platform. | def get_ostag() -> str:
if sys.platform.startswith("linux"):
return "linux"
elif sys.platform.startswith("win"):
return "win" + ("64" if sys.maxsize > 2**32 else "32")
elif sys.platform.startswith("darwin"):
return "mac"
raise ValueError(f"platform {sys.platform!r} not supported"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_os_type():\n return 'Linux'",
"def _get_osname():\n osname = sys.platform.lower()\n if osname == \"linux2\":\n osname = \"linux\"\n return osname",
"def get_os():\n\n os_platform = sys.platform\n\n if os_platform.startswith('darwin'):\n return 'mac'\n\n if os_platfo... | [
"0.78147733",
"0.7700117",
"0.76626337",
"0.7569227",
"0.7546347",
"0.7535036",
"0.7479456",
"0.7465493",
"0.74550796",
"0.742126",
"0.7356641",
"0.72778744",
"0.72720426",
"0.72607625",
"0.7225494",
"0.7220087",
"0.721806",
"0.721806",
"0.72084963",
"0.72035974",
"0.7203222"... | 0.77767515 | 1 |
Method to set the logging level | def set_logging_level(self, level):
if str(level) == '1':
self.logging_level = logging.DEBUG
elif str(level) == '2':
self.logging_level = logging.INFO
elif str(level) == '3':
self.logging_level = logging.WARNING
elif str(level) == '4':
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setlevel(self, lvl):\n self.logger.setLevel(lvl)",
"def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if level == 'debug':\n level = logging.DEBUG\n if level == 'error':\n level = logging.ERROR\n self._log.setLev... | [
"0.82317466",
"0.8190281",
"0.8173759",
"0.817187",
"0.81692755",
"0.8073475",
"0.80498683",
"0.79883164",
"0.7883592",
"0.7882922",
"0.78221655",
"0.77126765",
"0.7650156",
"0.7596648",
"0.75849724",
"0.75593483",
"0.7549872",
"0.7547367",
"0.7532421",
"0.7512227",
"0.748189... | 0.82335067 | 0 |
Method to get the data directory | def get_data_dir(self):
return self.data_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_data_directory(self):\n\n return self.data_directory",
"def data_directory(self):\n\n return self.get_raw(\"data_directory\")",
"def get_data_dir():\n return Path(current_app.config[\"USER_DIR\"]) / \"data\"",
"def data_dir(self):\r\n return self._data_dir",
"def dataDir(se... | [
"0.89675087",
"0.8856756",
"0.87423205",
"0.8644617",
"0.8628846",
"0.86014545",
"0.86014545",
"0.8590849",
"0.85503274",
"0.8530844",
"0.8492952",
"0.8409446",
"0.8397938",
"0.8395711",
"0.828872",
"0.82392347",
"0.8228786",
"0.8198568",
"0.81925446",
"0.8175608",
"0.8165439... | 0.8927392 | 1 |
Chooses a random thing from a list of items. | async def choose(self, ctx, *vargs):
embed = discord.Embed(
title="Choose",
description="Choices: {}\nChosen: **{}**".format(str(vargs), random.choice(vargs)),
color=discord.Color.blurple()
)
await ctx.send(embed=embed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_pick(lst):\n\n choice = random.randint(0, len(lst) - 1)\n return lst[choice]",
"def pick_random(items: Iterable[T]) -> Optional[T]:\n\n # Choose to remember the `i`th element from the stream with probability\n # `1/i`. Then probability of choosing the `i`th element is\n #\n # P(i)... | [
"0.74647456",
"0.7369317",
"0.729386",
"0.7275301",
"0.7270453",
"0.726797",
"0.70741236",
"0.6967675",
"0.6901884",
"0.6846059",
"0.6734045",
"0.6674709",
"0.6652805",
"0.6643336",
"0.66317564",
"0.66162133",
"0.6606161",
"0.65875477",
"0.65867347",
"0.65867347",
"0.65867347... | 0.0 | -1 |
Called once after all tests have run | def stopTestRun(self):
self.stopTime = time.time()
self.timeTaken = self.stopTime - self.startTime
self.printErrors()
if self.args.run_coverage or self.args.quiet_coverage:
from coverage.misc import CoverageException
try:
self.stream.writeln()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_test(self, test_results):\n pass",
"def tearDown(self):\n\t\tprint(\"end test\")\n\t\tpass",
"def tearDown(self):\n pass\n # teardown called after each test\n # e.g. maybe write test results to some text file",
"def tearDown(self):\n pass",
"def tearDown(sel... | [
"0.8292218",
"0.81348276",
"0.8130209",
"0.80737776",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
"0.80399656",
... | 0.0 | -1 |
Returns all categories in a list Optionally filters the products of these categories based on a searchterm and if the product is for sale. | def get_all_categories(searchterm='', for_sale=None, limit=None, offset=0):
categories = RedisSession().session.get('categories')
# Defining the range of products to be fetched
start = int(offset)
end = int(limit) + start if limit else limit
# if categores could not be retrieved from cache fetch ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_category_products(products, searchterm='', for_sale=None, **kwargs):\n\n searchterm = searchterm.lower()\n filtered_products = []\n for product in products:\n if searchterm not in product['name'].lower():\n continue\n if for_sale and not product['records']:\n ... | [
"0.7696018",
"0.6297458",
"0.6261977",
"0.61848545",
"0.60987383",
"0.60029453",
"0.5941536",
"0.5876258",
"0.5864454",
"0.571635",
"0.5702597",
"0.56952524",
"0.5683109",
"0.5681851",
"0.5678843",
"0.56733716",
"0.5657851",
"0.562213",
"0.5598116",
"0.5587407",
"0.5567129",
... | 0.69466573 | 1 |
We create a SubjectDatasetRequest with the defaults | def test_default_subjects_path(self):
t = self.create_request_object()
self.assertEqual("Mediflex", t.project_name)
self.assertEqual("Prod", t.environment_name)
self.assertEqual("studies/Mediflex(Prod)/subjects/1001/datasets/regular", t.url_path()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_data_request(modelbox, period, dataset, stream, res_name):\n head, _ = path.splitext(res_name)\n\n if dataset == 'interim':\n download = True\n req = {\\\n 'dataset' : \"interim\",\n 'step' : \"0\",\n 'number' : \"all\",\n 'levtype' : \"... | [
"0.57622474",
"0.5706718",
"0.5640855",
"0.5482839",
"0.5479038",
"0.546736",
"0.5440156",
"0.543842",
"0.5425268",
"0.5419281",
"0.5341425",
"0.53187895",
"0.5280309",
"0.52638984",
"0.5255019",
"0.52544075",
"0.52490246",
"0.5245012",
"0.52433646",
"0.5238599",
"0.5225856",... | 0.5331862 | 11 |
We create a SubjectDatasetRequest with nonsense | def test_banana_subjects_path(self):
with self.assertRaises(ValueError) as exc:
t = self.create_request_object(dataset_type="pineapple")
self.assertEqual("Dataset type not 'regular' or 'raw' is pineapple",
str(exc.exception)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_without_type(self):\n request = StudySubjectsRequest(self.project_name, self.environment)\n self.assertFalse(\"subjectKeyType\" in request.url_path())",
"def study_subject_create(\n self, study_identifier, enrollment_date, study_subject_id=None,\n secondary_la... | [
"0.5936585",
"0.58802533",
"0.57465345",
"0.5742729",
"0.5703949",
"0.56592405",
"0.56212974",
"0.56170547",
"0.5594376",
"0.55169165",
"0.55080944",
"0.5499772",
"0.5490618",
"0.54389596",
"0.5412224",
"0.5385658",
"0.53788966",
"0.53758067",
"0.53645724",
"0.5332279",
"0.53... | 0.537466 | 18 |
Get angle dictionary of three_atoms, force_consts, and theta_eqs. | def get_angle_info(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAxisAndAngleDegres(self):\n theta = numpy.arccos(self.real)\n angle = 360 * theta / numpy.pi\n xyz = self.pure / numpy.sin(theta)\n return xyz, angle",
"def getAngleIndices(self):\n coord_types, atom_indices = self.force_field.getInternalCoordinateDefinitions()\n ... | [
"0.59363943",
"0.5917686",
"0.5863905",
"0.5857307",
"0.5820208",
"0.5803172",
"0.57695085",
"0.5750037",
"0.5734703",
"0.5731494",
"0.56937027",
"0.5584539",
"0.551553",
"0.5512617",
"0.5510341",
"0.5478721",
"0.54754317",
"0.5463792",
"0.54368526",
"0.54180545",
"0.5413736"... | 0.5355759 | 28 |
Returns vnc_api.gen.resource_client.NetworkPolicy from api or None | def get_default_network_policy(con):
try:
return con.network_policy_read(fq_name=conf.get('default_network_policy', 'UNEXPECTED_VALUE'))
except NoIdError:
log.debug('Unable to find default_network_policy')
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def network_policy(self) -> 'outputs.NetworkPolicyResponse':\n return pulumi.get(self, \"network_policy\")",
"def network_policy(self) -> Optional[pulumi.Input[Union[str, 'NetworkPolicy']]]:\n return pulumi.get(self, \"network_policy\")",
"def network_access_policy(self) -> Optional[str]:\n ... | [
"0.69902796",
"0.6804435",
"0.6153666",
"0.5715606",
"0.5602192",
"0.5500536",
"0.5500536",
"0.5493907",
"0.544499",
"0.5407962",
"0.53712153",
"0.5342152",
"0.5322414",
"0.52976114",
"0.528367",
"0.52694046",
"0.5268328",
"0.52254206",
"0.52216226",
"0.52216226",
"0.52063763... | 0.6327308 | 2 |
Returns a configured vnc_api.gen.resource_xsd.VirtualNetworkPolicyType | def gen_virtual_network_policy():
sequence = SequenceType(major=0, minor=0)
pol = VirtualNetworkPolicyType(sequence=sequence)
return pol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_network_type(self):\n\t\treturn call_sdk_function('PrlVirtNet_GetNetworkType', self.handle)",
"def network_policy(self) -> Optional[pulumi.Input[Union[str, 'NetworkPolicy']]]:\n return pulumi.get(self, \"network_policy\")",
"def network_policy(self) -> 'outputs.NetworkPolicyResponse':\n r... | [
"0.6543712",
"0.6098282",
"0.6069195",
"0.5857029",
"0.58253944",
"0.58030754",
"0.57017595",
"0.55505973",
"0.5542941",
"0.5436804",
"0.53951186",
"0.53785187",
"0.5366141",
"0.53379124",
"0.530148",
"0.5223317",
"0.5222289",
"0.52052605",
"0.5194528",
"0.51926345",
"0.51924... | 0.7273791 | 0 |
Returns a configured vnc_api.gen.resource_xsd.VnSubnetsType Filled with SubnetType and IpamSubnetType stuff. | def gen_ipam_subnet(ip_prefix, ip_prefix_len, default_gateway):
subnet = SubnetType(ip_prefix=ip_prefix, ip_prefix_len=ip_prefix_len)
ipam_subnet = IpamSubnetType(subnet=subnet, default_gateway=default_gateway)
vn_subnet = VnSubnetsType(ipam_subnets=[ipam_subnet])
return vn_subnet | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceIdArgs']]]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Inp... | [
"0.6228633",
"0.6219383",
"0.619083",
"0.6007588",
"0.59950095",
"0.5936233",
"0.5936233",
"0.58983856",
"0.5883248",
"0.57703215",
"0.5738953",
"0.5642376",
"0.55513626",
"0.554745",
"0.5513661",
"0.550861",
"0.5477449",
"0.5454505",
"0.54406583",
"0.5395187",
"0.53892154",
... | 0.5265341 | 27 |
Returns a configured vnc_api.gen.resource_xsd.PolicyEntriesType Filled with ActionListType and PolicyEntriesType. | def gen_network_policy_entries():
src_port = PortType(start_port=-1, end_port=-1)
dst_port = PortType(start_port=-1, end_port=-1)
src_address = AddressType(virtual_network='any')
dst_address = AddressType(virtual_network='any')
action = ActionListType(simple_action='pass')
rule = PolicyRuleType(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_type(self):\n return (\n list(\n SchedulePolicies.policy_types.keys())[\n list(\n SchedulePolicies.policy_types.values()).index(self._task_json['policyType'])])",
"def __getPolTypes(self, granularity, status=None, formerStatus=None... | [
"0.5476016",
"0.51158834",
"0.507746",
"0.49599266",
"0.4846818",
"0.4813927",
"0.47957617",
"0.4649638",
"0.45728737",
"0.45453817",
"0.45432618",
"0.45423338",
"0.4539282",
"0.45364618",
"0.45355898",
"0.45310977",
"0.44911534",
"0.4481901",
"0.4481863",
"0.44767067",
"0.44... | 0.5670173 | 0 |
Returns if the word is in the trie. | def search(self, word: str) -> bool:
# Checking if the word is present in the list.
return word in self.mylist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838632",
"0.8150416",
"0.8123471",
"0.7856802",
"0.7830664",
"0.77935004",
"0.7792806",
"0.77642965",
"0.7753436",
"0.7747724",
"0.7711298",
"0.76816714",
"0.7677101",
"0.7664614",
"0.76506114",
"0.76338875",
"0.7628353",
"0.76114196",
"0.7577657",
"0.75695884",
"0.756079"... | 0.6643668 | 84 |
Find all the actions in the namespace. | def find_actions(namespace, action_prefix):
actions = {}
for key, value in namespace.iteritems():
if key.startswith(action_prefix):
actions[key[len(action_prefix):]] = analyse_action(value)
return actions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getActions():\n return getPlugins(IRenamingAction, plugins)",
"def actions(self):\n return self._action_list",
"def actions(self):\n actions = []\n\n for name, item in self._definition.get('actions', {}).items():\n name = self._get_name('action', name)\n action... | [
"0.6806308",
"0.6727623",
"0.65814173",
"0.6508478",
"0.65054417",
"0.64789534",
"0.6439947",
"0.64034885",
"0.638142",
"0.638142",
"0.6359195",
"0.63485485",
"0.6333873",
"0.6333873",
"0.6333873",
"0.62958413",
"0.6266492",
"0.62560976",
"0.62334186",
"0.61684275",
"0.615430... | 0.7189314 | 0 |
Remove a curve from the chart permanently. This will also clear the channel map cache from retaining the removed curve's appearance settings. | def remove_curve(self, pv_name):
curve = self.chart.findCurve(pv_name)
if curve:
self.chart.removeYChannel(curve)
del self.channel_map[pv_name]
self.chart.removeLegendItem(pv_name)
widgets = self.findChildren((QCheckBox, QLabel, QPushButton, QGroupBox), p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_curve(self, key):\n del self[key]\n del self._labels[key]",
"def remove_curve(self, name):\n self._curve_reg.__delitem__(name)",
"def onChartRemoveSeries(self):\n self.chart().removeAllSeries()\n self.series = {}\n self.yaxis = {}\n self.pen = {}\n ... | [
"0.7283609",
"0.7204987",
"0.67700624",
"0.6678678",
"0.64165175",
"0.6352763",
"0.6240694",
"0.6108885",
"0.6019966",
"0.60076904",
"0.59663576",
"0.59659314",
"0.5826129",
"0.5799459",
"0.5792361",
"0.57584316",
"0.574061",
"0.5735096",
"0.57151365",
"0.568077",
"0.5676843"... | 0.7613101 | 0 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 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.8093693",
"0.8092711",
"0.79585856",
"0.7851594",
"0.7842797",
"0.78244835",
"0.7766222",
"0.77547896",
"0.77476996",
"0.77476996",
"0.77476996",
"0.77476996",
"0.77476996",
"0.77476996",
"0.77476996",
"0.77476996",
"0.77193666",
"0.76677084",
"0.7664237",
"0.76496667",
"0... | 0.78108114 | 14 |
2dim gaussian distribution. DO NOT CHANGE THE ORDER OF PARAMETER | def two_dim_gaussian(xy_mesh, amplitude, xo, yo, sigma_x, sigma_y, offset, theta):
#DEBUG
theta = check_theta(theta)
sigma_x, sigma_y = check_sigma(sigma_x, sigma_y)
xo, yo = float(xo), float(yo)
x, y = xy_mesh[0], xy_mesh[1]
a = (np.cos(theta) ** 2) / (2 * sigma_x ** 2) + (np.sin(theta) ** 2) /... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gaussian_distribution(self, x: ndarray, mu: float, sigma: float) -> ndarray:\n return 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(\n -np.power(\n (x - mu) / sigma, 2) / 2)",
"def gaussian_window(n1, n2, sig=1, mu=0):\r\n x, y = np.meshgrid(np.linspace(-1, 1, n1), np.linspac... | [
"0.744618",
"0.7168427",
"0.7155235",
"0.70650166",
"0.69716954",
"0.6944246",
"0.6940582",
"0.6937153",
"0.6905228",
"0.68883055",
"0.68219566",
"0.68115973",
"0.6809711",
"0.6809711",
"0.6801821",
"0.6774848",
"0.676628",
"0.67622757",
"0.6761548",
"0.67575234",
"0.6738989"... | 0.0 | -1 |
Is this card scheduled for now? | def can_study_now(self, meta: "CardMeta") -> bool:
# WHY: You already studied today, come again tomorrow!
if is_today(meta.last_session):
return False
if meta.next_session == -1 or meta.actual_repetitions == 0:
return True
return is_today_or_earlier(meta.next_sess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_scheduled(self, handle):\n return not handle.cancelled()",
"def is_scheduled(self) -> bool:\n return not self.terminated and self.__state != Process.IDLE",
"def _is_ready(self, as_of):\n if self.is_one_off():\n return self.initial_billing_cycle.date_range.lower <= as_of\n... | [
"0.69646853",
"0.685595",
"0.6849197",
"0.67305565",
"0.67205364",
"0.66421723",
"0.66292953",
"0.66044426",
"0.6573087",
"0.656752",
"0.6532481",
"0.65296006",
"0.65236217",
"0.6494787",
"0.6493416",
"0.6457778",
"0.64564174",
"0.64362395",
"0.64320785",
"0.6418566",
"0.6416... | 0.6332701 | 25 |
Is this card scheduled for today? | def today(self) -> bool:
return self._algorithm.can_study_now(self._stat) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkToday(ctx, cron):\n daze = ctx.obj['daze']\n if cron is not None:\n if date.today() in daze.dateDict.keys():\n sys.exit(1)\n else:\n sys.exit(0)\n click.echo(date.today() in daze.dateDict.keys())\n return date.today() in daze.dateDict.keys()",
"def is_in_a... | [
"0.6947991",
"0.68045795",
"0.67766863",
"0.6756614",
"0.67271465",
"0.6632544",
"0.6612575",
"0.6578526",
"0.65487087",
"0.6529349",
"0.65263957",
"0.64729136",
"0.64620143",
"0.64559585",
"0.63391554",
"0.63314915",
"0.63230026",
"0.6281195",
"0.6227074",
"0.6213841",
"0.61... | 0.69490606 | 0 |
Initialize a `neighborhood_hash` kernel. | def __init__(self,
n_jobs=None,
normalize=False,
verbose=False,
random_seed=42,
R=3,
nh_type='simple',
bits=8):
super(NeighborhoodHash, self).__init__(n_jobs=n_jobs,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_(self):\n super(NeighborhoodHash, self).initialize_()\n\n if not self.initialized_[\"random_seed\"]:\n seed(self.random_seed)\n self.initialized_[\"random_seed\"] = True\n\n if not self.initialized_[\"R\"]:\n if type(self.R) is not int or self.R ... | [
"0.74826473",
"0.60283506",
"0.58911175",
"0.5744865",
"0.5721792",
"0.5618479",
"0.55807513",
"0.5543938",
"0.5543363",
"0.55286914",
"0.551622",
"0.5491403",
"0.54800165",
"0.54526204",
"0.5437969",
"0.5431406",
"0.5431406",
"0.541279",
"0.5405879",
"0.53934586",
"0.5367438... | 0.6939056 | 1 |
Test extensions parameter with full path | def test_extensions(self):
dummy_folder = TestOspaListDir.get_dummy_folder()
need_result = []
for i in range(1, 4):
need_result.append(os.path.join(dummy_folder, 'memes', 'meme monty python', 'meme{}.jpg'.format(i)))
need_result.append(os.path.join(dummy_folder, 'memes', 'mem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_11_is_allowed_file_correct_ext(self):\n\n for ext in list(ALLOWED_EXTENSIONS):\n filename = f\"somename.{ext}\"\n is_allowed = utils.is_allowed_file(filename)\n self.assertTrue(is_allowed)",
"def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', pa... | [
"0.7491482",
"0.74303705",
"0.73329586",
"0.7317714",
"0.7313268",
"0.7289178",
"0.7043628",
"0.7011991",
"0.70027727",
"0.69995224",
"0.69981515",
"0.6995358",
"0.6995358",
"0.6938391",
"0.68542916",
"0.67666775",
"0.6760818",
"0.67458147",
"0.6729507",
"0.67252606",
"0.6720... | 0.693017 | 14 |
Insert an item at a given position. The first argument is the index of the element before which to insert. | def insertToArray(ls=('AnyPin', [], {PinSpecifires.CONSTRAINT: '1', PinSpecifires.ENABLED_OPTIONS: PinOptions.ArraySupported | PinOptions.AllowAny}),
elem=('AnyPin', None, {PinSpecifires.CONSTRAINT: '1'}),
index=('IntPin', 0)):
ls.insert(index, elem)
return ls | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, index, item):\n if index > len(self):\n raise IndexError\n elif index == 0:\n self.insert_first(item)\n else:\n self._rest.insert(index-1, item)",
"def insert(self, item: T, index: int) -> None:\n pass",
"def insert(self, index, item... | [
"0.7950399",
"0.77290785",
"0.7710297",
"0.7516542",
"0.7504115",
"0.74515307",
"0.723503",
"0.7211555",
"0.718944",
"0.7142002",
"0.7130996",
"0.71251595",
"0.70912135",
"0.70857036",
"0.70763075",
"0.70686066",
"0.7006539",
"0.6985271",
"0.69499385",
"0.69490737",
"0.687992... | 0.0 | -1 |
Check an array is a single dimension | def single_dimension(array: np.ndarray) -> None:
if array.ndim > 1:
raise ValueError(
f"Array was multidimensional. Must pass 1D array; found {array.ndim}"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_1d_varray(arr):\r\n return len(arr.shape) < 2 or arr.shape[1] == 1",
"def really1d(arr):\n if np.ndim(arr) != 1:\n return False\n # Empty list or array\n if len(arr) == 0:\n return True\n if np.any(np.vectorize(np.ndim)(arr)):\n return False\n return True",
"def _... | [
"0.8357839",
"0.7986935",
"0.77649915",
"0.75070876",
"0.732115",
"0.72966397",
"0.72452056",
"0.71689236",
"0.70147914",
"0.68221134",
"0.66515267",
"0.6595797",
"0.65670556",
"0.6565911",
"0.65497863",
"0.65411764",
"0.6486502",
"0.6446081",
"0.64284056",
"0.64273804",
"0.6... | 0.7710304 | 3 |
Convert an array to another datatype, accounting for the array values. A normal numpy dtype conversion simply changes the datatype and leaves the values alone. This will convert an array and also convert the values to the same relative value of the new datatype. E.g. an element of value 100 on an uint8 array to be conv... | def convert_to_dtype(array: np.array, dtype: type[np.dtype]) -> np.array:
# original array info
old_dtype_info = get_dtype_info(array.dtype)
relative_values = array.astype(float) / old_dtype_info.max
# float range is so large that it's better to normalize
if isinstance(old_dtype_info, np.finfo):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_type(arr, type):\n return arr.astype(type)",
"def solution(array):\n array1 = np.array(array)\n array2 = array1.astype(float)\n return array2",
"def convert_array(self, v, t):\n return v.asnumpy()",
"def rescale_toa(arr, dtype=np.float32):\n # First look at raw value dists along ... | [
"0.7066014",
"0.696555",
"0.6711386",
"0.66376466",
"0.6401989",
"0.6388092",
"0.6370308",
"0.6360961",
"0.63057584",
"0.6278946",
"0.62637717",
"0.6211721",
"0.61782944",
"0.6174946",
"0.6147497",
"0.6122396",
"0.6117372",
"0.60842556",
"0.6078361",
"0.60375255",
"0.6018333"... | 0.7732451 | 0 |
Return the state attributes of the entity. | def extra_state_attributes(self) -> dict[str, Any]:
build: DevOpsBuild = self.coordinator.data[self.entity_description.build_key]
return self.entity_description.attrs(build) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._vehicle.data",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n ... | [
"0.83473676",
"0.83473676",
"0.7905188",
"0.77844214",
"0.77200794",
"0.77200794",
"0.76411456",
"0.76394033",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",
"0.76135784",... | 0.6854977 | 63 |
Return single column as numpy array | def __getattr__(self, col):
return self._obj[col].to_numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(self):\n return self.reshape((self.size, 1))",
"def get(self, column_name):\n if column_name is None:\n raise ValueError(\n 'column_name=None is not valid for column(), use value()')\n column = self.get_column(column_name)\n return np.rec.array(col... | [
"0.724511",
"0.7209096",
"0.68375635",
"0.67517763",
"0.6666471",
"0.66564703",
"0.66506785",
"0.65990853",
"0.6565661",
"0.65496945",
"0.6498632",
"0.6451602",
"0.6435279",
"0.6395274",
"0.6343058",
"0.6327756",
"0.62803394",
"0.6280268",
"0.6275699",
"0.6209507",
"0.6208646... | 0.69702387 | 2 |
Compute new learning rate given the old learning rate | def update_lr(self, *args, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def get_learning_rate():\n return 0.00001",
"def update_learning_rate(self):\n self.scheduler.step()\n lr = self.optimizer.param_groups[0]['lr']\n print('learning rate = %.7f' % lr)",
... | [
"0.7911128",
"0.766485",
"0.7622231",
"0.75681406",
"0.7563172",
"0.7563172",
"0.74988884",
"0.74568033",
"0.74548376",
"0.743741",
"0.743741",
"0.74092567",
"0.74047244",
"0.73837",
"0.7355749",
"0.73540854",
"0.7299618",
"0.728312",
"0.7249967",
"0.7228616",
"0.716794",
"... | 0.0 | -1 |
Returns the world coordinates corresponding to given image coordinates and the camera position | def world_pos_from_img_pos(self, img_pos, img_shape, arm_pos, scale):
centre_x = img_shape[0]/2
centre_y = img_shape[1]/2
#scale = 0.2*2/centre_x #m/pixel
#print("centre x, y")
#print(centre_x)
#print(centre_y)
wld_x = arm_pos[0]
wld_y = ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pointToWorld( nImageX, nImageY, rDepth, rMaxX = 320, rMaxY = 240, rFieldOfViewX = 60, rFieldOfViewY = 40 ):\n # convert to [-0.5,0.5]\n rCenteredX = ( nImageX / rMaxX ) - 0.5;\n rCenteredY = ( nImageY / rMaxY ) - 0.5;",
"def get_world_coords(self):\n # get pixel cordinates\n (H, W, _) ... | [
"0.68943864",
"0.6806621",
"0.6721196",
"0.64582914",
"0.6323244",
"0.62974346",
"0.6282987",
"0.6230357",
"0.62290096",
"0.615141",
"0.61413366",
"0.61126816",
"0.61020285",
"0.6070021",
"0.6068303",
"0.5982449",
"0.5923289",
"0.59039795",
"0.5888074",
"0.5880159",
"0.586557... | 0.65475804 | 3 |
Open given filelike object and parse it as YAML. Optionally, pass the path to the original_file for better error handling when the file contents are passed. Raise an exception if it contains "documentation_complete" key set to "false". | def _open_yaml(stream, original_file=None, substitutions_dict={}):
try:
yaml_contents = yaml.load(stream, Loader=yaml_SafeLoader)
return _get_yaml_contents_without_documentation_complete(yaml_contents, substitutions_dict)
except DocumentationNotComplete as e:
raise e
except Exceptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __open_yml_file(path_to_yml_file: str):\n\n yaml_content = None\n\n with open(path_to_yml_file, 'r', encoding='utf8') as stream:\n try:\n yaml_content = yaml.safe_load(stream)\n except yaml.YAMLError as exc:\n print(\"could not read yml file '\"... | [
"0.66589415",
"0.6566062",
"0.6256818",
"0.62562656",
"0.61746985",
"0.6165023",
"0.61072433",
"0.6081407",
"0.6074613",
"0.6074266",
"0.6064962",
"0.6030085",
"0.6015864",
"0.5985081",
"0.5984251",
"0.5957634",
"0.59572464",
"0.59387267",
"0.59015393",
"0.5891266",
"0.586280... | 0.7423043 | 0 |
Open given filelike object and parse it as YAML without performing any kind of template processing | def open_raw(yaml_file):
with codecs.open(yaml_file, "r", "utf8") as stream:
yaml_contents = _open_yaml(stream, original_file=yaml_file)
return yaml_contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read(self, text):\n return yaml.safe_load(text)",
"def from_path(cls, path: str) -> Any:\n cls._check_yaml()\n with open(path) as f:\n return yaml.safe_load(f)",
"def __open_yml_file(path_to_yml_file: str):\n\n yaml_content = None\n\n with open(path_to_yml_fil... | [
"0.6846257",
"0.66576844",
"0.6624308",
"0.6601623",
"0.659665",
"0.65715194",
"0.6516563",
"0.6479961",
"0.64637715",
"0.64578354",
"0.64368904",
"0.64333606",
"0.64132446",
"0.64039737",
"0.63924223",
"0.6390334",
"0.6389209",
"0.6386523",
"0.63812983",
"0.6379016",
"0.6368... | 0.6536563 | 6 |
Dropin replacement for yaml.load(), but preserves order of dictionaries | def ordered_load(stream, Loader=yaml_Loader, object_pairs_hook=OrderedDict):
class OrderedLoader(Loader):
pass
def construct_mapping(loader, node):
loader.flatten_mapping(node)
return object_pairs_hook(loader.construct_pairs(node))
OrderedLoader.add_constructor(
yaml.resolve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _yaml_ordering_support():\n _mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG\n\n def dict_representer(dumper, data):\n return dumper.represent_dict(data.iteritems())\n\n def dict_constructor(loader, node):\n return OrderedDict(loader.construct_pairs(node))\n\n yaml.add_representer(Ordere... | [
"0.72381467",
"0.6917885",
"0.6889193",
"0.683866",
"0.6832329",
"0.6747609",
"0.6653246",
"0.6388576",
"0.63085765",
"0.6294057",
"0.6247944",
"0.62463397",
"0.62237006",
"0.62132615",
"0.6194176",
"0.6166767",
"0.61140007",
"0.61113566",
"0.6088814",
"0.6039978",
"0.6016047... | 0.686994 | 3 |
Dropin replacement for yaml.dump(), but preserves order of dictionaries | def ordered_dump(data, stream=None, Dumper=yaml_Dumper, **kwds):
class OrderedDumper(Dumper):
# fix tag indentations
def increase_indent(self, flow=False, indentless=False):
return super(OrderedDumper, self).increase_indent(flow, False)
def _dict_representer(dumper, data):
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _yaml_dump(data):\n return yaml.dump(data, Dumper=_OrderedDumper, allow_unicode=True)",
"def yaml_dump(dict_to_dump):\n FlattenAliasDumper.add_representer(OrderedDict, _dict_representer)\n return yaml.dump(\n dict_to_dump,\n default_flow_style=False,\n Dumper=FlattenAliasDumper,... | [
"0.7265483",
"0.7202219",
"0.71971315",
"0.70921534",
"0.6910519",
"0.67780864",
"0.6742492",
"0.673389",
"0.66019475",
"0.6572451",
"0.6462051",
"0.6444429",
"0.6444417",
"0.642644",
"0.6401088",
"0.63380885",
"0.6324566",
"0.6313172",
"0.627594",
"0.6274556",
"0.6267629",
... | 0.69232774 | 4 |
Output a list, that either contains one string, or a list of strings. In Python, strings can be cast to lists without error, but with unexpected result. | def _strings_to_list(one_or_more_strings):
if isinstance(one_or_more_strings, str):
return [one_or_more_strings]
else:
return list(one_or_more_strings) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_or_list(value):\n if isinstance(value, list):\n return value\n return [value]",
"def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\n return input",
"def safelist(listable):\n if type(listable) == str:\n return [listable]\n else:\n... | [
"0.75640774",
"0.7433823",
"0.74280185",
"0.74101293",
"0.72969997",
"0.7230944",
"0.71689767",
"0.71638674",
"0.7149231",
"0.71322304",
"0.70893663",
"0.68785864",
"0.6857546",
"0.68403816",
"0.68100035",
"0.6794995",
"0.67809254",
"0.67431575",
"0.6711046",
"0.6698368",
"0.... | 0.7996305 | 0 |
The name of the cluster resource. | def cluster_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "cluster_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self):\n return self.name",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self):\n return self._data['cluster_name']",
"def cluster_na... | [
"0.84608793",
"0.8415085",
"0.8415085",
"0.82216406",
"0.7700061",
"0.7570648",
"0.7570648",
"0.7570648",
"0.7570648",
"0.7570648",
"0.7401764",
"0.7230603",
"0.7173421",
"0.7060018",
"0.69958895",
"0.6936662",
"0.6871251",
"0.6871251",
"0.6871251",
"0.6871251",
"0.6871251",
... | 0.7687609 | 5 |
The name of the resource group. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_gr... | [
"0.8794932",
"0.85470533",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.837923",
"0.8275838",
"0.8230199",
"0.82145786",
"0.807179",
"0.807179",
"0.80... | 0.81754035 | 41 |
Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. | def service_dns_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_dns_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_dns_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"service_dns_name\")",
"def service_name(self):\n return self._service_name",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n retu... | [
"0.84248364",
"0.71180904",
"0.70664567",
"0.70664567",
"0.67279387",
"0.6705132",
"0.6705132",
"0.6705132",
"0.6689461",
"0.6689461",
"0.6689461",
"0.66805255",
"0.66805255",
"0.66805255",
"0.6662011",
"0.66349787",
"0.66161656",
"0.66161656",
"0.66161656",
"0.65958303",
"0.... | 0.8645839 | 0 |
The name of the service type | def service_type_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_type_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_type_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"service_type_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_kind(se... | [
"0.8771637",
"0.76461864",
"0.76461864",
"0.75336266",
"0.7531004",
"0.7503859",
"0.74759877",
"0.7413506",
"0.7413506",
"0.7413506",
"0.7331155",
"0.7331155",
"0.7331155",
"0.7272653",
"0.72716093",
"0.72381914",
"0.7228606",
"0.71569216",
"0.71569216",
"0.71569216",
"0.7093... | 0.8681338 | 1 |
The current deployment or provisioning state, which only appears in the response | def provisioning_state(self) -> pulumi.Output[str]:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_provisioning_state(self):\n url = \"/api/v1/machine/{}\".format(self.machine_id)\n return self.urlhandler.get(url)",
"def provisioning_state(self) -> str:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> str:\n return pulumi.get(self, \"pr... | [
"0.7108924",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"0.7049463",
"... | 0.72025615 | 4 |
Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. | def service_dns_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "service_dns_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_dns_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_dns_name\")",
"def service_name(self):\n return self._service_name",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n retur... | [
"0.8645839",
"0.71180904",
"0.70664567",
"0.70664567",
"0.67279387",
"0.6705132",
"0.6705132",
"0.6705132",
"0.6689461",
"0.6689461",
"0.6689461",
"0.66805255",
"0.66805255",
"0.66805255",
"0.6662011",
"0.66349787",
"0.66161656",
"0.66161656",
"0.66161656",
"0.65958303",
"0.6... | 0.84248364 | 1 |
The name of the service type | def service_type_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "service_type_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_type_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_type_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_kind(sel... | [
"0.8681338",
"0.76461864",
"0.76461864",
"0.75336266",
"0.7531004",
"0.7503859",
"0.74759877",
"0.7413506",
"0.7413506",
"0.7413506",
"0.7331155",
"0.7331155",
"0.7331155",
"0.7272653",
"0.72716093",
"0.72381914",
"0.7228606",
"0.71569216",
"0.71569216",
"0.71569216",
"0.7093... | 0.8771637 | 0 |
Returns the rate at which air is being exchanged in the given room at a given time (in hours). Note that whilst the time is known inside this function, it may not be used to vary the result unless the specific time used is declared as part of a state change in the interval (e.g. when air_exchange == 0). | def air_exchange(self, room: Room, time: float) -> _VectorisedFloat:
return 0. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def air_exchange(self, room: Room, time: float) -> _VectorisedFloat:\n return np.array([\n ventilation.air_exchange(room, time)\n for ventilation in self.ventilations\n ], dtype=object).sum(axis=0)",
"def emission_rate(self, time) -> _VectorisedFloat:\n # Note: The orig... | [
"0.70454055",
"0.5634981",
"0.5603695",
"0.5348663",
"0.5169278",
"0.5097643",
"0.509083",
"0.50776094",
"0.50741154",
"0.50653964",
"0.5065052",
"0.50488806",
"0.50481266",
"0.50414944",
"0.50270593",
"0.4999192",
"0.4986521",
"0.49646255",
"0.49625087",
"0.49563265",
"0.491... | 0.7389456 | 0 |
The Particle object representing the aerosol here the default one | def particle(self) -> Particle:
return Particle() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def particle(self) -> Particle:\n return Particle(diameter=self.diameter)",
"def __init__(self,particle):\n self.par = particle",
"def __init__(self, particles):\n self.particles = particles",
"def __init__(self,E,px,py,pz):\n Particle.__init__(self)\n self.E=float(E)\n ... | [
"0.7454542",
"0.6870041",
"0.6565852",
"0.64614195",
"0.62459683",
"0.6133564",
"0.60621405",
"0.59752595",
"0.59529984",
"0.59109634",
"0.5846245",
"0.5841193",
"0.58239895",
"0.5802688",
"0.58006513",
"0.57258826",
"0.57154495",
"0.56994736",
"0.5669819",
"0.5639632",
"0.56... | 0.7946178 | 0 |
The emission rate of virions in the expired air per mL of respiratory fluid, per person, if the infected population is present, in (virion.cm^3)/(mL.h). This method includes only the diameterindependent variables within the emission rate. It should not be a function of time. | def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:
raise NotImplementedError("Subclass must implement") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n return self.known_individual_emission_rate",
"def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n # Note on units: exhalation rate is in m^3/h -> 1e6 conversion factor\n # Return... | [
"0.70549256",
"0.7030041",
"0.68119705",
"0.6351973",
"0.6193222",
"0.5990639",
"0.5715511",
"0.5681763",
"0.557528",
"0.551609",
"0.5504891",
"0.54911476",
"0.5480394",
"0.5480192",
"0.5439862",
"0.5438887",
"0.5408861",
"0.5382776",
"0.5377794",
"0.5366792",
"0.53312844",
... | 0.6309495 | 4 |
The emission rate of virions in the expired air per mL of respiratory fluid, per person, if the infected population is present, in (virion.cm^3)/(mL.h). This method includes only the diameterindependent variables within the emission rate. It should not be a function of time. | def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:
return self.known_individual_emission_rate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n # Note on units: exhalation rate is in m^3/h -> 1e6 conversion factor\n # Returns the emission rate times the number of infected hosts in the room\n\n ER = (self.virus.viral_load_in_sputum *\n self.... | [
"0.7030041",
"0.68119705",
"0.6351973",
"0.6309495",
"0.6193222",
"0.5990639",
"0.5715511",
"0.5681763",
"0.557528",
"0.551609",
"0.5504891",
"0.54911476",
"0.5480394",
"0.5480192",
"0.5439862",
"0.5438887",
"0.5408861",
"0.5382776",
"0.5377794",
"0.5366792",
"0.53312844",
... | 0.70549256 | 0 |
The emission rate of virions in the expired air per mL of respiratory fluid, if the infected population is present, in (virion.cm^3)/(mL.h). This method includes only the diameterindependent variables within the emission rate. It should not be a function of time. | def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:
# Note on units: exhalation rate is in m^3/h -> 1e6 conversion factor
# Returns the emission rate times the number of infected hosts in the room
ER = (self.virus.viral_load_in_sputum *
self.activity.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n return self.known_individual_emission_rate",
"def emission_rate_per_person_when_present(self) -> _VectorisedFloat:\n return (self.emission_rate_per_aerosol_per_person_when_present() *\n self.aerosols()... | [
"0.67502105",
"0.6438073",
"0.628212",
"0.62587756",
"0.611384",
"0.5994806",
"0.5781831",
"0.5726849",
"0.5706385",
"0.56790465",
"0.5654696",
"0.5608732",
"0.5555541",
"0.555159",
"0.54707634",
"0.5453624",
"0.5446318",
"0.5396579",
"0.53885114",
"0.53876925",
"0.5382849",
... | 0.68449783 | 0 |
The Particle object representing the aerosol here the default one | def particle(self) -> Particle:
return self.expiration.particle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def particle(self) -> Particle:\n return Particle()",
"def particle(self) -> Particle:\n return Particle()",
"def particle(self) -> Particle:\n return Particle(diameter=self.diameter)",
"def __init__(self,particle):\n self.par = particle",
"def __init__(self, particles):\n ... | [
"0.7946178",
"0.7946178",
"0.7454542",
"0.6870041",
"0.6565852",
"0.64614195",
"0.6133564",
"0.60621405",
"0.59752595",
"0.59529984",
"0.59109634",
"0.5846245",
"0.5841193",
"0.58239895",
"0.5802688",
"0.58006513",
"0.57258826",
"0.57154495",
"0.56994736",
"0.5669819",
"0.563... | 0.62459683 | 6 |
Minimum background concentration in the room for a given scenario (in the same unit as the concentration). Its the value towards which the concentration will decay to. | def min_background_concentration(self) -> _VectorisedFloat:
return 0. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_background_concentration(self) -> _VectorisedFloat:\n return self.CO2_atmosphere_concentration",
"def getMinAbundanceOfClrSample(self):\n #try: minimum = min(self.clr_sample['abundance'])-0.001\n try: minimum = min(self.clr_sample)-0.01\n except: minimum = 0\n return mi... | [
"0.7427263",
"0.6382879",
"0.6317175",
"0.6182026",
"0.6172238",
"0.61368895",
"0.6059633",
"0.59430975",
"0.5905795",
"0.58723444",
"0.58677775",
"0.5835509",
"0.5821671",
"0.5809213",
"0.5790617",
"0.578585",
"0.57831746",
"0.57679385",
"0.57374716",
"0.5718364",
"0.5670576... | 0.7934406 | 0 |
Total concentration as a function of time. The normalization factor has been put back. Note that time is not vectorised. You can only pass a single float to this method. | def concentration(self, time: float) -> _VectorisedFloat:
return (self._normed_concentration_cached(time) *
self.normalization_factor()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concentration(self, time: float) -> _VectorisedFloat:\n concentration = self.concentration_model.concentration(time)\n for interaction in self.short_range:\n concentration += interaction.short_range_concentration(self.concentration_model, time)\n return concentration",
"def _n... | [
"0.76779574",
"0.6672076",
"0.66665727",
"0.6314437",
"0.62167645",
"0.6193467",
"0.61841387",
"0.6163567",
"0.6123239",
"0.6004476",
"0.59745926",
"0.59168005",
"0.58759606",
"0.5860277",
"0.58083713",
"0.57867235",
"0.5770029",
"0.57576483",
"0.57554513",
"0.5754359",
"0.57... | 0.8309893 | 0 |
Get the integrated concentration of viruses in the air between the times start and stop. | def integrated_concentration(self, start: float, stop: float) -> _VectorisedFloat:
return (self.normed_integrated_concentration(start, stop) *
self.normalization_factor()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concentration(self, time: float) -> _VectorisedFloat:\n concentration = self.concentration_model.concentration(time)\n for interaction in self.short_range:\n concentration += interaction.short_range_concentration(self.concentration_model, time)\n return concentration",
"def no... | [
"0.6668683",
"0.6605099",
"0.6264128",
"0.616827",
"0.6027832",
"0.60100704",
"0.5967531",
"0.5820482",
"0.5810347",
"0.5721",
"0.5675906",
"0.55784065",
"0.5568928",
"0.55195177",
"0.551809",
"0.55175465",
"0.54964364",
"0.54914355",
"0.5485699",
"0.54404265",
"0.54134554",
... | 0.7209218 | 0 |
The geometry type OID used by PostGIS does not indicate the particular type of field that a geometry column is (e.g., whether it's a PointField or a PolygonField). Thus, this routine queries the PostGIS metadata tables to determine the geometry type. | def get_geometry_type(self, table_name, description):
with self.connection.cursor() as cursor:
cursor.execute(
"""
SELECT t.coord_dimension, t.srid, t.type FROM (
SELECT * FROM geometry_columns
UNION ALL
SELE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geometry_type(self) -> ir.StringValue:\n return ops.GeoGeometryType(self).to_expr()",
"def get_geometry_type(self):\n return self.geometry_type",
"def geometry_type(number):\n try:\n return GDAL_GEOMETRY_TYPES[number]\n except KeyError:\n return",
"def ge... | [
"0.7203882",
"0.71942675",
"0.7140914",
"0.7137252",
"0.706385",
"0.66863114",
"0.65912217",
"0.65461755",
"0.64958215",
"0.6359585",
"0.63406503",
"0.6225884",
"0.616962",
"0.613043",
"0.59419745",
"0.5854866",
"0.5816933",
"0.5812805",
"0.5790774",
"0.57866627",
"0.57866627... | 0.7568783 | 0 |
converts a single set of mass values to molecules. Returns result and residuals as arrays of values. | def solvePoint(matrix, vals, weights = None):
solvematrix = matrix
solvevals = vals
if weights is not None:
solvematrix = (matrix.T * weights).T
solvevals = np.array(vals) * weights
x, residual, rank, singular_vals = np.linalg.lstsq(solvematrix, solvevals, rcond= None)
residuals = np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mol_masses(mol):\n return np.array([a.GetMass() for a in mol.GetAtoms()])",
"def make_molecule(self):\n\n self.data.molecules = self.data.Smiles.apply(Chem.MolFromSmiles)\n\n return self.data.molecules",
"def _raw_to_arrays(self):\n self.update_geometry()\n if isinstance(... | [
"0.6392234",
"0.6228808",
"0.5981719",
"0.58569705",
"0.5759316",
"0.56736475",
"0.555243",
"0.55151343",
"0.5474837",
"0.53607184",
"0.5332116",
"0.52959687",
"0.52912587",
"0.5276583",
"0.5254936",
"0.52352685",
"0.5214173",
"0.51875716",
"0.51509184",
"0.51265",
"0.5107996... | 0.0 | -1 |
We need to override the default clean because when introducing an already existing name, username is left empty by default clean(), thus making the is_valid() return false | def clean(self):
username = self.cleaned_data.get("username", "")
password = self.cleaned_data.get("password", "")
password2 = self.cleaned_data.get("password2", "")
clean_data = {'username': username, 'password': password,
'password2': password2}
return cle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_username(self):\r\n username = self.cleaned_data.get(\"username\")\r\n\r\n if not username: \r\n return username\r\n\r\n \r\n if User.objects.filter(username__iexact=username).exclude(pk=self.instance.pk):\r\n raise forms.ValidationError(\"That username ... | [
"0.8121979",
"0.7934137",
"0.7934137",
"0.7917358",
"0.78843576",
"0.780652",
"0.7749958",
"0.7741971",
"0.77287674",
"0.7702291",
"0.76974964",
"0.7690289",
"0.764261",
"0.76306355",
"0.7617392",
"0.749426",
"0.7366474",
"0.7246987",
"0.72442716",
"0.72322506",
"0.7127091",
... | 0.60725725 | 66 |
Convert plural to singular. | def convert_to_singular(text):
if inflectengine.singular_noun(text):
return inflectengine.singular_noun(text).lower()
else:
return text.lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _plural_to_singular(self, plural_form):\n if plural_form is None:\n return None\n if plural_form == 'children':\n return 'child'\n elif plural_form.endswith('s'):\n return plural_form[:-1]\n return plural_form",
"def _singular_to_plural(self, singu... | [
"0.7819168",
"0.7381466",
"0.7365762",
"0.7166975",
"0.67389804",
"0.670706",
"0.6656803",
"0.6618886",
"0.65555876",
"0.65357345",
"0.6426185",
"0.6418314",
"0.63976616",
"0.6182724",
"0.6158774",
"0.61523813",
"0.61462533",
"0.61201894",
"0.60824317",
"0.6056122",
"0.591709... | 0.71341 | 4 |
Compute Mean square error of output activations using soft rounding which maps alpha parameter between zero and one and hard rounding which maps to exact zero and one | def _compute_recons_metrics(cls, quant_module: StaticGridQuantWrapper, act_func, inp_data: torch.Tensor,
out_data: torch.Tensor) -> Tuple[float, float]:
adaround_quantizer = quant_module.param_quantizers['weight']
# Enable hard rounding and get quantized wrapper module's... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rae(self) -> float:\n return float(np.sum(self._ae()) / (np.sum(np.abs(self.true - np.mean(self.true))) + EPS))",
"def mae(actual, predicted):\n rms = np.abs(actual-predicted)\n\n # Returning the sqaure root of the root mean square\n return float(rms.mean())",
"def gmrae(self, benchmark: np... | [
"0.59337765",
"0.5916872",
"0.5866231",
"0.5856518",
"0.5846681",
"0.57672334",
"0.5761057",
"0.57551175",
"0.57509714",
"0.57291985",
"0.56829864",
"0.56622624",
"0.56597215",
"0.56369185",
"0.56284004",
"0.5623269",
"0.56227183",
"0.56003964",
"0.5568409",
"0.5563733",
"0.5... | 0.0 | -1 |
Returns an array where each element is an array of attribute values for a particular attribute len(returned array) is equal to len(attributes) | def values_grouped_by_attribute(self, attributes):
values = []
for attribute in attributes:
_vals_in_attr = []
for instance in self.data:
if attribute.is_continuous():
_vals_in_attr.append(float(instance.value(attribute)))
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getattrs(self, attrlist):\n\t\treturn np.array([getattr(self, attr) for attr in attrlist])",
"def _get_active_attributes(self):\n\n count = gl.glGetProgramiv(self.handle, gl.GL_ACTIVE_ATTRIBUTES)\n attributes = []\n\n # This match a name of the form \"name[size]\" (= array)\n rege... | [
"0.68032956",
"0.6726259",
"0.642604",
"0.62063676",
"0.60705066",
"0.6065307",
"0.60646385",
"0.60605645",
"0.6048672",
"0.6041335",
"0.60094076",
"0.5996535",
"0.5990861",
"0.5983877",
"0.5925014",
"0.5892968",
"0.58925956",
"0.58925045",
"0.58831984",
"0.58831984",
"0.5881... | 0.6483661 | 2 |
Returns an array of indices where the class membership changes from one value to another the indicies will always lie between 0 and one less than number of instance, both inclusive. | def breakpoints_in_class_membership(self):
return [index for index in range(len(self.klass_values) - 1) if not self.klass_values[index] == self.klass_values[index + 1]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def occ_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==1:\n indices.append(index)\n return indices",
"def __find_integers_with_class_change(self, sorted_data):\n potential_integer_splits = []\n for row in range(sorted_dat... | [
"0.63544923",
"0.6174154",
"0.6076908",
"0.5827389",
"0.58065104",
"0.58063066",
"0.5749243",
"0.5738144",
"0.5670475",
"0.56060153",
"0.5543069",
"0.5534616",
"0.5501358",
"0.5494038",
"0.5494038",
"0.5484004",
"0.54825455",
"0.54200774",
"0.5411055",
"0.5408167",
"0.5400198... | 0.6952427 | 0 |
Return the list of query params for the `JoinBaseQuery`. | def get_params(self):
params = []
params.append(('from', self._from))
params.append(('to', self._to))
return params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params(self):\n params = super(JoinQuery, self).get_params()\n params.append(('q', self._query))\n\n return params",
"def get_params(self):\n params = super(JoinFilterQuery, self).get_params()\n params.append(('fq', self._query))\n\n return params",
"def get_pa... | [
"0.8521765",
"0.78558",
"0.6812002",
"0.6512537",
"0.6480954",
"0.6462373",
"0.6347584",
"0.62899536",
"0.6269281",
"0.6233851",
"0.6225676",
"0.6178912",
"0.61345893",
"0.609684",
"0.6054418",
"0.6019735",
"0.5991472",
"0.5948886",
"0.59423184",
"0.5936902",
"0.5931102",
"... | 0.6118761 | 13 |
Return the list of query params for the `JoinQuery`. | def get_params(self):
params = super(JoinQuery, self).get_params()
params.append(('q', self._query))
return params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params(self):\n params = super(JoinFilterQuery, self).get_params()\n params.append(('fq', self._query))\n\n return params",
"def get_parameters(self):\n params = []\n query_params = self.build_query_parameters()\n pagination_params = self.build_pagination_paramet... | [
"0.7728082",
"0.6356262",
"0.6339302",
"0.6237026",
"0.61797607",
"0.6158084",
"0.614382",
"0.6143094",
"0.61118174",
"0.59440416",
"0.5925002",
"0.59094304",
"0.5844952",
"0.58066577",
"0.5795255",
"0.57939667",
"0.57784545",
"0.57713604",
"0.56953263",
"0.56902677",
"0.5660... | 0.8336958 | 0 |
Wrapper for turning tensorflow metrics into keras metrics | def wrapper(self, args, **kwargs):
value, update_op = method(self, args, **kwargs)
K.get_session().run(tf.local_variables_initializer())
with tf.control_dependencies([update_op]):
value = tf.identity(value)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapt_tf_streaming_metric_for_keras(tf_metric, name,\n preprocss_fn=None, postprocess_fn=None,\n **kwargs):\n\n # Inspired from snipped by Ruzhitskiy Bogdan\n # (https://github.com/keras-team/keras/issues/6050#issuecomment-3299... | [
"0.69493836",
"0.6411531",
"0.6384598",
"0.6364321",
"0.6129579",
"0.59485316",
"0.59403133",
"0.5889492",
"0.58648014",
"0.5821645",
"0.58182657",
"0.579933",
"0.57958674",
"0.57888347",
"0.5782132",
"0.5773429",
"0.5769514",
"0.5763614",
"0.571847",
"0.5717282",
"0.57093304... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81936234",
"0.80946803",
"0.80283314",
"0.80186",
"0.7993046",
"0.7990442",
"0.79801315",
"0.7974616",
"0.7960565",
"0.79567033",
"0.7936678",
"0.7933718",
"0.7933456",
"0.7930259",
"0.79256636",
"0.79236794",
"0.79229367",
"0.792244",
"0.7922048",
"0.79213953",
"0.7916868... | 0.0 | -1 |
Return the index page. | def index():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n\n return {\n 'page': 'index',\n }",
"def index():\n return render_template('pages/index.html', isNav=True)",
"def get_index():\n return render_template('index.html')",
"def index_page():\n\n return render_template(\"index.html\")",
"def index_page():\n\n return rende... | [
"0.8527001",
"0.7784803",
"0.7762775",
"0.7702816",
"0.7702816",
"0.7702816",
"0.7700813",
"0.76334757",
"0.7605409",
"0.75989115",
"0.75966877",
"0.75966877",
"0.756402",
"0.7561059",
"0.75570226",
"0.75534356",
"0.75059396",
"0.75059396",
"0.7484278",
"0.7458089",
"0.745208... | 0.7410347 | 26 |
Builds a random decaying exploration. Decay a random value based on number of states and the decay_type. | def random_decay(num_actions=None, decay_type='polynomial_decay', start_decay_at=0,
stop_decay_at=1e9, decay_rate=0., staircase=False, decay_steps=10000,
min_exploration_rate=0):
if num_actions is None:
exploration_rate = partial(np.random.randn, 1)
else:
explor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_exploration_step(self, sess):\n episode_reward = 0.0\n episode_len = 0 #num of action\n \n # random policy\n random_policy = np.zeros((1,2*self.ACTION_DIM))\n \n #for each episode reset first\n state = self.env.reset()\n for t in range(self.... | [
"0.61208624",
"0.6037979",
"0.59544337",
"0.58540314",
"0.5744485",
"0.57092965",
"0.5621121",
"0.561321",
"0.5582224",
"0.55672777",
"0.55548894",
"0.55496716",
"0.5540424",
"0.5517544",
"0.54391015",
"0.5402843",
"0.5390066",
"0.538672",
"0.53818345",
"0.5367454",
"0.535706... | 0.7077303 | 0 |
Get an array compatible with netCDF dtypes from arry. Return an array whose dtype is not object. Assumes object arrays contain a single array. | def netcdf_compatible_array(arry):
arry = strip_array_wrappers(arry)
if arry.ndim > 0:
for _ in range(3):
if arry.dtype.char != "O" or arry.ndim == 0:
break
if arry.shape[0] == 1:
arry = np.array(arry[0])
else:
arry = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrayobj1d(inp: Iterable, copy=False) -> np.ndarray:\n return np.array([None] + list(inp), dtype=object, copy=copy)[1:]",
"def asanyarray(a, dtype=None, order='C'):\n\n if not use_origin_backend(a):\n # if it is already dpnp.ndarray then same object should be returned\n if isinstance(a, d... | [
"0.66872287",
"0.6613914",
"0.6587696",
"0.6414742",
"0.6394907",
"0.63766724",
"0.6293845",
"0.6103746",
"0.6089981",
"0.6086015",
"0.60744977",
"0.6069336",
"0.60535336",
"0.6049962",
"0.60398245",
"0.60095286",
"0.59996057",
"0.59889704",
"0.5969682",
"0.5966045",
"0.59654... | 0.7644806 | 0 |
Get the current position of the agent in the scene. | def current_agent_position(self):
return self.environment.current_agent_position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_position(agent):\n pos = Vector2()\n pos.x = agent.pose.pose.position.x\n pos.y = agent.pose.pose.position.y\n return pos",
"def getPosition(self):\n return self.ray.position",
"def pos(self):\n return Point(self.currentItem.mapFromScene(self._scenePos))",
"def pos(sel... | [
"0.81751263",
"0.77507883",
"0.74370384",
"0.74370384",
"0.74370384",
"0.7436141",
"0.7436141",
"0.7436141",
"0.7424659",
"0.7424659",
"0.73922944",
"0.73922944",
"0.73744804",
"0.7330624",
"0.73094887",
"0.7306678",
"0.7297189",
"0.72966325",
"0.72608054",
"0.7233372",
"0.71... | 0.82757956 | 0 |
Gets the com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_project_path of this ComAdobeCqScreensOfflinecontentImplBulkOfflineUpdateServiceImplProperties. | def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_project_path(self) -> ConfigNodePropertyArray:
return self._com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_project_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_project_path(self, com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_project_path: ConfigNodePropertyArray):\n\n self._com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_project_path ... | [
"0.7764515",
"0.48146278",
"0.47350243",
"0.46996203",
"0.4535057",
"0.45254976",
"0.45013237",
"0.44501546",
"0.43760243",
"0.43505484",
"0.43453646",
"0.4343443",
"0.4324654",
"0.43042755",
"0.42824844",
"0.4281275",
"0.42672518",
"0.42571616",
"0.42548645",
"0.42489636",
"... | 0.8421697 | 0 |
Gets the com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency of this ComAdobeCqScreensOfflinecontentImplBulkOfflineUpdateServiceImplProperties. | def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency(self) -> ConfigNodePropertyString:
return self._com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency(self, com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency: ConfigNodePropertyString):\n\n self._com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_... | [
"0.76947606",
"0.6221061",
"0.5595009",
"0.5345955",
"0.5337892",
"0.53328186",
"0.5282165",
"0.512679",
"0.5009555",
"0.49165097",
"0.48934576",
"0.48841956",
"0.48715895",
"0.47398967",
"0.46371377",
"0.4610023",
"0.46099532",
"0.45673016",
"0.45634767",
"0.456043",
"0.4551... | 0.83530736 | 0 |
Sets the com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency of this ComAdobeCqScreensOfflinecontentImplBulkOfflineUpdateServiceImplProperties. | def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency(self, com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency: ConfigNodePropertyString):
self._com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency(self) -> ConfigNodePropertyString:\n return self._com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency",
"def schedule_frequency(self) -> Optional[pulumi.Input['RefreshS... | [
"0.77291983",
"0.5553167",
"0.5211721",
"0.51133925",
"0.50520855",
"0.49935558",
"0.4988377",
"0.4857953",
"0.48417827",
"0.48257974",
"0.48166126",
"0.4794652",
"0.47946328",
"0.4793974",
"0.4793672",
"0.47701222",
"0.47458762",
"0.47301936",
"0.47045732",
"0.46926865",
"0.... | 0.83558667 | 0 |
Test if not logged user cannot delete a group. | def test_not_logged_cannot_delete(self):
utils.test_not_logged_cannot_access(self, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_not_in_group_cannot_delete(self):\n\n utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n\n utils.test_cannot_access(self, self.url, expected_url)\n self.assertEqual(len(Group.objects.all()), 1)",
"def test_not_creator_cannot_delete(self... | [
"0.84436494",
"0.7996995",
"0.7774906",
"0.76727885",
"0.76187766",
"0.7488057",
"0.7419512",
"0.73399526",
"0.70942676",
"0.7081216",
"0.70174646",
"0.69887334",
"0.6979419",
"0.69464743",
"0.6907956",
"0.68884057",
"0.68884057",
"0.68792915",
"0.68782115",
"0.68665004",
"0.... | 0.6975693 | 13 |
Test if user who is not in the group cannot delete and is redirected to my_groups_view. | def test_user_not_in_group_cannot_delete(self):
utils.create_user_and_authenticate(self)
expected_url = reverse('my_groups_view')
utils.test_cannot_access(self, self.url, expected_url)
self.assertEqual(len(Group.objects.all()), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_not_in_group_cannot_delete_tab(self):\n\n utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n\n utils.test_cannot_access(self, self.url, expected_url)\n self.assertEqual(len(Tab.objects.all()), 1)",
"def test_user_not_in_group_cannot_acc... | [
"0.7751776",
"0.75220597",
"0.7465341",
"0.74240047",
"0.72585595",
"0.7212814",
"0.71782136",
"0.7109453",
"0.6979112",
"0.6961299",
"0.6888154",
"0.68626213",
"0.6843624",
"0.6831654",
"0.67642856",
"0.6750346",
"0.66657156",
"0.65611464",
"0.6557292",
"0.65476567",
"0.6459... | 0.8092761 | 0 |
Test if creator of group who is in it can delete. | def test_creator_in_group_can_delete(self):
self.client.login(username='notlogged', password='notlogged')
expected_url = reverse('my_groups_view')
utils.test_can_access(self, self.url,
post_redirect_url=expected_url)
self.assertEqual(len(Group.objects.all(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_delete_permission(self):\n if getSecurityManager().checkPermission(\"Delete objects\", self):\n username = getSecurityManager().getUser().getUserName()\n if username == self.getOwner().getId():\n return True\n return False",
"def allowed_group_access_d... | [
"0.7103743",
"0.70155317",
"0.69939417",
"0.682081",
"0.674627",
"0.6741913",
"0.6741039",
"0.6708995",
"0.6654067",
"0.66117215",
"0.653666",
"0.64735955",
"0.64721966",
"0.6452353",
"0.639414",
"0.635729",
"0.6349456",
"0.63032204",
"0.63032204",
"0.6249518",
"0.6238502",
... | 0.7575944 | 0 |
Test if not logged user cannot access the group's view. | def test_not_logged_user_cannot_access(self):
utils.test_not_logged_cannot_access(self, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logged_user_not_in_group_cannot_access(self):\n\n utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n utils.test_cannot_access(self, self.url, expected_url)",
"def test_user_not_in_group_cannot_access(self):\n\n utils.create_user_and_authenti... | [
"0.83274865",
"0.8242403",
"0.7766358",
"0.7507943",
"0.7499446",
"0.74841535",
"0.7401261",
"0.72820675",
"0.72014195",
"0.7168022",
"0.7101498",
"0.7092945",
"0.70330316",
"0.69842505",
"0.6977071",
"0.6950686",
"0.69189435",
"0.6909778",
"0.68546915",
"0.6846951",
"0.68322... | 0.7605989 | 4 |
Test if user not in the group cannot access the group's view. | def test_user_not_in_group_cannot_access(self):
utils.create_user_and_authenticate(self)
expected_url = reverse('my_groups_view')
utils.test_cannot_access(self, self.url, expected_url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logged_user_not_in_group_cannot_access(self):\n\n utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n utils.test_cannot_access(self, self.url, expected_url)",
"def test_user_not_in_group_cannot_update(self):\n\n utils.create_user_and_authenti... | [
"0.8127918",
"0.7769374",
"0.76312774",
"0.75847906",
"0.7479362",
"0.7179417",
"0.7167001",
"0.6967209",
"0.69089156",
"0.69063365",
"0.69063365",
"0.69063365",
"0.69063365",
"0.6904077",
"0.689158",
"0.6867505",
"0.68503875",
"0.6833238",
"0.67994493",
"0.66726464",
"0.6655... | 0.83010256 | 0 |
Test if user in the group can access the group's view. | def test_user_in_group_can_access(self):
logged_user = utils.create_user_and_authenticate(self)
self.group.users.add(logged_user)
utils.test_can_access(self, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_permission(self, request, view):\n return request.user.group == 'admin'",
"def has_permission(self, request, view):\n usuario = request.user\n return str(usuario.grupo) == \"Vendedor\"",
"def has_permission(self, request, view):\n return request.user.group != 'patient'",
"... | [
"0.8398286",
"0.80416065",
"0.78774005",
"0.78491",
"0.779967",
"0.7753722",
"0.77534395",
"0.7690953",
"0.76031727",
"0.7575845",
"0.74442905",
"0.7417891",
"0.7393857",
"0.7360479",
"0.73391914",
"0.7320982",
"0.730672",
"0.72814685",
"0.7191342",
"0.71823525",
"0.7181419",... | 0.6827124 | 53 |
Test if logged user who already joined the group is redirected. | def test_logged_user_already_joined_is_redirected(self):
self.client.login(username='notlogged', password='notlogged')
response = self.client.get(self.url)
self.assertRedirects(response, reverse('my_groups_view'))
response = self.client.post(self.url)
self.assertRedirects(resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logged_user_can_join(self):\n\n logged_user = utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n\n utils.test_can_access(self, self.url,\n post_redirect_url=expected_url)\n\n self.assertIn(logged_user, self.group.u... | [
"0.7291255",
"0.71686155",
"0.66469526",
"0.65068424",
"0.6387516",
"0.6233293",
"0.6231481",
"0.6211274",
"0.61937743",
"0.6189052",
"0.61337894",
"0.60775816",
"0.6071009",
"0.5958737",
"0.5956799",
"0.59444934",
"0.5943503",
"0.5941254",
"0.5920972",
"0.59152657",
"0.58794... | 0.7615744 | 0 |
Test if not logged user cannot access the view. | def test_not_logged_user_cannot_access(self):
utils.test_not_logged_cannot_access(self, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_logged_cannot_access(self):\n\n utils.test_not_logged_cannot_access(self, self.url)",
"def assert_cannot_view(obj):\n selenium_utils.open_url(obj.url)\n assert ui_utils.is_error_403()",
"def test_not_logged_in(self):\n response = self.c.get(reverse(submit_point), {'lat': 34.0, 'lng... | [
"0.7962638",
"0.73514855",
"0.7195047",
"0.7141147",
"0.70708275",
"0.70582044",
"0.70553696",
"0.7034186",
"0.70256954",
"0.7014137",
"0.69830495",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346",
"0.6945346... | 0.8477163 | 1 |
Test if logged user can access the view. | def test_logged_user_can_access(self):
utils.create_user_and_authenticate(self)
utils.test_can_access(self, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def has_permission(self, request, view):\n if request.user.is_authenticated():\n return True\n return False",
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def can_be_viewed_by(sel... | [
"0.85734177",
"0.82252645",
"0.7937068",
"0.7887856",
"0.7868302",
"0.77498066",
"0.7672556",
"0.7628847",
"0.76126254",
"0.75641036",
"0.75320524",
"0.7503651",
"0.7494776",
"0.7438341",
"0.7436216",
"0.74281484",
"0.7418509",
"0.7418509",
"0.7418509",
"0.7398909",
"0.738007... | 0.7431767 | 15 |
Test if logged user see only joined groups. | def test_logged_user_see_only_joined_groups(self):
logged_user, not_logged_user = \
utils.create_two_users_authenticate_one(self)
seen = scripts.create_group('seen', 'seen', logged_user)
unseen = scripts.create_group('unseen', 'unseen', not_logged_user)
response = self.clie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logged_user_can_join(self):\n\n logged_user = utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n\n utils.test_can_access(self, self.url,\n post_redirect_url=expected_url)\n\n self.assertIn(logged_user, self.group.u... | [
"0.78712726",
"0.7121756",
"0.70003307",
"0.6751007",
"0.6718127",
"0.66807055",
"0.6638224",
"0.6561796",
"0.6520619",
"0.6499832",
"0.64802825",
"0.6470654",
"0.6467252",
"0.64560205",
"0.6446433",
"0.6438195",
"0.6435898",
"0.6430043",
"0.6391764",
"0.63495684",
"0.6346666... | 0.7974169 | 0 |
Test if logged user in group can leave it. | def test_logged_user_in_group_can_leave(self):
logged_user = utils.create_user_and_authenticate(self)
self.group.users.add(logged_user)
expected_url = reverse('my_groups_view')
utils.test_can_access(self, self.url,
post_redirect_url=expected_url)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_logged_user_cannot_leave(self):\n\n utils.test_not_logged_cannot_access(self, self.url)",
"def leave_group(self):\n\t\tself.sendMessage(ID_CTRL + \"LEAVE\", True)\n\t\tself.joinstate = 0\n\t\tself.createstate = 0\n\t\tself.__key = None",
"def can_leave_team(uid):\n current_user = get_use... | [
"0.717564",
"0.6916819",
"0.67417854",
"0.6572464",
"0.6259341",
"0.623888",
"0.62073165",
"0.61360705",
"0.60994637",
"0.60703975",
"0.59623474",
"0.5962141",
"0.5960211",
"0.5950684",
"0.594881",
"0.5916694",
"0.5854121",
"0.5841024",
"0.5841017",
"0.5836052",
"0.58187026",... | 0.7948205 | 0 |
Test if logged user not in group is redirected. | def test_logged_user_not_in_group_is_redirected(self):
logged_user = utils.create_user_and_authenticate(self)
response = self.client.get(self.url)
self.assertRedirects(response, reverse('my_groups_view'))
response = self.client.post(self.url)
self.assertRedirects(response, rev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logged_user_not_in_group_cannot_access(self):\n\n utils.create_user_and_authenticate(self)\n expected_url = reverse('my_groups_view')\n utils.test_cannot_access(self, self.url, expected_url)",
"def test_logged_user_already_joined_is_redirected(self):\n\n self.client.login(use... | [
"0.76528955",
"0.7490846",
"0.7377407",
"0.66444373",
"0.6623528",
"0.6611266",
"0.65157986",
"0.65157986",
"0.65157986",
"0.65157986",
"0.6499002",
"0.6498165",
"0.6475167",
"0.6439631",
"0.64326906",
"0.63115275",
"0.6306884",
"0.62967926",
"0.6273616",
"0.62521815",
"0.623... | 0.81507367 | 0 |
Test if not logged user cannot access the view. | def test_not_logged_user_cannot_access(self):
utils.test_not_logged_cannot_access(self, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_logged_cannot_access(self):\n\n utils.test_not_logged_cannot_access(self, self.url)",
"def assert_cannot_view(obj):\n selenium_utils.open_url(obj.url)\n assert ui_utils.is_error_403()",
"def test_not_logged_in(self):\n response = self.c.get(reverse(submit_point), {'lat': 34.0, 'lng... | [
"0.7964697",
"0.7351824",
"0.7196989",
"0.7140882",
"0.7070072",
"0.7058841",
"0.70573115",
"0.70357287",
"0.70270723",
"0.7015301",
"0.6984911",
"0.69444174",
"0.69444174",
"0.69444174",
"0.69444174",
"0.69444174",
"0.69444174",
"0.69444174",
"0.69444174",
"0.69444174",
"0.6... | 0.84788907 | 2 |
Test if logged user can access the view. | def test_logged_user_can_access(self):
utils.create_user_and_authenticate(self)
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def has_permission(self, request, view):\n if request.user.is_authenticated():\n return True\n return False",
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def can_be_viewed_by(sel... | [
"0.8572268",
"0.822499",
"0.7934867",
"0.78860265",
"0.786586",
"0.7748942",
"0.7671127",
"0.76292163",
"0.761052",
"0.7563227",
"0.7530556",
"0.7502641",
"0.74935335",
"0.74366987",
"0.7434737",
"0.74297297",
"0.7427123",
"0.7417502",
"0.7417502",
"0.7417502",
"0.7397844",
... | 0.6777647 | 99 |
Creates a new float ("f") array | def new_float(*args, **kwargs):
return array.array(FLOAT_TYPECODE, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_float(array):\n finial_array = []\n\n for number in array:\n finial_array.append(float(number))\n return finial_array",
"def py_make_float_array(cst, op_version=None):\n return numpy.array([cst], dtype=numpy.float32)",
"def floatX(arr):\n return np.asarray(arr, dt... | [
"0.7304302",
"0.6713156",
"0.66206926",
"0.6540736",
"0.6523692",
"0.64283293",
"0.6425455",
"0.6387579",
"0.6297701",
"0.6260626",
"0.61954945",
"0.61607736",
"0.6083319",
"0.6083319",
"0.60610193",
"0.6035965",
"0.5985892",
"0.5929911",
"0.587702",
"0.5853566",
"0.58390427"... | 0.82459986 | 0 |
Check if there are crossing edges between two faces. Return true if there are crossing edges and false otherwise. A face is represented by a series of edges(rays), i.e. faceOrig[] = [orig1u, orig1v, orig2u, orig2v, ... ] faceVec[] = [vec1u, vec1v, vec2u, vec2v, ... ] | def checkCrossingEdges(face1Orig, face1Vec, face2Orig, face2Vec):
face1Size = len(face1Orig)
face2Size = len(face2Orig)
for i in xrange(0, face1Size, 2):
o1x = face1Orig[i]
o1y = face1Orig[i+1]
v1x = face1Vec[i]
v1y = face1Vec[i+1]
n1x = v1y
n1y = -v1x
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faceIntersection(self, face):\n # Test wether both ends of the edge are in the same half space\n # (relative to <face>'s plane).\n normal = face.normalVect()\n v0 = vector(face.vertices[0])\n vp = vector(self.pvt)\n vn = vector(self.nvt)\n p = normal.dotProduct(... | [
"0.6867575",
"0.6104623",
"0.6102886",
"0.6033806",
"0.60139287",
"0.5986544",
"0.5930307",
"0.5777342",
"0.57301235",
"0.5729333",
"0.56762356",
"0.5668616",
"0.56596434",
"0.56273633",
"0.5601639",
"0.5521034",
"0.5519748",
"0.5506001",
"0.5502106",
"0.5500226",
"0.54815423... | 0.7475464 | 0 |
Set up the Netatmo switch platform. | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
@callback
def _create_entity(netatmo_device: NetatmoDevice) -> None:
entity = NetatmoSwitch(netatmo_device)
_LOGGER.debug("Adding switch %s", entity)
asy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_platform(hass, config, add_devices, discovery_info=None):\n from pybotvac import Account\n\n try:\n auth = Account(config[CONF_USERNAME], config[CONF_PASSWORD])\n except HTTPError:\n _LOGGER.error(\"Unable to connect to Neato API\")\n return False\n\n dev = []\n for ro... | [
"0.67062086",
"0.6453683",
"0.6443157",
"0.635149",
"0.63417196",
"0.6329259",
"0.63012594",
"0.6260712",
"0.62528366",
"0.6217826",
"0.6206926",
"0.6163937",
"0.6117656",
"0.6036012",
"0.6029125",
"0.6028257",
"0.60172457",
"0.59972453",
"0.5993295",
"0.5910496",
"0.590919",... | 0.0 | -1 |
Turn the zone on. | async def async_turn_on(self, **kwargs: Any) -> None:
await self._switch.async_on()
self._attr_is_on = True
self.async_write_ha_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_turn_on(self, **kwargs):\n self._wrap_device.device.set_duct_zone(self._zone, True)",
"def turn_on(self) -> None:\n self._monoprice.set_power(self._zone_id, True)",
"async def async_turn_on(self) -> None:\n self._zone.power = True",
"async def async_start_zone(self, *, zo... | [
"0.7661179",
"0.76038784",
"0.7120693",
"0.6860771",
"0.6744539",
"0.6450821",
"0.6372018",
"0.63587165",
"0.6299336",
"0.6290577",
"0.6225025",
"0.6208056",
"0.61659133",
"0.60895973",
"0.6080411",
"0.6035759",
"0.6032967",
"0.6018867",
"0.6002059",
"0.59844786",
"0.5972257"... | 0.0 | -1 |
Create a `ModelEndpoint` object according to a provided model endpoint dictionary. | def _convert_into_model_endpoint_object(
endpoint: typing.Dict[str, typing.Any], feature_analysis: bool = False
) -> mlrun.common.schemas.ModelEndpoint:
# Convert into `ModelEndpoint` object
endpoint_obj = mlrun.common.schemas.ModelEndpoint().from_flat_dict(endpoint)
# If feature a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_model_endpoint(\n cls,\n db_session: sqlalchemy.orm.Session,\n model_endpoint: mlrun.common.schemas.ModelEndpoint,\n ) -> mlrun.common.schemas.ModelEndpoint:\n\n if model_endpoint.spec.model_uri or model_endpoint.status.feature_stats:\n logger.info(\n ... | [
"0.71579885",
"0.6375824",
"0.6231307",
"0.61131525",
"0.59907466",
"0.59751236",
"0.5833769",
"0.56831276",
"0.56618935",
"0.5595704",
"0.55576915",
"0.5548332",
"0.5528234",
"0.53866714",
"0.53090334",
"0.5304563",
"0.5286656",
"0.5267784",
"0.5170992",
"0.5147115",
"0.5124... | 0.7205753 | 0 |
Creates the output tensor/op given the state tensor as input. | def call(self, state):
x = tf.cast(state, tf.float32)
x = self.flatten(x)
x -= self.min_vals
x /= self.max_vals - self.min_vals
x = 2.0 * x - 1.0 # Rescale in range [-1, 1].
x = self.dense1(x)
x = self.dense2(x)
x = self.last_layer(x)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_final_state(tensor, mask):\n tt = tf.transpose(tensor, [1, 0, 2])\n return tf.boolean_mask(tt, mask)",
"def _create_model(self, input_state, num_actions):\n with tf.name_scope('shared_layers'):\n layer = Dense(NN_WIDTH, activation = 'relu')(input_state);\n layer = ... | [
"0.661555",
"0.6495904",
"0.6492041",
"0.64566547",
"0.6289439",
"0.6248092",
"0.6245926",
"0.6221006",
"0.6187924",
"0.61544156",
"0.61445296",
"0.61396223",
"0.6090623",
"0.6088841",
"0.60426164",
"0.6037333",
"0.5973839",
"0.5946624",
"0.59405303",
"0.5922564",
"0.5899961"... | 0.5844161 | 30 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.