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 |
|---|---|---|---|---|---|---|
Sets the description of this Context. | def description(self, description):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, description):\n self.description = description",
"def set_description(self, description):\n self.__description = description",
"def set_description(self, description):\n self.... | [
"0.82839125",
"0.82240725",
"0.82129174",
"0.80971104",
"0.8035239",
"0.8035239",
"0.8035239",
"0.8035239",
"0.79715997",
"0.7922534",
"0.7922534",
"0.7922534",
"0.7922534",
"0.78992",
"0.78464216",
"0.77429014",
"0.7684227",
"0.760593",
"0.7529965",
"0.74933296",
"0.7472177"... | 0.797192 | 34 |
Sets the id of this Context. | 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 set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\... | [
"0.8333739",
"0.83109325",
"0.8123394",
"0.798901",
"0.7937271",
"0.7878671",
"0.77810943",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7772996",
"0.7763799",
"0.7763799",
"0.7763799",
"0.7763799",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Context):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
The time when this table was created, in milliseconds since the epoch. | def creation_time(self) -> str:
return pulumi.get(self, "creation_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_time(self):\n return self._create_time",
"def create_time(self):\n return self._create_time",
"def create_time(self):\n return self._create_time",
"def creation_timestamp(self):\n\n return self.getThisUpdate()",
"def created_timestamp(self):\n return self._crea... | [
"0.80330205",
"0.80330205",
"0.80330205",
"0.78535074",
"0.78340864",
"0.7812318",
"0.7812318",
"0.78018546",
"0.78018546",
"0.78018546",
"0.77463055",
"0.77463055",
"0.77463055",
"0.7725385",
"0.7725385",
"0.7725385",
"0.7725385",
"0.7704169",
"0.7682911",
"0.76779926",
"0.7... | 0.7758315 | 12 |
The default collation of the table. | def default_collation(self) -> str:
return pulumi.get(self, "default_collation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[str]:\n return pulumi.get(self, \"collation\")",
"def get_default_collation(self, col_id):\n # Exception ... | [
"0.78136224",
"0.78136224",
"0.77737534",
"0.7545584",
"0.7475068",
"0.7276392",
"0.7276392",
"0.7105119",
"0.7040239",
"0.63822234",
"0.61310786",
"0.6046535",
"0.58100015",
"0.5646899",
"0.5602024",
"0.55141604",
"0.55011624",
"0.545752",
"0.54123014",
"0.539641",
"0.537901... | 0.86264414 | 0 |
[Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. | def external_data_configuration(self) -> 'outputs.ExternalDataConfigurationResponse':
return pulumi.get(self, "external_data_configuration") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table(self) -> 'outputs.PreventionStoredInfoTypeLargeCustomDictionaryBigQueryFieldTable':\n return pulumi.get(self, \"table\")",
"def raw_table_data(*args, **kwargs):\n # pylint: disable=unused-argument\n return {\n \"columns\": [\n {\"title\": \"id\"},\n {\"title\":... | [
"0.69016546",
"0.66494435",
"0.64065456",
"0.6119074",
"0.60907674",
"0.6067867",
"0.6024894",
"0.5946301",
"0.5924499",
"0.592229",
"0.592079",
"0.58975965",
"0.5889021",
"0.58009356",
"0.5758227",
"0.5740704",
"0.5728949",
"0.57172334",
"0.56923234",
"0.5678525",
"0.5628191... | 0.0 | -1 |
[Optional] A descriptive name for this table. | def friendly_name(self) -> str:
return pulumi.get(self, "friendly_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n if self.table:\n return \"{}.{}\".format(self.table, self.field_name)\n return self.field_name",
"def table_name() -> str:\n pass",
"def name(self) -> str:\n return f\"lookup_table_{self.table_number}\"",
"def table_name(self) -> pulumi.Output[str]:\n ... | [
"0.7807215",
"0.7501432",
"0.7392283",
"0.73176074",
"0.7271936",
"0.72107065",
"0.72107065",
"0.72107065",
"0.7193346",
"0.7180009",
"0.7155558",
"0.7147313",
"0.71393424",
"0.7030151",
"0.6995039",
"0.6979066",
"0.6903773",
"0.68651736",
"0.6852314",
"0.68083334",
"0.680833... | 0.0 | -1 |
The type of the resource. | def kind(self) -> str:
return pulumi.get(self, "kind") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pu... | [
"0.87906647",
"0.8584323",
"0.8584323",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8225315",
"0.79590267",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.7... | 0.0 | -1 |
The geographic location where the table resides. This value is inherited from the dataset. | def location(self) -> str:
return pulumi.get(self, "location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self):\n return self.geometry.location",
"def geo(self):\n return self.query.geo",
"def get_location(self):\n return self.location",
"def get_location(self):\n\t\treturn self.location",
"def get_location(self):\r\n return self.__location",
"def location(self):... | [
"0.74479157",
"0.7304543",
"0.72684556",
"0.72581834",
"0.72391886",
"0.71933967",
"0.71933967",
"0.7173958",
"0.7147563",
"0.7044566",
"0.70119196",
"0.6993423",
"0.69838476",
"0.6938545",
"0.692765",
"0.692765",
"0.692765",
"0.68873495",
"0.6885552",
"0.6877596",
"0.6819904... | 0.7098293 | 18 |
The size of this table in bytes, excluding any data in the streaming buffer. | def num_bytes(self) -> str:
return pulumi.get(self, "num_bytes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_size(self):\n return len(self.table)",
"def get_table_size(self):\r\n return self.table_size",
"def Size(self):\n return _table.Table_Size(self)",
"def nbytes(self):\n return self.tables.nbytes",
"def get_table_size(self, table_name):\n # Size of the new table on ... | [
"0.8699214",
"0.8579445",
"0.85120296",
"0.8310454",
"0.7801687",
"0.7751941",
"0.7647896",
"0.76134",
"0.7611741",
"0.7601728",
"0.7590972",
"0.75707984",
"0.7558651",
"0.7512537",
"0.7486619",
"0.7486619",
"0.7486619",
"0.7486619",
"0.74509245",
"0.74500346",
"0.7446358",
... | 0.0 | -1 |
The number of rows of data in this table, excluding any data in the streaming buffer. | def num_rows(self) -> str:
return pulumi.get(self, "num_rows") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NumberOfRows(self):\n return _table.DSTable_NumberOfRows(self)",
"def row_count(self) -> int:\n return len(self.rows)",
"def row_count(self) -> int:\n return len(self.rows)",
"def num_rows(self):\n return (len(self.rows))",
"def rows_count(self):\n return len(self.val... | [
"0.85394216",
"0.85293907",
"0.85293907",
"0.84312284",
"0.8412384",
"0.84086573",
"0.81958157",
"0.81296355",
"0.811677",
"0.811077",
"0.81107044",
"0.8102242",
"0.80644774",
"0.80101675",
"0.7989217",
"0.7980506",
"0.79217064",
"0.7915248",
"0.7888677",
"0.78502095",
"0.779... | 0.7893846 | 18 |
Total number of logical bytes in the table or materialized view. | def num_total_logical_bytes(self) -> str:
return pulumi.get(self, "num_total_logical_bytes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def totalbytes(self):\n with self.session as session:\n result = session.execute(select([func.sum(IndexRecord.size)])).scalar()\n if result is None:\n return 0\n return long(result)",
"def nbytes(self):\n return self.tables.nbytes",
"def get_size(se... | [
"0.79217714",
"0.7506452",
"0.7446191",
"0.7316531",
"0.7173879",
"0.71348846",
"0.7132611",
"0.7127796",
"0.70895934",
"0.70560026",
"0.7046603",
"0.70415944",
"0.70050097",
"0.7003393",
"0.6993725",
"0.69600844",
"0.6946887",
"0.6924681",
"0.69006073",
"0.68954057",
"0.6868... | 0.75662625 | 1 |
The physical size of this table in bytes. This also includes storage used for time travel. This data is not kept in real time, and might be delayed by a few seconds to a few minutes. | def num_total_physical_bytes(self) -> str:
return pulumi.get(self, "num_total_physical_bytes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_size(self):\r\n return self.table_size",
"def Size(self):\n return _table.Table_Size(self)",
"def get_size(self):\n return len(self.table)",
"def speed_table_size(self):\n\n return self.__table_size(Speed)",
"def get_table_size(self, table_name):\n # Size of... | [
"0.8460477",
"0.8297233",
"0.8112408",
"0.78544104",
"0.77760714",
"0.7577903",
"0.75246567",
"0.75227606",
"0.7506876",
"0.7425617",
"0.7370523",
"0.7364475",
"0.73087907",
"0.73022574",
"0.72907454",
"0.72852165",
"0.7267207",
"0.72555375",
"0.7214479",
"0.72122824",
"0.718... | 0.7121418 | 34 |
[TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified. | def range_partitioning(self) -> 'outputs.RangePartitioningResponse':
return pulumi.get(self, "range_partitioning") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_partitioning(self):\n raise Exception(\"Unimplemented\")",
"def _is_partitioned(self):\n ## check if the table are partitioned, need the split because of a change in the type of partitions in pydantic\n partitions = self.table_config[\"partitions\"]\n if partitions is None or ... | [
"0.5908911",
"0.57341045",
"0.5669595",
"0.55702806",
"0.5398147",
"0.5370436",
"0.5356754",
"0.5342656",
"0.53156346",
"0.5257485",
"0.525152",
"0.5233062",
"0.52306575",
"0.52021116",
"0.5191875",
"0.5169792",
"0.51235795",
"0.5108051",
"0.51012963",
"0.5096346",
"0.5034526... | 0.67215306 | 0 |
[Required] Reference describing the ID of this table. | def table_reference(self) -> 'outputs.TableReferenceResponse':
return pulumi.get(self, "table_reference") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_id(self) -> str:\n return pulumi.get(self, \"table_id\")",
"def unique_id(self):\n return self._table.id",
"def Id(self):\n return self._id",
"def id(self):\n return self.__id",
"def id(self):\n\t\treturn self.__id",
"def route_table_id(self):\n return self._r... | [
"0.7902887",
"0.7523377",
"0.7228239",
"0.72048825",
"0.7185027",
"0.7131604",
"0.70950943",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"0.70671606",
"... | 0.0 | -1 |
Convert a datetime object to an indystandard datetime string. | def datetime_to_str(dt: Union[str, datetime]) -> str:
if isinstance(dt, datetime):
dt = dt.replace(tzinfo=timezone.utc).isoformat(" ").replace("+00:00", "Z")
return dt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_datetime(self, datetime_obj):\n if isinstance(datetime_obj, np.datetime64):\n datetime_obj = pd.Timestamp(datetime_obj).to_pydatetime()\n\n if isinstance(datetime_obj, dt.datetime):\n return datetime_obj.strftime(\"%Y%m%dT%H%M%S\")\n elif isinstance(datetime_ob... | [
"0.7868194",
"0.750783",
"0.74204874",
"0.74170095",
"0.73605525",
"0.7308985",
"0.72649616",
"0.72649616",
"0.7225484",
"0.7208789",
"0.71867216",
"0.71677744",
"0.7121334",
"0.70454055",
"0.7031042",
"0.6987522",
"0.69870627",
"0.6958048",
"0.6956313",
"0.6837198",
"0.68329... | 0.745024 | 2 |
Timestamp in ISO format. | def time_now() -> str:
return datetime_to_str(datetime_now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_iso_format(timestamp):\n if timestamp is None:\n return None\n return datetime.isoformat(datetime.utcfromtimestamp(int(timestamp)))",
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def _get_timestamp():\n return '{}Z'.format(\n ... | [
"0.7669968",
"0.753076",
"0.7455154",
"0.73336184",
"0.7227689",
"0.72097605",
"0.7126199",
"0.71094406",
"0.7083096",
"0.70634013",
"0.7055605",
"0.7049728",
"0.7026564",
"0.6989766",
"0.6977851",
"0.69755125",
"0.69750756",
"0.6954906",
"0.6915595",
"0.69046843",
"0.6893874... | 0.0 | -1 |
Return a weighted sum of items. Items can be list of tensors, numpy arrays, or nested lists / dicts. If ``weights`` is None, this is simply an unweighted sum. | def weighted_sum(items: list[T], weights: Sequence[float | None] = cast(Sequence[Optional[float]], None)) -> T:
if weights is None:
weights = [None] * len(items)
assert len(items) == len(weights) > 0
elem = items[0]
unsupported_msg = 'Unsupported element type in weighted sum: {}. Value is: {}'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_sum(data, dim=None, weights=None):\n if isinstance(data, xr.DataArray):\n return weighted_sum_da(data, dim, weights)\n elif isinstance(data, xr.Dataset):\n return weighted_sum_ds(data, dim, weights)\n else:\n raise ValueError('Data must be an xarray Dataset or DataArray')... | [
"0.71925735",
"0.6888829",
"0.6864763",
"0.6765233",
"0.65581334",
"0.64911574",
"0.6438327",
"0.6420932",
"0.64095163",
"0.6386797",
"0.63724184",
"0.6240242",
"0.62072104",
"0.61985594",
"0.618577",
"0.6174428",
"0.61200285",
"0.6046423",
"0.60413694",
"0.602425",
"0.600418... | 0.83690184 | 0 |
Mock function for implementing the ConnectionError exception for get_comments() function. | def raise_connection_error_get_comments(api_url, headers, params, timeout, proxies):
raise requests.exceptions.ConnectionError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_issue_get_comments(self):\n pass",
"def test_comments_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.comments(-1)\n\n with self.assertRaises(AssertionError):\n self.resource.comments('foo', 'bar')",
"def test_issue_get_comment(self):\n ... | [
"0.7054444",
"0.70382273",
"0.67858785",
"0.6677939",
"0.6630677",
"0.6601845",
"0.6470455",
"0.6204246",
"0.61810756",
"0.61799806",
"0.6118818",
"0.6112512",
"0.60544556",
"0.5960097",
"0.5942213",
"0.5930291",
"0.59279805",
"0.59199744",
"0.5894636",
"0.588664",
"0.5883708... | 0.7270582 | 0 |
Mock function for implementing test responses from the server for put_comments() function. | def post_mock_response_comments(status_code, content):
test_mock = mock.Mock()
test_mock.status_code = status_code
test_mock.content = content
def mock_response(api_url, headers, json, timeout, proxies):
return test_mock
return mock_response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mock_response_comments(status_code, content):\n test_mock = mock.Mock()\n test_mock.status_code = status_code\n test_mock.content = content\n\n def mock_response(api_url, headers, params, timeout, proxies):\n return test_mock\n\n return mock_response",
"def test_comment_update(self)... | [
"0.7138392",
"0.7061201",
"0.69146216",
"0.6888383",
"0.66953963",
"0.66437674",
"0.6604533",
"0.66018337",
"0.65766215",
"0.65766215",
"0.6532709",
"0.6520894",
"0.6465181",
"0.6458578",
"0.643454",
"0.6431737",
"0.6422859",
"0.64016324",
"0.63384837",
"0.62964875",
"0.62892... | 0.7498607 | 0 |
Mock function for implementing the ConnectionError exception for put_comments() function. | def raise_connection_error_put_comments(api_url, headers, json, timeout, proxies):
raise requests.exceptions.ConnectionError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_comments_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.comments(-1)\n\n with self.assertRaises(AssertionError):\n self.resource.comments('foo', 'bar')",
"def raise_timeout_error_put_comments(api_url, headers, json, timeout, proxies):\n raise... | [
"0.701195",
"0.6750641",
"0.65917635",
"0.6359844",
"0.6262346",
"0.622226",
"0.6175148",
"0.6137611",
"0.60764325",
"0.6060395",
"0.60466164",
"0.6030629",
"0.60175973",
"0.5988928",
"0.59687793",
"0.59592646",
"0.59098583",
"0.59045106",
"0.585974",
"0.58461463",
"0.5845886... | 0.7312669 | 0 |
Return the passed in dictionary after removing any keys whose value is `None` | def not_none(data: Dict[Any, Any]) -> Dict[Any, Any]:
return dict(filterfalse(lambda x: x[1] is None, data.items())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _drop_none_values(dictionary: Dict) -> Dict:\n return {key: value for key, value in dictionary.items() if value is not None}",
"def remove_none_values(dict_):\r\n\r\n res = {}\r\n res.update((key, value) for key, value in dict_.iteritems() \\\r\n if value is not None)\r\n return re... | [
"0.8293126",
"0.8260851",
"0.7992403",
"0.7960719",
"0.78745437",
"0.7855159",
"0.77950966",
"0.77699697",
"0.77135247",
"0.7688711",
"0.76405084",
"0.76347107",
"0.7607296",
"0.75683933",
"0.75189096",
"0.7494253",
"0.7407655",
"0.73980755",
"0.7361079",
"0.7335773",
"0.7264... | 0.7465794 | 16 |
Utility function to merge the keys and values of two dicts recursively | def merge(first: Dict[Any, Any], second: Dict[Any, Any]) -> Dict[Any, Any]:
if not isinstance(second, dict):
return second
result = deepcopy(first)
for key, value in second.items():
if key in result and isinstance(result[key], dict):
result[key] = merge(result[key], value)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_merge(a, b, path=None):\n\n if path is None: path = []\n for key in b:\n if key in a:\n if isinstance(a[key], dict) and isinstance(b[key], dict):\n dict_merge(a[key], b[key], path + [str(key)])\n else:\n a[key] = b[key]\n return a",
"def merge_... | [
"0.7748852",
"0.77468914",
"0.7737366",
"0.77141505",
"0.77141505",
"0.7690336",
"0.7646337",
"0.76312804",
"0.7622293",
"0.7611898",
"0.75830215",
"0.75754756",
"0.7544592",
"0.7533087",
"0.75329417",
"0.7528591",
"0.7523194",
"0.749724",
"0.74854934",
"0.74854034",
"0.74471... | 0.76600325 | 6 |
Splits the data_set into a train and test split | def split_dataset(data_set, train_size, test_size):
# Generate random indices without replacement, to make train and test sets disjoint
rand_indices = np.random.choice(data_set.shape[0], train_size+test_size, replace=False)
feature_end = data_set.shape[1] - 1
output_location = feature_end
feature_of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_split(raw_training_data, test_size=0.2, random_state=42)\n return train_set, test_set",
"def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n ... | [
"0.8487214",
"0.8336971",
"0.813719",
"0.80679923",
"0.8036128",
"0.7971644",
"0.7941187",
"0.79350126",
"0.7880899",
"0.7875266",
"0.7874642",
"0.78510416",
"0.7848221",
"0.7831215",
"0.78145176",
"0.7807052",
"0.7785325",
"0.7741662",
"0.77382153",
"0.7736848",
"0.7695744",... | 0.7858266 | 11 |
Return the representationish for this image. | def __repr__(self):
repr_str = ("<Journalize(id='{}', action_date='{}', action='{}')")
return repr_str.format(self.id, self.action_date, self.action) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def __repr__(self):\n return self.textual_representation().encode(\"utf-8\")",
"def image(self):\n # type: () -> string_types\n return self._image",
"def representation(self) -> DrawingObjects:\n pass",
... | [
"0.71336955",
"0.67383814",
"0.6677891",
"0.66539836",
"0.66193813",
"0.66084206",
"0.6528242",
"0.65189004",
"0.6492569",
"0.64611065",
"0.6428156",
"0.64237547",
"0.64206696",
"0.64206696",
"0.64206696",
"0.64206696",
"0.64206696",
"0.64206696",
"0.64206696",
"0.64206696",
... | 0.0 | -1 |
Return all associated skinCluster nodes. | def get_skin_clusters(node_list):
# -- Get a valid iterable
if not is_iterable(node_list):
node_list = [node_list]
results = []
for node in node_list:
# -- Get any skinClusters from mesh history
# -- Get any skinClusters from joint connections
results.extend([sk for
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNodes(self):\n return self.__allNodes",
"def all_nodes(self):\n nodes = []\n for layer in self.layers:\n nodes += layer.nodes\n return nodes",
"def list_nodes(self):\n return self.ironic_client.node.list()",
"def get_all_nodes(self):\n return self._... | [
"0.6869982",
"0.68501186",
"0.6800282",
"0.67999434",
"0.6752082",
"0.67087334",
"0.6697265",
"0.66299033",
"0.6623317",
"0.66205287",
"0.66205287",
"0.6594207",
"0.6594207",
"0.6594207",
"0.65872383",
"0.657886",
"0.6540526",
"0.6511304",
"0.65077835",
"0.65014374",
"0.64998... | 0.6725553 | 5 |
Test getting storage used by a s3 bucket | def test_minio_get_storage_used(self, mock_class):
mock_class().list_buckets.return_value = list(s3_fake_objects.keys())
mock_class().list_objects.side_effect = [list(s3_fake_objects["bucket1"].keys()),
list(s3_fake_objects["bucket2"].keys())]
mock_class().stat_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_bucket(self):\n pass",
"def test_get_buckets(self):\n conn = boto3.resource('s3', region_name='us-east-1')\n # We need to create the bucket since this is all in Moto's 'virtual' AWS account\n conn.create_bucket(Bucket='foobucket')\n\n s3_connector = S3Connector()\n... | [
"0.718965",
"0.7160721",
"0.69289345",
"0.6745038",
"0.66251934",
"0.65960777",
"0.6431287",
"0.64245534",
"0.63582176",
"0.63471043",
"0.6336915",
"0.63159096",
"0.6314473",
"0.6300853",
"0.62948203",
"0.62579805",
"0.62569636",
"0.62335104",
"0.6220839",
"0.62145793",
"0.62... | 0.7999693 | 0 |
Returns the path on disk to the supplied document. May be ``None`` if the document has not been saved. | def _document_path(document):
try:
path = document.fullName.fsName
except Exception:
path = None
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_document_path(self):\n return pathlib.Path(urlparse(self.get_document().uri).path)",
"def get_document(self):\n\t\tif(self.fs.tmp_dir):\n\t\t\tfull_filename = self.fs.tmp_dir + os.sep + self.fs.get_document()\n\t\telse:\n\t\t\tfull_filename = self.fs.get_document()\n\t\t\n\t\treturn full_filename"... | [
"0.75493854",
"0.6856172",
"0.6446816",
"0.6441175",
"0.6441175",
"0.6357646",
"0.6263664",
"0.62145454",
"0.6175039",
"0.61661816",
"0.61201173",
"0.60995424",
"0.59786606",
"0.59786606",
"0.59786606",
"0.59674996",
"0.59674996",
"0.5962638",
"0.59606266",
"0.5959413",
"0.59... | 0.7979619 | 0 |
Returns a fully connected layer in tensorflow. | def make_fully_connected_layer(input_layer,
layer_size,
activation=tf.nn.relu,
layer_name='',
logs=False):
if not layer_name:
layer_name = ''.join(str(x) for x in np.random.randint(9, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fully_connected(self, input_layer, num_outputs, activation=None):\n num_inputs = input_layer.get_shape().as_list()[1]\n kernel_size = [num_inputs, num_outputs]\n with tf.variable_scope(self._count_layer('fully_connected')):\n kernel = self._get_variable('weights', kernel_size,\n... | [
"0.76150006",
"0.74527204",
"0.7389604",
"0.72646606",
"0.7242828",
"0.7193371",
"0.7164736",
"0.68571",
"0.6856851",
"0.68173015",
"0.68106276",
"0.6700139",
"0.66871935",
"0.65814614",
"0.6538123",
"0.6533016",
"0.64895093",
"0.648114",
"0.6476825",
"0.64760816",
"0.6446395... | 0.7459731 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CreateKeyStoreRequestBody):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return the name of the sensor. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Return the state attributes of the sensor. | def device_state_attributes(self):
return {
ATTR_ATTRIBUTION: HA_ATTRIBUTION,
HA_TIMESTAMP: self._timestamp,
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self) ... | [
"0.8418945",
"0.82497084",
"0.8243777",
"0.8243777",
"0.8200083",
"0.8169021",
"0.8169021",
"0.8159991",
"0.8159991",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
... | 0.7713804 | 47 |
Delete a country group (deleteCountryGroup) Delete a country groups by its country group code. This endpoint usually used for testing purpose to cleanup test data. | def delete_country_group(
country_group_code: str,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = DeleteCountr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def delete_country_group_async(\n country_group_code: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\... | [
"0.85902894",
"0.7012122",
"0.690866",
"0.68461424",
"0.6839419",
"0.68078065",
"0.67244136",
"0.6713779",
"0.6656999",
"0.66211504",
"0.6599354",
"0.6589754",
"0.65427905",
"0.6506878",
"0.6440473",
"0.6428682",
"0.6424824",
"0.641218",
"0.63813734",
"0.6370706",
"0.634458",... | 0.85491055 | 1 |
Delete a country group (deleteCountryGroup) Delete a country groups by its country group code. This endpoint usually used for testing purpose to cleanup test data. | async def delete_country_group_async(
country_group_code: str,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
return None, error
request = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_country_group(\n country_group_code: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n request... | [
"0.8546806",
"0.70092034",
"0.69062155",
"0.6843592",
"0.6836356",
"0.68070465",
"0.67232513",
"0.67144614",
"0.6652703",
"0.66178745",
"0.6595043",
"0.65898865",
"0.6541353",
"0.6504214",
"0.643811",
"0.642654",
"0.64240503",
"0.6408796",
"0.63758665",
"0.63706183",
"0.63418... | 0.85889673 | 0 |
Update a country group (updateCountryGroup) Update a country groups. The countryGroupCode must be exist beforehand. | def update_country_group(
country_group_code: str,
body: Optional[UpdateCountryGroupRequest] = None,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
if error:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def update_country_group_async(\n country_group_code: str,\n body: Optional[UpdateCountryGroupRequest] = None,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespac... | [
"0.8204224",
"0.6409706",
"0.62188023",
"0.608649",
"0.60575014",
"0.60530055",
"0.60199076",
"0.58349484",
"0.56926996",
"0.5641211",
"0.56131303",
"0.56108296",
"0.546043",
"0.54586095",
"0.54392755",
"0.5436049",
"0.53917164",
"0.5369921",
"0.5363396",
"0.5326239",
"0.5323... | 0.8342735 | 0 |
Update a country group (updateCountryGroup) Update a country groups. The countryGroupCode must be exist beforehand. | async def update_country_group_async(
country_group_code: str,
body: Optional[UpdateCountryGroupRequest] = None,
namespace: Optional[str] = None,
x_additional_headers: Optional[Dict[str, str]] = None,
**kwargs
):
if namespace is None:
namespace, error = get_services_namespace()
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_country_group(\n country_group_code: str,\n body: Optional[UpdateCountryGroupRequest] = None,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n ... | [
"0.8341961",
"0.64082706",
"0.6215589",
"0.60842746",
"0.60568357",
"0.6052311",
"0.6018487",
"0.58323324",
"0.5691085",
"0.5636549",
"0.56118095",
"0.5609613",
"0.5455656",
"0.54537344",
"0.5434462",
"0.5431773",
"0.53906065",
"0.5373576",
"0.53592575",
"0.5323223",
"0.53199... | 0.82036316 | 1 |
The derivative of the RHS with respect to sigma | def getRHSDeriv_m(self, freq, v, adjoint=False):
Src = self.survey.getSrcByFreq(freq)[0]
S_eDeriv = Src.S_eDeriv_m(self, v, adjoint)
return -1j * omega(freq) * S_eDeriv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient_descent(f, df, x, sigma=0.5, epsilon=1e-8):\n pass",
"def _derivativeTerm(self):\n\n\t\treturn self._Kd * (self._getErrorFunction() - self._previousError) / self._dt",
"def dgdy(self, X):\n \n return 3*X[1]**2",
"def drag_der(t, params):\n t_final = tf.cast(params['t_final'].... | [
"0.68527174",
"0.6536688",
"0.643671",
"0.6419633",
"0.64191926",
"0.6397669",
"0.63838464",
"0.636017",
"0.63280016",
"0.63218224",
"0.62655926",
"0.62512535",
"0.6231818",
"0.6197454",
"0.616442",
"0.6144404",
"0.6141581",
"0.61311233",
"0.6127966",
"0.6110649",
"0.610561",... | 0.0 | -1 |
Returns the number of rows in arraydata | def rowCount(self, parent):
return len(self.arraydata) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_count(data):\n return int(arcpy.GetCount_management(data).getOutput(0))",
"def count(self):\r\n return self.data_array.size",
"def getNumRows(self) -> int:\n ...",
"def getNbRows(self):\n return self.data.shape[1]",
"def data_count(self):\r\n\r\n shp = self.df.shape\r... | [
"0.8233816",
"0.78524345",
"0.76663595",
"0.7593465",
"0.7550645",
"0.7510177",
"0.7488041",
"0.7400101",
"0.737704",
"0.73633367",
"0.73269194",
"0.7269484",
"0.7262394",
"0.72371435",
"0.7221",
"0.71860474",
"0.7163175",
"0.7062287",
"0.7034802",
"0.7023831",
"0.7018027",
... | 0.77230555 | 2 |
Returns the number of columns in arraydata | def columnCount(self, parent):
if len(self.arraydata) > 0:
return len(self.arraydata[0]) - 2
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numRowsCols(array):\n return len(array),len(array[0])",
"def dataDimensions(data):\n logging.info('Number of rows of data: %s' % len(data))\n logging.info('Number of columns of data: %s' % len(data[1]))",
"def getNbColumns(self):\n return self.data.shape[0]",
"def columnCount( self ):\n ... | [
"0.8023058",
"0.7789613",
"0.7653921",
"0.75697285",
"0.7532519",
"0.7477663",
"0.7402054",
"0.73721355",
"0.736128",
"0.72163296",
"0.72155184",
"0.7205677",
"0.7165945",
"0.71463376",
"0.71280736",
"0.7078896",
"0.70699185",
"0.7060351",
"0.70494926",
"0.7032408",
"0.702078... | 0.7980242 | 1 |
Sets the model data to the most recent data from the frame. | def update(self, datain):
self.arraydata = datain
self.layoutChanged.emit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_original_data(self):\n pass",
"def init_model_df(self):\n\n self.model_df = pd.DataFrame(columns=self.query_df[self.column_name].unique())\n\n # add _TIMESTAMP column to dataframe\n self.model_df[self.column_index] = self.min_increments\n\n # set row index to _TIMEST... | [
"0.6391546",
"0.6367261",
"0.6358637",
"0.63338894",
"0.6280461",
"0.6034211",
"0.60014874",
"0.59743905",
"0.59566677",
"0.5945333",
"0.59240943",
"0.59240943",
"0.59240943",
"0.59233314",
"0.590194",
"0.5892477",
"0.58576316",
"0.58479875",
"0.58388937",
"0.58239424",
"0.58... | 0.0 | -1 |
Test applying a VIM strategy that starts to apply but then fails | def test_applying_vim_strategy_fails_apply_later(self):
# first api query is before the apply
self.vim_client.get_strategy.side_effect = [
STRATEGY_READY_TO_APPLY,
STRATEGY_APPLYING,
STRATEGY_APPLY_FAILED,
]
# API calls acts as expected
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_vim():\n pass",
"def test_running_main_error_in_parser_modifying(exopy_qtbot, monkeypatch):\n import exopy.__main__ as em\n\n def false_iter(arg):\n\n class FalseEntryPoint(EntryPoint):\n def load(self, *args, **kwargs):\n\n def false_modifier(parser):\n ... | [
"0.58349484",
"0.57588017",
"0.56066304",
"0.5570331",
"0.54221207",
"0.5287976",
"0.52789307",
"0.5272874",
"0.5271053",
"0.52681977",
"0.5249422",
"0.5243324",
"0.524135",
"0.52055943",
"0.5142456",
"0.5116529",
"0.5113984",
"0.5100642",
"0.5069906",
"0.5052782",
"0.5047976... | 0.53130245 | 5 |
Test applying a VIM strategy while a broken strategy exists | def test_applying_vim_strategy_already_exists_and_is_broken(self):
# first api query is what already exists
# remainder are during the loop
self.vim_client.get_strategy.side_effect = [
STRATEGY_APPLY_FAILED,
]
# invoke the strategy state operation on the orch thread... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_applying_vim_strategy_fails_apply_immediately(self):\n\n # first api query is before the apply\n self.vim_client.get_strategy.return_value = STRATEGY_READY_TO_APPLY\n\n # return a failed strategy\n self.vim_client.apply_strategy.return_value = STRATEGY_APPLY_FAILED\n\n #... | [
"0.5744124",
"0.5599518",
"0.55969155",
"0.55531347",
"0.5370553",
"0.53486234",
"0.5240246",
"0.5151608",
"0.509064",
"0.5085574",
"0.5067957",
"0.5050297",
"0.5042007",
"0.5039046",
"0.5033658",
"0.5031068",
"0.5028002",
"0.50040144",
"0.5001511",
"0.49954057",
"0.49946094"... | 0.56996334 | 1 |
Converts tensor to onehot tensor | def get_onehot(tensor, labels=10):
one_hot = np.zeros((tensor.shape[0], labels))
one_hot[range(tensor.shape[0]), tensor.astype(int)] = 1.
return one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_hot(tensor: torch.Tensor, num_classes: int = -1, dim: int = -1) -> torch.Tensor:\n if not check_for_index_targets(tensor):\n raise ValueError(f'tensor must be integer type, current type: {tensor.dtype}')\n\n max_index = tensor.max() + 1\n if num_classes == -1:\n num_classes = int(ma... | [
"0.806305",
"0.8020203",
"0.7963499",
"0.79215986",
"0.79052496",
"0.7861582",
"0.7861582",
"0.7826264",
"0.7794856",
"0.7721877",
"0.7685404",
"0.76773524",
"0.76697624",
"0.76599205",
"0.7653098",
"0.7648181",
"0.7648173",
"0.7648173",
"0.7613151",
"0.7549753",
"0.7549657",... | 0.8071545 | 0 |
Given a string and a nonnegative int n, return a larger string that is n copies of the original string. | def string_times(str, n):
if n <= 0:
return('n has to be non-negative')
else:
return(str * n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shorten(strings, n):\n return sorted(strings, key=lambda x: x[n])",
"def rotate(string, n):\r\n # default no change unless n is negative or positive\r\n rotated_string = string\r\n if n > 0:\r\n rotated_string = string[n:] + string[:n]\r\n elif n < 0:\r\n # calc how many letters ... | [
"0.6991367",
"0.6444605",
"0.6290526",
"0.6149936",
"0.6113236",
"0.60905534",
"0.6036309",
"0.600256",
"0.5998178",
"0.5964973",
"0.59335476",
"0.5930521",
"0.59211814",
"0.5910505",
"0.58888716",
"0.5858266",
"0.58437264",
"0.5831173",
"0.58119625",
"0.58072406",
"0.5792413... | 0.6976988 | 1 |
The topleft dot indicator. | def top_left_dot(self) -> bool:
return bool(self._getindicator(1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_left_dot(self) -> bool:\n return bool(self._getindicator(2))",
"def dots_left(self):\n return (len(self.top_row) +\n len(self.bottom_row) +\n len(self.left_col) +\n len(self.right_col))",
"def top(self):\n return self.points['topRight... | [
"0.6752271",
"0.6279848",
"0.59957975",
"0.59957975",
"0.58692133",
"0.58631235",
"0.58264565",
"0.58264565",
"0.5737743",
"0.57141167",
"0.57067084",
"0.5655358",
"0.5648357",
"0.5642877",
"0.5623615",
"0.5605227",
"0.55811876",
"0.55688363",
"0.55584145",
"0.55462706",
"0.5... | 0.7540004 | 0 |
The bottomleft dot indicator. | def bottom_left_dot(self) -> bool:
return bool(self._getindicator(2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom(self):\n return self.points['bottomRight'].y",
"def bottom(self):\n return self.points['bottomRight'].y",
"def bb_bottom(self) -> float:\n return self._bb_bottom",
"def top_left_dot(self) -> bool:\n return bool(self._getindicator(1))",
"def bottom(self):\n # ty... | [
"0.66587734",
"0.66587734",
"0.6630531",
"0.6579593",
"0.65287286",
"0.6503158",
"0.64272845",
"0.63668114",
"0.63127744",
"0.62767315",
"0.62678593",
"0.6206965",
"0.6138494",
"0.6117231",
"0.6050496",
"0.60307425",
"0.60206085",
"0.60176796",
"0.5960389",
"0.59450656",
"0.5... | 0.79062665 | 0 |
A simple decorator for wrapping functions that return tensors to move them to a GPU, if one is available. | def cudify(fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
result = fn(*args, **kwargs)
return cuda_if_gpu(result)
return wrapper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def real_decorator(f):\n\n def inner(*args, **kwargs):\n \"\"\"returns a torch tensor for cpu or gpu when appropriate.\"\"\"\n\n s, r, d, p = f(*args, **kwargs)\n\n if torch.cuda.is_available():\n s = torch.from_numpy(s).cuda().type(dtype)\n\n else:... | [
"0.7602797",
"0.7318461",
"0.6736358",
"0.6361371",
"0.63007003",
"0.6243802",
"0.6211542",
"0.6173982",
"0.6097828",
"0.6088415",
"0.6045646",
"0.60398614",
"0.5967361",
"0.59182614",
"0.5910665",
"0.5886841",
"0.5869622",
"0.5864254",
"0.5835428",
"0.5798669",
"0.5740398",
... | 0.69810545 | 2 |
Convert a sequence of categorical values to onehot representation | def cat2onehot_var(snt_ids, vocab_size, batch_size):
targets = np.array([snt_ids]).reshape(-1)
one_hot_targets = np.eye(vocab_size)[targets]
result = Variable(torch.FloatTensor(one_hot_targets).view(-1, batch_size, vocab_size)) #
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(seq):\n prot_seq = seq\n BASES = 'ARNDCQEGHILKMFPSTWYV'\n bases = np.array([base for base in BASES])\n feat = np.concatenate(\n [[(bases == base.upper()).astype(int)] if str(base).upper() in BASES else np.array([[-1] * len(BASES)]) for base\n in prot_seq])\n return feat",
... | [
"0.7900038",
"0.7761454",
"0.77572477",
"0.7656085",
"0.7645253",
"0.76205313",
"0.76140594",
"0.75799567",
"0.75201845",
"0.75153685",
"0.7484859",
"0.7478565",
"0.74712616",
"0.7459115",
"0.74381256",
"0.7420046",
"0.74090344",
"0.74061126",
"0.7405195",
"0.7398852",
"0.736... | 0.0 | -1 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"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.70900273 | 52 |
Initializes the elevation servo | def elevation_servo_init(self):
if self.pwm_controller is None:
print("You must initialize the PWM controller before the servo")
raise AntennyMotorException
self.elevation_servo = Pca9685ServoController(
self.pwm_controller,
self.antenny_config.get("elevat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elevation_servo_load(self, name: str = None):\n if name is not None:\n self.servo_config.load(name)\n self.elevation_servo.set_min_position(self.servo_config.get(\"elevation\")[\"min\"])\n self.elevation_servo.set_max_position(self.servo_config.get(\"elevation\")[\"max\"])",
"... | [
"0.6986267",
"0.6177895",
"0.61232555",
"0.6107497",
"0.6106311",
"0.6078838",
"0.60276484",
"0.60055256",
"0.5999789",
"0.5956045",
"0.5903296",
"0.5903059",
"0.59018105",
"0.5891061",
"0.5890614",
"0.5855732",
"0.5842102",
"0.5822398",
"0.58103454",
"0.57966363",
"0.5791346... | 0.7202165 | 0 |
Builds a Pandas DataFrame for the AggregateFilter's bins. This method constructs a Pandas DataFrame object for the AggregateFilter with columns annotated by filter bin information. This is a helper method for the Tally.get_pandas_dataframe(...) method. | def get_pandas_dataframe(self, data_size, stride, summary=None, **kwargs):
# Create NumPy array of the bin tuples for repeating / tiling
filter_bins = np.empty(self.num_bins, dtype=tuple)
for i, bin in enumerate(self.bins):
filter_bins[i] = bin
# Repeat and tile bins as need... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pandas_dataframe(self, datasize, summary=None):\n\n # If left and right filters are identical, do not combine bins\n if self.left_filter == self.right_filter:\n df = self.left_filter.get_pandas_dataframe(datasize, summary)\n\n # If left and right filters are different, combi... | [
"0.6558768",
"0.6209868",
"0.61848015",
"0.5863795",
"0.5760703",
"0.5684288",
"0.5642039",
"0.55959946",
"0.5516651",
"0.54755014",
"0.54674554",
"0.54308707",
"0.540216",
"0.53679585",
"0.53450966",
"0.5335203",
"0.52899563",
"0.5273754",
"0.52399236",
"0.5221628",
"0.52143... | 0.6769158 | 0 |
Draw from the uniform distribution with bounds [0, upper_value). | def discrete_uniform_sampler(upper_value):
return int(np.random.random() * upper_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniform(lower, upper):\n\n return lower + random.random() * (upper - lower)",
"def _uniform(val_range):\r\n return np.random.uniform(val_range[0], val_range[1])",
"def uniform_sample(upper, num):\n sample = []\n for i in range(num):\n value = random.randint(0, upper - 1)\n ... | [
"0.6739893",
"0.6541357",
"0.6341239",
"0.62541753",
"0.6017499",
"0.59122705",
"0.58457863",
"0.58209",
"0.58063513",
"0.5738522",
"0.5738522",
"0.5737967",
"0.57255375",
"0.5666568",
"0.5607356",
"0.55762553",
"0.54986304",
"0.5497341",
"0.5494295",
"0.5480217",
"0.5471701"... | 0.671232 | 1 |
Takes two tuples of coordinates (a query and a reference) and returns a boolean indicating whether the query overlaps any part of the reference. Query overlaps reference if either the start or the end of the query falls between the reference range. >>> test_overlap((1, 4), (5, 10)) False >>> test_overlap((1, 5), (5, 10... | def test_overlap(query, reference):
return (reference[0] <= query[0] <= reference[1] or
reference[0] <= query[1] <= reference[1] or
query[0] <= reference[0] <= reference[1] <= query[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap(start1, end1, start2, end2):\n return not (end1 < start2 or end2 < start1)",
"def overlap(t1start, t1end, t2start, t2end):\n\n return (t1start <= t2start <= t1end) or (t2start <= t1start <= t2end)",
"def isOverlap(peak, ref_distance_map, ref_distance_indexmap):\n chromosome = peak[0]\n ... | [
"0.70355207",
"0.6989546",
"0.6939245",
"0.68323493",
"0.68128633",
"0.67454463",
"0.6732577",
"0.6711391",
"0.6696669",
"0.6662298",
"0.65639406",
"0.6531077",
"0.65205234",
"0.6464498",
"0.6449246",
"0.63985574",
"0.6377017",
"0.6326594",
"0.6312239",
"0.63035893",
"0.62760... | 0.842389 | 0 |
Instantiates a RE_BOW_DECODER model object. | def __init__(self, word_embedding_size=None, vector_relation_encoding=None, num_relations=None, vocab_size=None,
rels_descs_embed_type=None, rels_embedder_hidden_size=None,
mlp_layers=None, mlp_activations=None, mlp_dropout_values=None, mlp_params_dict={},
load_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, window_size, alphabet_size, embedding_size, conv_layers, fc_hidden_size, num_of_classes, batch_max_sentences, batch_max_windows,\n\t\t\t\t bert_trainable, cnn_dropout_rate, bert_wrapper, learning_rate, init_model, optimizer='adam', loss='categorical_crossentropy'):\n\t\tself.window_size = window... | [
"0.5732961",
"0.5725582",
"0.56224823",
"0.5609708",
"0.557355",
"0.55470616",
"0.5472067",
"0.5462747",
"0.5426218",
"0.5416998",
"0.54123",
"0.5404653",
"0.5369267",
"0.5368163",
"0.5367015",
"0.5358027",
"0.5354505",
"0.5351841",
"0.5341687",
"0.5334403",
"0.5322333",
"0... | 0.70592344 | 0 |
Read image using its path. Default value is grayscale, and image is read by YCbCr format as the paper said. | def imread(path, is_grayscale=True):
if is_grayscale:
# flatten=True: 形成單層的灰階通道
return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float)
else:
return scipy.misc.imread(path, mode='YCbCr').astype(np.float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imread(path, is_grayscale=True):\n if is_grayscale:\n #flatten=True 以灰度图的形式读取 \n return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float)\n else:\n return scipy.misc.imread(path, mode='YCbCr').astype(np.float)",
"def imread(path, is_grayscale=True):\n if is_grayscale:\n retu... | [
"0.7786202",
"0.777032",
"0.76410556",
"0.7521609",
"0.7467179",
"0.74580973",
"0.7368277",
"0.7228054",
"0.7215092",
"0.7214897",
"0.720058",
"0.71829665",
"0.70770717",
"0.70580566",
"0.7028147",
"0.70162797",
"0.6945682",
"0.6943187",
"0.69340265",
"0.6900752",
"0.6892851"... | 0.77277374 | 2 |
Construct a DataSet. one_hot arg is used only if fake_data is true. `dtype` can be either `uint8` to leave the input as `[0, 255]`, or `float16` to rescale into `[0, 1]`. | def __init__(self,
images,
labels,
dtype=dtypes.float16,
reshape=True):
dtype = dtypes.as_dtype(dtype).base_dtype
if dtype not in (dtypes.uint8, dtypes.float16):
raise TypeError('Invalid image dtype %r, expected uint8 or float16' %
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(x, num_classes, dtype=jnp.float32):\n return jax.nn.one_hot(x, num_classes).astype(dtype)",
"def onehot(t, num_classes, device='cpu'):\n return torch.zeros(t.size()[0], num_classes).to(device).scatter_(1, t.view(-1, 1), 1)",
"def labels_to_one_hot(\n labels: np.ndarray, categories: int, ... | [
"0.68997324",
"0.6356934",
"0.63522905",
"0.62943405",
"0.6291095",
"0.6275374",
"0.62567407",
"0.6245759",
"0.6223719",
"0.6219973",
"0.6215124",
"0.6209283",
"0.6209039",
"0.620597",
"0.6202614",
"0.61832446",
"0.61798906",
"0.6153753",
"0.61519146",
"0.61473185",
"0.613268... | 0.0 | -1 |
Whether this target generates header files during building. | def _generate_header_files(self):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_header(file):\n return not file.is_dir() and not file.name == 'module.modulemap.in' and file.name != 'libcxx.imp'",
"def _need_generate(paths):\r\n if not os.path.exists(paths.generated_dir):\r\n return True\r\n\r\n if not os.path.exists(paths.index_file):\r\n return True\r\n\r\n ... | [
"0.6351012",
"0.6333202",
"0.6155612",
"0.58451384",
"0.5826202",
"0.5765669",
"0.5675578",
"0.55789876",
"0.55672276",
"0.55388415",
"0.5509707",
"0.54891735",
"0.54826945",
"0.53893036",
"0.5372234",
"0.5351331",
"0.52846694",
"0.52776176",
"0.52710676",
"0.52660954",
"0.52... | 0.7422676 | 0 |
Sample all variables and return as a dictionary. | def read(self):
self._sync()
d = {tag: struct.unpack('<f', self.pic.read(4))[0] for tag in tags}
d['ts_pic'] = struct.unpack('<i', self.pic.read(4))[0]
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(self):\n assignments = {}\n for v in self.all_variables():\n for _ in range(gc.max_satisfy_tries):\n assignments[v] = v.sample()\n if self.check(assignments):\n break\n assert len(assignments) == len(self.all_variables())\n... | [
"0.7674708",
"0.7417095",
"0.65749156",
"0.65292966",
"0.65135473",
"0.6441782",
"0.643683",
"0.6249105",
"0.6218143",
"0.6149392",
"0.61231697",
"0.6112385",
"0.6105623",
"0.60613453",
"0.6038819",
"0.5962434",
"0.5958079",
"0.59174085",
"0.5859233",
"0.58390564",
"0.5829304... | 0.0 | -1 |
Keeps only alphanumeric characters and lowers them | def to_clean_str(s: str) -> str:
return re.sub("[^a-zA-Z0-9]", "", s).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _alphanum(x):\n return lower(sub(r'\\W+', '', str(x)))",
"def make_alphabetic(text):\n text = re.sub(r'[^A-Za-z\\s]', '', text)\n return text.lower()",
"def standardize(text):\n # FIXME regex restricts us to only ascii\n # FIXME move regex compilation outside\n p = re.compile('[^a-zA-Z]')... | [
"0.7742487",
"0.7555332",
"0.7489212",
"0.748212",
"0.7439685",
"0.7334157",
"0.7264554",
"0.72211844",
"0.7216447",
"0.7195798",
"0.71799576",
"0.7172865",
"0.71604776",
"0.7149594",
"0.70787424",
"0.7052824",
"0.7042457",
"0.70306444",
"0.70044094",
"0.7003077",
"0.6997283"... | 0.7115608 | 14 |
Samples values from truncated normal distribution centered at 0 | def truncated_normal(size, threshold=1):
return truncnorm.rvs(-threshold, threshold, size=size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_from_truncated_normal(mean, std, clip_a, clip_b, size=None):\n a, b = (clip_a - mean) / std, (clip_b - mean) / std\n r = stats.truncnorm.rvs(a, b, size=size)\n return r * std + mean",
"def _sampling_normal(self, args):\n z_mean, z_log_var = args\n return sampling_normal(z_mean, z_log_... | [
"0.69710225",
"0.6861845",
"0.6861845",
"0.6861845",
"0.6861845",
"0.6861845",
"0.68373376",
"0.6746532",
"0.6731208",
"0.66560835",
"0.66424775",
"0.6609895",
"0.6560262",
"0.649696",
"0.64863753",
"0.6477289",
"0.6444458",
"0.6420713",
"0.6403661",
"0.6372714",
"0.6367038",... | 0.64158607 | 18 |
Initialize a model, tokenizer and config. | def __init__(
self,
hparams: argparse.Namespace,
num_labels=None,
mode="base",
config=None,
tokenizer=None,
model=None,
**config_kwargs
):
super().__init__()
self.step_count = 0
self.hparams = hparams
self.output_dir = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, model, tokenizer):\n self.model = model\n self.tokenizer = tokenizer\n self.max_context_size = max_context\n self.predict_len = steps\n self.beam_size = beam_size\n self.beam_steps = beam_steps",
"def basic_model_init(model_args... | [
"0.7721862",
"0.75269216",
"0.71541077",
"0.7110465",
"0.7072716",
"0.7058341",
"0.70387423",
"0.69877243",
"0.6955412",
"0.6924358",
"0.68692195",
"0.6806762",
"0.6740265",
"0.67386603",
"0.67232543",
"0.6722358",
"0.6664681",
"0.66439635",
"0.6599982",
"0.65382737",
"0.6530... | 0.6357611 | 40 |
Returns ['data']['value'] of first subchild's data entity, if it exists | def _get_child_data_value(self, include_data, child_j):
data_value = None
if include_data:
try:
data_value = child_j['children']['dataEntity'][0]['data']['value']
except:
raise KeyError('Data value not found for {}'.format(child_j))
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_entity_value(entities, entity):\n if entity not in entities:\n return None\n val = entities[entity][0]['value']\n if not val:\n return None\n return val['value'] if isinstance(val, dict) else val",
"def prepare_value(self, data):\n\n # value = super(RelateSingleField, s... | [
"0.58509576",
"0.5834961",
"0.57106614",
"0.5700003",
"0.56631577",
"0.5642633",
"0.56403315",
"0.56063944",
"0.559187",
"0.5564173",
"0.55620027",
"0.5524665",
"0.5493252",
"0.54701823",
"0.5397819",
"0.53884274",
"0.5368115",
"0.53607947",
"0.5356973",
"0.53258836",
"0.5305... | 0.6942079 | 0 |
Returns list of `DataPoint` of a deployment | def list_availability_deployment(self, feed_id, server_id, resource_id, **kwargs):
metric_id = self._metric_id_availability_deployment(feed_id=feed_id, server_id=server_id,
resource_id=resource_id)
return self.list_availability(metric_id=metric... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deployments(self) -> List[Dict]:\n return [\n {\n 'name': self.name,\n 'head_host': self.head_host,\n 'head_port': self.head_port,\n }\n ]",
"def get_deployment_data(cluster_id, namespace_id=None, deployment_id=None):\n # dep... | [
"0.6197668",
"0.586651",
"0.57324106",
"0.55762476",
"0.55762476",
"0.55495584",
"0.5535297",
"0.55101895",
"0.55036724",
"0.5424236",
"0.53874755",
"0.53760296",
"0.5372146",
"0.5356725",
"0.531656",
"0.530651",
"0.5289987",
"0.524022",
"0.52307934",
"0.5222782",
"0.5189373"... | 0.4648708 | 100 |
Draws an ellipse on this image. position = (x, y) specifies the topleft corner, and size = (width, height) specifies the width and height of the ellipse. border_width specifies the width of the border to draw. If it is 0, the ellipse is | def draw_ellipse(self, color, position, size, border_width = 0, anchor= 'topleft'):
# We'll try to make sure that everything is okay later
color = spyral.color._determine(color)
offset = self._calculate_offset(anchor, size)
pygame.draw.ellipse(self._surf, color, (position + offs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_ellipse(self, color, position, size=None,\n border_width=0, anchor='topleft'):\n if size is None:\n rect = spyral.Rect(position)\n else:\n rect = spyral.Rect(position, size)\n offset = self._calculate_offset(anchor, rect.size)\n pygame.... | [
"0.77426904",
"0.72297555",
"0.70628095",
"0.68637216",
"0.6805927",
"0.6719079",
"0.67154104",
"0.66144174",
"0.6564764",
"0.6468441",
"0.64360106",
"0.6431525",
"0.64258194",
"0.64236206",
"0.6420154",
"0.64131224",
"0.63699245",
"0.63572997",
"0.63543624",
"0.631804",
"0.6... | 0.7774541 | 0 |
Draws an elliptical arc on this surface. position = (x, y) specifies the topleft corner, and size = (width, height) specifies the width and height of the ellipse. The start_angle and end_angle specify the range of the arc to draw. border_width specifies the width of the border to draw. If it is 0, the ellipse is | def draw_arc(self, color, position, size, start_angle, end_angle, border_width = 0, anchor = 'topleft'):
color = spyral.color._determine(color)
offset = self._calculate_offset(anchor, size)
pygame.draw.arc(self._surf, color, (position + offset, size), start_angle, end_angle, border_width) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_arc(self, color, start_angle, end_angle,\n position, size=None, border_width=0, anchor='topleft'):\n if size is None:\n rect = spyral.Rect(position)\n else:\n rect = spyral.Rect(position, size)\n offset = self._calculate_offset(anchor, rect.size)\... | [
"0.7217539",
"0.68452185",
"0.682003",
"0.67782253",
"0.6691401",
"0.6664652",
"0.65185124",
"0.6517495",
"0.6421039",
"0.63649523",
"0.6291049",
"0.62850755",
"0.62775254",
"0.62722635",
"0.6254285",
"0.6239966",
"0.6239083",
"0.6177745",
"0.6160329",
"0.61075497",
"0.610121... | 0.72403 | 0 |
Return the 2D rotation matrix corresponding to the given angle. | def rot_angle2rot_mat(angle):
rot_mat = np.asarray([
[np.cos(angle), -np.sin(angle)],
[np.sin(angle), np.cos(angle)]
])
return rot_mat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_2d(angle):\n psi = Angle(angle).rad\n return np.array([[cos(psi), -sin(psi)],\n [sin(psi), cos(psi)]])",
"def rotation_matrix2(angle):\n c, s = cos(angle), sin(angle)\n return np.array([[c, -s], [s, c]])",
"def rotation_matrix(angle) -> np.array:\n return ... | [
"0.8493576",
"0.8353667",
"0.8197651",
"0.8136927",
"0.8061678",
"0.7804649",
"0.7756534",
"0.75383544",
"0.7510617",
"0.7437409",
"0.7412163",
"0.7402979",
"0.73650944",
"0.7327914",
"0.72343284",
"0.7194354",
"0.71743864",
"0.7136688",
"0.70758903",
"0.7070923",
"0.70621735... | 0.81990165 | 2 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
day = days[0]
month = months[0]
# get user input for city (chicago, new york city, washington).
while True:
print('Choose a city! Chicago, New York city or Washington. Which you prefer to analyze?\n')
city = i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.6671077",
"0.65363395",
"0.64597565",
"0.6374352",
"0.6349016",
"0.6310872",
"0.6287443",
"0.62599736",
"0.62324905",
"0.62140554",
"0.6205851",
"0.6182028",
"0.6172251",
"0.61696005",
"0.61590976",
"0.6159067",
"0.6153877",
"0.6145122",
"0.6132135",
"0.61053854",
"0.61032... | 0.6091941 | 21 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# load data file into a dataframe
df = pd.read_csv(CITY_DATA[city])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# extract month and day of week from Start Time to create new columns
df['month'] = df['Start T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.77198625 | 59 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# display the most common month
common_month_index = df['month'].mode()[0]
months = ['January', 'February', 'March', 'April', 'May', 'June']
common_month = months[common_month_index-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.0 | -1 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip:...\n')
start_time = time.time()
# display most commonly used start station
common_start_station = df['Start Station'].mode()[0]
print('The most commonly used start station is:',common_start_station)
# display mos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.0 | -1 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration:...\n')
start_time = time.time()
# display total travel time
print('Total Travel Time is:',df['Trip Duration'].sum())
# display mean travel time
print('Mean Travel Time is:',df['Trip Duration'].mean())
print("\nThis took %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7623416 | 83 |
PFR represented as a marching ODE. | def test_VODE():
mech = 'h2o2.xml'
gas = cantera.Solution(mech)
T0 = 1500 # [K]
p0 = cantera.one_atm # [Pa]
gas.TPX = T0, p0, "H2:2, O2:1, AR:0.1"
length = 1.5e-7 # *approximate* PFR length [m]
u0 = 0.006 # inflow velocity [m/s]
Ac = 1.0e-4 # cross-section... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Magnus4(self,direction='x'):\n self.reset()\n self.mol.orthoDen()\n self.mol.orthoFock()\n h = -1j*self.stepsize\n for idx,time in enumerate((self.time)):\n if direction.lower() == 'x':\n self.mol.computeDipole()\n self.dipole.append(n... | [
"0.5635199",
"0.55776995",
"0.55264556",
"0.5456321",
"0.54017174",
"0.5393865",
"0.5387657",
"0.53733474",
"0.5246317",
"0.52183264",
"0.51928186",
"0.5192656",
"0.5191723",
"0.51655555",
"0.51263756",
"0.5117637",
"0.51151127",
"0.51081467",
"0.5107799",
"0.50951695",
"0.50... | 0.0 | -1 |
Add to children in order. comments_by_item is not predictable order, therefore items list is taken as argument) | def add_comments_to_items(items, comments_by_item, parents):
for item in items:
comments = comments_by_item.get(item)
if comments:
log_comment(Color.magenta("Add comments to "), item, Color.blue("Comments"), comments)
item.add_comments(comments, parents) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SortChildren(self, item):\r\n\r\n children = item.GetChildren()\r\n \r\n if len(children) > 1:\r\n self._dirty = True\r\n children.sort(self.OnCompareItems)",
"def add_comments_to_block_child_list(block, comments, parents):\n open_brace = block[\"open_brace\"]\n ... | [
"0.647478",
"0.6413509",
"0.63679296",
"0.6323175",
"0.5957797",
"0.59012496",
"0.5690921",
"0.56721836",
"0.565662",
"0.56307185",
"0.5568565",
"0.5533133",
"0.55193686",
"0.5496968",
"0.54672384",
"0.54522127",
"0.5434004",
"0.54247403",
"0.5346394",
"0.52920437",
"0.528558... | 0.7971857 | 0 |
Reset performance statistics to zero across the cluster. | def zero_cluster(name):
ret = {"name": name, "changes": {}, "result": None, "comment": ""}
if __opts__["test"]:
ret["comment"] = "Zeroing cluster statistics"
return ret
__salt__["trafficserver.zero_cluster"]()
ret["result"] = True
ret["comment"] = "Zeroed cluster statistics"
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.sum_metric = 0.\n self.num_inst = 0.\n self.metrics.reset_stats()",
"def stats_reset(self):\n self.stats.reset()",
"def stats_reset(self):\n self.stats.reset()",
"def reset(self):\n reset_system_health_series()",
"def reset(self) -> None:\n ... | [
"0.7827252",
"0.7534795",
"0.7534795",
"0.7402714",
"0.7365327",
"0.7331224",
"0.7309859",
"0.72884315",
"0.72294605",
"0.71887064",
"0.70849186",
"0.7044942",
"0.70418096",
"0.701435",
"0.701435",
"0.701435",
"0.70138794",
"0.6930379",
"0.6849832",
"0.6824036",
"0.6729499",
... | 0.64971566 | 36 |
Returns a batch of upto length N continguous experiences. | def sample(self, batch_size):
indices = np.random.randint(len(self._storage), size=batch_size)
sequences = []
for index in indices:
start = 0
finish = start + self._sequence_length
sequences.append(self._storage[index][start: finish + 1])
return sequences | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batch_experience(self, batch_size):\r\n batch = []\r\n for i in range(batch_size):\r\n index = random.choice(range(self.n_experience - 1))\r\n batch.append(self.get_single_experience(index))\r\n return batch",
"def batch(iterable, n):\n iterable = [e for e in... | [
"0.6279547",
"0.6212554",
"0.6212151",
"0.6068479",
"0.5892613",
"0.588865",
"0.588865",
"0.588865",
"0.5800799",
"0.571749",
"0.5615903",
"0.5614911",
"0.55598754",
"0.55528826",
"0.55171096",
"0.5510915",
"0.54928464",
"0.5478786",
"0.54710984",
"0.5463956",
"0.5456808",
... | 0.0 | -1 |
Sets the id of this CrossMarginLoan. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def SetId(self, id):\n self.id = int(id)",
"def loan_id(self, loan_id):\n\n self._loan_id = loan_id",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n s... | [
"0.7334544",
"0.7289575",
"0.7157138",
"0.71011764",
"0.69114923",
"0.6827113",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.67162114",
"0.6709656",
"0.6709656",
"0.6709656",
"0.6709656",
"0.6... | 0.0 | -1 |
Sets the amount of this CrossMarginLoan. | def amount(self, amount):
if self.local_vars_configuration.client_side_validation and amount is None: # noqa: E501
raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501
self._amount = amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_amount(self, amount):\n self.amount = amount",
"def amount(self, amount):\n\n self._amount = amount",
"def amount(self, amount):\n\n self._amount = amount",
"def amount(self, amount):\n\n self._amount = amount",
"def amount(self, amount):\n\n self._amount = amount... | [
"0.6575343",
"0.6407547",
"0.6407547",
"0.6407547",
"0.6407547",
"0.6407547",
"0.6407547",
"0.6407547",
"0.6407547",
"0.6407547",
"0.5885513",
"0.58744335",
"0.5828171",
"0.5828171",
"0.58017755",
"0.58017755",
"0.58017755",
"0.5695555",
"0.56628186",
"0.56616986",
"0.565533"... | 0.504995 | 78 |
Sets the repaid of this CrossMarginLoan. | def repaid(self, repaid):
self._repaid = repaid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repaid_interest(self, repaid_interest):\n\n self._repaid_interest = repaid_interest",
"def set_repin(self, repin):\n self.repin = repin",
"def set_recharge(self, recharge):\n self.__recharge = recharge",
"def rpn(self, rpn):\n\n self._rpn = rpn",
"def rpn(self, rpn):\n\n ... | [
"0.59658605",
"0.56281686",
"0.544545",
"0.53470695",
"0.53470695",
"0.5343957",
"0.5249176",
"0.5146487",
"0.51265526",
"0.50668824",
"0.5064865",
"0.5063873",
"0.5018679",
"0.5012497",
"0.4951365",
"0.49425554",
"0.49197307",
"0.4899127",
"0.4885343",
"0.48730257",
"0.48395... | 0.7470001 | 0 |
Sets the unpaid_interest of this CrossMarginLoan. | def unpaid_interest(self, unpaid_interest):
self._unpaid_interest = unpaid_interest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest",
"def unapproved(self, unapproved):\n\n self._unapproved = unapproved",
"def isolation_policy_num_not_in(self, isolation_policy_num_not_in):\n\n self._isolation_policy_num_not_in = isolation_policy_num_not_in"... | [
"0.65660286",
"0.64163935",
"0.5621806",
"0.559974",
"0.557969",
"0.55691355",
"0.52356446",
"0.5185407",
"0.51847136",
"0.5159445",
"0.51123214",
"0.50992906",
"0.5087776",
"0.50336075",
"0.5019461",
"0.49983567",
"0.49954283",
"0.4945987",
"0.49367666",
"0.49328208",
"0.491... | 0.87522936 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CrossMarginLoan):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, CrossMarginLoan):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Determine if a queue is local or not | def is_local(queue):
_setup()
return queue in [dest(0) for dest in cupsd.getDests()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_queued(self):\n qstat = self._grep_qstat('queued')\n if qstat:\n return True\n return False",
"def pg_is_local(self) -> bool:\n query = queries.get(\"get_pga_inet_addresses\")\n ret = pg.fetchone(self.pg_conn, query)\n if ret[\"inet_server_addr\"] == re... | [
"0.65059656",
"0.63774717",
"0.629765",
"0.6286598",
"0.6280513",
"0.6280513",
"0.62551486",
"0.6235655",
"0.6216112",
"0.6118212",
"0.6069025",
"0.60412204",
"0.60391194",
"0.6012053",
"0.5975139",
"0.5963351",
"0.5937814",
"0.5916416",
"0.59056616",
"0.586541",
"0.5862007",... | 0.8629293 | 0 |
Canonicalize local queue names to Athena queue names If the passedin queue name is a local print queue that bounces to an Athena print queue, canonicalize to the Athena print queue. If the queue does not exist on the default CUPS server, then assume it is an alreadycanonicalized Athena queue. If the queue refers to a l... | def canonicalize_queue(queue):
_setup()
uri = get_cups_uri(queue)
if not uri:
return queue
proto = rest = hostport = path = host = port = None
(proto, rest) = urllib.splittype(uri)
if rest:
(hostport, path) = urllib.splithost(rest)
if hostport:
(host, port) = urllib.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_queue(queue):\n athena_queue = canonicalize_queue(queue)\n # If a queue isn't an Athena queue, punt straight to the default\n # CUPS server\n if not athena_queue:\n return SYSTEM_CUPS, None, queue\n queue = athena_queue\n\n # Get rid of any instance on the queue name\n # TODO T... | [
"0.68510914",
"0.6002772",
"0.5856126",
"0.5711096",
"0.5605801",
"0.5411404",
"0.5410876",
"0.5342672",
"0.5275022",
"0.5266116",
"0.52198374",
"0.51719046",
"0.5141873",
"0.5124191",
"0.5106551",
"0.5096371",
"0.5089035",
"0.5077614",
"0.50696933",
"0.5054045",
"0.49461082"... | 0.80063903 | 0 |
Validate that the username is formatted and unique | def validate_username(username):
min_username_length = 3
stats = 'valid'
if len(username) < min_username_length:
stats = 'invalid'
elif re.match("^[a-zA-Z0-9_-]+$", username) is None:
stats = 'invalid'
else:
user = AuthTools.get_user_by_username(username)
if user is not None:
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_username(self):\n data = self.cleaned_data['username']\n if '@' in data or '|' in data or ' ' in data or '+' in data:\n raise forms.ValidationError(_(u'Usernames should not have special characters.'))\n try:\n user = User.objects.get(username__exact=self.cleaned... | [
"0.8056219",
"0.79686534",
"0.7955156",
"0.7949714",
"0.79144996",
"0.7913527",
"0.79119647",
"0.7898224",
"0.78747183",
"0.78584737",
"0.7857931",
"0.77379966",
"0.77307016",
"0.77265024",
"0.77124137",
"0.7707888",
"0.7702503",
"0.7699926",
"0.76864743",
"0.7684254",
"0.767... | 0.79610443 | 2 |
Validate the email is formatted and unique | def validate_email(email):
status = 'valid'
try:
validate_email(email)
user = AuthTools.get_user_by_email(email)
if user is not None:
status = 'taken'
except:
status = 'invalid'
return status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_email(self):\n # source: https://docs.python.org/2/howto/regex.html\n if not re.match(r\"[^@.]+@[A-Za-z]+\\.[a-z]+\", self.email):\n return 'Invalid email address!'\n return self.email",
"def clean_email(self):\n if User.objects.filter(email__iexact=self.cleane... | [
"0.7350793",
"0.7335948",
"0.7335948",
"0.733099",
"0.7328245",
"0.7314295",
"0.73135495",
"0.7309215",
"0.7290749",
"0.7283638",
"0.7235074",
"0.72296256",
"0.721521",
"0.7213764",
"0.72075385",
"0.7171827",
"0.71575016",
"0.714647",
"0.7130795",
"0.7125248",
"0.71215254",
... | 0.0 | -1 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)
if not hass.data[DOMAIN]:
hass.data.pop(DOMAIN)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.63742703 | 47 |
Init a player character. | def __init__(self, character = "cuby", local=True, controls = 0, onlineId = None):
# Set ID
base.playerid += 1
self.id = base.playerid
# Set Online ID
self.onlineId = onlineId
# Character name
self.character = character.strip().lower()
# Load Animations
charDir = os.listdir(base.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, letter: str, player: int = 0) -> None:\n self.letter, self.player = letter, player",
"def set_player(self, char_data):\n self.player = self.server.object_manager.add_player(char_data)",
"def __init__(self, x, y, agent):\n self.health = MainCharacter.health\n self.... | [
"0.6877978",
"0.67164236",
"0.63931024",
"0.6342751",
"0.63021165",
"0.6231091",
"0.617353",
"0.61452585",
"0.61354876",
"0.60334456",
"0.5999012",
"0.5994385",
"0.59669787",
"0.5916112",
"0.5911151",
"0.5896063",
"0.5895674",
"0.587402",
"0.58585274",
"0.5807152",
"0.5793074... | 0.6267583 | 5 |
Check to see if there is a rect collision with a tile. | def colWithTile(self, pos):
return self.colWithBox(pos, [2.0,2.0,2.0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rect_intersects(self, rect):\n\tb = (self.left() > rect.right() or \n\t\tself.right() < rect.left() or \n\t\tself.top() < rect.bottom() or \n\t\tself.bottom() > rect.top())\n\treturn not b",
"def tile_exists_utm(boundsSrc, boundsTile):\n\n\n boundsSrcBox = box(*boundsSrc)\n boundsTileBox = box(*bounds... | [
"0.7444433",
"0.7138657",
"0.6913372",
"0.690468",
"0.6882083",
"0.6852363",
"0.68004674",
"0.67938626",
"0.6784718",
"0.67813694",
"0.6767994",
"0.6755162",
"0.6731557",
"0.67149675",
"0.67098755",
"0.66847414",
"0.66832954",
"0.6676328",
"0.66522986",
"0.6632362",
"0.660971... | 0.0 | -1 |
Reduce resistance after getting bumped. | def reduceResist(self, ammt = .5):
if not self.isNoReduce:
self.resist -= ammt
if self.resist < 1.0: self.resist = 1.0
messenger.send("Player_" + str(self.id) + "_Resist_UpdateHud")
self.noReduce(.75) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shrink(self):\n self.mass *= 0.8",
"def repair(self) -> None:\n if self.health < self.max_health:\n if self.repair_timer == 0:\n self.health += 1\n self.repair_timer = self.REPAIR_TIME\n else:\n self.repair_timer -= 1",
"def _... | [
"0.64036787",
"0.6369406",
"0.62445503",
"0.62332255",
"0.62231964",
"0.61548936",
"0.6113797",
"0.609788",
"0.60246056",
"0.5955771",
"0.5951543",
"0.5933296",
"0.5902022",
"0.5882861",
"0.5875462",
"0.58654344",
"0.5846275",
"0.5814933",
"0.5805769",
"0.5795994",
"0.5788501... | 0.6934086 | 0 |
Creates and saves a superuser with the given su_id, first_name, last_name, email, phone_number and password. | def create_superuser(self, su_id, first_name, last_name, email, phone_number, password):
user = self.create_user(
su_id,
first_name,
last_name,
email,
phone_number,
password=password,
)
user.is_admin = True
user.save... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user(self, su_id, first_name, last_name, email, phone_number, password=None):\n if not email and not su_id: #to contact SU students at least student id or email address is required\n raise ValueError('Users must have an email address or SU ID')\n\n user = self.model(\n ... | [
"0.7705317",
"0.7383623",
"0.73430467",
"0.7330442",
"0.73119366",
"0.7304643",
"0.72870594",
"0.72814137",
"0.72575825",
"0.7225236",
"0.722275",
"0.72103",
"0.71939236",
"0.7190888",
"0.7165532",
"0.7147439",
"0.711341",
"0.71050483",
"0.7102248",
"0.70973366",
"0.70884067"... | 0.8629904 | 0 |
Generate a PyTorch Variable of uniform random noise. | def sample_noise(batch_size, dim):
noise = torch.rand(batch_size, dim) * 2 - 1
return noise.view(batch_size, dim, 1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_noise(sample_size, latent):\r\n\treturn Variable(torch.randn(sample_size, latent))",
"def generate_noise_vector(self, ):\n self.noise.resize_(\n self.batch_size, int(self.opt.nz), 1, 1).normal_(0, 1)\n self.noisev = Variable(self.noise) # TODO: Add volatile=True???",
"def get_... | [
"0.83419305",
"0.7170281",
"0.7039853",
"0.6834736",
"0.6795651",
"0.67750555",
"0.6632702",
"0.65720916",
"0.6552767",
"0.65078986",
"0.6494427",
"0.6440631",
"0.6412848",
"0.63924724",
"0.6389693",
"0.63593805",
"0.63531125",
"0.63404405",
"0.6334233",
"0.63182336",
"0.6318... | 0.64616275 | 11 |
Gets the room_type of this Room. | def room_type(self):
return self._room_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room_type(self):\n\t\troom_type = ''\n\t\tnum = randint(1,8)\n\n\t\tif num >= 1 and num <= 4:\n\t\t\troom_type = 'Empty'\n\t\telif num >= 5 and num <= 7:\n\t\t\troom_type = 'Monster'\n\t\telif num == 8:\n\t\t\troom_type = 'Treasure'\n\t\t\n\t\treturn room_type",
"def get_type(self):\n return self.... | [
"0.6807455",
"0.65633297",
"0.65633297",
"0.6513084",
"0.6490215",
"0.6490215",
"0.64093226",
"0.63901407",
"0.6387068",
"0.63868695",
"0.63840944",
"0.6338362",
"0.63365144",
"0.6327687",
"0.63035",
"0.62619424",
"0.624822",
"0.62220824",
"0.6201027",
"0.6159388",
"0.6159329... | 0.8705415 | 1 |
Sets the room_type of this Room. | def room_type(self, room_type):
if room_type is not None and len(room_type) > 200:
raise ValueError("Invalid value for `room_type`, length must be less than or equal to `200`")
self._room_type = room_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def room_type(self, room_type):\n if room_type is None:\n raise ValueError(\"Invalid value for `room_type`, must not be `None`\")\n\n self._room_type = room_type",
"def update_room_type(self):\n\t\t# otherwise gamelog room will just stay fixed at value obtained during construction\n\t\ts... | [
"0.88217705",
"0.72221285",
"0.7075677",
"0.7075677",
"0.65159637",
"0.65159637",
"0.64423233",
"0.62254155",
"0.62083435",
"0.6206444",
"0.61632866",
"0.6127253",
"0.6100346",
"0.6100346",
"0.6100346",
"0.6069128",
"0.6067452",
"0.6064143",
"0.6064143",
"0.6050231",
"0.60203... | 0.82254165 | 1 |
Gets the surface of this Room. | def surface(self):
return self._surface | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface(self):\n return BRep_Tool_Surface(self.topods_shape())",
"def surface_area(self):\n return self._surface_area",
"def update(self) -> pygame.Surface:\n return self.surface",
"def get_surface(self, new: bool = True) -> 'pygame.Surface':\n if new:\n return self... | [
"0.6824311",
"0.68202114",
"0.6735238",
"0.66922826",
"0.6575736",
"0.6555278",
"0.6513427",
"0.6487768",
"0.64553696",
"0.6404262",
"0.6380272",
"0.63388795",
"0.6226513",
"0.6226513",
"0.61905426",
"0.6102062",
"0.59627134",
"0.5912662",
"0.5910866",
"0.58555657",
"0.581760... | 0.8211755 | 0 |
Sets the surface of this Room. | def surface(self, surface):
if surface is not None and surface > 1000:
raise ValueError("Invalid value for `surface`, must be a value less than or equal to `1000`")
if surface is not None and surface < 0:
raise ValueError("Invalid value for `surface`, must be a value greater than... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_surface(self, surface:str, image:pygame.image) -> None:\n self.surface = surface\n self.__set_image__(image)",
"def surface_area(self, surface_area):\n\n self._surface_area = surface_area",
"def __init__(self, surface, rect):\n self.surface = surface\n self.rect = rec... | [
"0.71654326",
"0.6339202",
"0.6316111",
"0.6316111",
"0.62931836",
"0.595468",
"0.58006126",
"0.56688917",
"0.56118697",
"0.5603917",
"0.55900055",
"0.55900055",
"0.55878067",
"0.5583206",
"0.5562287",
"0.55397046",
"0.55367815",
"0.54776967",
"0.54473186",
"0.5446557",
"0.54... | 0.71615326 | 1 |
Gets the wall_covering of this Room. | def wall_covering(self):
return self._wall_covering | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def floor_covering(self):\n return self._floor_covering",
"def wall_covering(self, wall_covering):\n if wall_covering is not None and len(wall_covering) > 200:\n raise ValueError(\"Invalid value for `wall_covering`, length must be less than or equal to `200`\")\n\n self._wall_cove... | [
"0.70156467",
"0.6534892",
"0.6401697",
"0.6128864",
"0.6128864",
"0.59380764",
"0.5869793",
"0.5761123",
"0.5761123",
"0.5731232",
"0.56444997",
"0.55022466",
"0.5385891",
"0.5371985",
"0.52586985",
"0.5175374",
"0.51701766",
"0.5161036",
"0.51559114",
"0.5154135",
"0.51453"... | 0.8477903 | 0 |
Gets the floor_covering of this Room. | def floor_covering(self):
return self._floor_covering | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wall_covering(self):\n return self._wall_covering",
"def floor(self):\n return self.container['floor']",
"def floor(self):\n return self._floor",
"def floor_covering(self, floor_covering):\n if floor_covering is not None and len(floor_covering) > 200:\n raise ValueE... | [
"0.7359682",
"0.69954157",
"0.69395536",
"0.638733",
"0.5925529",
"0.5925529",
"0.5724004",
"0.57221574",
"0.56341654",
"0.5511471",
"0.5504571",
"0.53731996",
"0.5369445",
"0.53591454",
"0.5288676",
"0.5245271",
"0.52119094",
"0.5189952",
"0.517897",
"0.5166886",
"0.51487815... | 0.85488707 | 0 |
Gets the general_state of this Room. | def general_state(self):
return self._general_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_game_state(self):\n return self.game_state",
"def get_game_state(self):\n return self._current_state",
"def get_game_state(self):\r\n return self._game_state",
"def get_game_state(self):\n return self._game_state",
"def get_game_state(self):\n return self._game_st... | [
"0.6855938",
"0.6822563",
"0.6776716",
"0.6770722",
"0.6770722",
"0.6770722",
"0.672692",
"0.66817755",
"0.66817755",
"0.6440449",
"0.6392815",
"0.6392815",
"0.63719195",
"0.63719195",
"0.63719195",
"0.63642895",
"0.62649244",
"0.62649244",
"0.62649244",
"0.62649244",
"0.6264... | 0.8256431 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.