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 |
|---|---|---|---|---|---|---|
Test that lz4 output is a bytearray, not bytes, so that numpy deserialization is not forced to perform a deep copy to obtain a writeable array. Note that zlib, zstandard, and snappy don't have this option. | def test_lz4_decompression_avoids_deep_copy():
pytest.importorskip("lz4")
a = bytearray(1_000_000)
b = compressions["lz4"].compress(a)
c = compressions["lz4"].decompress(b)
assert isinstance(c, bytearray) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_decompress_1(self):\n b_array = bytearray([8]) + bytearray(b'abcd') + bytearray([0, 49])\n actual = LZ77.decompress(b_array)\n expected = 'abcdabc'\n self.assertEqual(actual, expected)",
"def test_bytearray_respects_length(self):\n self._respects_length_test(bytearray)... | [
"0.61614126",
"0.60792977",
"0.6006324",
"0.5978758",
"0.5940263",
"0.57191825",
"0.5688926",
"0.5632419",
"0.5631345",
"0.56150365",
"0.56053966",
"0.55997986",
"0.55997986",
"0.5523054",
"0.548766",
"0.5464243",
"0.5426304",
"0.5419309",
"0.5396777",
"0.53856736",
"0.535786... | 0.7047705 | 0 |
Gets the id of this Subscription. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n if not subscription_id:\n subscription_id = self.cmd.cli_ctx.data.get('subscription_id')\n if not subscription_id:\n subscription_id = Profile(cli_ctx=self.cmd.cl... | [
"0.79285127",
"0.7844872",
"0.7836286",
"0.7836286",
"0.7836286",
"0.7836286",
"0.7836286",
"0.7836286",
"0.7638341",
"0.7638341",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
"0.7611599",
... | 0.73760384 | 71 |
Sets the id of this Subscription. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)",
"def set_id(self, id):\n self.data['id'] = id",
"def id... | [
"0.805061",
"0.7966671",
"0.7816839",
"0.77255535",
"0.7611612",
"0.7564503",
"0.7564503",
"0.7564503",
"0.75567025",
"0.75567025",
"0.75567025",
"0.75567025",
"0.75567025",
"0.75375235",
"0.75375235",
"0.75375235",
"0.75375235",
"0.75375235",
"0.75375235",
"0.75375235",
"0.7... | 0.0 | -1 |
Gets the custom_domain of this Subscription. Additional domain parked to this subscription (e.g. support.example.com) | def custom_domain(self):
return self._custom_domain | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_domain(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"custom_domain\")",
"def custom_domain(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"custom_domain\")",
"def custom_domain(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, ... | [
"0.7693411",
"0.7693411",
"0.7693411",
"0.7396142",
"0.6929275",
"0.6841913",
"0.6580824",
"0.6518735",
"0.6494903",
"0.6464694",
"0.63817215",
"0.62589246",
"0.62536263",
"0.6192022",
"0.6121035",
"0.6121035",
"0.60580605",
"0.6033622",
"0.603335",
"0.6025324",
"0.60217696",... | 0.8184352 | 0 |
Gets the customer_email of this Subscription. | def customer_email(self):
return self._customer_email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customer_email(customer):\n return customer.get(\"email\")",
"def email(self):\n billing_contact = self.owner.organization_user.user\n return billing_contact.email",
"def get_customer(self):\n return self._customer",
"def get_customer(self):\n return self._customer",
"def... | [
"0.76194197",
"0.7510468",
"0.718357",
"0.718357",
"0.70904756",
"0.70904756",
"0.69993395",
"0.6930989",
"0.69225335",
"0.69127244",
"0.68605095",
"0.68451774",
"0.6751982",
"0.6751982",
"0.6751982",
"0.6751982",
"0.674039",
"0.6684782",
"0.6681342",
"0.666271",
"0.6639222",... | 0.8670679 | 0 |
Sets the customer_email of this Subscription. | def customer_email(self, customer_email):
self._customer_email = customer_email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customer(self, customer):\n\n self._customer = customer",
"def customer(self, customer):\n\n self._customer = customer",
"def customer_uuid(self, customer_uuid):\n\n self._customer_uuid = customer_uuid",
"def customer(self, customer):\n if customer is None:\n raise ... | [
"0.71579546",
"0.71579546",
"0.7123111",
"0.68914276",
"0.6829082",
"0.6829082",
"0.6829082",
"0.6829082",
"0.66683495",
"0.6566946",
"0.65185636",
"0.6461878",
"0.6461878",
"0.64379805",
"0.6393757",
"0.6393757",
"0.6393757",
"0.6393757",
"0.6393757",
"0.6393757",
"0.6393757... | 0.8680772 | 0 |
Gets the customer_name of this Subscription. | def customer_name(self):
return self._customer_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_customer(self):\n return self._customer",
"def get_customer(self):\n return self._customer",
"def customer_id(self) -> str:\n return self._customer_id",
"def getCustomer(self):\n return self._Customer",
"def get_billing_name(self):\n if self.billing_name:\n ... | [
"0.7422282",
"0.7422282",
"0.7249696",
"0.71735954",
"0.7066458",
"0.702173",
"0.6967441",
"0.6967441",
"0.69385684",
"0.6891034",
"0.6840236",
"0.63803655",
"0.63803655",
"0.6331311",
"0.6329586",
"0.6265542",
"0.6251801",
"0.6173871",
"0.61678904",
"0.616504",
"0.6136034",
... | 0.8726546 | 0 |
Sets the customer_name of this Subscription. | def customer_name(self, customer_name):
self._customer_name = customer_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customer(self, customer):\n\n self._customer = customer",
"def customer(self, customer):\n\n self._customer = customer",
"def customer_id(self, customer_id: str):\n self._customer_id = customer_id",
"def customer_id(self, customer_id):\n\n self._customer_id = customer_id",
"... | [
"0.72701705",
"0.72701705",
"0.7235606",
"0.72313845",
"0.72313845",
"0.72313845",
"0.72313845",
"0.69113487",
"0.68477046",
"0.6753203",
"0.6661585",
"0.6589104",
"0.65576816",
"0.65576816",
"0.6429408",
"0.6429408",
"0.631255",
"0.62437916",
"0.61369103",
"0.6004889",
"0.59... | 0.8798253 | 0 |
Gets the company of this Subscription. | def company(self):
return self._company | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_company(self, name):\n return self.website.company.id",
"def get_company(self, company_referece):\n url = 'companies/{0}'.format(company_referece)\n result = self.get(url)\n return result.get('company', result)",
"def get_company(self, name):\n return self.store.compa... | [
"0.7559707",
"0.7547816",
"0.74913836",
"0.74707437",
"0.70779455",
"0.6861598",
"0.6742208",
"0.6691231",
"0.65548396",
"0.64661324",
"0.64498425",
"0.6411034",
"0.6293388",
"0.6269212",
"0.6235009",
"0.61448485",
"0.60919255",
"0.6087857",
"0.60782784",
"0.6063791",
"0.6056... | 0.8184845 | 0 |
Sets the company of this Subscription. | def company(self, company):
self._company = company | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def company(self, company):\n\n self._company = company",
"def company(self, company):\n\n self._company = company",
"def design_company(self, design_company):\n\n self._design_company = design_company",
"def company_name(self, company_name):\n\n self._company_name = company_name"... | [
"0.82152945",
"0.82152945",
"0.70760614",
"0.6916972",
"0.67010695",
"0.6393221",
"0.6393221",
"0.616203",
"0.5969625",
"0.5732423",
"0.57207245",
"0.5661834",
"0.56523895",
"0.54824704",
"0.5416295",
"0.54066545",
"0.5389885",
"0.5377297",
"0.5361731",
"0.53482574",
"0.53373... | 0.82504916 | 0 |
Gets the date_created of this Subscription. | def date_created(self):
return self._date_created | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_date(self):\n return self._created_date",
"def created_date(self):\n return self._created_date",
"def date_created(self) -> datetime:\n return self._date_created",
"def date_created(self) -> str:\n return pulumi.get(self, \"date_created\")",
"def get_account_created_... | [
"0.83273",
"0.83273",
"0.8190115",
"0.7984648",
"0.79756516",
"0.790888",
"0.7835807",
"0.75913346",
"0.7532737",
"0.7497185",
"0.7497185",
"0.7497185",
"0.7468619",
"0.743187",
"0.743187",
"0.739039",
"0.735424",
"0.73210984",
"0.73210984",
"0.73210984",
"0.7319762",
"0.72... | 0.8275892 | 2 |
Gets the date_validity of this Subscription. | def date_validity(self):
return self._date_validity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiration_date(self) -> typing.Optional[datetime.datetime]:\n return self._values.get('expiration_date')",
"def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cert.getValidTo()\n return date",
... | [
"0.62170833",
"0.6209356",
"0.6019371",
"0.60187",
"0.59992915",
"0.5960085",
"0.5913156",
"0.586728",
"0.5801312",
"0.57371914",
"0.57100224",
"0.5705267",
"0.5687385",
"0.5687385",
"0.56575817",
"0.5623052",
"0.55944175",
"0.5518045",
"0.5476104",
"0.54734814",
"0.5450101",... | 0.8196839 | 0 |
Gets the status of this Subscription. I installing\nA active\nS suspended\nT terminated\nD deleted\n | def status(self):
return self._status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n with self.connection.lock:\n output = ''.join([line for line in self.connection.wpa_cli(self.status_command)[0]])\n return output",
"def status(self) -> str:\n return pulumi.get(self, \"status\")",
"def status(self) -> str:\n return pulumi.get(self, \"... | [
"0.69525975",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
"0.6864705",
... | 0.0 | -1 |
Gets the account_id of this Subscription. | def account_id(self):
return self._account_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self):\n\n return self._account_id",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def ... | [
"0.8491664",
"0.82527345",
"0.82527345",
"0.82527345",
"0.82527345",
"0.82527345",
"0.82527345",
"0.82527345",
"0.82527345",
"0.8215344",
"0.818634",
"0.80099714",
"0.79544866",
"0.79544866",
"0.79544866",
"0.79544866",
"0.79544866",
"0.7792685",
"0.7743747",
"0.7721056",
"0.... | 0.8452286 | 1 |
Sets the account_id of this Subscription. | def account_id(self, account_id):
self._account_id = account_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self, account_id):\n\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id",
"def account_id(self, account_id):\n\n self._account_id = account_id"... | [
"0.8443768",
"0.8443768",
"0.8443768",
"0.8443768",
"0.8443768",
"0.8443768",
"0.82517135",
"0.7537638",
"0.7472851",
"0.7145436",
"0.7118773",
"0.7118773",
"0.7118773",
"0.7118773",
"0.7025362",
"0.6523233",
"0.6505394",
"0.6505394",
"0.64621663",
"0.6403609",
"0.6403609",
... | 0.8404371 | 6 |
Gets the cluster_id of this Subscription. | def cluster_id(self):
return self._cluster_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_id(self) -> str:\n return pulumi.get(self, \"cluster_id\")",
"def cluster_id(self) -> str:\n return pulumi.get(self, \"cluster_id\")",
"def cluster_id(self) -> str:\n return pulumi.get(self, \"cluster_id\")",
"def cluster_id(self) -> str:\n return pulumi.get(self, \"cl... | [
"0.8435697",
"0.8435697",
"0.8435697",
"0.8435697",
"0.8435697",
"0.82122064",
"0.82122064",
"0.82122064",
"0.82122064",
"0.78138655",
"0.78138655",
"0.778369",
"0.778369",
"0.778369",
"0.7516979",
"0.74175745",
"0.70493674",
"0.70345265",
"0.6878775",
"0.6878775",
"0.6827758... | 0.8526055 | 0 |
Sets the cluster_id of this Subscription. | def cluster_id(self, cluster_id):
self._cluster_id = cluster_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_node_id(self, cluster_node_id):\n\n self._cluster_node_id = cluster_node_id",
"def cluster_uuid(self, cluster_uuid):\n\n self._cluster_uuid = cluster_uuid",
"def cluster(self, cluster):\n\n self._cluster = cluster",
"def cluster(self, cluster):\n\n self._cluster = clus... | [
"0.7726095",
"0.7613369",
"0.709329",
"0.709329",
"0.709329",
"0.709329",
"0.709329",
"0.709329",
"0.68470645",
"0.68214846",
"0.6786231",
"0.6610279",
"0.6339907",
"0.62104094",
"0.61526287",
"0.6086316",
"0.6086316",
"0.6086316",
"0.6086316",
"0.6086316",
"0.6046891",
"0.... | 0.8248091 | 0 |
Gets the task_id of this Subscription. | def task_id(self):
return self._task_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_id(self) -> str:\n return self.get_from_redis(\"task_id\")",
"def task_id(self):\n return self._mpis.task_id",
"def get_task_id(self):\n if self.task_id:\n return self.task_id\n return (f'{self.task_type}_{self.get_source_system().lower()}'\n f'.{s... | [
"0.8310622",
"0.78763574",
"0.75328475",
"0.72719264",
"0.7253412",
"0.66983986",
"0.66569626",
"0.65919757",
"0.6579565",
"0.6569426",
"0.6550442",
"0.6462296",
"0.6462296",
"0.6462296",
"0.6462296",
"0.6462296",
"0.64493996",
"0.6421516",
"0.6421516",
"0.6421516",
"0.642151... | 0.8440012 | 2 |
Gets the version of this Subscription. | def version(self):
return self._version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(self):\n return self._version",
"def get_version(self):\n return self._version",
"def get(self):\n return self._version",
"def get_version(self):\n return self.version",
"def version(self):\n return self._client.getVersion()",
"def get_version(self):\n ... | [
"0.7806325",
"0.7806325",
"0.77170503",
"0.76900214",
"0.76588196",
"0.76288325",
"0.7554105",
"0.7532424",
"0.7497206",
"0.7447975",
"0.74453664",
"0.74453664",
"0.7436709",
"0.74258363",
"0.73535717",
"0.7319623",
"0.7313775",
"0.7312144",
"0.726092",
"0.7256232",
"0.725187... | 0.74005693 | 17 |
Gets the is_latest of this Subscription. | def is_latest(self):
return self._is_latest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest(self) -> Optional[bool]:\n return pulumi.get(self, \"latest\")",
"def latest(self):\n return self._latest",
"def is_latest(self, is_latest):\n self._is_latest = is_latest",
"def is_last(self) -> Optional[bool]:\n return pulumi.get(self, \"is_last\")",
"def latest_flag... | [
"0.7792029",
"0.6650419",
"0.6577183",
"0.6512438",
"0.647528",
"0.6096951",
"0.60960424",
"0.60754114",
"0.60574335",
"0.60574335",
"0.60574335",
"0.60574335",
"0.60574335",
"0.60574335",
"0.60574335",
"0.6032853",
"0.59987444",
"0.5977414",
"0.5858078",
"0.58446467",
"0.577... | 0.7913719 | 0 |
Sets the is_latest of this Subscription. | def is_latest(self, is_latest):
self._is_latest = is_latest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest(self, latest):\n\n self._latest = latest",
"def is_latest(self):\n return self._is_latest",
"def latest(self) -> Optional[bool]:\n return pulumi.get(self, \"latest\")",
"def update_from_latest_data(self) -> None:\n self._attr_is_on = self.coordinator.data[self.entity_de... | [
"0.6376566",
"0.6254975",
"0.57535833",
"0.5600552",
"0.5547408",
"0.5427509",
"0.531856",
"0.5263689",
"0.52207404",
"0.51915294",
"0.5137971",
"0.5108727",
"0.50809115",
"0.5062451",
"0.5039356",
"0.5039356",
"0.5039356",
"0.5039356",
"0.49702114",
"0.49702114",
"0.49702114... | 0.7865691 | 0 |
Gets the product_id of this Subscription. | def product_id(self):
return self._product_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"product_id\")",
"def product_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"product_id\")",
"def product_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"product_id\")",
"def get_produ... | [
"0.79257846",
"0.7647346",
"0.7586719",
"0.7056033",
"0.69683146",
"0.68942994",
"0.68370515",
"0.6759598",
"0.6640832",
"0.6483972",
"0.64214677",
"0.6346179",
"0.63450515",
"0.63450515",
"0.6330493",
"0.62502724",
"0.6231944",
"0.6231944",
"0.6231944",
"0.62298137",
"0.6221... | 0.8429178 | 0 |
Sets the product_id of this Subscription. | def product_id(self, product_id):
self._product_id = product_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_id(self, product_id):\n\n self._product_id = product_id",
"def product_id(self, product_id):\n\n self._product_id = product_id",
"def product_id(self, product_id):\n if product_id is None:\n raise ValueError(\"Invalid value for `product_id`, must not be `None`\") # ... | [
"0.851048",
"0.851048",
"0.76561344",
"0.72087497",
"0.72087497",
"0.70622534",
"0.69918454",
"0.6656717",
"0.66529167",
"0.6651842",
"0.66163576",
"0.6610674",
"0.65376014",
"0.6497257",
"0.6497257",
"0.6497257",
"0.6497257",
"0.646325",
"0.6372063",
"0.6295532",
"0.6295532"... | 0.84808 | 2 |
Gets the variation_id of this Subscription. | def variation_id(self):
return self._variation_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription_id(self):\n return self.instance_metadata.subscription_id",
"def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n if not subscription_id:\n subscription_id = self.cmd.cli_ctx.data.get('subscription_id')\n ... | [
"0.66210264",
"0.62084866",
"0.61666286",
"0.61666286",
"0.61666286",
"0.61666286",
"0.60404414",
"0.58713377",
"0.58713377",
"0.58430845",
"0.58278877",
"0.5805981",
"0.5747429",
"0.57304144",
"0.5717507",
"0.5717507",
"0.5717507",
"0.5717507",
"0.5717507",
"0.5717507",
"0.5... | 0.86127335 | 0 |
Sets the variation_id of this Subscription. | def variation_id(self, variation_id):
self._variation_id = variation_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variation_id(self):\n return self._variation_id",
"def variation(self, variation):\n if self.local_vars_configuration.client_side_validation and variation is None: # noqa: E501\n raise ValueError(\"Invalid value for `variation`, must not be `None`\") # noqa: E501\n if (self.... | [
"0.66345805",
"0.587608",
"0.5772111",
"0.5772111",
"0.57485884",
"0.5724701",
"0.5615921",
"0.5615921",
"0.5519353",
"0.5519353",
"0.5519353",
"0.5432944",
"0.53735095",
"0.5350447",
"0.53479123",
"0.5281427",
"0.5275033",
"0.5275033",
"0.52545476",
"0.5232576",
"0.5184209",... | 0.84106547 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 16 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8455985",
"0.83913255",
"0.81440157",
"0.8140831",
"0.8132328",
"0.80937284",
"0.809181",
"0.809181",
"0.809181",
"0.808509",
"0.808509",
"0.8076134",
"0.8076134",
"0.8065528"
] | 0.0 | -1 |
Swaps two locations randomly in a list. modified code from stackoverflow.com/questions/47724017/swaptwovaluesrandomlyinlist | def swap_random(seq, noise=0.25, max_nodes=12):
# Swap makes no sense if less than 3 items.
if len(seq) <= 3:
return seq
# Sometimes we dont want to randomly swap.
if random.random() > noise:
return seq[:max_nodes]
idx = range(len(seq))
i1, i2 = random.sample(idx, 2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swapBetweenLists(values1, values2):\n\tp1 = randint(0, len(values1)-1)\n\tp2 = randint(0, len(values2)-1)\n\ttmp = values1[p1]\t\n\tvalues1[p1] = values2[p2]\n\tvalues2[p2] = tmp",
"def swap_one(list_one, list_two):\n i = random.choice(list_one)\n j = random.choice(list_two)\n\n list_one.remove(i)\n... | [
"0.7835078",
"0.7500118",
"0.73335874",
"0.70251495",
"0.69034314",
"0.68896145",
"0.68812424",
"0.68726194",
"0.6768729",
"0.6633629",
"0.66211516",
"0.6550803",
"0.64874864",
"0.6460514",
"0.63926226",
"0.63624364",
"0.6343409",
"0.63155895",
"0.6284738",
"0.62803197",
"0.6... | 0.640135 | 14 |
If the request body is a string, encode it to bytes (for python3 support) By default yaml serializes to utf8 encoded bytestrings. When this cassette is loaded by python3, it's automatically decoded into unicode strings. This makes sure that it stays a bytestring, since that's what all the internal httplib machinery is ... | def convert_body_to_bytes(resp):
try:
if resp["body"]["string"] is not None and not isinstance(resp["body"]["string"], six.binary_type):
resp["body"]["string"] = resp["body"]["string"].encode("utf-8")
except (KeyError, TypeError, UnicodeEncodeError):
# The thing we were converting ei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_body_encoded(self):\r\n return self.encode(self.get_body())",
"def _encode_post_dict(self, post_dict):\r\n return json.dumps({\r\n k: v.encode('utf-8') if v is not None else v\r\n for k, v in post_dict.items()\r\n })",
"def _encode(self, data, format: str = No... | [
"0.6145642",
"0.58662343",
"0.5859535",
"0.5841094",
"0.57032436",
"0.5686894",
"0.5683008",
"0.5648626",
"0.5643581",
"0.5601715",
"0.55765915",
"0.5566937",
"0.5566418",
"0.556296",
"0.55416656",
"0.5479621",
"0.54443896",
"0.5438886",
"0.5434842",
"0.54180634",
"0.54093057... | 0.68199295 | 0 |
Allows differences in a mapping whose keys satisfy the given predicate. | def allowedKeys(self, predicate, msg=None):
return allowed_keys(predicate, msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_dict(dictionary, pred):\n return dict((k, v) for k, v in dictionary.items() if pred(k, v))",
"def filter_keys(func, a_dict):\n return dict((k, v) for (k, v) in a_dict.items() if func(k))",
"def dict_subtract(a, b):\n return {k: a[k] for k in set(a) - set(b)}",
"def filt_dict(d: dict, incl... | [
"0.65425843",
"0.59362596",
"0.56723344",
"0.5620112",
"0.5588711",
"0.5533448",
"0.54976207",
"0.54599375",
"0.5450304",
"0.5416666",
"0.5405391",
"0.5350319",
"0.5348367",
"0.530538",
"0.52789265",
"0.5269836",
"0.52451867",
"0.52355486",
"0.52335525",
"0.52040917",
"0.5186... | 0.5345172 | 13 |
Load tf checkpoints in a pytorch model. | def load_tf_weights_in_t5(model, config, tf_checkpoint_path):
try:
import re
import numpy as np
import tensorflow as tf
except ImportError:
logger.error(
"Loading a TensorFlow model in PyTorch, requires TensorFlow to be installed. Please see "
"https://www... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(self, ckpt_fn):\n checkpoint = torch.load(ckpt_fn)\n self.net_.load_state_dict(checkpoint[\"model\"])\n self.optimizer_.load_state_dict(checkpoint[\"optimizer\"])\n self.epoch_ = checkpoint[\"epoch\"]\n self.global_step_ = checkpoint[\"global_st... | [
"0.7818547",
"0.77112293",
"0.76138324",
"0.7560399",
"0.7499998",
"0.7496065",
"0.7447952",
"0.74361366",
"0.73971164",
"0.73389333",
"0.7330062",
"0.7236497",
"0.71625334",
"0.7155759",
"0.7135457",
"0.71294856",
"0.7105434",
"0.70987046",
"0.70951587",
"0.70935684",
"0.709... | 0.68209064 | 42 |
Construct a layernorm module in the T5 style No bias and no substraction of mean. | def __init__(self, hidden_size, eps=1e-6):
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_init(module, mean=0, std=1, bias=0):\n nn.init.normal_(module.weight, mean, std)\n if hasattr(module, 'bias') and module.bias is not None:\n nn.init.constant_(module.bias, bias)",
"def _DefaultLN(self, name):\n p = self.params\n return p.layernorm_tpl.Copy().Set(\n name=name,... | [
"0.6149039",
"0.5660529",
"0.53075504",
"0.52757025",
"0.52448845",
"0.52398646",
"0.5222166",
"0.52217126",
"0.52188176",
"0.52066785",
"0.5199795",
"0.5199795",
"0.5194235",
"0.5190357",
"0.51543766",
"0.5133761",
"0.51334167",
"0.51330906",
"0.51242316",
"0.5117686",
"0.51... | 0.0 | -1 |
Reshape the tensors to fixed sizes. | def _set_shapes(self, batch_size, features_in, labels_in):
features_in['mcts_features'] = tf.reshape(
features_in['mcts_features'], [batch_size, self._env_state_space],
name='mcts_feature_reshape')
features_in['policy_features'] = tf.reshape(
features_in['policy_features'], [batch_size,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape(tensor, newshape):\n raise NotImplementedError",
"def reshape(arr):\r\n reshape_arr = np.empty((3,240,320),dtype='float32')\r\n reshape_arr[0,:,:] = arr[:,:,0]\r\n reshape_arr[1,:,:] = arr[:,:,1]\r\n reshape_arr[2,:,:] = arr[:,:,2]\r\n return reshape_arr",
"def reshape(data):\... | [
"0.67534953",
"0.6634416",
"0.66150916",
"0.659883",
"0.65709877",
"0.65373147",
"0.65271604",
"0.6501701",
"0.647631",
"0.6449136",
"0.64484954",
"0.64409256",
"0.6437004",
"0.6395474",
"0.638149",
"0.63664556",
"0.635962",
"0.635962",
"0.63365865",
"0.63337696",
"0.63337696... | 0.0 | -1 |
Initialize a tf.Estimator run with random initial weights. This bootstrap is used when a random checkpoint is required. | def bootstrap(self, working_dir):
estimator_initial_checkpoint_name = 'model.ckpt-1'
save_file = os.path.join(working_dir, estimator_initial_checkpoint_name)
sess = tf.Session(graph=tf.Graph())
with sess.graph.as_default():
features = self.get_inference_input_ppo_bootstrap()
self._model_fn(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker_init_fn(worker_id):\r\n base_seed = torch.IntTensor(1).random_().item()\r\n #print(worker_id, base_seed)\r\n np.random.seed(base_seed + worker_id)",
"def worker_init_fn(worker_id: int) -> None:\n worker_info = torch.utils.data.get_worker_info()\n set_rnd(worker_info.dataset, seed=worker... | [
"0.6505552",
"0.64185923",
"0.6407201",
"0.6384337",
"0.6384337",
"0.6344618",
"0.6292673",
"0.6229996",
"0.6229996",
"0.6197513",
"0.61764187",
"0.6134716",
"0.61217505",
"0.61215407",
"0.6058252",
"0.60273933",
"0.60268533",
"0.60197383",
"0.60060424",
"0.5984391",
"0.59660... | 0.64928955 | 1 |
Argument 'removeTerms' should be a list of words | def SetRemoveTerms( self, removeTerms ):
self.removeTermsNew = removeTerms | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_terms(self, *terms):\n result = self.sequence\n for term in ANCOVA(*terms).sequence:\n result.remove(term)\n return ANCOVA(*result)",
"def delete_words(self, words=None):\n\n if words is None:\n words = self.stopwords\n\n self.__corpora = [\n ... | [
"0.72686106",
"0.71809417",
"0.70104283",
"0.69979584",
"0.69558203",
"0.69374365",
"0.69373333",
"0.68902355",
"0.68818206",
"0.6870223",
"0.6843433",
"0.68336767",
"0.6831448",
"0.68261886",
"0.6821065",
"0.6812066",
"0.6805833",
"0.67708194",
"0.67708194",
"0.67708194",
"0... | 0.69879866 | 4 |
Access a value from os.environ. Handles proxied variables, e.g. SMTP_LOGIN={{MAILGUN_LOGIN}}. Returns a tuple (envvar_key, envvar_value, proxied_key). The ``envvar_key`` will be different from the passed key for proxied variables. proxied_key will be None if the envvar isn't proxied. The ``proxied`` flag is recursively... | def _get_from_environ(self, key, default, proxied=False):
env_key = self._get_key(key, omit_prefix=proxied)
value = os.environ.get(env_key, default)
if hasattr(value, "strip"):
match = _PROXIED_PATTERN.match(value)
if match: # Proxied variable
proxied_key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, key):\n return os.environ[key]",
"def getenv(self, key):\n return self._env[key]",
"def get(self, key, default=None):\n value = os.environ.get(key)\n\n if value:\n self.logging.info(\"Got %s from environment.\" % key)\n self.logging.debug(... | [
"0.6720226",
"0.671493",
"0.6619462",
"0.65980035",
"0.6448069",
"0.6441465",
"0.6418035",
"0.64146227",
"0.63960963",
"0.6365213",
"0.6345853",
"0.6342052",
"0.6313833",
"0.6304164",
"0.62890786",
"0.62765336",
"0.62765336",
"0.62590826",
"0.6235576",
"0.62013257",
"0.619535... | 0.7715215 | 0 |
add a new node to the doubly linked list with the given value. almost the same as the standard linked list, except for dealing with the previous reference. | def addItem(self, value):
_linkedNode = DoublyLinkedNode(value)
if self._linkHead == None:
self._linkHead = _linkedNode
self._linkTail = _linkedNode
return True
self._linkTail._itemNext = _linkedNode
_linkedNode._itemPre = self._linkTail
self._linkTail = _linkedNode
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, value):\n # Find the tail\n tail = self.head\n while tail and tail.next:\n tail = tail.next\n\n if tail:\n # Add a new node with the value\n tail.next = Node(value, tail, None)\n else:\n # Add first node to the list\n ... | [
"0.7865144",
"0.78065467",
"0.77608156",
"0.7664134",
"0.7630519",
"0.75759053",
"0.7546384",
"0.75423765",
"0.75323975",
"0.7524561",
"0.7409395",
"0.74072576",
"0.73700374",
"0.73417383",
"0.7316891",
"0.7280919",
"0.72518647",
"0.7220423",
"0.7200418",
"0.7192233",
"0.7169... | 0.7026502 | 31 |
Return an indented text. 'lines' can be a list of lines or a single line (as a string). One level of indentation is 4 spaces. | def _indent_text(self, lines, level=1):
prefix = ' ' * (4 * level)
if isinstance(lines, basestring):
return prefix + lines
else:
return '\n'.join(
prefix + line
for line in lines
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent(lines, spaces=4):\n if isinstance(lines, str):\n text = [lines]\n text = \"\\n\".join(lines)\n return textwrap.indent(text, \" \" * spaces)",
"def indent(lines_or_str, indent_str=' ', join=True):\n if isinstance(lines_or_str, str):\n lines = lines_or_str.split('\\n')\n el... | [
"0.79630816",
"0.640413",
"0.63974655",
"0.63974655",
"0.6344658",
"0.6323063",
"0.6194979",
"0.6176289",
"0.59741896",
"0.59602433",
"0.5891417",
"0.5885713",
"0.5865051",
"0.58442193",
"0.5794399",
"0.5776509",
"0.57302696",
"0.5708509",
"0.5685989",
"0.5626474",
"0.5616447... | 0.82223237 | 0 |
Constructs an App This is not intended for direct instantiation. Use the derived PrivateApp or PublicApp instead. | def __init__(self, owner):
self._owner = owner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\n raise NotImplementedError",
"def __new__(cls, debug=False):\n if not App.instance:\n App.instance = App.__OnlyApp(debug)\n return App.instance",
"def get_app(self):\n return Application()",
"def _create_app_instance(script_info):\n return crea... | [
"0.7700531",
"0.7330789",
"0.71962327",
"0.7188048",
"0.71236545",
"0.6955145",
"0.68156475",
"0.68141276",
"0.68039846",
"0.67972356",
"0.6729226",
"0.6717517",
"0.6705088",
"0.6683924",
"0.6677634",
"0.6652181",
"0.6612519",
"0.66037834",
"0.6564347",
"0.6559178",
"0.654754... | 0.0 | -1 |
Loads the pretrained weights of the opcodes subnetwork into the bimodal architecture | def load_opcodes_subnetwork_pretrained_weights(self, model):
print("ToImplement") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_bytes_subnetwork_pretrained_weights(self, model):\n print(\"ToImplement\")",
"def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()",
"... | [
"0.72961056",
"0.70640045",
"0.6582828",
"0.656916",
"0.6565025",
"0.65418714",
"0.6476783",
"0.64429015",
"0.6422145",
"0.6420271",
"0.6410404",
"0.63969994",
"0.6389589",
"0.63370204",
"0.63306904",
"0.63306904",
"0.6329062",
"0.6295602",
"0.6280716",
"0.6260058",
"0.625777... | 0.7788815 | 0 |
Loads the pretrained weights of the bytes subnetwork into the bimodal architecture | def load_bytes_subnetwork_pretrained_weights(self, model):
print("ToImplement") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_opcodes_subnetwork_pretrained_weights(self, model):\n print(\"ToImplement\")",
"def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()",
... | [
"0.75475764",
"0.7483382",
"0.7016825",
"0.6901651",
"0.6805089",
"0.68039495",
"0.678437",
"0.6779721",
"0.6751675",
"0.6708222",
"0.6690305",
"0.66792923",
"0.6665609",
"0.6630812",
"0.66163427",
"0.6599024",
"0.6572008",
"0.65493804",
"0.6499725",
"0.6499392",
"0.6495548",... | 0.8378159 | 0 |
Returns the waveform value at the given X coordinate. | def get_value(self, xval: float, wvtype: str, wv_id: int, precision=6) -> float:
fmt = ':measure:vtime? {0:.%dg},{1}{2}' % precision
return float(self.query(fmt.format(xval, wvtype, wv_id))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self, x):\n return np.dot(self.w, x)",
"def wavefunction(self, x):\n return ( float(1) / math.pi**(float(1)/4)) * math.exp( x**2 / float(-2))",
"def get(self, x):\r\n f = math.sin(self.phase_offset + self.angular_frequency*x)\r\n return self.amplitude_offset + self.amp... | [
"0.72896606",
"0.72179216",
"0.7014188",
"0.67219824",
"0.66986334",
"0.66653466",
"0.6443925",
"0.6343845",
"0.62670535",
"0.6257931",
"0.62529427",
"0.62387985",
"0.61946034",
"0.6187429",
"0.61417276",
"0.61289454",
"0.61245733",
"0.6116466",
"0.6101549",
"0.6101549",
"0.6... | 0.0 | -1 |
Returns the maximum voltage of the given channel. | def get_vmax(self, ch_id: int) -> float:
return float(self.query(':measure:vmax? channel{}'.format(ch_id))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_voltage(self, channel):\n self.check_validity()\n\n channel = int(channel)\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_VOLTAGE, (channel,), 'B', 12, 'i')",
"def get_max_cell_voltage(self): \n summary = \" \".join(self.get_summa... | [
"0.74427354",
"0.7182135",
"0.6915198",
"0.68923616",
"0.6622036",
"0.6570844",
"0.65470845",
"0.6478647",
"0.6469492",
"0.64544976",
"0.6361184",
"0.62316",
"0.61803997",
"0.6167478",
"0.61276597",
"0.606692",
"0.60384613",
"0.6021789",
"0.60194564",
"0.60038114",
"0.5992744... | 0.7759395 | 0 |
Returns the minimum voltage of the given channel. | def get_vmin(self, ch_id: int) -> float:
return float(self.query(':measure:vmin? channel{}'.format(ch_id))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min_cell_voltage(self):\n summary = \" \".join(self.get_summary().split())\n pattern = '\\$.... .. .*? .*? .*? (.*?) .*? . .*? .*? . . . .*?'\n minv = float(re.findall(pattern,summary).pop())\n return minv",
"def getMinGain(self, channel, group=\"I\", unitCode=0):\n if ... | [
"0.6956547",
"0.661885",
"0.6475814",
"0.64179987",
"0.6300553",
"0.62729496",
"0.6152619",
"0.6053662",
"0.59502476",
"0.5935185",
"0.59131867",
"0.5884707",
"0.5851876",
"0.5824277",
"0.58178663",
"0.58178663",
"0.57686234",
"0.5750246",
"0.57394665",
"0.57382387",
"0.57300... | 0.7535327 | 0 |
Returns value for variable in os.environ Function throws AssertionError if variable is defined. Unittest based python tests require certain input params to be set in environment, otherwise they can't be run | def env_get_var_value(var_name, allow_missing=False):
if allow_missing:
if var_name not in os.environ.keys():
return None
assert var_name in os.environ.keys(), "Please supply %s in environment" % var_name
return os.environ[var_name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_environment_string(self):\n pass",
"def env(var):\n return os.environ[var]",
"def get_value(key:str):\n value = environ.get(key)\n if value == None or len(str(value)) == 0:\n raise ValueError('Missing env: '+key)\n return value",
"def getenv_check(e):\n res = os.getenv(e)\n ... | [
"0.75374365",
"0.74225664",
"0.741899",
"0.7292368",
"0.70756626",
"0.7064996",
"0.70033056",
"0.69782495",
"0.6969381",
"0.69562095",
"0.69478625",
"0.69352615",
"0.6934913",
"0.69261736",
"0.6924561",
"0.6920273",
"0.69057196",
"0.69008434",
"0.6896105",
"0.6882389",
"0.687... | 0.7252702 | 4 |
Expand the called script into a fully resolved path in the bin directory. | def _make_cmdline(self, line):
if isinstance(line, list):
parts = line
else:
parts = line.split(" ", 1)
cmd = parts[0]
exe = os.path.join(BINDIR, cmd)
python_cmds = ["samba-tool",
"samba_dnsupdate",
"samba_upgradedns",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rel_resolve(path):\n if os.path.isabs(path):\n return os.path.abspath(path)\n else:\n return os.path.join(SCRIPTDIR, path)",
"def do__relative_load(self, arg=None):\n if arg:\n arg = arg.split(None, 1)\n targetname, args = arg[0], (arg[1:] or [''])[0]\n ... | [
"0.60820305",
"0.5934515",
"0.5885685",
"0.58721286",
"0.5850962",
"0.58292955",
"0.5817957",
"0.58098596",
"0.5798774",
"0.5798774",
"0.5798",
"0.5761396",
"0.5739803",
"0.57292557",
"0.5722865",
"0.5715768",
"0.5707328",
"0.56968975",
"0.5681231",
"0.5675726",
"0.5667794",
... | 0.0 | -1 |
Given a list of PollDataRows, returns the most recent row with the specified Pollster and State. If no such row exists, returns None. | def most_recent_poll_row(poll_rows, pollster, state):
mostrecent = None #Set a variable equal to None
date2 = 'Feb 10 1900' #Create an old formatted date
for row in poll_rows: #Iterate through each row
date = row['Date'] #Extract the date of each row
if row['State'] == st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_recent_poll_row(poll_rows, pollster, state):\n # in order to return None if there is no answer, we initialize res with None.\n most_recent_row = None\n # traverse all rows to find rows with indicated pollster and state\n for row in poll_rows:\n \t# if pollster and state match\n \tif poll... | [
"0.8337372",
"0.8255183",
"0.5863254",
"0.56088597",
"0.5608422",
"0.55023825",
"0.51645875",
"0.51461434",
"0.509285",
"0.5077059",
"0.5072742",
"0.50276756",
"0.50032103",
"0.49313924",
"0.48918268",
"0.4890832",
"0.48795635",
"0.48758864",
"0.4875526",
"0.48738375",
"0.486... | 0.82058054 | 2 |
Test if device has given group address. | def has_group_address(self, group_address):
return (
# self.datetime.has_group_address(group_address)
self.date.has_group_address(group_address)
or self.time.has_group_address(group_address) # noqa W503
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_group_address(self, group_address):\n return self.switch.has_group_address(group_address)",
"def test_has_group_address(self):\n xknx = XKNX(loop=self.loop)\n sensor = Sensor(\n xknx,\n 'TestSensor',\n value_type='temperature',\n group_addr... | [
"0.8003855",
"0.74194866",
"0.73597074",
"0.684124",
"0.6833056",
"0.679198",
"0.66302305",
"0.65502614",
"0.6527251",
"0.64366084",
"0.6386731",
"0.637297",
"0.6313541",
"0.6309699",
"0.6300635",
"0.62995213",
"0.6286691",
"0.62814397",
"0.6268198",
"0.6267067",
"0.62516564"... | 0.70567983 | 3 |
Retrieve final DFR near the surface. | def retrieve_dfrFinalNearSurface(ds):
da_z = ds["zFactorFinalNearSurface"]
da_dfr = da_z.sel(radar_frequency="Ku") - da_z.sel(radar_frequency="Ka")
da_dfr.name = "dfrFinalNearSurface"
return da_dfr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_rfl(self, x_surface, geom):\n\n return self.rfl",
"def _dsurface_dR(self):\n\n I_bs = (self.I0 * self._mu_0\n * self.SRF.brdf(self.t_0, self.t_ex,\n self.p_0, self.p_ex,\n param_dict=self.param_dict))\n\n\n ... | [
"0.64866763",
"0.64627886",
"0.6342827",
"0.5931995",
"0.5865273",
"0.58607084",
"0.5856718",
"0.57532334",
"0.5750242",
"0.5593547",
"0.5573624",
"0.55248797",
"0.5496554",
"0.5466644",
"0.54628515",
"0.5419447",
"0.5406833",
"0.53946894",
"0.5385631",
"0.5371302",
"0.535946... | 0.76546776 | 0 |
Retrieve the vertical maximum radar reflectivity in the column. | def retrieve_REFC(
ds,
variable="zFactorFinal",
radar_frequency="Ku",
mask_bright_band=False,
mask_solid_phase=False,
mask_liquid_phase=False,
):
if mask_solid_phase and mask_liquid_phase:
raise ValueError("Either specify 'mask_solid_phase' or 'mask_liquid_phase'.")
# Retrieve re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_cell_voltage(self): \n summary = \" \".join(self.get_summary().split())\n pattern = '\\$.... .. .*? .*? .*? .*? (.*?) . .*? .*? . . . .*?'\n maxv = float(re.findall(pattern,summary).pop())\n return maxv",
"def get_vmax(self, ch_id: int) -> float:\n return flo... | [
"0.6722998",
"0.64350724",
"0.63458127",
"0.61588246",
"0.6099622",
"0.59743255",
"0.5958981",
"0.58683825",
"0.5791696",
"0.57912415",
"0.5766302",
"0.5761903",
"0.57539874",
"0.5733451",
"0.5703486",
"0.5691049",
"0.5687884",
"0.56864774",
"0.5685399",
"0.5664946",
"0.56626... | 0.0 | -1 |
Compute Hail Kinetic Energy. Lower and upper reflectivity thresholds are used to retain only higher reflectivities typically associated with hail and filtering out most of the lower reflectivities typically associated with liquid water. | def retrieve_HailKineticEnergy(
ds, variable="zFactorFinal", radar_frequency="Ku", lower_threshold=40, upper_threshold=50
):
# Retrieve required DataArrays
da_z = ds[variable].sel({"radar_frequency": radar_frequency})
# Compute W(Z)
# - Used to define a transition zone between rain and hail reflect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __energy__(self, initial_data: np.ndarray, threshold: float) -> float:\n\n energy = - 0.5 * initial_data.dot(self.weights).dot(initial_data)\n energy += np.sum(initial_data * threshold)\n\n return energy",
"def internal_heat_gain(dwelling):\n losses_gain = -40 * dwelling.Nocc\n wat... | [
"0.6326549",
"0.6297221",
"0.6187218",
"0.60141456",
"0.59916383",
"0.5960822",
"0.59040296",
"0.5834685",
"0.58133435",
"0.5754812",
"0.5747526",
"0.5731435",
"0.5659568",
"0.5629961",
"0.56025195",
"0.5558216",
"0.5541765",
"0.55261976",
"0.55078363",
"0.5470382",
"0.545229... | 0.7036735 | 0 |
The Probability of Severe Hail (POSH). The probability of 0.75inch diameter hail occurring. When SHI = WT, POSH = 50%. Output probabilities are rounded off to the nearest 10%, to avoid conveying an unrealistic degree of precision. | def retrieve_POSH(ds):
# Retrieve zero-degree height
da_height_0 = ds["heightZeroDeg"]
# Retrieve warning threshold
da_wt = 57.5 * da_height_0 - 121
# Retrieve SHI
da_shi = retrieve_SHI(ds)
# Retrieve POSH
da_posh = 29 * np.log(da_shi / da_wt) + 50
da_posh = da_shi.clip(min=0, max=1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_hour(self):\n if self.is_salary():\n return 0.0\n return self.wage_cents / 100.0",
"def punch(self):\n if self.weight < 5.0:\n return 'That tickles.'\n elif self.weight >= 5.0 and self.weight < 15.0:\n return 'Hey that hurt!'\n else:\n ... | [
"0.60544294",
"0.60503155",
"0.60411775",
"0.60223216",
"0.6005808",
"0.59674233",
"0.59442127",
"0.59323806",
"0.5923622",
"0.59135205",
"0.5901381",
"0.5889842",
"0.5853344",
"0.583912",
"0.5829637",
"0.58242655",
"0.579512",
"0.5791714",
"0.57707137",
"0.5753673",
"0.57243... | 0.6950061 | 0 |
Convert a corpus file into chunks of size n | def corpus2chunks(corpus_fname: Union[str, Path], n: int):
with open(corpus_fname) as f:
out = f.read()
print("Starting spacy processing of document")
doc = nlp(out)
print("Finished spacy processing.")
sentences = [s.text for s in doc.sents]
chunked_sents = [
rem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_corpus(filename):\n\n fid = 1\n with open(filename, 'r') as infile:\n f = open('%s-%s.txt' % (filename.strip('.txt'), fid), 'wb')\n for line, doc in enumerate(infile):\n f.write(doc)\n if not line % 1000 and line > 1:\n f.close()\n ... | [
"0.6632512",
"0.6395442",
"0.6321116",
"0.63119787",
"0.6302326",
"0.6281511",
"0.6231243",
"0.6227218",
"0.6214203",
"0.61787975",
"0.61548126",
"0.6150591",
"0.6146923",
"0.61394125",
"0.61287",
"0.6123003",
"0.61135757",
"0.6106985",
"0.6106829",
"0.6106829",
"0.6102783",
... | 0.77147263 | 0 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8420823",
"0.8404479",
"0.8361814",
"0.83085257",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8282424",
"0.8235543",
"0.8217555",
"0.8213202",
"0.82027507",
"0.8181267",
"0.81790775",
"0.81728435",
"0.81534296",
"0.8117203",
"0.80905306",
"0.8072701... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88995916",
"0.88373667",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8804994",
"0.8714837",
"0.86373883",
"0.86191267",
"0.85986114",
"0.8572542",
"0.8569049",
"0.8569049",
"0.8446438",
"0.8446438",
"0.8446438"... | 0.0 | -1 |
Create a onehot vector from a class index or a list of class indices. | def one_hot_from_int(int_or_list, batch_size=1):
if isinstance(int_or_list, int):
int_or_list = [int_or_list]
if len(int_or_list) == 1 and batch_size > 1:
int_or_list = [int_or_list[0]] * batch_size
assert batch_size == len(int_or_list)
array = np.zeros((batch_size, 1000), dtype=np.fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_one_hot(class_indices, num_classes):\n one_hot_vectors = np.zeros((len(class_indices), num_classes))\n for vector_arg, class_args in enumerate(class_indices):\n one_hot_vectors[vector_arg, class_args] = 1.0\n return one_hot_vectors",
"def indices_to_one_hot(cls_indeces, nb_classes):\n t... | [
"0.8721072",
"0.82700574",
"0.82155186",
"0.8082604",
"0.8082604",
"0.8082604",
"0.8082604",
"0.8008652",
"0.79250443",
"0.791899",
"0.7895276",
"0.784519",
"0.783387",
"0.7762184",
"0.7748371",
"0.7682285",
"0.7672625",
"0.7608456",
"0.7584713",
"0.7567186",
"0.7567186",
"... | 0.0 | -1 |
Remove latest configuration file and use the same configuration that was in place before running the test | def disable(self):
logging.debug("Restoring autologin configuration...")
backup_filename = None
for filename in self.generate_backup_filename():
if not os.path.exists(filename):
break
backup_filename = filename
if backup_filename:
shut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_server_configuration_fixture():\n config_instance = Configuration()\n Path(config_instance.server_config_dir, 'test-gigantum-com.json').unlink()\n Path(config_instance.server_config_dir, 'CURRENT').unlink()\n config_instance._get_redis_client().delete(config_instance.SERVER_CONFIG_CACHE_KEY,\... | [
"0.71908057",
"0.70239425",
"0.68403846",
"0.681763",
"0.6767878",
"0.6739893",
"0.67208743",
"0.663871",
"0.6597442",
"0.65823597",
"0.651881",
"0.6515449",
"0.648903",
"0.646717",
"0.64662087",
"0.6465145",
"0.6451274",
"0.6450656",
"0.6436073",
"0.6430939",
"0.6426551",
... | 0.59426636 | 68 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(self, confusion_matrix, class_names, normalize=False, cmap="gray", path_to_save="./", name="temp"):
# https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py
if normalize:
... | {
"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.81940335",
"0.8095006",
"0.80290395",
"0.8019189",
"0.7993875",
"0.7991161",
"0.79809004",
"0.7975263",
"0.7961412",
"0.7956938",
"0.7937461",
"0.7934524",
"0.7934342",
"0.7931134",
"0.7926225",
"0.79244965",
"0.792367",
"0.79231006",
"0.7922885",
"0.792215",
"0.7917699",
... | 0.0 | -1 |
Constructs a DummyModel with given policy and session. | def __init__(self, policy, sess):
super().__init__(policy=policy, env=None, requires_vec_env=True, policy_base='Dummy')
self.sess = sess | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, policy):\n super().__init__(policy=policy, sess=policy.sess)",
"def _create_model(self):\n\n model_formula = self.get_model_formula()\n\n removed_observation_index = self._model_dataset.index.isin(self._excluded_observations)\n\n # TODO: Handle error that occurs whe... | [
"0.64510643",
"0.54727256",
"0.5442567",
"0.53141403",
"0.5308589",
"0.5301072",
"0.52993226",
"0.52726877",
"0.52682257",
"0.5239075",
"0.52166986",
"0.52156335",
"0.52156335",
"0.52156335",
"0.52156335",
"0.52115303",
"0.52065146",
"0.52058905",
"0.51791835",
"0.5139506",
"... | 0.672118 | 0 |
Constructs a BaseRLModel using policy for predictions. | def __init__(self, policy):
super().__init__(policy=policy, sess=policy.sess) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, num_policies: int, net_params: dict) -> None:\n self.policy_choice_history = []\n self.past_input_vectors = []\n self.target_output_vectors = []\n self.lookback = net_params[\"LOOKBACK\"]\n\n self.net = RL_RNN(\n num_policies = num_policies,\n ... | [
"0.66082716",
"0.61091316",
"0.59627974",
"0.594257",
"0.5866183",
"0.58219606",
"0.58125573",
"0.57950366",
"0.57929695",
"0.5767319",
"0.5733662",
"0.5686977",
"0.56835204",
"0.56789756",
"0.5658744",
"0.5612555",
"0.56069416",
"0.5596966",
"0.55875707",
"0.5581671",
"0.556... | 0.60926884 | 2 |
Filter comments from specific post | def get_queryset(self):
post_pk = self.get_post().pk
queryset = super(CommentListView, self).get_queryset()
return queryset.filter(object_pk=post_pk) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments(id_post):\n return Comms.objects.filter(post__id=id_post)",
"def _filter_posts(posts):\n\n return filter(_filter_post, posts)",
"def return_filtered_comments(submission):\n submission.comment_sort = COMMENT_SORT_BY\n submission.comment_limit = COMMENT_LIMIT\n filtered_comments =... | [
"0.6657972",
"0.66501045",
"0.66192067",
"0.6609589",
"0.6512286",
"0.64465034",
"0.6414895",
"0.63012797",
"0.6212435",
"0.6206472",
"0.6175947",
"0.6041768",
"0.6026764",
"0.5981375",
"0.598012",
"0.5975253",
"0.5938606",
"0.5907424",
"0.58769864",
"0.5784207",
"0.5766632",... | 0.6853108 | 0 |
Save a blog post to the database and return its inserted id. | def save_post(self, post):
return self.collection.insert_one(post.serialize()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_current_post(entry):\n return current.insert_one(entry).inserted_id",
"def get_post_id(self):\n return int(self.request.get('blog_id'))",
"def post(self, post_id=None):\n\n if post_id:\n abort(400)\n else:\n args = parsers.post_post_parser.parse_args(stric... | [
"0.7281745",
"0.6937935",
"0.68168765",
"0.6786075",
"0.67251515",
"0.66237724",
"0.65531933",
"0.652381",
"0.65010905",
"0.6482597",
"0.6471551",
"0.63275117",
"0.63201535",
"0.62846124",
"0.62756896",
"0.6239311",
"0.6206968",
"0.617267",
"0.61105657",
"0.61103415",
"0.6109... | 0.7605118 | 0 |
Returns the length of this Dictionary. | def __len__(self):
return self.keyvaluepair_set.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self) -> int:\n return len(self._dict)",
"def size(self):\n return dict.__len__(self)",
"def __len__(self):\n return len(self._dict)",
"def __len__(self) -> int:\n return len(self._keys)",
"def getLength(self):\n return len(self.entries)",
"def size(self, ke... | [
"0.85590214",
"0.84935254",
"0.81146616",
"0.79731923",
"0.79601836",
"0.789161",
"0.77321506",
"0.77321506",
"0.77049685",
"0.7691566",
"0.76559335",
"0.7647897",
"0.7639101",
"0.76311016",
"0.7628186",
"0.7624229",
"0.7624229",
"0.7618838",
"0.7615446",
"0.7615446",
"0.7615... | 0.7298376 | 91 |
Returns an iterator over the tuples of this Dictionary. | def iteritems(self):
return iter((kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n return ((x, y) for y, x in self._items.items())",
"def __iter__(self):\n if self._len_keys == 1:\n yield from self._dict.keys()\n else:\n for key in self._dict.keys():\n yield tuple(sorted(list(key)))",
"def __iter__(self) -> Itera... | [
"0.7650565",
"0.7411403",
"0.7319945",
"0.729405",
"0.72689676",
"0.7242977",
"0.72251856",
"0.7225088",
"0.7184194",
"0.71319675",
"0.71252924",
"0.7089136",
"0.70868945",
"0.707035",
"0.7046826",
"0.7046613",
"0.70155734",
"0.7007819",
"0.69546026",
"0.69539404",
"0.6947731... | 0.76109433 | 1 |
Returns all values in this Dictionary as a list. | def values(self):
return [kvp.value for kvp in self.keyvaluepair_set.all()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self):\n values = []\n for key in self.keys():\n values.append(self[key])\n return values",
"def values(self):\n x = []\n for k in list(self.keys()):\n x.append(self[k])\n return x",
"def values(self):\n return [self[k] for k in ... | [
"0.86468875",
"0.86176884",
"0.8616378",
"0.8611809",
"0.8583866",
"0.8583866",
"0.8583866",
"0.84837425",
"0.844855",
"0.84052616",
"0.83983463",
"0.7982812",
"0.7893348",
"0.7790944",
"0.7738394",
"0.77080506",
"0.7693721",
"0.7648416",
"0.76437914",
"0.76437914",
"0.762401... | 0.8117118 | 11 |
Get a list of tuples of key, value for the items in this Dictionary. This is modeled after dict.items(). | def items(self):
return [(kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items(self):\n return ((key, value) for (key, value) in zip(self.__keys, self.__vals))",
"def items(self):\n return [(k, self[k]) for k in self.keys()]",
"def items(self):\n return [(key, self[key]) for key in self.keys()]",
"def items(self):\n return [(key, self[key]) for key... | [
"0.82283413",
"0.8055495",
"0.8010343",
"0.8010343",
"0.7950202",
"0.7845133",
"0.7795988",
"0.77753174",
"0.77372843",
"0.7629516",
"0.7629516",
"0.73449826",
"0.73314553",
"0.7325318",
"0.7325318",
"0.7325318",
"0.7317927",
"0.7295001",
"0.72763616",
"0.7245725",
"0.7245725... | 0.8112596 | 1 |
Get a python dictionary that represents this Dictionary object. This object is readonly. | def asPyDict(self):
fieldDict = dict()
for kvp in self.keyvaluepair_set.all():
fieldDict[kvp.key] = kvp.value
return fieldDict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_dict(self) -> dict:\n tmp_dict = self.__dict__\n return tmp_dict",
"def dict(self):\n return objToDict(self)",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n ... | [
"0.7707829",
"0.7683181",
"0.76506394",
"0.76506394",
"0.76506394",
"0.76506394",
"0.76506394",
"0.76506394",
"0.76506394",
"0.7643782",
"0.7643782",
"0.75965863",
"0.7548945",
"0.7546646",
"0.75332505",
"0.7526967",
"0.7522519",
"0.7476981",
"0.74300134",
"0.7416488",
"0.737... | 0.0 | -1 |
Compute a useable index tuple from the inputs of a ``Subtensor`` ``Op``. | def indices_from_subtensor(idx_list, indices):
return tuple(
tuple(convert_indices(list(indices), idx) for idx in idx_list) if idx_list else indices
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advanced_indexing_op(input, index):\n batch_size = tf.shape(input)[0]\n max_length = int(input.get_shape()[1])\n dim_size = int(input.get_shape()[2])\n index = tf.range(0, batch_size) * max_length + (index - 1)\n flat = tf.reshape(input, [-1, dim_size])\n relevant = tf.gather(flat, index)\n ... | [
"0.6113105",
"0.59096926",
"0.5751775",
"0.5740285",
"0.5738532",
"0.5722932",
"0.56372344",
"0.5629407",
"0.560365",
"0.5599822",
"0.55781674",
"0.5563797",
"0.5563161",
"0.5561458",
"0.5538537",
"0.5533971",
"0.5518768",
"0.5511742",
"0.54910046",
"0.5473389",
"0.5468551",
... | 0.64316726 | 0 |
Given two sparse vectors |v1| and |v2|, perform v1 += scale v2. This function will be useful later for linear classifiers. | def incrementSparseVector(v1, scale, v2):
# BEGIN_YOUR_ANSWER (our solution is 2 lines of code, but don't worry if you deviate from this)
for v2_key in v2:
v1[v2_key] += scale * v2[v2_key]
return v1
# END_YOUR_ANSWER | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incrementSparseVector(v1, scale, v2):\n for index in v2:\n v1[index] += v2[index] * scale",
"def incrementSparseVector(v1, scale, v2):\n # BEGIN_YOUR_CODE (our solution is 2 lines of code, but don't worry if you deviate from this)\n for k in v2.keys():\n v1[k] += scale*v2[k]\n\n ret... | [
"0.8317877",
"0.80408067",
"0.72659016",
"0.71150833",
"0.6808642",
"0.6489312",
"0.6358828",
"0.62503725",
"0.6155338",
"0.6144651",
"0.5932728",
"0.5929888",
"0.5919542",
"0.5876552",
"0.5872865",
"0.5774591",
"0.5770154",
"0.5707947",
"0.5629782",
"0.5606047",
"0.56008464"... | 0.80174154 | 2 |
Get the ContainerRegistry object managed by this helper. This is the model for the container registry with self.name. If that container registry doesn't exist, create it and then return the model object. | def registry(self):
if self._registry is None:
print('Creating container registry...')
registry_ops = self.registry_client.registries
try:
registry = registry_ops.get(
self.resources.group.name,
self.name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_registry(self, app):\n # if no registry key is defined in the configuration, return\n if not app.containers.registry:\n return None\n\n # cache the registry object so that it is not recreated\n # during each image pull, which would re-execute a docker login\n #... | [
"0.619276",
"0.6057566",
"0.60361713",
"0.5973121",
"0.5953434",
"0.58803076",
"0.5694957",
"0.5686717",
"0.559378",
"0.5499378",
"0.5475975",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.546738",
"0.5455749"... | 0.70094526 | 0 |
returns guassian density given x on log scale | def log_normal_density(x, mean, log_std, std):
variance = std.pow(2)
log_density = -(x - mean).pow(2) / (2 * variance) - 0.5 *\
np.log(2 * np.pi) - log_std # num_env * frames * act_size
log_density = log_density.sum(dim=-1, keepdim=True) # num_env * frames * 1
return log_density | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_density_gaussian(x, mu, logvar):\n norm = - 0.5 * (math.log(2 * math.pi) + logvar)\n log_density = norm - 0.5 * ((x - mu) ** 2 * torch.exp(-logvar))\n return log_density",
"def log_density_gaussian(x: torch.Tensor, mu: torch.Tensor, logvar: torch.Tensor):\n norm = -0.5 * (math.log(2 * math.pi... | [
"0.7565519",
"0.7503947",
"0.69597495",
"0.69120324",
"0.68328094",
"0.68210346",
"0.6795797",
"0.6787948",
"0.6735831",
"0.67035735",
"0.67035735",
"0.66731095",
"0.6644659",
"0.66355366",
"0.656607",
"0.6562923",
"0.65562403",
"0.65554374",
"0.6536779",
"0.6531345",
"0.6527... | 0.61494297 | 69 |
Sets seed of random number generators. Setting seeds will not ensure 100 % reproducibity but at least the same starting point. | def set_rng_seed(seed: Optional[int]) -> None:
if seed is not None:
os.environ["PYTHONHASHSEED"] = str(0)
import random
random.seed(seed)
import numpy as np
np.random.seed(seed)
from tensorflow.compat.v1 import set_random_seed
set_random_seed(seed)
pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_seed(cls, seed: Any) -> None:\n cls.rand = Random(seed)",
"def set_seed():\n np.random.seed(1423)",
"def set_random_seed(seed):\n random.seed(seed)\n np.random.seed(seed)\n logging.info(f\"Set simulation random seed to: {seed}\")",
"def _set_seed(self) -> None:\r\n ... | [
"0.81549495",
"0.81408685",
"0.8082665",
"0.8019362",
"0.7998537",
"0.79903066",
"0.79903066",
"0.79760855",
"0.7968404",
"0.7948733",
"0.793796",
"0.7935603",
"0.7924195",
"0.79237515",
"0.79184544",
"0.7910188",
"0.78964734",
"0.78869516",
"0.7870483",
"0.78561187",
"0.7841... | 0.80256563 | 3 |
Convert an array of integers into datetime objects. This function optimizes the num2date function of pythonnetCDF4 if the standard calendar is used. | def num2date(times, units, calendar=None):
try:
unit, epoch = units.split(" since ")
except ValueError:
raise InvalidUnitString("Could not convert to datetimes!")
if calendar is None:
calendar = "gregorian"
else:
calendar = calendar.lower()
if calendar != "gregorian... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _datenums_to_datetime(timearr):\n def convert(dn):\n # ref: https://stackoverflow.com/questions/13965740/converting-matlabs-datenum-format-to-python\n _dtg = datetime.fromordinal(int(dn)) + timedelta(days=dn % 1) - timedelta(days=366)\n return _dtg\n\n # return quickly if float (not ... | [
"0.6905143",
"0.6388553",
"0.6383871",
"0.6326008",
"0.6160877",
"0.6157265",
"0.6119092",
"0.5985708",
"0.594588",
"0.59311795",
"0.5900772",
"0.5863157",
"0.58132815",
"0.57845306",
"0.56307256",
"0.5628324",
"0.554825",
"0.554825",
"0.5519057",
"0.5443539",
"0.54328585",
... | 0.62618434 | 4 |
Convert an array of integer into datetime objects. This function optimizes the date2num function of pythonnetCDF4 if the standard calendar is used. | def date2num(dates, units, calendar=None):
if calendar is None:
calendar = "gregorian"
else:
calendar = calendar.lower()
if calendar != "gregorian":
return netCDF4.date2num(dates, units, calendar)
try:
unit, epoch = units.split(" since ")
except ValueError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _datenums_to_datetime(timearr):\n def convert(dn):\n # ref: https://stackoverflow.com/questions/13965740/converting-matlabs-datenum-format-to-python\n _dtg = datetime.fromordinal(int(dn)) + timedelta(days=dn % 1) - timedelta(days=366)\n return _dtg\n\n # return quickly if float (not ... | [
"0.67581964",
"0.632096",
"0.6242169",
"0.6232649",
"0.6205797",
"0.61533004",
"0.5903469",
"0.5886518",
"0.5833129",
"0.5833091",
"0.5770238",
"0.5746166",
"0.5669197",
"0.5595971",
"0.5593202",
"0.55752385",
"0.55436903",
"0.54829913",
"0.54684997",
"0.5455619",
"0.54185593... | 0.64674747 | 1 |
Divide the data of each variables in bins and apply a function to them. | def collapse(self, bins, collapser=None, deep=False):
# Default collapser is the mean function:
if collapser is None:
collapser = np.nanmean
bins = np.asarray(bins)
# Collapse the data:
collapsed_data = type(self)()
collapsed_data.attrs.update(**self.attrs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_on_bins(self, bins, functions, return_dict=False):\n binned_data = self.bin(bins)\n\n if return_dict:\n return_values = {\n name: np.asarray(\n [func(bin, 0) for bin in binned_data]\n ).flatten()\n for name, func in ... | [
"0.6976708",
"0.6791289",
"0.6251674",
"0.62373763",
"0.60169554",
"0.5982995",
"0.59677905",
"0.5919966",
"0.58937657",
"0.58346355",
"0.5825173",
"0.58134764",
"0.5810922",
"0.5764428",
"0.5756015",
"0.57411075",
"0.5727579",
"0.56645995",
"0.56167203",
"0.55969715",
"0.559... | 0.0 | -1 |
Remove fields from the object. | def drop(self, fields, inplace=True):
if inplace:
obj = self
else:
obj = copy.deepcopy(self)
for field in list(fields):
del obj[field]
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_fields(self):\n self.fields = None",
"def clear_field_values(self):\n\t\tlogging.info(\"Clearing values in the field[] dictionary of the object\")\n\t\tlogging.debug(\"Before = \" + str(self.field))\n\t\tfor key, value in self.fields.items():\n\t\t\tself.field[str(key)] = None\n\t\tlogging.... | [
"0.82652587",
"0.68709177",
"0.68336976",
"0.6673487",
"0.66342115",
"0.6468943",
"0.6396853",
"0.6371379",
"0.6326306",
"0.63113433",
"0.63076264",
"0.6260755",
"0.62429065",
"0.61971664",
"0.6178677",
"0.61651176",
"0.61088896",
"0.6098864",
"0.60939264",
"0.60788465",
"0.6... | 0.7906739 | 1 |
Create an GroupedArrays from a dictionary. | def from_dict(cls, dictionary):
obj = cls()
for var, data in dictionary.items():
obj[var] = data
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_grouped_arr(ht):\n grouped_arr = []\n for anagram in ht.keys():\n (original, orig_cnt, anag_cnt) = ht[anagram]\n\n # Add original-anagram pairs\n for i in range(0, anag_cnt):\n grouped_arr.append(original)\n grouped_arr.append(... | [
"0.6684682",
"0.59732157",
"0.5891896",
"0.5812013",
"0.57226366",
"0.5722552",
"0.5649673",
"0.562847",
"0.54966444",
"0.5492354",
"0.53557295",
"0.53424054",
"0.53407514",
"0.5340228",
"0.52917266",
"0.5248256",
"0.52432793",
"0.52187645",
"0.5204358",
"0.5197826",
"0.51949... | 0.0 | -1 |
Get the minimum and maximum of one field. | def get_range(self, field, deep=False, axis=None):
variables = list(self.vars(deep, with_name=field))
if not variables:
raise KeyError("No variable named '%s' was found!" % field)
start = [np.nanmin(self[var], axis).item(0) for var in variables]
end = [np.nanmax(self[var], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFieldMinMax(fielddef):\n minmax = {'c': (0, 0xff),\n '?': (0, 1),\n 'b': (~0x7f, 0x7f),\n 'B': (0, 0xff),\n 'h': (~0x7fff, 0x7fff),\n 'H': (0, ... | [
"0.7553137",
"0.69511724",
"0.6938614",
"0.68577105",
"0.6816358",
"0.676927",
"0.67293096",
"0.6678381",
"0.6628363",
"0.6620557",
"0.6600389",
"0.6558138",
"0.6548778",
"0.65063906",
"0.6483355",
"0.6476901",
"0.6469147",
"0.64403874",
"0.6438038",
"0.6423845",
"0.6421674",... | 0.6047854 | 46 |
Returns the names of all groups in this GroupedArrays object. | def groups(self, deep=False, exclude_prefix=None):
for group in self._groups:
if exclude_prefix is None or not group.startswith(exclude_prefix):
yield group
if deep:
yield from (group + "/" + subgroup
for subgroup in self[group... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_names(self):\r\n return self.groups.keys()",
"def get_group_names(self):\n return [self.frame.columns[i] for i in self.group_cols]",
"def groups(self):\n return self.get_data(\"groups\")",
"def groups(self):\n # type: (...) -> Set[str]\n return self._groups",
... | [
"0.8006743",
"0.74152255",
"0.7133401",
"0.7075462",
"0.7015703",
"0.7015703",
"0.7015703",
"0.6975087",
"0.68280053",
"0.68268734",
"0.6795847",
"0.67415917",
"0.673966",
"0.66737604",
"0.66559017",
"0.6616437",
"0.6589002",
"0.6567246",
"0.65033424",
"0.64121914",
"0.631258... | 0.0 | -1 |
Converts this GroupedArrays object to a xarray.Dataset. | def to_xarray(self):
xarray_object = xr.Dataset()
for var, data in self.items(deep=True):
xarray_object[var] = data.to_xarray()
xarray_object.attrs.update(**self.attrs)
return xarray_object | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dataset(self):\n import xarray as xr\n ds = xr.Dataset(coords={'x': (['x', ], self.center_grid.x_coord),\n 'y': (['y', ], self.center_grid.y_coord)}\n )\n ds.attrs['pyproj_srs'] = self.proj.srs\n return ds",
"def data_array(... | [
"0.67562604",
"0.6446598",
"0.6402248",
"0.63464725",
"0.6340053",
"0.6313539",
"0.6313539",
"0.6313539",
"0.6281053",
"0.6048018",
"0.60325724",
"0.5959102",
"0.5904324",
"0.58423626",
"0.58304393",
"0.58240885",
"0.5815819",
"0.5796583",
"0.5783801",
"0.57776976",
"0.576193... | 0.7055569 | 0 |
Returns the names of all variables in this GroupedArrays object main group. | def vars(self, deep=False, with_name=None, hidden=True):
# Only the variables of the main group:
if with_name is None:
if hidden or self.hidden_prefix is None:
yield from self._vars
else:
yield from filter(
lambda x: not x.star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables_names(self):\n return self.project.get_variable_names() + self.design.get_variable_names()",
"def get_variable_names(self):\n return [VariableString(s) for s in\n self._design.GetVariables()+self._design.GetPostProcessingVariables()]",
"def varNames(self):\n ... | [
"0.73018754",
"0.721269",
"0.71380556",
"0.70934284",
"0.7048922",
"0.69622594",
"0.69445777",
"0.6932868",
"0.68720376",
"0.679149",
"0.6706439",
"0.66460335",
"0.6613669",
"0.6607794",
"0.64743006",
"0.64159614",
"0.64147365",
"0.64090157",
"0.64045066",
"0.6402307",
"0.640... | 0.0 | -1 |
Tests the interaction energy of a reference structure. | def test_interaction_energy(self):
buff_score = self.pdb.get_interaction_energy(ff=self.ff)
self.assertAlmostEqual(buff_score.total_energy, -1005.41, places=2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_energy():\n # Test something\n \n from nose.tools import assert_equal\n assert_equal(energy([0.0,0.0],1.0), 0)\n assert_equal(energy([4.0,5.0],1.0), 10)",
"def test_internal_energy(self):\n buff_score = self.pdb[0].get_internal_energy(ff=self.ff)\n self.assertAlmostEqual(buff_score.to... | [
"0.6482731",
"0.6369546",
"0.62664753",
"0.6130934",
"0.61176956",
"0.6089759",
"0.6026899",
"0.59657276",
"0.5962188",
"0.5900666",
"0.58322054",
"0.5822066",
"0.5776054",
"0.5759199",
"0.57427704",
"0.5737633",
"0.57316893",
"0.5705886",
"0.56984687",
"0.5605938",
"0.559076... | 0.7529944 | 0 |
returns all projects for the given user | def all(cls):
projects_url = 'https://www.pivotaltracker.com/services/v3/projects'
response = _perform_pivotal_get(projects_url)
root = ET.fromstring(response.text)
if root is not None:
return [Project.from_node(project_node) for project_node in root] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects_of_user(self, user_id):\n res = self.conn.cursor().execute(\"\"\"SELECT * FROM projects p JOIN users_projects up \n ON p.id = up.project_id \n WHERE owner=? OR up.user_id=?\n GROUP BY p.id\n ORDER BY last_update DESC\"\"\", (user_id, user_id,))\n return re... | [
"0.8428174",
"0.8384723",
"0.79425204",
"0.77670926",
"0.7678094",
"0.75687045",
"0.75545335",
"0.74962413",
"0.71681637",
"0.7070704",
"0.70580006",
"0.70128125",
"0.70014966",
"0.6903883",
"0.6897157",
"0.6875102",
"0.6849584",
"0.6834363",
"0.680805",
"0.67691106",
"0.6757... | 0.62581813 | 65 |
Convert v to a tuple if it is a list. | def _list_to_tuple(v):
if isinstance(v, list):
return tuple(v)
return v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_tuple(v):\n if not isinstance(v, tuple):\n return tuple(v)\n else:\n return v",
"def astuple(v: Any) -> Tuple[Any, ...]:\n return to_tuple(v, reuse_instances=False, convert_sets=False)",
"def _tuple_from_one_or_two_ints(self, v):\n try:\n a, b = [int(x) f... | [
"0.85594004",
"0.75421923",
"0.7371281",
"0.7313604",
"0.7023194",
"0.663165",
"0.66015583",
"0.6488036",
"0.64798427",
"0.64587915",
"0.62483615",
"0.6218016",
"0.6174967",
"0.613174",
"0.6100183",
"0.6100183",
"0.6038556",
"0.6026321",
"0.6018098",
"0.58960384",
"0.5882388"... | 0.8860024 | 0 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def dist(lat1, lon1, lat2, lon2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
r = 637... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.8145727",
"0.7863793",
"0.7632431",
"0.76049554",
"0.7595838",
"0.7594924",
"0.75935525",
"0.7570717",
"0.7564014",
"0.75558245",
"0.75298345",
"0.7516176",
"0.7494569",
"0.74658835",
"0.7451055",
"0.7433021",
"0.7392573",
"0.7356451",
"0.73476917",
"0.7330554",
"0.7327826... | 0.71996814 | 24 |
Returns the directory path of the trainimages repository into the workspace | def train_image_path(self) -> str:
return join(self.directory_path, 'train-images') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_of_image():\n top.folder_name = filedialog.askdirectory(title=\"select directory\",\n initialdir=\"C:/Users/Ayush sagore/JUPITER NOTEBOOK ML/CNN Model/\"\n \"test_dataset/\")\n ... | [
"0.6910282",
"0.6874162",
"0.6822783",
"0.6773903",
"0.66677946",
"0.6569247",
"0.6485816",
"0.6454904",
"0.6390247",
"0.6386785",
"0.6374411",
"0.6360562",
"0.63316715",
"0.62980807",
"0.62718266",
"0.6228291",
"0.6166619",
"0.6166401",
"0.6151216",
"0.6150865",
"0.6146378",... | 0.8011631 | 0 |
Returns the directory path of the predict_images repository into the workspace | def predict_image_path(self) -> str:
return join(self.directory_path, 'predict-images') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_image_path(self) -> str:\n return join(self.directory_path, 'train-images')",
"def images_path(self):\n return os.path.join(self.extracted_path, \"images\")",
"def get_replay_folder(self):\n\n images_with_labels_folder = self.base_folder_path + \"/data/replay_images_and_labels/\"... | [
"0.7279855",
"0.6807341",
"0.6789434",
"0.6753021",
"0.66547996",
"0.6510833",
"0.64823616",
"0.6474355",
"0.645726",
"0.6425141",
"0.63868225",
"0.633892",
"0.6333433",
"0.62749165",
"0.6249575",
"0.62463963",
"0.6238275",
"0.6138357",
"0.6095685",
"0.60813534",
"0.6075679",... | 0.81980765 | 0 |
Returns the directory path of the train_features repository into the workspace | def train_features_path(self) -> str:
return join(self.feature_path, 'train_features') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_path(self) -> str:\n return join(self.directory_path, 'features')",
"def train_image_path(self) -> str:\n return join(self.directory_path, 'train-images')",
"def get_features_dir(self, dataset_type: DatasetType) -> str:\n return os.path.join(self.save_dir, self.name, dataset_ty... | [
"0.72631466",
"0.68973655",
"0.6531107",
"0.64720815",
"0.6389493",
"0.6296793",
"0.62048936",
"0.6134895",
"0.6110814",
"0.60843325",
"0.5996528",
"0.5987274",
"0.5933599",
"0.59112215",
"0.589518",
"0.58865035",
"0.5864889",
"0.5854026",
"0.58390576",
"0.58103573",
"0.58059... | 0.7567212 | 0 |
Returns the directory path of the train_features repository into the workspace | def predict_features_path(self) -> str:
return join(self.feature_path, 'predict') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_features_path(self) -> str:\n return join(self.feature_path, 'train_features')",
"def feature_path(self) -> str:\n return join(self.directory_path, 'features')",
"def train_image_path(self) -> str:\n return join(self.directory_path, 'train-images')",
"def get_features_dir(self,... | [
"0.75670105",
"0.726327",
"0.68971056",
"0.6531339",
"0.6470691",
"0.63895255",
"0.629538",
"0.6204659",
"0.6134797",
"0.6111279",
"0.60854447",
"0.5996104",
"0.5987552",
"0.5933655",
"0.5911776",
"0.5894882",
"0.58858025",
"0.58643717",
"0.5854063",
"0.5839411",
"0.5810542",... | 0.0 | -1 |
Returns the directory path of the train_machinelearning repository into the workspace | def ml_train_samples_path(self) -> str:
return join(self.machine_learning_path, 'train_machinelearning') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def machine_learning_path(self) -> str:\n return join(self.directory_path, 'machinelearning')",
"def train_image_path(self) -> str:\n return join(self.directory_path, 'train-images')",
"def base_dir():\n return os.path.join(TrainFile.base_dir(), 'model')",
"def get_repository_dir():\n ... | [
"0.7444279",
"0.70899916",
"0.70369816",
"0.65489495",
"0.6420318",
"0.6349567",
"0.6297817",
"0.62970924",
"0.62774026",
"0.62774026",
"0.624301",
"0.6192384",
"0.61844766",
"0.61416394",
"0.61313945",
"0.61289626",
"0.6072724",
"0.60720503",
"0.6042369",
"0.6041084",
"0.603... | 0.6813073 | 3 |
Returns the directory path of the evaluate repository into the workspace | def ml_evaluate_samples_path(self) -> str:
return join(self.machine_learning_path, 'evaluate') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_repository_dir():\n expected = os.path.abspath(__file__).rsplit('/', 2)[0]\n\n # get_path verifies the existance of these directories\n get_path(expected, 'data')\n get_path(expected, 'latex')\n\n return expected",
"def local_path(self):\n if self.repo_path:\n return self... | [
"0.7377997",
"0.69689256",
"0.68696225",
"0.67902815",
"0.6754747",
"0.67263234",
"0.6671666",
"0.6572674",
"0.6561445",
"0.65577114",
"0.6541721",
"0.6526692",
"0.6522672",
"0.6520338",
"0.6519109",
"0.65186226",
"0.6501876",
"0.64058465",
"0.6385956",
"0.63643074",
"0.63589... | 0.0 | -1 |
Return the Post model that is active in this project | def get_post_model():
from django.conf import settings
try:
from django.apps import apps
get_model = apps.get_model
except ImportError:
from django.db.models import get_model
try:
POST_MODEL = getattr(settings, 'STARDATE_POST_MODEL')
except AttributeError:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_post(self):\n post_pk = self.kwargs.get('post_pk', 0)\n return get_object_or_404(Post, pk=post_pk)",
"def get_model(self):\n\t\treturn self.object.__class__",
"def model(self):\n return self.__model",
"def latest_post(self):\r\n try:\r\n return self.post_set.la... | [
"0.63887566",
"0.62788135",
"0.6025116",
"0.6007665",
"0.5979987",
"0.5975837",
"0.59342396",
"0.5925787",
"0.5925787",
"0.5925787",
"0.5925787",
"0.5925787",
"0.59226346",
"0.5922436",
"0.5922436",
"0.5922436",
"0.5922436",
"0.5922436",
"0.5922436",
"0.5922436",
"0.5922436",... | 0.68997544 | 0 |
Tries to convert a date datestring into a date. Accounts for NA. May raise a ValueError | def convert_date(datestring):
datestring = datestring.rstrip('†')
if datestring not in ('NA', 'None specified', 'TBA', 'None', 'N/A', ''):
try:
return dateutil_parser.parse(datestring).date()
except ValueError: # dateutil's error messages aren't friendly
raise ValueError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_str_to_date(date: str):\n try:\n return datetime.strptime(date, \"%Y/%m/%d\").date()\n except ValueError:\n try:\n return datetime.strptime(date, \"%Y-%m-%d\").date()\n except ValueError as error:\n raise error",
"def str_to_date(date_str: str) -> Opti... | [
"0.8139445",
"0.80241174",
"0.7976259",
"0.7705478",
"0.7652813",
"0.7592498",
"0.75631243",
"0.75472426",
"0.75346065",
"0.74839526",
"0.74790907",
"0.74681425",
"0.74334854",
"0.73873127",
"0.7382881",
"0.7320011",
"0.7281532",
"0.7281523",
"0.7270766",
"0.7263942",
"0.7248... | 0.85123146 | 0 |
Excel strips trailing zeroes, so for example what should be 1.20 is 1.2 in the data. Since the rows are sequential (or should be!), we should be able to account for this. | def fix_excel_decimals(self, reqid):
while reqid.endswith("."): # Handle a hack around Excel problems
reqid = reqid.rstrip(".")
if "." not in reqid:
raise ValueError(
"Requirement ID without . separator: {0}".format(reqid))
policy, requirement = reqid.spl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __float__(self):\n\t\toutput = 0.0\n\n\t\tfor index,value in enumerate(self):\n\t\t\tif value > 0:\n\t\t\t\toutput+=float(value) * (10 ** -index)\n\n\t\treturn output",
"def normalise_zero_base(df):\n return df / df.iloc[0] - 1",
"def normalise_zero_base(df):\n return df / df.iloc[0] - 1",
"def fix... | [
"0.6141517",
"0.5812901",
"0.5812901",
"0.5755785",
"0.57099944",
"0.55915654",
"0.55463606",
"0.5532291",
"0.54637784",
"0.54404503",
"0.5413124",
"0.5397176",
"0.5394562",
"0.53622246",
"0.5355958",
"0.5324867",
"0.5318633",
"0.5317493",
"0.528813",
"0.5288093",
"0.52678293... | 0.56397486 | 5 |
Verifies that an existing anonymous session gets promoted to an authenticated session when the user logs in. | def test_session_promotion(self):
cursor = self.db.cursor()
cursor.execute("INSERT INTO session VALUES ('123456', 0, 0)")
incookie = Cookie()
incookie['trac_session'] = '123456'
outcookie = Cookie()
req = Mock(authname='john', base_path='/', incookie=incookie,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in(self):\n return self.auth.get_user_by_session() is not None",
"def test_anonymous_session(self):\r\n incookie = Cookie()\r\n incookie['trac_session'] = '123456'\r\n outcookie = Cookie()\r\n req = Mock(authname='anonymous', base_path='/', incookie=incookie,\r\n ... | [
"0.6745446",
"0.66757685",
"0.65668285",
"0.65342414",
"0.6454742",
"0.6454541",
"0.64524275",
"0.6451636",
"0.6451636",
"0.6451636",
"0.6451636",
"0.6451636",
"0.6451636",
"0.6451636",
"0.64351964",
"0.63906133",
"0.63472134",
"0.6340159",
"0.6337582",
"0.6255388",
"0.623272... | 0.0 | -1 |
Verify that a modifying a variable in a session not associated with a request updates the database accordingly. | def test_modify_detached_session(self):
cursor = self.db.cursor()
cursor.execute("INSERT INTO session VALUES ('john', 1, 0)")
cursor.execute("INSERT INTO session_attribute VALUES "
"('john', 1, 'foo', 'bar')")
session = DetachedSession(self.env, 'john')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_logged_cannot_update(self):\n\n utils.test_not_logged_cannot_access(self, self.url, self.data)",
"def test_update_session(self):\r\n now = time.time()\r\n\r\n # Make sure the session has data so that it doesn't get dropped\r\n cursor = self.db.cursor()\r\n cursor.e... | [
"0.5917518",
"0.58355206",
"0.5783379",
"0.57541054",
"0.56932485",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.56875414",
"0.5668375",
"0.56661284",
"0.5652998",
... | 0.56309676 | 28 |
Returns a dictionary showing the descomposition into irreducibles of the ith homology like a S_n module of a simplicial complex. | def decomposition_into_s_n_irreducibles(self, n):
w5 = partitions_list(n)
M5 = form_matrix_yt(w5)
card = math.factorial(n)
vec_dic = {}
for k in range(self.dimension()+1):
D = {}
uu = []
vv = []
p = k
A = self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimension_homology_sc(self):\r\n vec_dic = {}\r\n for k in range(self.dimension()+1):\r\n p = k \r\n A = self.matrix_simmetric_representate(p)\r\n dn = 0\r\n dc = 0\r\n if (p == 0):\r\n dn = A.shape[1]\r\n if (p > 0 ... | [
"0.64158285",
"0.61812556",
"0.61167073",
"0.6046451",
"0.6027637",
"0.59476006",
"0.5938235",
"0.5921842",
"0.5717197",
"0.56676424",
"0.5621515",
"0.5557342",
"0.55383784",
"0.5530746",
"0.55243254",
"0.5507579",
"0.5467293",
"0.5429373",
"0.5418344",
"0.5414058",
"0.540680... | 0.622131 | 1 |
Compute softmax values for each sets of scores in x. | def _softmax(self,x):
e_x = np.exp(x - np.max(x))
return np.nan_to_num(e_x / np.nan_to_num(e_x.sum(axis=0))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.7109847 | 36 |
Get the string for daily updates | def get_update_string(today, previous_day):
pfizer = today['pfizer'] - previous_day['pfizer']
az = today['astraZeneca'] - previous_day['astraZeneca']
moderna = today['moderna'] - previous_day['moderna']
johnson = today['jj'] - previous_day['jj']
seven_day, rolling_avg = return_weekly_figure()
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_updated() -> str:\n return GLOBAL.get(\"last_update\")",
"def last_update(blank):\n today = date.today()\n return today.strftime('%A %B %d')",
"def today(update: Update, _: CallbackContext) -> None:\n \n logger.info(\"Getting latest update for \" + str(update.message.chat_id))\n \n ... | [
"0.67906463",
"0.6533487",
"0.65333635",
"0.65134275",
"0.6117778",
"0.608402",
"0.5945347",
"0.5823016",
"0.5735524",
"0.5723631",
"0.5722866",
"0.57196563",
"0.5695164",
"0.5694709",
"0.56889325",
"0.5688541",
"0.56809604",
"0.56359303",
"0.5625444",
"0.5625444",
"0.5625444... | 0.6417752 | 4 |
Creating Post Run setup to be executed after running the test case Cleans the data created by this script | def postRunCleanup(self):
self.logDesc("Post Run Cleanup")
#logout of application
self.logout() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self) -> None:\n self.sqlite_db = setup_sqlite_in_memory_db()\n create_tables(self.sqlite_db)\n seed_all_distributions()\n container_flow_generation_manager = ContainerFlowGenerationManager()\n container_flow_generation_manager.set_properties(\n name=\"Test p... | [
"0.6910505",
"0.680083",
"0.6749079",
"0.66821516",
"0.66685045",
"0.6655896",
"0.6619784",
"0.66049796",
"0.66049796",
"0.66049796",
"0.66049796",
"0.6601408",
"0.66003174",
"0.65918505",
"0.6531701",
"0.65222794",
"0.65183455",
"0.6515566",
"0.65105194",
"0.6484094",
"0.646... | 0.6303729 | 51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.